首页 > 其他分享 >Rhel7.8编译安装suricata

Rhel7.8编译安装suricata

时间:2023-04-17 13:44:39浏览次数:53  
标签:-- suricata 编译 install 6.0 Rhel7.8 root localhost

Rhel7.8编译安装suricata

1、安装依赖

yum install -y libpcap-devel libnet-devel pcre-devel gcc-c++ automake autoconf libtool make libyaml-devel zlib-devel file-devel jansson-devel nss-devel lua-devel 
yum install -y rustc cargo python3 git

 

2、下载suricata源码

下载链接:https://github.com/OISF/suricata/tags

 

3、安装suricata-6.0.0

1 [root@localhost 16:21 /<path>]# tar -zxvf suricata-6.0.0.tar.gz
2 [root@localhost 16:22 /<path>]# cd suricata-6.0.0/
3 [root@localhost 16:23 /<path>/suricata-suricata-6.0.0]# ./autogen.sh   # 原生没有configure,需要该脚本来生成configure
4 [root@localhost 16:24 /<path>/suricata-suricata-6.0.0]# ./configure --disable-gccmarch-native --localstatedir=/var --prefix=/usr/ --sysconfdir=/etc --enable-lua --enable-geoip
# --localstatedir 指定日志保存位置
# --prefix 指定安装位置
# --sysconfdir 指定配置文件保存位置


##### 如果报出一下错误,根据提示,在当前目录下执行git clone https://github.com/OISF/libhtp,并重新执行./autogen.sh
##########################################################################################
#ERROR: Libhtp is not bundled. Get libhtp by doing:
#	git clone https://github.com/OISF/libhtp
#Then re-run Suricata's autogen.sh and configure script.
#Or, if libhtp is installed in a different location,
#pass --enable-non-bundled-htp to Suricata's configure script.
#Add --with-libhtp-includes=<dir> and --with-libhtp-libraries=<dir> if
#libhtp is not installed in the include and library paths.
##########################################################################################
# 5、6用以解决LibHtp的报错
5 [root@localhost 16:27 /<path>/suricata-suricata-6.0.0]# git clone https://github.com/OISF/libhtp
6 [root@localhost 16:28 /<path>/suricata-suricata-6.0.0]# ./autogen.sh


# 再次执行configure
7 [root@localhost 16:29 /<path>/suricata-suricata-6.0.0]# ./configure --disable-gccmarch-native --localstatedir=/var --prefix=/usr/ --sysconfdir=/etc --enable-lua --enable-geoip


# 后续报错,缺什么依赖包,根据提示安装什么依赖包


###################### 如果抛出以下错误,根据提示安装cbindgen,并加到PATH中 ######################
##########################################################################################
#Warning: cbindgen too old or not found, it is required to 
#      generate header files.
#  To install: cargo install --force cbindgen
#configure: error: cbindgen required
##########################################################################################

8 [root@localhost 16:30 /<path>/suricata-suricata-6.0.0]# cargo install --force cbindgen   # 该步骤需要联网
9 [root@localhost 16:40 /<path>/suricata-suricata-6.0.0]# export PATH=/root/.cargo/bin:$PATH


# 再次执行configure

# 编译安装
11 [root@localhost 16:45 /<path>/suricata-suricata-6.0.0]# make -j 4 && make install


# 拷贝htp的库到lib中,直接cp或者 ln软链接都可以
12 [root@localhost 17:45 /<path>/suricata-suricata-6.0.0]# cp -d libhtp/htp/.libs/libhtp.so* /lib64/
########################### 如果不执行该步骤,在执行suricata命令时会报以下错误######################################
# [root@localhost ~]# suricata
# suricata: error while loading shared libraries: libhtp.so.2: cannot open shared object file: No such file or directory
############################################################################################################ 


# 生成conf目录、log目录等目录
13 [root@localhost 17:47 /<path>/suricata-suricata-6.0.0]# make install-conf
#install -d "/etc/suricata/"
#install -d "/var/log/suricata/files"
#install -d "/var/log/suricata/certs"
#install -d "/var/run/"
#install -m 770 -d "/var/run/suricata"

 

5、生成规则文件

  • suricata-6.0.0引擎程序和规则是分开来安装的,因此需要单独安装suricata-update程序进行规则的安装。由于该程序是python写的,因此linux环境最好支持python同时安装pip工具
  • 安装完suricata-update,直接运行该程序,则会到指定的网站下载rules,下载到/var/lib/suricata/rules/
yum -y install epel-release
yum -y install python3-pip   # 由于在安装依赖时已经安装python3,所以可以忽略此步
pip3 install --upgrade pip   # 升级pip

