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
1 changed files with 5 additions and 2 deletions

View File

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