-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Git SSH keys failing to authenticate #9122
Comments
Did you try cloning the repository with same private key and that works? ssh-agent |
Clones fine
Unfortunately argcod doesn't really give any logs. If I had to guess, it's not using the SSH key private for some reason and ignoring it... but it would be great if I knew why, the key exists entirely for argocd, so it's easy enough to generate a new one. I'm unclear how the cli/server and what not work. I would hope running the cli on the server would give some idea, but maybe it's xferring the key to another component, and that is failing. I've tried stripping and running dos2unix, but still the same error. I would be happy enough to regenerate a key, but it would be random flags until argocd decides it likes that key :( From #1894 I've tried generating a new key with -m pem, as maybe argocd doesn't support non-pem keys? but this is the same behaviour, git and ssh work, argocd fails |
from #7600 I think argocd isn't supporting the default flags of whatever ssh-keygen arch installs. |
Argo CD only half supports PEM keys. The error is confusing because of history like #2890 and from that history you'll notice mention that Argo does not consistently handle the git URLs and the disparity is visible when attempting to use PEM formatted private keys, which you might have if you're migrating from fluxcd. The error presents as follows for the application:
Viewing the repo status, it has "Successful" for the status. |
@MaiCabrera yes, just don't use PEM formatted keys. Use OpenSSH formatted keys. These commands will change the files in-place. Make backups beforehand just in case. (I might have this backwards btw, it's been a while)
I actually stopped using Argo CD after seeing these inconsistencies and have fully adopted Flux v2 at this point. The one thing Argo CD would do for me that Flux v2 doesn't is accept an Application that installs cert-manager via helm + Issuers, and eventually reconcile these things. Flux v2 would need to be setup with a Kustomization CR (it can dynamically build it's own kustomization.yaml). The entire thing will fail if cert-manager is not installed but Issuers are in the manifests. For chicken and egg issues where CR's don't exist yet, I just built a shim that would wrap the problem inside HelmReleases, which can depend on each other. In fact, being forced to this state, I've found that I actually like the way my problems had to be addressed in the Flux v2 eco system. My Kustomization does gitops by using a repo where all objects are required to be a HelmRelease. Automation for pull requests validate HelmReleases with kubeconform and yq checking the "kind". PR's can't be merged if validation fails. Using only HelmReleases is more akin to config management, which my team desires. Maintaining pods, configmaps, and replicasets is more like app development, which my team does not desire in the cluster management repo. Not saying Argo CD is bad by any stretch here, but having more field of view over this, it does fall a bit short in ways I didn't expect. |
@protosam Thank you. |
So I was having trouble with creating an app in ArgoCD after successfully connecting to my repo over ssh in ArgoCD. I was using bitbucket as a repository. by reading the error message that ArgoCD output when I hit app create. Which went something like "[email protected] unable to "git fetch... etc" (Public Key)". I realized that Argo was trying to authenticate with bitbucket using the username argocd. This would not work in my setup as we did not have a user account set up for argocd. TLDR; I selected https instead of ssh in ArgoCD and used bitbucket app passwords in account settings on bitbucket and used my bitbucket username and the app password provided through the app password process. solved all my auth problems with the repo. |
This really helped solve this problem! Thanks |
See my comment in #7600.
|
golang/crypto@6fad3dfc may have fixed this. Argo CD 2.7.x upgraded to |
In my case I had to remove passphrase from a key and then it started working. I figured that out by installing argo cli and then adding repo manually specifying a key path and there was a clear error about passphrase protection.
|
Checklist:
argocd version
.Describe the bug
Argocd is failing to authenticate with a valid private key
Using ssh on the same server shows the key is good
To Reproduce
Run
argocd add repo
Expected behavior
Argocd adds the repo with it's credentials
Screenshots
Version
argocd@argocd-server-c9958cfc8-cwvg2:~$ argocd version argocd: v2.3.3+07ac038 BuildDate: 2022-03-30T00:59:49Z GitCommit: 07ac038a8f97a93b401e824550f0505400a8c84e GitTreeState: clean GoVersion: go1.17.6 Compiler: gc Platform: linux/arm64 argocd-server: v2.3.3+07ac038 BuildDate: 2022-03-30T00:59:49Z GitCommit: 07ac038a8f97a93b401e824550f0505400a8c84e GitTreeState: clean GoVersion: go1.17.6 Compiler: gc Platform: linux/arm64 Ksonnet Version: vdev-2022-03-30T00:42:07+0000 Kustomize Version: v4.4.1 2021-11-11T23:36:27Z Helm Version: v3.8.0+gd141386 Kubectl Version: v0.23.1 Jsonnet Version: v0.18.0
Logs
The text was updated successfully, but these errors were encountered: