treewide: Add fail2ban
This commit is contained in:
parent
325e8a0ea1
commit
c4fa991b62
3 changed files with 63 additions and 0 deletions
configuration/services
|
@ -28,4 +28,23 @@ in {
|
|||
|
||||
locations."/".proxyPass = "http://${httpAddress}:${toString httpPort}";
|
||||
};
|
||||
|
||||
# Block repeated failed login attempts
|
||||
#
|
||||
# TODO(tlater): Update to the new regex, since apparently this one
|
||||
# is deprecated (but the new one doesn't work on the current version
|
||||
# of gitea yet): https://docs.gitea.io/en-us/fail2ban-setup/
|
||||
environment.etc = {
|
||||
"fail2ban/filter.d/gitea.conf".text = ''
|
||||
[Definition]
|
||||
failregex = .*(Failed authentication attempt|invalid credentials|Attempted access of unknown user).* from <HOST>
|
||||
journalmatch = _SYSTEMD_UNIT=gitea.service + _COMM=gitea + SYSLOG_IDENTIFIER=gitea
|
||||
'';
|
||||
};
|
||||
|
||||
services.fail2ban.jails = {
|
||||
gitea = ''
|
||||
enabled = true
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue