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

Support new format for SSH private keys #389

Closed
Soulou opened this issue Nov 17, 2018 · 3 comments
Closed

Support new format for SSH private keys #389

Soulou opened this issue Nov 17, 2018 · 3 comments
Assignees

Comments

@Soulou
Copy link
Member

@Soulou Soulou commented Nov 17, 2018

ssh-keygen on some system seems to generate OPENSSH PRIVATE KEY instead of RSA PRIVATE KEY in the private key, we need to add the compatibility.

Some references:

hierynomus/sshj#276
duplicati/duplicati#3360

@dkocher
Copy link

@dkocher dkocher commented Dec 5, 2018

This is as of OpenSSH 7.8 the default.

  • ssh-keygen(1): write OpenSSH format private keys by default
    instead of using OpenSSL's PEM format. The OpenSSH format,
    supported in OpenSSH releases since 2014 and described in the
    PROTOCOL.key file in the source distribution, offers substantially
    better protection against offline password guessing and supports
    key comments in private keys. If necessary, it is possible to write
    old PEM-style keys by adding "-m PEM" to ssh-keygen's arguments
    when generating or updating a key.

Workaround is to use ssh-keygen -m PEM.

@dkocher
Copy link

@dkocher dkocher commented Dec 5, 2018

The failure is a message like Bad item length: -1512035316 which is caused from reading the key in OpenSSHKeyV1KeyFile.

@EtienneM EtienneM self-assigned this Dec 5, 2018
@EtienneM
Copy link
Member

@EtienneM EtienneM commented Dec 6, 2018

Stack trace is:

db/tunnel.go:61: fail to connect to SSH server
net/ssh/client.go:37:
crypto/sshkeys/read.go:55: Invalid SSH key or password: ssh: unhandled key type

Soulou added a commit that referenced this issue Feb 22, 2019
Fixes #389
Soulou added a commit that referenced this issue Feb 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants