outposts/ldap: fix order of Listeners

TCP -> PROXY -> TLS

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-07-20 15:25:11 +02:00
parent d678d33756
commit d89266a9d2

View file

@ -97,15 +97,18 @@ func (ls *LDAPServer) StartLDAPTLSServer() error {
GetCertificate: ls.getCertificates, GetCertificate: ls.getCertificates,
} }
ln, err := tls.Listen("tcp", listen, tlsConfig) ln, err := net.Listen("tcp", listen)
if err != nil { if err != nil {
ls.log.Fatalf("FATAL: listen (%s) failed - %s", listen, err) ls.log.Fatalf("FATAL: listen (%s) failed - %s", listen, err)
} }
proxyListener := &proxyproto.Listener{Listener: ln} proxyListener := &proxyproto.Listener{Listener: ln}
defer proxyListener.Close() defer proxyListener.Close()
tln := tls.NewListener(proxyListener, tlsConfig)
ls.log.WithField("listen", listen).Info("Starting ldap tls server") ls.log.WithField("listen", listen).Info("Starting ldap tls server")
err = ls.s.Serve(proxyListener) err = ls.s.Serve(tln)
if err != nil { if err != nil {
return err return err
} }