@@ -2,6 +2,7 @@ package certgraphanalysis
22
33import (
44 "fmt"
5+ "slices"
56
67 "github.com/openshift/library-go/pkg/certs/cert-inspection/certgraphapi"
78 certificatesv1 "k8s.io/api/certificates/v1"
@@ -13,6 +14,16 @@ import (
1314 "k8s.io/client-go/util/cert"
1415)
1516
17+ var caBundleKeys = []string {
18+ "ca-bundle.crt" ,
19+ "client-ca-file" ,
20+ "client-ca.crt" ,
21+ "metrics-ca-bundle.crt" ,
22+ "requestheader-client-ca-file" ,
23+ "image-registry.openshift-image-registry.svc..5000" ,
24+ "image-registry.openshift-image-registry.svc.cluster.local..5000" ,
25+ }
26+
1627func InspectSecret (obj * corev1.Secret ) ([]* certgraphapi.CertKeyPair , error ) {
1728 tlsCrt , isTLS := obj .Data ["tls.crt" ]
1829 if ! isTLS || len (tlsCrt ) == 0 {
@@ -60,8 +71,18 @@ func InspectConfigMap(obj *corev1.ConfigMap) (*certgraphapi.CertificateAuthority
6071 return details , nil
6172 }
6273
63- caBundle , ok := obj .Data ["ca-bundle.crt" ]
64- if ! ok || len (caBundle ) == 0 {
74+ var caBundle string
75+ for key := range obj .Data {
76+ if ! slices .Contains (caBundleKeys , key ) {
77+ continue
78+ }
79+ if value := obj .Data [key ]; len (value ) > 0 {
80+ caBundle = value
81+ break
82+ }
83+ }
84+
85+ if len (caBundle ) == 0 {
6586 return nil , nil
6687 }
6788
0 commit comments