Linux/Nextcloud

From Wiki

fail2ban

  • /etc/fail2ban/filter.d/nextcloud.conf
[Definition]
failregex=^{"reqId":".*","remoteAddr":".*","app":"core","message":"Login failed: '.*' \(Remote IP: '<HOST>'\)","level":2,"time":".*"}$
          ^{"reqId":".*","level":2,"time":".*","remoteAddr":".*","user,:".*","app":"no app in context".*","method":".*","message":"Login failed: '.*' \(Remote IP: '<HOST>'\)".*}$
          ^{"reqId":".*","level":2,"time":".*","remoteAddr":".*","user":".*","app":".*","method":".*","url":".*","message":"Login failed: .* \(Remote IP: <HOST>\).*}$
  • /etc/fail2ban/jail.d/nextcloud.local
[nextcloud]
backend = auto
enabled = true
port = 80,443
protocol = tcp
filter = nextcloud
maxretry = 10
bantime = 3600
findtime = 36000
logpath = /srv/docker-data/nextcloud/html/data/nextcloud.log


Cron

  • /etc/cron.d/nextcloud
# m    h    dom    mon    dow    user    command
*/5    *    *      *      *      root    /bin/bash /srv/docker-config/nextcloud/run_cronjob.sh
  • /srv/docker-config/nextcloud/run_cronjob.sh
docker exec -u www-data nextcloud_app_1 php cron.php