outposts/ldap: improve logging of client IPs

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-09-05 19:47:30 +02:00
parent 9dbafaaea2
commit 9ad4cf1db9
5 changed files with 24 additions and 11 deletions

View File

@ -11,6 +11,7 @@ import (
log "github.com/sirupsen/logrus"
"goauthentik.io/api"
"goauthentik.io/internal/outpost"
"goauthentik.io/internal/utils"
)
const ContextUserKey = "ak_user"
@ -36,7 +37,7 @@ func (pi *ProviderInstance) getUsername(dn string) (string, error) {
func (pi *ProviderInstance) Bind(username string, req BindRequest) (ldap.LDAPResultCode, error) {
fe := outpost.NewFlowExecutor(req.ctx, pi.flowSlug, pi.s.ac.Client.GetConfig(), log.Fields{
"bindDN": req.BindDN,
"client": req.conn.RemoteAddr().String(),
"client": utils.GetIP(req.conn.RemoteAddr()),
"requestId": req.id,
})
fe.DelegateClientIP(req.conn.RemoteAddr())