digitalocean / doctl

The official command line interface for the DigitalOcean API.
https://docs.digitalocean.com/reference/doctl/
Apache License 2.0
3.24k stars 385 forks source link

Not able to add droplet IP to known_hosts on Linux #720

Open ghost opened 4 years ago

ghost commented 4 years ago

I installed doctl trough snap sudo snap install doctl and then I give it permissions sudo snap connect doctl:ssh-keys :ssh-key.

But if I try to enter to my droplet via doctl using doctl compute ssh _droplet-name_ it fails to add droplet's IP to the list of known hosts, while if I enter with ssh it works as intended ssh -q root@__droplet-ip__ exit.

Doctl gives the following message:

The authenticity of host '__droplet-ip__' can't be established.
ECDSA key fingerprint is SHA256:__droplet-sha__.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/username/.ssh/known_hosts).

And then continues:

Enter passphrase for key '/home/username/.ssh/__keyname__': [...]

Is Doctl able to add droplet's IP to the list of known hosts right now? Is this a bug related to Snap/Linux or isn't a present feature?

By the waty, my specs npx envinfo are the following:

  System:
    OS: Linux 5.0 Ubuntu 19.04 (Disco Dingo)
    Container: Yes
    Shell: 3.0.2 - /usr/bin/fish
  Binaries:
    Node: 13.2.0 - ~/.config/nvm/13.2.0/bin/node
    Yarn: 1.19.1 - /usr/bin/yarn
    npm: 6.13.1 - ~/.config/nvm/13.2.0/bin/npm
  Utilities:
    Make: 4.2.1 - /usr/bin/make
    GCC: 8.3.0 - /usr/bin/gcc
    Git: 2.20.1 - /usr/bin/git
  Virtualization:
    Docker: 18.09.7 - /usr/bin/docker
    VirtualBox: 6.0.14 - /usr/bin/vboxmanage
  Languages:
    Bash: 5.0.3 - /bin/bash
    Perl: 5.28.1 - /usr/bin/perl
    Python: 2.7.16 - /usr/bin/python
    Ruby: 2.5.5 - /usr/bin/ruby
  Databases:
    MongoDB: 4.0.13 - /usr/bin/mongo
bentranter commented 4 years ago

Thanks for the report @frbrz, I'm looking into this now.

bentranter commented 4 years ago

Okay, spent some time looking into this – I reproduced this in both a Snap environment, and when building from source, both on Ubuntu 18.04.3 (LTS). I suspect there's something up with doctl compute ssh because it uses an exec.Command to establish the SSH connection. We'll need to dig into this further, so we'll keep this issue updated.