# 安装suricata-update
pip3 install --upgrade suricata-update
# 执行,下载规则文件,会自动下载到/var/lib/suricata/rules中,执行该步骤后,不需要再执行make install-rules
suricate-update


# 修改/etc/suricata/suricata.yaml文件,将default-rule-path修改为/var/lib/suricata/rules
# 一定要修改,因为默认使用/etc/suricata/rules作为规则目录


# 简单测试suricata
suricata -T

 

6、测试suricata

suricata -c /etc/suricata/suricata.yaml -i ens161

标签:--,suricata,编译,install,6.0,Rhel7.8,root,localhost
From: https://www.cnblogs.com/linagcheng/p/17325600.html

相关文章

  • eBPF动手实践系列一:解构内核源码eBPF样例编译过程
    作者:闻茂泉他山之石了解和掌握纯c语言的ebpf编译和使用,有助于我们加深对于eBPF技术原理的进一步掌握,也有助于开发符合自己业务需求的高性能的ebpf程序。目前常见和主流的纯c语言的ebpf编译使用方法,主要是两种。一种是内核源码中原生提供的编译方式。另外一种是libbpf-bootstrap项目......
  • golang语言下,在x86的linux平台上编译arm64二进制
    转载自:https://www.annhe.net/article-4542.html================== 编译etcd测试工具benchmark:CGO_ENABLED=0GOOS=linuxGOARCH=arm64gobuild.  概述有很多开源软件并没有提供arm安装包或者二进制,或者能通过包管理工具安装但是版本比较旧(比如Pandoc)。如果想......
  • DAPLink源码生成Keil工程并编译成功——笔记(实践篇)
    本文介绍使用DAP源码生产Keil工程的步骤。一、前期准备工作以下1~4为步骤:1.安装Python3(https://www.python.org/downloads/),并添加至路径PATH,此处忘截图了,总之看见pip、alluser、addtoPATH之类的就勾选。(网上也有些帖子说暂时不支持Python3要用Python2.7的,本人实测Pyt......
  • 2023.04.16 - TS编译之后的JS不具备校验功能
    TypeScript编译后的JavaScript文件并不具备类型检查的功能,因为JavaScript语言本身是动态类型、弱类型的,在运行时无法推断变量的类型,只能在编译时推断。而将TypeScript文件编译成JavaScript文件时,会把TypeScript中的类型声明和类型检查都去掉,只保留JavaScript代码,所以......
  • vs 2017编译bootst库
    1.下载boost源码,这里下载boost_1_69_0:boost_1_69_0.7z.2.解压后,已管理员身份打开VS2017的x86_x64兼容工具.例如我的路径是F:F://切换到F盘cdwork\C++\boost_1_69_0执行bootstrap.bat生成b2.exe执行b2.exe--toolset=msvc-14.1install--prefix="D:\Project\Boos......
  • 每天打卡一小时 第六天 编译四部曲
    书接上回求特殊方程的正整数解 第一部曲自然语言第一步建立for循环 第二步数学计算进行选择 第二部曲流程图   第三部曲伪代码(代码)#include<bits/stdc++.h>usingnamespacestd;boolcheck(autox){ if(x-(int)x==0) { return1; } else { return......
  • vue2源码-五、将模板编译解析成AST语法树2
    生成render函数前言上篇,生成ast语法树,而这篇使用ast语法树生成render函数。exportfunctioncompileToFunction(template){//1,将模板编译称为AST语法树letast=parserHTML(template);//2,使用AST生成render函数letcode=codegen(ast);}生成r......
  • 为何vs编译边出来的程序ebp-4存放的不是第一个局部变量?而是security_cookie——本质上
    快速识别 最后那个call就是比较存的随机数和ebp异或的值是否和之前是否一样:    探究security_cookie在程序中的作用 from:https://www.kn0sky.com/?p=66学习环境:Windows1020H2+VisualStudio2019前言在学习看反汇编程序的时候,使用VS2019编译的releas......
  • arm gcc undefined reference编译问题
    armgcc编译的时候,出现下面的错误。经检查,是因为添加了stdio.h,且调用了printf()函数,去掉了stdio.h和printf函数之后,编译通过。 ......
  • 从零编译 Qt 源码
    写在前头为了保证流程可复现,本文档展示的编译全过程在Windows10提供的沙盒中进行。Linux安装Qt想必都不会有什么问题,所以本文讲的其实是Windows上如何从零编译Qt源码。此处的Qt源码指的是Qt这个第三库本身,所以想找怎么编译自己写的Qt项目的可以到此为止了。......