Skip to content

feat: Add support for SSH agents as well as raw file scans#901

Open
KazWolfe wants to merge 1 commit into
railwayapp:masterfrom
KazWolfe:ssh-agent-support
Open

feat: Add support for SSH agents as well as raw file scans#901
KazWolfe wants to merge 1 commit into
railwayapp:masterfrom
KazWolfe:ssh-agent-support

Conversation

@KazWolfe
Copy link
Copy Markdown

Simple-ish attempt to fix #870 since it started to become a headache for me. I'll preface this PR by warning everyone that I am not a Rust developer, so I'm pretty sure a lot of things in here are wrong or deeply suboptimal (though I did have some people who are much better at Rust than me look at it and tell me to do arcane things). I'd be more than willing to bring in any fixes.

Changes:

  • Read all SSH keys returned by ssh-add -L to query the agent, then read keys from ~/.ssh.
    • If a key is in both locations, prefer the key from the agent.
  • Add new methods LocalSshKey#key_name and #key_source to encapsulate some logic.
    • Key name is decided by comment, then file_stem, then hash.
    • Key source is the path or an SSH agent hint.
  • Replace hostname with comment for semantic clarity.
    • Comments are now everything after the second split.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

railway ssh ignores ssh-agent, fails when keys aren't on disk

1 participant