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:
parent
5be6a4e2b0
commit
9a1a82e3b5
1 changed files with 1 additions and 9 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue