mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 22:30:56 +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:
@@ -151,8 +151,8 @@ func (s *Server) ClientConnected(cc ftpserver.ClientContext) (string, error) {
|
||||
return "Access denied: banned client IP", common.ErrConnectionDenied
|
||||
}
|
||||
if !common.Connections.IsNewConnectionAllowed(ipAddr) {
|
||||
logger.Log(logger.LevelDebug, common.ProtocolFTP, "", "connection refused, configured limit reached")
|
||||
return "Access denied: max allowed connection exceeded", common.ErrConnectionDenied
|
||||
logger.Log(logger.LevelDebug, common.ProtocolFTP, "", fmt.Sprintf("connection not allowed from ip %#v", ipAddr))
|
||||
return "Access denied", common.ErrConnectionDenied
|
||||
}
|
||||
_, err := common.LimitRate(common.ProtocolFTP, ipAddr)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user