proxy protocol: add more logs

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2024-10-31 18:04:55 +01:00
parent beff4432dc
commit 60558de728
No known key found for this signature in database
GPG key ID: 935D2952DEC4EECF

View file

@ -844,6 +844,7 @@ func getProxyPolicy(allowed, skipped []func(net.IP) bool, def proxyproto.Policy)
if err != nil {
// Something is wrong with the source IP, better reject the
// connection.
logger.Error(logSender, "", "reject connection from ip %q, err: %v", connPolicyOptions.Upstream, err)
return proxyproto.REJECT, proxyproto.ErrInvalidUpstream
}
@ -863,6 +864,8 @@ func getProxyPolicy(allowed, skipped []func(net.IP) bool, def proxyproto.Policy)
}
if def == proxyproto.REQUIRE {
logger.Debug(logSender, "", "reject connection from ip %q: proxy protocol signature required and not set",
upstreamIP)
return proxyproto.REJECT, proxyproto.ErrInvalidUpstream
}
return def, nil