为失败的根ssh压缩OSSEC电子邮件

我在Ubuntu 12.10服务器上将OSSEC作为HIDS运行,并且每天(3-4x)每天向我发送如下通知:(请注意IP地址的最后八位字节已被更改为“xxx”以保护有罪)

OSSEC HIDS Notification. 2013 Nov 21 15:10:43 Received From: localhost->/var/log/auth.log Rule: 2502 fired (level 10) -> "User missed the password more than one time" Portion of the log(s): Nov 21 15:10:41 localhost sshd[3594]: PAM 5 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=61.147.74.xxx user=root --END OF NOTIFICATION 

我是服务器上的唯一(合法)用户,并且我的/etc/ssh/sshd_config PermitRootLogin no设置PermitRootLogin no 。 所以,每次给我发送一个提醒都会导致一个人无法通过SSHlogin。

我发现OSSEC规则2502在/var/ossec/rules/syslog_rules.xml定义为:

  <rule id="2502" level="10"> <match>more authentication failures;|REPEATED login failures</match> <description>User missed the password more than one time</description> <group>authentication_failed,</group> </rule> 

我宁愿不要完全禁用此规则,因为知道是否有尝试login失败我的用户名是非常有帮助的。 当用户名为root时,我只需要它不要给我发电子邮件。

将以下内容添加到“/ var / ossec / rules / local_rules.xml”中。

 <rule id="100001" level="10"> <if_sid>2502</if_sid> <description>Suppress email from failed login attempts</description> <options>no_email_alert</options> </rule> 

这样,警报( <options>no_email_alert</options> )中就不会发送电子邮件,但它仍会在级别10上标记并触发适当的主动响应。