測試環境
- CentOS 7
- Nginx 1.12.2
尚未安裝Fail2ban 請參考 Fail2ban 防止 SSH 密碼嘗試攻擊
本篇就著重在Fail2ban設定
1.新增判斷模組
預設檔案位置
/etc/fail2ban/filter.d/wp-login.conf
檔案內容
[Definition]
failregex = ^<HOST> - - .*(POST|GET)\ .*wp-login.php.*
ignoreregex =
2.添加至條件至jail.local
預設路徑
/etc/fail2ban/jail.local
添加檔案內容
[wp-login]
enabled = true
port = http,https
filter = wp-login
logpath = /var/log/nginx/access.log
maxretry = 10
findtime = 600
bantime = 3600
3.重新啟動
sudo systemctl restart fail2ban