mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 22:30:56 +03:00
fix proxy protocol policy
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -810,7 +810,8 @@ func getProxyPolicy(allowed, skipped []func(net.IP) bool, def proxyproto.Policy)
|
||||
return func(upstream net.Addr) (proxyproto.Policy, error) {
|
||||
upstreamIP, err := util.GetIPFromNetAddr(upstream)
|
||||
if err != nil {
|
||||
// something is wrong with the source IP, better reject the connection
|
||||
// Something is wrong with the source IP, better reject the
|
||||
// connection if a proxy header is found.
|
||||
return proxyproto.REJECT, err
|
||||
}
|
||||
|
||||
@@ -829,6 +830,9 @@ func getProxyPolicy(allowed, skipped []func(net.IP) bool, def proxyproto.Policy)
|
||||
}
|
||||
}
|
||||
|
||||
if def == proxyproto.REQUIRE {
|
||||
return proxyproto.REJECT, nil
|
||||
}
|
||||
return def, nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user