server: nextcloud: enable fail2ban

This commit is contained in:
Kabbone 2023-06-04 15:03:12 +02:00
parent 6059c3c0ba
commit c17489376e
Signed by: Kabbone
SSH Key Fingerprint: SHA256:A5zPB5I6u5V78V51c362BBdCwhDhfDUVbt7NfKdjWBY
3 changed files with 18 additions and 0 deletions

View File

@ -80,6 +80,10 @@
source = ../modules/services/server/fail2ban/filter/gitea.conf;
mode = "0444";
};
"fail2ban/filter.d/nextcloud.conf" = {
source = ../modules/services/server/fail2ban/filter/nextcloud.conf;
mode = "0444";
};
};
systemPackages = with pkgs; [ # Default packages install system-wide
vim
@ -127,6 +131,12 @@
backend = systemd
action = iptables-allports
'';
nextcloud = ''
backend = auto
enabled = true
filter = nextcloud
logpath = /var/lib/nextcloud/data/nextcloud.log
action = iptables-allports
};
};

View File

@ -0,0 +1,6 @@
[Definition]
_groupsre = (?:(?:,?\s*"\w+":(?:"[^"]+"|\w+))*)
failregex = ^\{%(_groupsre)s,?\s*"remoteAddr":"<HOST>"%(_groupsre)s,?\s*"message":"Login failed:
^\{%(_groupsre)s,?\s*"remoteAddr":"<HOST>"%(_groupsre)s,?\s*"message":"Trusted domain error.
datepattern = ,?\s*"time"\s*:\s*"%%Y-%%m-%%d[T ]%%H:%%M:%%S(%%z)?"
journalmatch =

View File

@ -8,11 +8,13 @@
package = pkgs.nextcloud26;
enableBrokenCiphersForSSE = false;
database.createLocally = false;
logType = "file";
caching = {
redis = true;
apcu = false;
};
extraOptions = {
logfile = "nextcloud.log";
redis = {
host = "/run/redis-nextcloud/redis.sock";
port = 0;