agent/consul: check nil on getCAProvider result

This commit is contained in:
Mitchell Hashimoto 2018-05-08 21:30:18 -07:00
parent 9b3495dddb
commit c8b65217c3
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
1 changed files with 6 additions and 0 deletions

View File

@ -157,6 +157,9 @@ func (s *ConnectCA) ConfigurationSet(
// Have the old provider cross-sign the new intermediate
oldProvider := s.srv.getCAProvider()
if oldProvider == nil {
return fmt.Errorf("internal error: CA provider is nil")
}
xcCert, err := oldProvider.CrossSignCA(intermediateCA)
if err != nil {
return err
@ -283,6 +286,9 @@ func (s *ConnectCA) Sign(
}
provider := s.srv.getCAProvider()
if provider == nil {
return fmt.Errorf("internal error: CA provider is nil")
}
// todo(kyhavlov): more validation on the CSR before signing
pem, err := provider.Sign(csr)