argo-cd: x509: certificate signed by unknown authority
Checklist:
- I’ve searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
- I’ve included steps to reproduce the bug.
- I’ve pasted the output of
argocd version.
Describe the bug I deployed a self built private Harbor and have configured a self signed TLS certificate for it.
I configured a repo for argocd using the parameter " –insecure-skip-server-verification", and it appears to be successfully connected.
The command is as follows:
argocd repo add harbor.sredevops.me --type helm --name will-harbor-helm --enable-oci --username admin --insecure-skip-server-verification
The chart in my Harbor is as follows:
I have created an application as follows:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: helm-nginx-harbor
namespace: argocd
spec:
project: default
source:
chart: helm/nginx
repoURL: harbor.sredevops.me
targetRevision: "0.24"
helm:
releaseName: my-nginx
destination:
server: "https://kubernetes.default.svc"
namespace: helm-app
syncPolicy:
syncOptions:
- CreateNamespace=true
The Configmap also looks normal.
I always thought that if the repo connection was successful, the application should not show ‘x509: certificate signed by unknown authority’.
To Reproduce
Expected behavior
The expected behavior is that the application can proceed smoothly. Ultimately, a chart named nginx will be installed.
Screenshots
Version argocd: 2.72
**Logs**
Paste any relevant application logs here.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 7
- Comments: 16 (3 by maintainers)
Commits related to this issue
- fix: creds.CAPath passed helm in PullOCI (#13726) Signed-off-by: Nandor Galambosi <dromie@gmail.com> — committed to dromie/argo-cd by dromie 3 years ago
- fix: creds.CAPath passed helm in PullOCI (#13726) (#13871) Signed-off-by: Nandor Galambosi <dromie@gmail.com> — committed to argoproj/argo-cd by dromie 3 years ago
- fix: creds.CAPath passed helm in PullOCI (#13726) (#13871) Signed-off-by: Nandor Galambosi <dromie@gmail.com> — committed to yyzxw/argo-cd by dromie 3 years ago
- fix: creds.CAPath passed helm in PullOCI (#13726) (#13871) Signed-off-by: Nandor Galambosi <dromie@gmail.com> — committed to tesla59/argo-cd by dromie 3 years ago
The ConfigMap ist created by Trustmanager ( https://github.com/cert-manager/trust-manager ) and placed inside the argo-cd namespace.
Afterwards I updated the values.yaml of the helmchart by which ArgoCD is installed: https://github.com/argoproj/argo-helm/blob/main/charts/argo-cd/values.yaml#L2197-L2206
This looks something like this for me:
I hope this helps 😃 @ElouanLD @augeivv
Facing the same issue, pretty much same setup as @FrancescoAzzariti. Might very well be a chain issue as well, and I’ll try to fix that accordingly.
In the argocd GUI I see the error
certificate signed by unknown authority. This shouldn’t pop up if using--insecure-skip-server-verification(respectively setting insecure to true) in the repo configuration, right? Otherwise I don’t understand what the flag is there for.Thought I would chip in with how I seem to have solved this. TL;DR SSL_CERT_FILE environment variable on the repo server.
My problem was caused by the corporate firewall doing SSL inspection and Argo not trusting our internal root CA. The error was
tls: failed to verify certificate: x509: certificate signed by unknown authoritywhen Argo tries to download from repos.I could kind of work around this by doing what @kromooooo said, by creating repos in Argo and marking them as insecure. This would never work long term and is just bad, so I tried various suggestions online.
I was hopeful that argocd-tls-certs-cm would solve it but this did absolutely nothing. I don’t know if it’s because my problem repo was from a subchart that wasn’t in the repos list or what. I think Argo was created that configmap by default and it was empty, but then I had no way to add to it when my Argo CD is installed from the community helm chart (their config.tls value did nothing either, or did something but didn’t work, I can’t remember what).
I tried adding my cert to the OS trust store (e.g. like this) but that didn’t work because Argo wasn’t running as root and I couldn’t run update-ca-certificates.
I was going to try updating ca-certificates.crt in an init container and mounting that in the main container, but it sounded fiddly and I was already stretching the limits of my time (and capabilities!) so I benched it. It sounded promising though so linking here for someone else. Link
In the end, what seemed to work was using the SSL_CERT_FILE environment variable on the repo server. I found this env var independently and just now found it on here. In my parent chart where I configure Argo I ‘just’ added a new config map with root CA in it, then in the values file under reposerver I added that cm as volume, a volume mount in /usr/share/ca-certificates, and the env var itself. No changed to the server needed, only reposerver.
@FrancescoAzzariti
Thank you for your help. It works. I had bound the certificates to the server pod. But not to the repo server.
I just checked - mine says:
Verify return code: 2 (unable to get issuer certificate)i’ll try adding the cert of the issuer / the whole chain
EDIT: @dromie I added the chain to the configmap (selfsigned PKI), waited until the cert was in the Pod and now I get
Verification: OKAfter this I retried to apply the Application and i still get:
tls: failed to verify certificate: x509: certificate signed by unknown authorityEDIT2: I found a solution that works for us: I mounted the configmap which includes the cert+chain provided by trustmanager into the “reposerver” and “server” pod to
/etc/ssl/certs/pkichain.pem