Snort是一款轻量级的免费入侵检测系统,作为免费系统其功能性肯定不能与专业的入侵检测产品相比,但是作为受到用户广泛追捧的Snort必然有其优势所在。今天我们就以测试Snort的实例,简单接触一下Snort这款入侵检测系统。
测试Snort环境RH Enterprise AS3、4
一、安装Snort:
1)先安装pcre目录里的pcre-7.0.tar.gz
方法:
tar zxvf pcre-7.0.tar.gz
cd pcre-7.0
./configure
make
make install
2)安装snort-2.4.2.tar.gz
方法同上
3)解压Snort规则包snortrules-pr-2.4.tar.tar
方法tar zxvf snortrules-pr-2.4.tar.tar
4)安装Snort插件snortsam-src-2.50.tar.tar
方法同1)
以上安装好后执行:
mkdir /etc/snort
mkdir /var/log/snort
cp /chameleon/Snort/snort-2.4.2/etc/snort.conf /etc/snort
cp /chameleon/Snort/snort-2.4.2/etc/*.map /etc/snort
cp /chameleon/Snort/snort-2.4.2/etc/*.config /etc/snort
mkdir /chameleon/Snort/snort-2.4.2/rules/
cp /chameleon/Snort/snort-2.4.2/rules/*.rules /etc/snort
以上根绝个人安装目录不同可作适当修改
二、修改配置文件:
vi /etc/snort/snort.conf
修改其中规则路径:
var RULE_PATH /etc/snort
三、启动snort:
后台启动:
snort -c /etc/snort/snort.conf -D
我们可以用ps -aux|grep snort来看一下Snort是否成功启动了
启动成功
四、测试snort:
在运行Snort的主机上执行tail -f /var/log/snort/alert命令实时查看警告日志:
然后我在另一台机器上用hping2工具,也可以直接用ping命令来测试:
hping2 -x 运行snort主机的ip 或 ping 运行snort主机的ip
注意看了,他的日志在不断记录着,当我停止后他就没再记录了
这是会看到alert日志不听的告警,如下:
[**] [1:368:6] ICMP PING BSDtype [**]
[Classification: Misc activity] [Priority: 3]
03/06-10:28:39.272055 218.206.116.41 -> 192.168.1.7
ICMP TTL:55 TOS:0x0 ID:8 IpLen:20 DgmLen:84 DF
Type:8 Code:0 ID:32882 Seq:8 ECHO
[Xref => http://www.whitehats.com/info/IDS152]
[**] [1:366:7] ICMP PING *NIX [**]
[Classification: Misc activity] [Priority: 3]
03/06-10:28:39.272055 218.206.116.41 -> 192.168.1.7
ICMP TTL:55 TOS:0x0 ID:8 IpLen:20 DgmLen:84 DF
Type:8 Code:0 ID:32882 Seq:8 ECHO
[**] [1:384:5] ICMP PING [**]
[Classification: Misc activity] [Priority: 3]
03/06-10:28:39.272055 218.206.116.41 -> 192.168.1.7
ICMP TTL:55 TOS:0x0 ID:8 IpLen:20 DgmLen:84 DF
Type:8 Code:0 ID:32882 Seq:8 ECHO
[**] [1:368:6] ICMP PING BSDtype [**]
[Classification: Misc activity] [Priority: 3]
03/06-10:28:40.281751 218.206.116.41 -> 192.168.1.7
ICMP TTL:55 TOS:0x0 ID:9 IpLen:20 DgmLen:84 DF
Type:8 Code:0 ID:32882 Seq:9 ECHO
[Xref => http://www.whitehats.com/info/IDS152]
[**] [1:366:7] ICMP PING *NIX [**]
[Classification: Misc activity] [Priority: 3]
03/06-10:28:40.281751 218.206.116.41 -> 192.168.1.7
ICMP TTL:55 TOS:0x0 ID:9 IpLen:20 DgmLen:84 DF
Type:8 Code:0 ID:32882 Seq:9 ECHO
[**] [1:384:5] ICMP PING [**]
[Classification: Misc activity] [Priority: 3]
03/06-10:28:40.281751 218.206.116.41 -> 192.168.1.7
ICMP TTL:55 TOS:0x0 ID:9 IpLen:20 DgmLen:84 DF
Type:8 Code:0 ID:32882 Seq:9 ECHO
【编辑推荐】