add rate limiting support for REST API/web admin too

This commit is contained in:
Nicola Murino
2021-04-19 08:14:04 +02:00
parent 112e3b2fc2
commit f45c89fc46
15 changed files with 109 additions and 39 deletions

View File

@@ -360,7 +360,8 @@ func canAcceptConnection(ip string) bool {
logger.Log(logger.LevelDebug, common.ProtocolSSH, "", "connection refused, configured limit reached")
return false
}
if err := common.LimitRate(common.ProtocolSSH, ip); err != nil {
_, err := common.LimitRate(common.ProtocolSSH, ip)
if err != nil {
return false
}
if err := common.Config.ExecutePostConnectHook(ip, common.ProtocolSSH); err != nil {