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

New header for id_rsa on macOs #263

Open
katoquro opened this issue Sep 28, 2019 · 3 comments
Open

New header for id_rsa on macOs #263

katoquro opened this issue Sep 28, 2019 · 3 comments

Comments

@katoquro
Copy link

katoquro commented Sep 28, 2019

Environment info

groovy-ssh 2.10.1
openjdk version "11.0.3" 2019-04-16 LTS
groovy 2.5.7
jsch 0.1.55

Steps to reproduce

  1. generate new key (like in https://github.com/int128/docker-sshd : ssh-keygen -t rsa -N '' -C '' -f id_rsa )
  2. use generated key
  3. get exception java.lang.RuntimeException: java.lang.RuntimeException: com.jcraft.jsch.JSchException: invalid privatekey: [B@79f7005

According to this issue appears after ssh-keygen update because the header of the file was changed from -----BEGIN RSA PRIVATE KEY----- to -----BEGIN OPENSSH PRIVATE KEY-----

Workaround

with additional flag -m PEM key will be generated with old header.

Most of the people generate key using github guide or something like that and it leads to issues with groovy-ssh lib. So support of this ssh-keygen update is highly desirable.

I've generated keys from mac os with new version of ssh-keygen (ssh-keygen -t rsa -N '' -C '' -f id_rsa) keys.zip . You can use it to debug

Thank you!

p.s.
Is it possible to combine ssh related repos in one or make one multirepo with git-submodules? It's quite difficult to setup the whole env from scratch to debug the problem or run tests. And having all ssh-related issues in one repo also can be a bit convenient

@tobiashochguertel
Copy link

tobiashochguertel commented May 30, 2020

I tried it also with the -m PEM Option and I can‘t get an working solution. I use ssh-steps plugin with Jenkins. Ssh-steps plugin uses groovy-ssh as dependency. and I think Groovy-ssh uses as Dependency jsch-1.55, which looks like not active developed. But a few hours ago @mwiede has forked jsch (https://github.com/mwiede/jsch). If I understood it correct he has applied some fixes to get it working with the newer ssh-keys. Have a look at the jsch bug tracker https://sourceforge.net/p/jsch/bugs/119/#efc6 ...

is this repository maintained?

@mwiede
Copy link

mwiede commented Oct 16, 2020

I have implemented support for openssh private key format in https://github.com/mwiede/jsch
It is now released https://search.maven.org/artifact/com.github.mwiede/jsch/0.1.60/jar
you can give it a try.

@katoquro
Copy link
Author

@mwiede nice to hear. Thank you for the contribution but we moved from groovy-ssh to https://mina.apache.org/sshd-project/

groovy-ssh lib has more convenient api than sshd but looks abandoned. May be we will make something like groovy-ssh on top of apache mina sshd. Currently ssh covers all our cases and even more

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

No branches or pull requests

3 participants