记一次安装suricata的经历,因为之前安装过一次,所以这次很顺利,简要记录下操作流程,方便下次使用
首先,安装依赖;
其次,下载安装配置;
最后,验证。
官网安装指导
https://www.osgeo.cn/suricata/install.html
- 安装依赖(centos安装)
yum -y install gcc libpcap-devel pcre-devel libyaml-devel file-devel
yum -y install zlib-devel jansson-devel nss-devel libcap-ng-devel libnet-devel tar make
yum -y install libnetfilter_queue-devel lua-devel
- 下载安装配置
wget https://openinfosecfoundation.org/download/suricata-6.0.0.tar.gz
tar xzvf suricata-6.0.0.tar.gz
cd suricata-6.0.0
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-nfqueue --enable-lua
make
make install
这将把Suricata安装到 /usr/bin/ ,使用中的默认配置 /etc/suricata/ 并将输出到 /var/log/suricata
- 验证(找个码流,放到安装suricata的目录下,或者指定下路径)
suricata -r XXXX.pcap
如图所示,则安装成功
记录下安装过程中遇到的问题
第一次验证时,输入如下命令:
suricata -r x-online-host.pcap
报错:类似报错,解决办法如下(推荐解决2)
failed to open file: /usr/local/etc/suricata//suricata.yaml: No such file or directory
原因:
安装时,执行./configure,没有使用./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-nfqueue --enable-lua命令,导致相关文件没有安装在特定路径下
解决1:suricata.yaml默认去/usr/local/etc/suricata/路径下加载,指定到当前路径
suricata -c suricata.yaml -r x-online-host.pcap
解决2:把/etc下的文件复制到指定路径下
cp suricata.yaml /usr/local/etc/suricata
验证特定规则,根据自己的需求修改以下内容,具体规则,到规则文件修改
suricata.yaml
规则存放路径:default-rule-path: /usr/local/etc/suricata/rules
规则文件配置:rule-files:
- sqlinjection.rules