-
Notifications
You must be signed in to change notification settings - Fork 6
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
x/crypto/ssh: support encrypted private keys #4
x/crypto/ssh: support encrypted private keys #4
Conversation
@Unimarimos76
I appreciate your contribution! |
Hi @tsurubee !
https://github.com/Unimarimos76/sshr To try the key for OpenSSH 7.8 or later, do the following
I'm sorry for the late reply, but I need a review. |
@Unimarimos76 取り込んでいただいたGoのSSHパッケージの変更を詳細に確認したところ, 実際に私は変更前のsshr.cryptoを使ったsshrサーバでクライアントの秘密鍵をパスフレーズ付きのOpenSSH形式の鍵(-----BEGIN OPENSSH PRIVATE KEYで始まるもの)で問題なく動作することを確認しました. もしかしたらそこの認識が大きくずれているかもしれないと思うので,
ここで言っている対応していないということを再現する方法を教えていただけないでしょうか.どうことをやろうとして困っていたかを詳細に教えていただけると助かります.回答も日本語でかまいません! |
こんにちは @tsurubee さん 今回sshrの改良に取り組んだリポジトリはこちらになります. その時はクライアントの公開鍵をDBに格納しておりそこから公開鍵を取り出してくる形にしていました.
このようにしてFetchAuthorizedKeysMyHookを使いました.これを使用して公開鍵を用いたsshを行うと鍵認証ではなくパスワード認証になりました. これが原因だと考え今回の改善を行ないました.これが私が秘密鍵の読み込みをスルーしてしまうのではないかと至った流れとなります. 行なったことや,公開できる情報を書きました.他にも足りないことがあると思いますがご教授していただけると幸いです. 追記openSSH7.8以前で生成される鍵での検証も行いました.しかし,それでもsshの秘密鍵を使用しての接続を行うことができませんでした. |
@Unimarimos76 まず,原因の切り分けとして, この辺りの情報がわかりましたら,また一緒に考えましょう!お願いします! |
@tsurubee さん 返信ありがとうございます! 公開鍵が一致していない可能性もありそうですね.私も少しづつでバックしながら調査をしようと思います. |
はい!不明点あればいつでもお聞きください! |
I'm going to close the PR once. |
I can't do PR, but I can't do it. Also, if we can improve it, we will create a PR again. Thank you |
Hi @tsurubee
Why
The sshr.crypto used in the sshr package does not support the keys generated by OpenSSH version 7.8.
Resolve
So I found the following issue on the original golang
golang/go#18692
This issue discusses support for private keys with passphrases.
So I ported the final merged version to sshr.crypto.
However, it did not work on its own, because it failed to call certs.go.
So I ported the original ssh/certs.go.
I tested it with the keys generated by OpenSSH version 7.8, and confirmed that it works.
How about improving sshr.crypto in this direction?