Skip to content

Possible for Uncloud to use SSH configuration? (or provide an specific identity?) #131

@luislavena

Description

@luislavena

I've machines provisioned with SSH keys that are stored in 1Password SSH agent:

https://developer.1password.com/docs/ssh/agent/

The agent is running and is the default SSH_AUTH_SOCK, so doing ssh-add -L list all the SSH keys available in all the vaults I have access to.

$ ssh-add -L | wc -l
      73

Due that, when connecting to SSH, I normally receive the following error:

Received disconnect from REDACTED-IPV6::1 port 22:2: Too many authentication failures
Disconnected from REDACTED-IPV6::1 port 22

To workaround that, I've explicitly defined a SSH configuration in my ~/.ssh/config file for that server:

Host my-machine
    HostName my-machine
    User core
    IdentityAgent ~/.1password/agent.sock
    IdentitiesOnly yes
    IdentityFile ~/.ssh/keys/my-user-ssh-key.pub

This works great for ssh:

$ ssh my-machine "whoami"
core

$ ssh core@my-machine "whoami"
core

And also work for docker:

$ DOCKER_HOST=ssh://core@my-machine docker network ls
NETWORK ID     NAME      DRIVER    SCOPE
2e677f8e8266   bridge    bridge    local
bc4366252ae3   host      host      local
872afa4e11ba   none      null      local

However, the same approach fails for uncloud (~/bin/uncloud is the latest build from main):

$ UNCLOUD_CONNECT=ssh://core@my-machine ~/bin/uncloud machine ls
Error: connect to cluster: connect to machine: SSH login to core@my-machine:22: connect using SSH agent: ssh: handshake failed: ssh: disconnect, reason 2: Too many authentication failures

It seems Docker relies on standard ssh command and has a hidden dial-stdio plugin under their system subcommand:

https://github.com/docker/cli/blob/75f3c08257ea0f04ddb57ec09afb7af182c36134/cli/connhelper/connhelper.go#L43-L66

Not submitting this as a feature request or a bug, but putting out there to gather feedback if I'm the only one on this scenario in order to determine if is worth to invest time on replace current SSH implementation with something similar.

Right now I've a workaround locally by commenting out all the other vaults and leave only the one that has the SSH keys for the active cluster. Also this is not a general issue as SSH to those machines is managed via Tailscale SSH.

Thank you.
❤️ ❤️ ❤️

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions