ingress-nginx: TLS auth secret not found using controller v1.11.4
What happened:
When updating the helm chart to version 4.11.4 (v1.11.4 of the controller), it is not able to find the secret specified with the nginx.ingress.kubernetes.io/auth-tls-secret annotation, which in previous versions had been working fine and the secret still exists and with the same value. This causes all requests to return a 403. I also tried with version 4.12.0 in case it was an incompatibility problem with the k8s 1.31 versoin, but the behaviour is the same.
k logs ingress-nginx-controller-vb8vw --tail 100000 | grep -i "ca-secret"
E0102 09:48:02.038394 7 annotations.go:219] "error reading Ingress annotation" err="error obtaining certificate: local SSL certificate internal-develop-ci/ca-secret was not found" name="CertificateAuth" ingress="internal-develop-ci/app-tls-ingress"
Also in nginx.conf
# error obtaining certificate: local SSL certificate internal-develop-ci/ca-secret was not found
return 403;
- Ingress object:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
cert-manager.io/cluster-issuer: prod
meta.helm.sh/release-name: app
meta.helm.sh/release-namespace: internal-develop-ci
nginx.ingress.kubernetes.io/auth-tls-pass-certificate-to-upstream: "true"
nginx.ingress.kubernetes.io/auth-tls-secret: internal-develop-ci/ca-secret
nginx.ingress.kubernetes.io/auth-tls-verify-client: optional
nginx.ingress.kubernetes.io/auth-tls-verify-depth: "3"
nginx.ingress.kubernetes.io/backend-protocol: HTTP
nginx.ingress.kubernetes.io/configuration-snippet: |
if ($ssl_client_verify != "SUCCESS") { return 403; }
nginx.ingress.kubernetes.io/proxy-connect-timeout: "600"
nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/use-regex: "true"
creationTimestamp: "2024-07-08T07:48:06Z"
generation: 7
labels:
app.kubernetes.io/managed-by: Helm
name: app-tls-ingress
namespace: internal-develop-ci
resourceVersion: "511512779"
uid: 7a3b7ed6-e1ff-411c-907c-849ccb3f5efc
spec:
ingressClassName: nginx
rules:
- host: app.develop.ci.help
http:
paths:
- backend:
service:
name: app-svc
port:
number: 80
path: /pemea
pathType: Prefix
tls:
- hosts:
- app.develop.ci.help
secretName: app-tls-secret
status:
loadBalancer:
ingress:
- hostname: a0fd247c95da34021b7ad53b770c03dd-0187727592fb99ea.elb.eu-west-1.amazonaws.com
What you expected to happen:
That it would continue to function normally, being able to validate the client certificate with the CAs chain specified in the ca.crt field of the ca-secret secret.
NGINX Ingress controller version (exec into the pod and run /nginx-ingress-controller --version):
ingress-nginx-controller-6qdqb:/etc/nginx$ /nginx-ingress-controller --version
-------------------------------------------------------------------------------
NGINX Ingress controller
Release: v1.11.4
Build: ba0f2ee37f032c9f11967b74862c60a43ed59b36
Repository: https://github.com/kubernetes/ingress-nginx
nginx version: nginx/1.25.5
-------------------------------------------------------------------------------
Kubernetes version (use kubectl version):
kubectl version
Client Version: v1.30.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.31.3-eks-56e63d8
Environment:
- How was the ingress-nginx-controller installed:
- If helm was used then please show output of
helm ls -A | grep -i ingress:
- If helm was used then please show output of
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
ingress-nginx nginx-ingress 64 2025-01-02 10:47:15.078656077 +0100 CET deployed ingress-nginx-4.11.4 1.11.4
- If helm was used then please show output of
helm -n <ingresscontrollernamespace> get values <helmreleasename>
USER-SUPPLIED VALUES:
controller:
admissionWebhooks:
patch:
image:
digest: ""
allowSnippetAnnotations: true
config:
proxy-body-size: 600m
stream-access-log-path: /dev/null
use-proxy-protocol: false
image:
digest: ""
digestChroot: ""
ingressClass: nginx
ingressClassResource:
default: true
name: nginx
kind: DaemonSet
livenessProbe:
periodSeconds: 30
metrics:
enabled: true
serviceMonitor:
enabled: true
namespace: monitoring
priorityClassName: app-infra-priority
readinessProbe:
periodSeconds: 3
resources:
limits:
cpu: 900m
requests:
cpu: 100m
service:
annotations:
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: "600"
service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: "true"
service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*'
service.beta.kubernetes.io/aws-load-balancer-type: nlb
nodePorts:
http: "31685"
https: "30761"
tolerations:
- effect: NoExecute
key: node.kubernetes.io/not-ready
operator: Exists
tolerationSeconds: 5
- effect: NoExecute
key: node.kubernetes.io/unreachable
operator: Exists
tolerationSeconds: 5
tcp:
"5349": internal-develop-ci/app-webrtc-turn-svc:5349
udp: {}
- Current State of the controller:
kubectl describe ingressclasses
kubectl describe ingressclasses
Name: nginx
Labels: app.kubernetes.io/component=controller
app.kubernetes.io/instance=ingress-nginx
app.kubernetes.io/managed-by=Helm
app.kubernetes.io/name=ingress-nginx
app.kubernetes.io/part-of=ingress-nginx
app.kubernetes.io/version=1.11.4
helm.sh/chart=ingress-nginx-4.11.4
Annotations: ingressclass.kubernetes.io/is-default-class: true
meta.helm.sh/release-name: ingress-nginx
Controller: k8s.io/ingress-nginx
Events: <none>
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (10 by maintainers)
This issue is affecting me when using the default Debian bullseye trust store located at
/etc/ssl/certs/ca-certificates.crtas theca.crtcontents in mynginx.ingress.kubernetes.io/proxy-ssl-secret.After v1.11.3, ingress-nginx throws
backend_ssl.go:47] Error obtaining X.509 certificate: unexpected error creating SSL Cert: x509: negative serial numberand fails to read the default CA certificate trust store from Debian bullseye (and most likely many other distros).This is caused by https://github.com/golang/go/issues/65085 / https://go-review.googlesource.com/c/go/+/562343 The commit itself specifically acknowledges
There is ... one trusted certificate I could find in the web pki which has a negative serial number.CATCert (who is responsible for this root cert) successfully argued for its inclusion in Mozilla’s trust store, stating:
To me it seems premature that the commit was merged in conflict with past precedent regarding this particular root certificate, knowingly breaking Go from being able to accept operating system default PKI trust stores.
Trust-manager recently worked around Go’s regression by allowing negative serial numbers when using Go 1.23, which is how I would propose ingress-nginx resolve this absent a better solution.
Hi, I’ve found the problem, I hadn’t seen this error line, which is more descriptive:
W0103 11:19:24.955854 7 backend_ssl.go:47] Error obtaining X.509 certificate: unexpected error creating SSL Cert: x509: negative serial numberIt turns out that in the ca-secret secret that gives error, which is a chain of CAs, there is a CA that has a negative serial number. Up to version v1.11.3 of the Ingress Controller driver, this is not a problem, but from v1.11.4 onwards it is, because the version of go has been updated to v1.23.3 and although it does not appear in the releases notes, now the x509.ParseCertificate says:
Thanks to this stackoverflow post.
I will try to update the chain of CAs, to see if there is no longer any with a negative serial number, and that would solve my case.