Fail2ban指南:修订间差异

Admin留言 | 贡献
无编辑摘要
Admin留言 | 贡献
无编辑摘要
 
(未显示同一用户的2个中间版本)
第1行: 第1行:
编写文件 /etc/fail2ban/filter.d/frps.conf
= 安装 =
<pre>
'''apt install fail2ban'''
[Definition]
 
failregex = ^.*get a user connection \[<HOST>:[0-9]*\]
= 配置 =
            ^.*get a new work connection: \[<HOST>:[0-9]*\]
vim /etc/fail2ban/jail.local
ignoreregex =
 
</pre>
== SSH ==
编写文件 /etc/fail2ban/jail.local 添加(以frp为例)
<syntaxhighlight lang="bash">
<pre>
[sshd]               
[frp]
enabled = true
enabled = true
findtime = 300
port = 14213
maxretry = 3
filter = sshd
bantime = -10d
logpath = /var/log/auth.log
filter = frps
maxretry = 5
logpath = /home/log/frps.log
bantime = 12h
protocol = all
</syntaxhighlight>
chain = all
 
port = all
=重启查看状态 =
action = iptables-allports[name=frp,protocol=tcp]
service fail2ban restart
        mail[name=frp, dest=w1073@qq.com]
 
</pre>
'''fail2ban-client status sshd'''
fail2ban-client reload 重载服务和 fail2ban-client status frp 确认服务状态
 
[[分类:Linux]]
= 日志 =
[[分类:命令行工具]]
/var/log/fail2ban.log