时间:2021-07-01 10:21:17 帮助过:57人阅读
修改ossec.conf配置文件,加入以下内容:
< /syscheck >
修改ossec.conf配置文件,加入以下内容:
< /localfile >
修改ossec.conf配置文件
比如某种后门会在/tmp目录下生成mcrootkit文件,在/var/ossec/etc/shared/rootkit_files.txt文件中添加如下内容:
tmp/mcrootkit ! Bash door ::/rootkits/bashdoor.php
邮件通知信息
OSSEC HIDS Notification. 2015 Jul 07 18:19:14 Received From: (web-10-10-51-51) 10.10.51.51->rootcheckRule: 510 fired (level 7) -> "Host-based anomaly detection event (rootcheck)."
Portion of the log(s):Rootkit 'Bash' detected by the presence of file '/tmp/secrootkit' .
--END OF NOTIFICATION
添加ddos_rules.xml文件到ossec.conf配置文件中
< /rules >
# cat /var/ossec/rules/ddos_rules.xml
< /rule >
< /rule >
说明:
60秒内同一IP访问php文件超过10次,触发脚本
匹配urle id 为31108的日志中URL包含任何php文件
关于rule id 31108 规则详细定义,请查看web_rules.xml文件。
< id >^2|^3< /id >
< /rule >
说明:rule id 31108是匹配web日志2x,3x访问代码。有效过滤了404,403等错误页面
在ossec.conf配置文件中,添加如下内容:
< command >
< /command >
< command >firewall-drop< /command > #自动响应命令名称,上面定义
< /active-response >
在日志中过滤字符串,比如日志中出现admin_backdoor,触发报警
添加test_rules.xml文件到ossec.conf配置文件中
< /rules >
#vi /var/ossec/rules/test_rules.xml
< /rule >
< /group >
# cat /var/ossec/etc/decoder.xml
< /decoder >
报警信息:
[root@ossec-server-10-10-51-50 /var/ossec]# ./bin/ossec-logtest
2015 /07/07 19:48:20 ossec-testrule: INFO: Reading local decoder file .
2015 /07/07 19:48:20 ossec-testrule: INFO: Started (pid: 16189).
ossec-testrule: Type one log per line.
admin_backdoor #输入字符串
**Phase 1: Completed pre-decoding.
full event: 'admin_backdoor'
hostname : 'ossec-server-10-10-51-50'
program_name: '(null)'
log: 'admin_backdoor'
**Phase 2: Completed decoding.
decoder: 'admin_backdoor'
**Phase 3: Completed filtering (rules).
Rule id : '7777' #匹配到rule id 8888
Level: '7'
Description: 'admin_backdoor access' #描述,上面定义好的
**Alert to be generated.