Skip to content

Poor SSH key handling: overly coupled to id_rsa private keys #442

@quicksketch

Description

@quicksketch

Describe the bug

The Lagoon CLI tool seems to make several assumptions about SSH keys. In several places, the existing code searches for exactly the string ~/.ssh/id_rsa, giving that type of private key special status. GitHub specifically recommends ed25519 keys and only suggests RSA on "legacy systems".

In PR #44, it was suggested by @smlx:

Honestly I think it would be fair to offload all key handling to the agent and not attempt to manually load SSH keyfiles at all. Best practice is to use an agent anyway, and that way any new SSH key formats are automatically handled going forward.

But I don't think this suggestion was implemented.

It would be much better if Lagoon CLI would read (and try) all available keys from ssh-add -L, rather than reading individual SSH keys.

To Reproduce
Steps to reproduce the behavior:

  1. Install lagoon CLI normally.
  2. On an environment where ~/.lagoon.yml has not been modified to add an sshkey value, create a key at ~/.ssh/id_ed25519 with chmod 600. There should also not be a ~/.ssh/id_rsa file.
  3. Attempt to execute a lagoon command such as lagoon whoami
  4. The command will return Error: open /home/runner/.ssh/id_rsa: no such file or directory.

Expected behavior
The command should succeed using the available ~/.ssh/id_ed25519 key.

Desktop (please complete the following information):

  • OS: Ubuntu 24.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions