Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect with OpenSSH private keys #53

Closed
tomconnors opened this issue May 14, 2020 · 4 comments
Closed

Can't connect with OpenSSH private keys #53

tomconnors opened this issue May 14, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@tomconnors
Copy link
Contributor

I continued to have ssh issues after upgrading to 0.1.0-alpha.9 so I tried a couple different things.

Using PEM keys works fine for me:

ssh-keygen -t rsa -m PEM

With that I can ssh with ssh -i privatekey user@host and can connect with spire, using the :username, :hostname, and :identity options.

Using the default format (on my MacOS 10.15.4 using OpenSSH_8.1p1) doesn't work with spire:

ssh-keygen -t rsa

With that I can ssh with ssh -i privatekey user@host but attempting to connect with spire gives me invalid privatekey: [B@106e2d130 [at provision.clj, line 1, column 1] {:type :sci/error, :line 1, :column 1, :message "invalid privatekey: [B@106e2d1 30 [at provision.clj, line 1, column 1]"}

I'm just going to use PEM format keys, but perhaps spire should support the OpenSSH format as well.

@retrogradeorbit
Copy link
Member

retrogradeorbit commented May 14, 2020

Ah yes this is an issue I saw when reading documentation while investigating the other key issue #23 and has to do with JSch not natively recognising the OpenSSH format (starts with a different --- line on the PEM, says BEGIN OPENSSH PRIVATE KEY, not BEGIN RSA PRIVATE KEY to represent the new format). There is a way to get it to load the keys, but I forget what it was. This can definitely be fixed fairly easily. Will have a look in the next few days.

@retrogradeorbit retrogradeorbit added the bug Something isn't working label May 14, 2020
@timotheosh
Copy link

Might be time to look at moving to a maintained fork of Jsch which addresses this very issue: https://github.com/mwiede/jsch

It is more than just a drop in replacement though, I tried it and was getting KeyExchange exceptions. Probably has something to with "For compatibility with OpenSSH and improved security, the order of crypto algorithms was changed. If you still want to use older or deprecated algorithms, you need to change the configuration." I have not tried changing the configuration.

@retrogradeorbit
Copy link
Member

fixed in 0.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants