本文主要为即将进行CVE漏洞分析以及IDS规则编写的同事提供文档参考资料。文中所述过程均为本人安装使用过程,不能保证每一项配置均为最优配置,希望大家在使用过程中发现问题可以及时交流分享。
Suricata是安全开发人员中目前比较流行的一个网络入侵检测和防御引擎。
在目前CVE漏洞分析和IDS规则编写工作中,主要用于对编写的IDS规则进行可用性验证。文档主要内容为Suricata的环境配置、详细安装过程和使用方式的简介,在每一部分列出了可能遇到问题的解决方法。
1.Suricata的环境配置
1)Suricata的安装是在Linux系统中进行,首先在VMware中安装一个较为稳定的Linux系统,具体操作系统类型不限,建议使用较新版本的系统。因为太老版本的系统可能满足不了Suricata的运行环境要求,还需要再进行更新,比较麻烦。
2)在Debian、Ubunto或者Linux Mint系统中安装依赖包使用命令为:
sudo apt-get install wget build-essential libpcre3-dev libpcre3-dbg automake autoconf libtool libpcap-dev libnet1-dev libyaml-dev zlib1g-dev libcap-ng-dev libjansson-dev
3)在CentOS、Fedora或者RHEL系统中安装依赖包使用命令为:
sudo yum install wget libpcap-devel libnet-devel pcre-devel gcc-c++ automake autoconf libtool make libyaml-devel zlib-devel file-devel jansson-devel nss-devel epel-release lz4-devel rustc cargo libcap-ng-devel
4)在Mac OS X系统中安装依赖包使用命令为:
brew install pkg-config libmagic libyaml nss nspr jansson libnet lua pcre
5)所有依赖包安装完成后进行验证截图如下:
安装依赖包中可能遇到的问题:
a.安装中提示unable to locate package zliblg-dev,问题产生原因为依赖包中字母b和g中间为数字1而不是字母l,输入错误,将依赖包名改正后重新安装即可。
需要安装的依赖包太多,安装中手动一次性输入所有命令可能会存在输入错误等原
b.因导致的安装失败并且不容易找到具体安装到了哪里,建议手动输入命令时可以先安装第一个包wget,安装好后在命令后面再添加下一个包build-essential进行安装,依次类推,在安装下一个包同时顺便对前面的包进行校验。
2.Suricata的详细安装过程
1)从官网下载suricata压缩文件包,命令及运行结果截图如下(推荐下载新版6.0以后的版本):
wget http://www.openinfosecfoundation.org/download/suricata-4.0.4.tar.gz
2)对压缩包进行解压,命令及运行结果截图如下:
tar -xvf suricata-4.0.4.tar.gz
3)进入到suricata-4.0.4目录中:cd suricata-4.0.4,非Mac OS X系统中执行命令./configure –sysconfdir=/etc –localstatedir=/var,执行结果截图如下:
## 在Mac OS X系统中执行:
4)执行make命令,执行结果如下:
5)执行sudo make install,执行结果如下:
6)执行sudo make install-conf,执行结果如下:
7)非Mac OX X中执行sudo make install-rules,Mac中执行make install-full,执行结果如下:
3.Suricata使用方式简介
本文所叙述的Suricata使用方式为在本地进行pcap包校验,如果要在网络环境中进行抓包校验,还需进行配置,可以自行学习。
1)Suricata按照以上步骤安装完成后可以正常使用本地pcap包检测,其中Suricata配置文件为/etc/suricata/suricata.yaml。对自己编写的IDS规则进行验证时首先需要在配置中添加启用自己上传的IDS规则。
进入/etc/suricata目录,使用sudo vim suricata.yaml命令打开配置文件,在蓝字step2内容中添加自己使用的IDS规则名字,命令为 – test.rules(我的规则名字是test.rules),保存并退出。
2)需要把我们需要进行测试的pcap包上传到/etc/suricata中,这里使用Xshell6来实现。从官网上下载安装Xshell6,打开后点击文件->新建,需要输入的信息有名称(自己随意设置)和主机IP(在Linux虚拟机终端中输入ifconfig获取),然后点击连接。
Xshell6与虚拟机连接后进入/etc/suricata目录,切换到用户root,使用命令rz上传需要进行IDS规则测试的文件test.pcap包。
3)Suricata安装后的规则目录为/etc/suricata/rules。在验证时需要将测试规则test.rules放置在规则目录中。进入目录/etc/suricata/rules,使用命令vim test.rules命令创建test.rules并且写入自己编写的IDS规则,保存并退出。
4)cd ../返回上级目录/etc/suricata,输入命令suricata -k none -r test.pcap -vvv -c /etc/suricata.yaml -l /home/Desktop,suricata会对本地test.pcap包进行离线测试。测试结果如下:
在Xshell界面输出的详细告警信息:
在虚拟机Desktop目录会生成3个日志文件eve.json、fast.log、state.log。
在eve.json中输出的结果:
在fast.log中输出的告警信息:
suricata -k none -r test.pcap -vvv -c /etc/suricata.yaml -l /home/Desktop 命令中,-k none是跳过对pcap包的校验,如果不带有这个参数,有的pcap包在运行过程中会报出pcap包类型错误;-r参数是对本地pcap包进行离线检测;test.pcap为需要测试的数据包的地址;-c /etc/suricata.yaml 指定配置文件的位置;-vvv参数是让命令行显示出详细的告警信息,便于观察测试结果;-l /home/Desktop参数是检测日志的输出位置,在检测完成后,suricata会把生成的3个日志文件和告警输出到虚拟机Linux的桌面,可以从中查看告警日志。
一般在IDS规则测试完毕后,Xshell命令行界面的Alerts参数输出数据为1,并且在
eve.json中可以查询到对应IDS规则的sid编号,在fast.log中能够看到对应的1条告警信息则认为是IDS规则有效。
4.使用Suricata可能出现的问题
a.安装的Linux系统没有vim命令:
使用sudo apt-get install vim进行安装即可。
b.使用Xshell连接虚拟机时失败:
问题原因是虚拟机Linux中没有安装并开启ssh服务,在终端中使用sudo apt-get install ssh安装,安装完成后需要重启虚拟机再进行连接。
c. Xshell中找不到rz命令,问题原因是没有安装rz和sz,使用sudo apt-get install lrzsz进行安装。
d.使用命令过程中报出权限不足错误:
问题产生原因是没有切换到root用户或者是命令前没有加sudo,普通用户权限不足,切换到root或者加sudo可以解决。
e.vim /etc/suricata/suricata.yaml
将 fast 下 enabled: yes 改成 enabled: no
yes 会生成fast.log 日志,no为关闭这个文件
5.写在最后
本文为几年前的库存,编译安装是为了加深你对suricata的理解,也可以选择用yum install 安装。
今天的文章suricata pcap_informatica安装教程[通俗易懂]分享到此就结束了,感谢您的阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/86901.html
![suricata pcap_informatica安装教程[通俗易懂]插图 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/a62b1f7340844dfaad5b811f2069a359.png)
![suricata pcap_informatica安装教程[通俗易懂]插图1 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/ddb8cee272344c919714885eb29c4cd8.png)
![suricata pcap_informatica安装教程[通俗易懂]插图2 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/1a4f027c4fb041cabc727a1bce64c651.png)
![suricata pcap_informatica安装教程[通俗易懂]插图3 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/9805f872c95d4d6eb2d2b5942347c42a.png)
![suricata pcap_informatica安装教程[通俗易懂]插图4 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/c384080c77ff47af9aa9e697e7de91e1.png)
![suricata pcap_informatica安装教程[通俗易懂]插图5 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/dee1858e9c19487791b340fbcb2b3b8e.png)
![suricata pcap_informatica安装教程[通俗易懂]插图6 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/94de17f30b25401187bb936829e6879d.png)
![suricata pcap_informatica安装教程[通俗易懂]插图7 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/3c7dbf986a7546aa8ab81c3be635cabb.png)
![suricata pcap_informatica安装教程[通俗易懂]插图8 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/173fb6a88df349f3993ed77215c1f778.png)
![suricata pcap_informatica安装教程[通俗易懂]插图9 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/0e94721b19114b7bb26d975129998696.png)
![suricata pcap_informatica安装教程[通俗易懂]插图10 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/79d3ef60004d459a9f36879008b6a9b2.png)
![suricata pcap_informatica安装教程[通俗易懂]插图11 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/24d2fbde3bb84c429787cab251b26fd5.png)
![suricata pcap_informatica安装教程[通俗易懂]插图12 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/27d81a9412be413da2f15af6b9e93ebb.png)
![suricata pcap_informatica安装教程[通俗易懂]插图13 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/5ec751e5fcd14d729f43032d1b6c3070.png)
![suricata pcap_informatica安装教程[通俗易懂]插图14 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/785d780434ee408291a047e29bf896a9.png)
![suricata pcap_informatica安装教程[通俗易懂]插图15 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/22c28a0f523a49f1a5caac97577da63b.png)
![suricata pcap_informatica安装教程[通俗易懂]插图16 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/800cb16c93bd40a0bcb4f20876c2712c.png)
![suricata pcap_informatica安装教程[通俗易懂]插图17 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/615be0a15c4a4363ba5b58b37399aa2a.png)
![suricata pcap_informatica安装教程[通俗易懂]插图18 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/e0fe70b337f84e29a061aac7d1426560.png)
![suricata pcap_informatica安装教程[通俗易懂]插图19 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/f91ff50ba008440e9cae34dd1980ddd1.png)
![suricata pcap_informatica安装教程[通俗易懂]插图20 suricata pcap_informatica安装教程[通俗易懂]](https://img.bianchenghao.cn/app/bianchenghao_cn/ca5867c334274f9a9310ef934cd74d8c.png)