1、Syscheck
Integrity checking is an essential part of intrusion detection.
执行周期 periodically: scans the system every few hours(by default 22h for ubuntu and 20h for windows).
数据存放位置 database stored: on the maneger in /var/ossec/queue/syscheck.
三次改变则以后忽略 By default when a file has changed 3 times futher changes are automaticallyignored.
配置选项:祥见原文http://www.ossec.net/doc/manual/syscheck/index.html#configuration-options
2、Rootcheck
执行周期:by default every 2 hours.
检测内容:
a. Read the rootkit_files.txt which contains a database of rootkits and files commonly used by them.
b. Reat the rootkit_trojans.txt which contains a database of signatures of files trojaned by rootkits.
c. Scan the /dev directory looking for anomalies.
d. Scan the whole filesystem looking for unusual files and permission problems.
e. Look for the presence of hidden processes.
f. Look for the presence of hidden ports.
g. Scan all interfaces on the system and look for the ones with "promisc" mode enabled.
配置选项:见原文http://www.ossec.net/doc/manual/rootcheck/index.html#configuration-options
3、Agent
Agent可以在终端配置,也可以在服务器端集中配置。http://www.ossec.net/doc/manual/agent/agent-configuration.html
Agentless:在没有装agent的设备或系统上,也可以进行integrity checking:http://www.ossec.net/doc/manual/agent/agentless-monitoring.html#agentless-monitoring
4、Log monitoring/analysis
It is done in real time.
It is done inside OSSEC by the logcollector and analysisd processes.
配置选项:详见原文:http://www.ossec.net/doc/manual/monitoring/index.html#configuration-options。
OSSEC不仅能监测文件名固定的log文件,也可以监测文件名随时间变化的log文件。比如/var/log/apache2/access.log.2010-09-25, 可以设置为
<location>/var/log/apache2/access.log.%Y-%m-%d.
Ossec不仅能处理log文件,也检测进程和命令的输出,并对他们像log一样进行处理。
比如通过监听命令"df -f"的输出,并设置相应的rule(已设置),一旦有磁盘利用率达到100%就报警;
比如通过监听命令"netstat -tan | grep LISTEN | grep -v 127.0.01"的输出,并设置相应的rule,一旦有新的端口开放(即此命令的输出有改变)就报警。
甚至可以检测是否有U盘插入等等。
此方法很灵活啊!
http://www.ossec.net/doc/manual/monitoring/process-monitoring.html
5、Rules and Decoders
测试new rules and decoders的方法:使用工具/var/ossec/bin/ossec-logtest。http://www.ossec.net/doc/manual/rules-decoders/testing.html
CDB(Contet-based Data Base) list lookups from within Rules. http://www.ossec.net/doc/manual/rules-decoders/rule-lists.html
编写自己的decoder和rules:
ossec的decoder文件保存在/var/ossec/etc/decoder.xml中。自己要编写最好新建一个local_decoder.xml。(测试未通过,不知是在何处设置decoder文件)
ossec有自己的一套正则表达式regex解析法,所以regex越简单越好越不容易出错。
先编写好decoder,再在/var/ossec/bin/local_rules.xml中添加对应的rules。http://www.ossec.net/doc/manual/rules-decoders/create-custom.html
如果在ossec.conf中没有指定<decoders>,那么将默认加载etc/decoder.xml and etc/local_decoder.xml。
ossec.conf中不仅可以单文件的指定rules文件和decoder文件,也可以直接指定目录,例如:
<ossec_config>
<rules>
<decoder>etc/decoder.xml</decoder>
<decoder_dir>rules/plugins</decoder_dir>
<rule>rules/rules/00_rules_config.xml</rule>
<rule_dir pattern=".xml$">rules/</rule_dir>
<rule_dir>rules/plugins</rule_dir>
</rules>
</ossec_config>
可以通过syslog将alart发送给一个或多个syslog servers。http://www.ossec.net/doc/manual/output/syslog-output.html
<syslog_output>
<server>192.168.4.1</server>
</syslog_output>
<syslog_output>
<level>10</level>
<server>10.1.1.1</server>
</syslog_output>
也可以将alert发个一个或多个E-Mail邮箱。
<global>
<email_notification>yes</email_notification>
<email_to>me@example.com</email_to>
<smtp_server>mx.example.com..</smtp_server>
<email_from>ossec@example.com</email_from>
</global>
<alerts>
<email_alert_level>10</email_alert_level>
</alerts>
也可以输出到数据库和prelude。
可以设置一些脚本命令来主动响应一些alert。http://www.ossec.net/doc/manual/ar/index.html