b3159a74e5
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> # Conflicts: # Dockerfile # internal/outpost/ak/api.go # internal/outpost/ak/api_uag.go # internal/outpost/ak/global.go # internal/outpost/ldap/api_tls.go # internal/outpost/ldap/instance_bind.go # internal/outpost/ldap/utils.go # internal/outpost/proxy/api_bundle.go # outpost/go.mod # outpost/go.sum # outpost/pkg/ak/cert.go
24 lines
749 B
Go
24 lines
749 B
Go
package ldap
|
|
|
|
import "crypto/tls"
|
|
|
|
func (ls *LDAPServer) getCertificates(info *tls.ClientHelloInfo) (*tls.Certificate, error) {
|
|
if len(ls.providers) == 1 {
|
|
if ls.providers[0].cert != nil {
|
|
ls.log.WithField("server-name", info.ServerName).Debug("We only have a single provider, using their cert")
|
|
return ls.providers[0].cert, nil
|
|
}
|
|
}
|
|
for _, provider := range ls.providers {
|
|
if provider.tlsServerName == &info.ServerName {
|
|
if provider.cert == nil {
|
|
ls.log.WithField("server-name", info.ServerName).Debug("Handler does not have a certificate")
|
|
return ls.defaultCert, nil
|
|
}
|
|
return provider.cert, nil
|
|
}
|
|
}
|
|
ls.log.WithField("server-name", info.ServerName).Debug("Fallback to default cert")
|
|
return ls.defaultCert, nil
|
|
}
|