我从源代码安装了 snort-2.9.7,并作为 IDS 启动:
% snort -devQ -A console -c /etc/snort/snort.conf -i eth0:eth1
Enabling inline operation
Running in IDS mode
...
配置文件非常简单:
#
var RULE_PATH rules
# Set up the external network addresses. Leave as "any" in most situations
ipvar EXTERNAL_NET any
# Setup the network addresses you are protecting
ipvar HOME_NET [10.10.10.0/24]
config daq: afpacket
config daq_mode: inline
config policy_mode:inline
include $RULE_PATH/icmp.rules
为了测试目的,icmp.rules 中的规则也很简单:
block icmp 10.10.10.2 any <> 10.10.10.1 any (msg:"Blocking ICMP Packet from 10.10.10.2"; sid:1000001; rev:1;)
在运行 Snort 的主机上,接口 eth0 的地址为 10.10.10.1,但是当我从另一台主机发送 ping 10.10.10.1 时,icmp 数据包不会被 Snort 丢弃,并且会生成 icmp 回复:
WARNING: No preprocessors configured for policy 0.
02/27-15:04:40.623763 [Drop] [**] [1:1000001:1] Blocking ICMP Packet from 10.10.10.2 [**] [Priority: 0] {ICMP} 10.10.10.2 -> 10.10.10.1
警告是什么意思?我做错了什么吗?