我有一个运行Logwatch的CentOS 5.6系统。
如果我对这个主机执行安全扫描(Nessus),它会在Logwatch输出中产生不必要的噪音。 我想从内部IP和外部IP定期运行这些安全扫描,而不会对安全扫描产生不必要的噪音。
由于我知道这些主机的IP,我可以防止这个输出显示在Logwatch输出?
--------------------- pam_unix Begin ------------------------ sshd: Authentication Failures: root (scan1.example.org): 1 Time(s) unknown (scan1.example.org): 1 Time(s) Invalid Users: Unknown Account: 1 Time(s) --------------------- SSHD Begin ------------------------ Failed logins from: 192.168.100.1 (scan1.example.org): 1 time Illegal users from: XY123.123 (scan2.example.org): 1 time **Unmatched Entries** pam_succeed_if(sshd:auth): error retrieving information about user admin : 1 time(s) fatal: Write failed: Connection reset by peer : 1 time(s)
Logwatch提供*Remove共享脚本,告诉Logwatch忽略包含特定string(例如grep -v )的行,然后再处理。
/usr/share/logwatch/default.conf/services/sshd.conf复制到/etc/logwatch/conf/services/sshd.conf # Ignore these hosts *Remove = 192.168.100.1 *Remove = XY123.123 # Ignore these usernames *Remove = testuser
3.现在,没有为这些主机生成logging消息。
我不能用ignore.conf来做到这一点。 我不能拿出一个正则expression式,这将允许Logwatch打印有关来自邪恶领域的攻击的消息:
Failed logins from: 11.12.100.1 (EVILSCAN.example.ru): 1 time
隐藏友好扫描仪生成的消息:
Failed logins from: 192.168.100.1 (friendscan.example.org): 1 time
Logwatch方法做这件事logging很less,不好googleable。
/usr/share/logwatch/scripts/shared/remove将对string执行反转grep。 /usr/share/doc/logwatch-*/HOWTO-Customize-LogWatch文件如何执行这些脚本:
你可以有以下forms的命令:
* SharedScriptName =参数
它将执行在名为'SharedScriptName'的/ usr / share / logwatch / scripts / shared /目录中find的带有参数'Arguments'的脚本。该filter将修改对服务filter的input。
你可以把正则expression式忽略日志行到/etc/logwatch/conf/ignore.conf