1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

feat: parse all root CA certs (#3808)

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
This commit is contained in:
Charles-Edouard Brétéché 2022-05-05 10:31:22 +02:00 committed by GitHub
parent 5be6a4e2b0
commit 9a1a82e3b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -343,19 +343,11 @@ func (c *CertRenewer) ValidCert() (bool, error) {
// build cert pool
pool := x509.NewCertPool()
caPem, _ := pem.Decode(rootCA)
if caPem == nil {
if !pool.AppendCertsFromPEM(rootCA) {
logger.Error(err, "bad certificate")
return false, nil
}
cac, err := x509.ParseCertificate(caPem.Bytes)
if err != nil {
logger.Error(err, "failed to parse CA cert")
return false, nil
}
pool.AddCert(cac)
// valid PEM pair
_, err = tls.X509KeyPair(tlsPair.Certificate, tlsPair.PrivateKey)
if err != nil {