Open takuan-osho opened 5 years ago
Working on it
@alexmt FYI: According to https://github.com/golang/go/issues/18692, golang/x/crypto/ssh
itself doesn't support encrypted private key with passphrase.
It seems difficult to fix this issue with only using golang/x/crypto/ssh
package.
As a workaround, some person suggested a 3rd party package for supporting openssh-key-v1
format key.
As far as I investigated, a SSH private key generated by newer OpenSSH without -m pem
option has a newer format which is not supported by golang/x/crypto/ssh
.
$ ssh -V
OpenSSH_7.9p1, LibreSSL 2.7.3
$ ssh-keygen -t rsa -b 4096 -C "shimizu.taku@gmail.com" -f keytest.pem -m pem
# This keytest.pem with passphrase can be parsed by ssh.ParsePrivateKeyWithPassphrase function
$ ssh-keygen -t rsa -b 4096 -C "shimizu.taku@gmail.com" -f keytest2.pem
# This keytest2.pem with passphrase cannot be parsed by ssh.ParsePrivateKeyWithPassphrase function
Thank you for the information, @takuan-osho ! I was waiting fo PR1807 to get merged before start working on this ticket. Will try to use your advice tomorrow and will update ticket with my findings.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I stumbled on that issue today. Any news on it?
@FredM
This probrems depends on x/crypto/ssh
package. latest x/crypto/ssh
has already supported Private key with passphrase in OpenSSH format.
Master branch has already depended on corrected x/crypto/ssh
version, so it should work correctly in master.
// go.mod in master branch
// ...
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975
// ...
But, latest version ArgoCD v1.6.1 does not follow fixed version.
// go.mod in release 1.6.1
// ...
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586
// ...
Maybe it will work correctly in the next release.
The argocd codebase still uses the ParsePrivateKey
method (https://github.com/argoproj/argo-cd/blob/master/util/git/client.go#L193) so I believe this feature won't work yet. It needs to use the ParsePrivateKeyWithPassphrase
method of the crypto library.
I am also stumbled on this issue today. Any news on it?
any solution? ping the issue.
I am still having this issue. Any news ?
Any news on this front? Thanks!
The argocd codebase still uses the
ParsePrivateKey
method (https://github.com/argoproj/argo-cd/blob/master/util/git/client.go#L193) so I believe this feature won't work yet. It needs to use theParsePrivateKeyWithPassphrase
method of the crypto library.
refer to the solution this week if I have time.
I am wondering if there is any update on this?
I would also like to know if there has been any progress?
This is still a good addition that should be made to ArgoCD
According to https://github.com/golang/go/issues/18692, there might have been some progress in adding the support. We might want to revisit this.
I still see ParsePrivateKey
being used https://github.com/argoproj/argo-cd/blob/e8d52650b1599e22feadfdf093c20e846a9b2e5b/util/git/client.go#L267.
I can try to fix this, but ParsePrivateKeyWithPassphrase
requires an additional parameter passphrase
. Where can I get a proper value?
Describe the bug
I tried to add my private git repository to Argo CD with SSH private key credential.
However, Argo CD CLI invoked some error like this.
It seems that this
ssh: cannot decode encrypted private keys
came from golang.org/x/crypto/ssh package.golang/x/crypto/ssh package has a function for dealing with a private key with passphrase like this, but it seems that Argo CD codes don't use it.
To Reproduce
Expected behavior Argo CD CLI add the git repository with no errors.
Version
Have you thought about contributing a fix yourself?
I tried to fix this issue, but code base of Argo CD is complicated for me.