Add ability to limit the maximum number of SANs

This commit is contained in:
Darren Shepherd
2020-03-18 23:15:44 -07:00
parent 1e67d402dc
commit 05d7922a86
2 changed files with 9 additions and 3 deletions

View File

@@ -52,6 +52,7 @@ func NewListener(l net.Listener, storage TLSStorage, caCert *x509.Certificate, c
Listener: l,
storage: &nonNil{storage: storage},
sans: config.SANs,
maxSANs: config.MaxSANs,
tlsConfig: config.TLSConfig,
}
if dynamicListener.tlsConfig == nil {
@@ -90,6 +91,7 @@ type Config struct {
Organization []string
TLSConfig *tls.Config
SANs []string
MaxSANs int
ExpirationDaysCheck int
CloseConnOnCertChange bool
}
@@ -108,6 +110,7 @@ type listener struct {
tlsConfig *tls.Config
cert *tls.Certificate
sans []string
maxSANs int
init sync.Once
}
@@ -261,7 +264,7 @@ func (l *listener) updateCert(cn ...string) error {
return err
}
if !factory.NeedsUpdate(secret, cn...) {
if !factory.NeedsUpdate(l.maxSANs, secret, cn...) {
return nil
}