mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 23:00:55 +03:00
add a global whitelist
if defined only the listed IPs/networks can access the configured services, all other client connections will be dropped before they even try to authenticate Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -983,8 +983,8 @@ func (s *httpdServer) checkConnection(next http.Handler) http.Handler {
|
||||
defer common.Connections.RemoveClientConnection(ipAddr)
|
||||
|
||||
if !common.Connections.IsNewConnectionAllowed(ipAddr) {
|
||||
logger.Log(logger.LevelDebug, common.ProtocolHTTP, "", "connection refused, configured limit reached")
|
||||
s.sendForbiddenResponse(w, r, "configured connections limit reached")
|
||||
logger.Log(logger.LevelDebug, common.ProtocolHTTP, "", fmt.Sprintf("connection not allowed from ip %#v", ipAddr))
|
||||
s.sendForbiddenResponse(w, r, "connection not allowed from your ip")
|
||||
return
|
||||
}
|
||||
if common.IsBanned(ipAddr) {
|
||||
|
||||
Reference in New Issue
Block a user