Skip to content

Instantly share code, notes, and snippets.

@ngugijames
Created April 29, 2022 19:31
Show Gist options
  • Save ngugijames/d90118bddcb2137a009c702eb434359a to your computer and use it in GitHub Desktop.
Save ngugijames/d90118bddcb2137a009c702eb434359a to your computer and use it in GitHub Desktop.
#Filter:
cd /etc/fail2ban/filter.d
[Definition]
#failregex = <HOST> - - \[(\d{2})/\w{3}/\d{4}:\1:\1:\1 -\d{4}\] "POST /admin/ HTTP/1.1"
#failregex = ^<HOST> - .* "POST /admin/ HTTP/1.1" 499
#failregex = ^<HOST> - .* "(GET|POST|HEAD).*HTTP.*" 404 .*$
#failregex = ^<HOST> - .* "(GET|POST|HEAD) /admin/ HTTP.*" .*$
#failregex = ^<HOST> - .* "POST /admin/ HTTP/1.1" .*
failregex = ^<HOST> - .* "POST /admin/ HTTP/1.1" .*
ignoreregex =
#Jail
vim /etc/fail2ban/jail.local
[opencart-admin]
enabled = true
filter = opencart-admin
logpath = /var/log/nginx/kiukabrands.com.access.log
/var/log/nginx/kiukabrands.com.access.log
port = http,https
maxretry = 1
findtime = 30d
bantime = 600
bantime.rndtime = 100
bantime.increment = true
bantime.factor = 24
bantime.maxtime = 6w
#restart fail2ban
sudo fail2ban-client restart
sudo fail2ban-client status opencart-admin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment