我修改了我的WordPress主题functions.php文件以添加以下内容:
add_action(‘wp_login_failed’,’log_wp_login_fail’); //挂钩登录失败
function log_wp_login_fail($username){
error_log(“用户名为:WP登录失败:$username”);
}
登录失败现在写在我的错误日志中.
我的apache-wp-config.conf看起来像这样:
[定义]
failregex = [[] client< HOST> []] WP登录失败.*
ignoreregex =
我的jail.local包含以下内容:
[阿帕奇-WP-登录]
enabled = true
filter = apache-wp-login
action = iptables-multiport [name = apache-wp-login,port =“http,https”]
sendmail-whois [name = apache-wp-login,dest = root,sender = fail2ban@example.com]
logpath = /home/*/logs/*error.log
bantime = 720
maxretry = 6
更多信息在这site