运行fail2ban而不禁止

在某种“模拟模式”下运行fail2ban是可能的,所以它不禁止,但是在什么地方禁止login呢?

在Ubuntu 12.04上运行fail2ban。

如果你看看jail.conf,你会看到一行说:

 # Default banning action (eg iptables, iptables-new, # iptables-multiport, shorewall, etc) It is used to define # action_* variables. Can be overriden globally or per # section within jail.local file banaction = iptables-multiport 

所有的动作都在/etc/action.d/

你可以做一个只是发送邮件..已经有相当多的行动,可以做你想做的。

具有讽刺意味的是, fail2ban没有一种方法来执行“干运行” or "no-ops" running of the actions defined within. Your only options are to temporarily change the为特定监狱定义or "no-ops" running of the actions defined within. Your only options are to temporarily change the banaction,通过覆盖给定的监狱或者自己重写操作。

在较新版本的fail2ban ,可以通过使用后缀.local而不是.conf来命名相同的文件来轻松创build覆盖。 您还可以访问actions.djail.d子目录,您可以在其中为特定的jail放置覆盖的configuration文件,以便您可以重新定义先前设置的variables(如banaction

所以说你的jail.confjail.local有这个在里面:

 [sshd] port = ssh logpath = %(sshd_log)s banaction = iptables-multiport 

你可以像这样覆盖这个监狱,通过在jail.d下创build一个新文件, jail.d包含以下内容:

 [sshd] port = ssh logpath = %(sshd_log)s banaction = iptables-multiport-debug 

然后你需要在action.d创build一个相应的文件,名为iptables-multiport-debug.conf 。 你也可以放弃做这个,只需重写action.d目录中的banaction文件本身。 只需将预先存在的iptables-multipart.conf文件复制到iptables-multipart.local

注意:在做第二个选项时要小心,因为你将会覆盖任何可能使用它的监狱。