snort简单的报警规则

在官网下载规则包(需要注册登陆)

https://www.snort.org/downloads

我下载的是29151版本的

将snort安装目录的包用规则包进行替换

替换到snort-2.9.17文件夹内

练习一条规则

👉在rules/local.rules下进行规则配置。实现对内网的ICMP相关流量进行检测,并报警

编辑文件的时候都采用vim的方式 vim <文件路径>

以下操作都在snort的文件夹内完成。 cd /snort-2.9.17

把下面的内容添加到local.rules里

vim rules/local.rules
alert icmp any any -> 172.16.68.139 any (msg:"ICMP";sid:41409)

测试规则,看是否有报错

小猪猪跑出来,成功运行

snort -c rules/local.rules -T

利用Snort检测ping攻击

在rules/icmp-info.rules文件中设置如下规则:

alert icmp any any -> 172.16.68.139 any (msg:"ICMP Large ICMP Packet";dsize:>800;reference:arachoids,246; sid:499;rev:4;)

tip:官方文档:This configuration file enables active response, to run snort in test mode -T you are required to supply an interface -i or test mode will fail to fully validate the configuration and exit with a FATAL error

检验规则是否报错:

snort -c rules/icmp-info.rules -T

开启检测模式

snort -i eth0 -c /snort-2.9.17/etc/snort.conf -A fast -l log/snort-detect/

⛔️报错:Invalid keyword ‘preprocessor’

官网下载的配置文件,默认把preprocessor reputation注释掉。找到这行。看配置文件,把preprocessor注释打开。

不设置黑白名单,可以把黑白名单注释掉。

❗️注意!!!!!!!!!逗号问题!!!!在每个配置的最后一行,不能有,\。 不然会出现类似这种的报错。莫名其妙的,天真的我之前还认真的去看了官网配置。。

再次运行监测模式

⛔️报错:ERROR: Perfmonitor: Cannot open base stats file “/var/snort/snort.stats”. Fatal Error, Quitting..

💚打开sonrt.conf这行注释掉 # preprocessor perfmonitor: time 300 file /var/snort/snort.stats pktcnt 10000

没有报错了!小猪猪跑出来,运行如德芙巧克力一般丝滑~尽享愉悦,纵享丝滑~

在另一台主机上ping snort所在主机,log下面会生成警报日志

kali 上开启snort入侵检测

snort -i eth0 -c /snort-2.9.17/etc/snort.conf -A fast -l log/snort-detect/

另一台主机去ping

生成了alert警告日志

日志内记录的内容

评论