suricata编译安装和运行

目录

编译安装

运行

调试


编译安装

apt -y install autoconf automake build-essential cargo \
     libjansson-dev libpcap-dev libpcre2-dev libtool \
    libyaml-dev make pkg-config rustc zlib1g-dev
    
apt-get install libpcre3-dev

wget https://www.openinfosecfoundation.org/download/suricata-7.0.0.tar.gz
tar xzvf suricata-7.0.0.tar.gz
cd suricata-7.0.0/

./configure --enable-nfqueue --prefix=/usr --sysconfdir=/etc --localstatedir=/var

make
make install-full

运行

1、编辑/etc/suricata/suricata.yaml

修改如下:

第一个箭头处为抓包网卡名称

第二箭头处添加一行

2、

cd /var/lib/suricata/rules

新增自定义规则,创建test.rules,内容为

alert tcp any any -> any any (msg: "Http rule test!";  flow:to_server,established; http.uri; content:"suricata"; sid:3030303; rev:1;)

http报文中uri包含suricata字段,就会匹配中该规则
编辑/etc/suricata/suricata.yaml新增一行

3、

运行suricata,使用af-packet抓包

/usr/bin/suricata -c /etc/suricata/suricata.yaml --af-packet

回放http pcap文件uri中包含suricata字段即可

tcpreplay -i ens160 -M 50  test.pcap

tail -f fast.log,查看日志如下

08/19/2024-05:50:30.126731  [**] [1:3030303:1] Http rule test! [**] [Classification: (null)] [Priority: 3] {TCP} 192.168.1.4:62622 -> 192.168.1.5:8080

3030303就是自定义的规则id

调试

1、开启debug模式

执行configure时需要加上--enable-debug

 ./configure --enable-debug  --enable-nfqueue --prefix=/usr --sysconfdir=/etc --localstatedir=/var

编辑/etc/suricata/suricata.yaml,default-log-level改成debug

执行: /usr/bin/suricata -c /etc/suricata/suricata.yaml --af-packet,会输出很多debug日志

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值