How Ingress router default certificate is managed in Azure Red Hat OpenShift 4
Environment
- Red Hat OpenShift on Azure (ARO)
- 4
Issue
Ingress router defaultcertificate is about to expire- How to confirm which certificates are used for Ingress router default?
- How to identify which
CAis signing default certificates? - Which code block is used for auto renewing certificates?
Resolution
-
In Azure Red Hat OpenShift (ARO), when no
custom domaincertificate has been applied to the cluster, the certificate renewals for thedefault ingress controllersare managed by Red Hat as part of the ARO service and is auto renewed. This is managed, by thetls.gomodule by requesting a certificate from one of theAzure Certificate Authorities. The certificate is then stored in the clustersAzure Keyvaultwhere it is then recalled and added as a cluster secret. -
This means that Azure Red Hat OpenShift 4 (ARO) does not require the certificate authority which is provided in the the
cert-utilsoperator. -
If
custom domaincertificates have been applied to the cluster, then the cluster administrators will need to maintain the certificate.
Diagnostic Steps
-
Confirm the default certificate is mounted in the
router-defaultdeployment inopenshift-ingressnamespace$ oc get deployment/router-default -o yaml -n openshift-ingress| grep -A10 volumes volumes: - name: default-certificate secret: defaultMode: 420 secretName: xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-ingress <------ cert is mounted in the deployment/router-default - configMap: defaultMode: 420 items: - key: service-ca.crt path: service-ca.crt name: service-ca-bundle ............output omitted.................$ oc get secrets -n openshift-ingress | grep -i ingress xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-ingress kubernetes.io/tls -
Check the
default router certificateto confirmaroapp.iodomain is used. Confirm the certificate expiration date andCAsigning the certificate. Azure is the expected singingCA.$ echo -e "NAMESPACE\tNAME\tEXPIRY" && oc get secrets -n openshift-ingress -o go-template='{{range .items}}{{if eq .type "kubernetes.io/tls"}}{{.metadata.namespace}}{{" "}}{{.metadata.name}}{{" "}}{{index .data "tls.crt"}}{{"\n"}}{{end}}{{end}}' | while read namespace name cert; do echo -en "$namespace\t$name\t"; echo $cert | base64 -d | openssl x509 -noout -text ; done NAMESPACE NAME EXPIRY openshift-ingress xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-ingress Certificate: Signature Algorithm: sha384WithRSAEncryption Issuer: C = US, O = Microsoft Corporation, CN = Microsoft Azure TLS Issuing CA 05 Validity Not Before: Jul 6 05:11:18 2023 GMT Not After : Jun 27 23:59:59 2024 GMT <----------------- Expiration date Subject: C = US, ST = WA, L = Redmond, O = Microsoft Corporation, CN = *.apps.u1kgiy5t.centralindia.aroapp.io <------- Azure aroapp.io domain is used Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public-Key: (2048 bit) Modulus: ............output omitted................. -
Check if
openshift-ingress-operatorhas self-signedrouter-cacertificate. This is only one place where it should be used.$ echo -e "NAMESPACE\tNAME\tEXPIRY" && oc get secrets -n openshift-ingress-operator -o go-template='{{range .iems}}{{if eq .type "kubernetes.io/tls"}}{{.metadata.namespace}}{{" "}}{{.metadata.name}}{{" "}}{{index .data "tls.crt"}}{{"\n"}}{{end}}{{end}}' | while read namespace name cert; do echo -en "$namespace\t$name\t"; echo $cert | base64 -d | openssl x509 -noout -text ; done openshift-ingress-operator router-ca Certificate: Data: Version: 3 (0x2) Serial Number: 1 (0x1) Signature Algorithm: sha256WithRSAEncryption Issuer: CN = ingress-operator@xxxxxx Validity Not Before: Jul 6 05:30:09 2023 GMT Not After : Jul 5 05:30:10 2025 GMT Subject: CN = ingress-operator@xxxxxx <--- the only one Ingress Controller cert is not signed by the Azure CA Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public-Key: (2048 bit) Modulus: ............output omitted................. -
Check and make sure that no other
secrets/certificatesare using certificate issued byingress-operator@xxxxxx$ echo -e "NAMESPACE\tNAME\tEXPIRY" && oc get secrets -A -o go-template='{{range .items}}{{if eq .type "kubernetes.io/tls"}}{{.metadat.namespace}}{{" "}}{{.metadata.name}}{{" "}}{{index .data "tls.crt"}}{{"\n"}}{{end}}{{end}}' | while read namespace name cert; do echo -en "$namespace\t$name\t"; echo $cert | base64 -d | openssl x509 -noout -text ; done | grep -i -A10 -B10 'ingress-operator@' openshift-ingress-operator router-ca Certificate: Data: Version: 3 (0x2) Serial Number: 1 (0x1) Signature Algorithm: sha256WithRSAEncryption Issuer: CN = ingress-operator@xxxxxx Validity Not Before: Jul 6 05:30:09 2023 GMT Not After : Jul 5 05:30:10 2025 GMT Subject: CN = ingress-operator@xxxxxx Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public-Key: (2048 bit) Modulus: ............output omitted.................
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments