手动打造Snort+barnyard2+BASE可视化报警平台

资讯 2024-07-13 阅读:71 评论:0
Snort:轻量级的开源IDS系统。Snort: Lightweight open source IDS system. Acid(Analysis Console for Intrusion Databases) ***数据库...
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
  • Snort:轻量级的开源IDS系统。

    Snort: Lightweight open source IDS system.

  • Acid(Analysis Console for Intrusion Databases) ***数据库分析控制台,它是一个基于PHP的分析引擎,可以搜索和处理snort具所生成的安全事件数据库。

    Acid (Analysis Console for Intrusion Databases)*** Database Analysis Console, a PHP-based analytical engine that can search and process the security incident database generated by snort devices.

  • BASE(Basic Analysis and Security Engine)直译为基本安全分析引擎,它用来查看Snort IDS告警的Web应用程序,是Acid的升级版。

    BASE (Basic Analysis and Security Engineering) is translated directly into the Basic Safety Analysis Engine, which is used to view the Web application of Snort IDS alerts and is an upgraded version of Acid.

  • Barnyard2 用来将Snort发出的告警事件存入数据库。

    Barneyard2 was used to place alarms sent by Snort in the database.

大家在安装基于Snort NIDS系统, 感觉很难,总是出错,其他安装Snort并不难,难的是准备工作做得不充分,如配置不当,当设置Snort的可视化报警时会遇到各种问题,例如:

It's hard, it's always wrong, it's not hard to install Snort, it's not hard to install other Snort, it's not hard to prepare, if not properly configured, when setting Snort's visual alarm, for example:

  • 为什么Snort编译总报错?
  • 为什么启动Snort后会立刻退出?
  • 为什么新添加的snort规则,不能展现在BASE控制台?
  • Snort不报警怎么办?
  • MySQL数据库里无法存储Snort报警怎么办?
  • 浏览器打开ACID,里面一片空白怎么办? 看着别人安装成功了,我却怎么也装不上?真是折磨人呐!下面我们看看应对这些问题的方法。

手动编译安装Snort时所需的准备工作如下所示。 步骤 1.准备软件环境。在安装前,必须在交换机上设置SPAN。中高端Cisco交换机都有SPAN功能。SPAN须为一个专用端口。以下是在虚拟机环境下的实验,须把网卡设置为混杂模式。 步骤2.安装最新版VMware Workstations虚拟机,并准备远程连接 工具。 步骤3.到异步社区的本书页面中统一获取安装资源。 步骤4.使用镜像CentOS-6.8-x86_64-mini在虚拟机中安装操作系统。 步骤5.重启系统后设置系统IP、网关及DNS,更新系统。 默认安装时,网络IP是自动获取的,需要改成静态IP地址。 #ifconfig -a //查看网卡配置信息 #vi /etc/sysconfig/network-scripts/ifcfg-eth0 //编辑网卡配置文件 DEVICE="eth0" BOOTPROTO="dhcp" HWADDR="00:0C:29:BA:53:4E" IPV6INIT="yes" NM_CO***OLLED="yes" //由于敏感词被限制此出为星号。 ONBOOT="yes" TYPE="Ethernet" UUID="685d0725-02ab-41b9-b9bf-6a52fc68c0f8"

SPAN must be a dedicated port. The following is an experiment in a virtual environment, where the web card must be set up as a hybrid mode. step 2. The latest version of VMware Works virtual, and the preparation of remote access tools. step 3. The installation of SPAN is required on the switchboard. step 2 . step 2 > installation of the VMqureWorks virtual machine and preparation of the remote connection tool. > > ; step 3 > ; > ;

修改为静态IP地址的方法是将BOOTPROTO="dhcp"中的"dhcp"改为"static",然后增加以下内容(根据内网环境配置IP): IPADDR=192.168.x.y NETMASK=255.255.255.0 GATEWAY=192.168.x.z DNS1=192.168.x.z DNS2=8.8.8.8 //DNS地址可以多个,要根据当地网络供应商进行添加

The method of changing to static IP address is to change BOOTPROTO=" dhcp" &quat; &quat; to &quat; static" and then to add the following (IP configuration based on the intranet environment): IPADDR=192.168.x.y NETMASK=255.255.255.0 GATEWAY=192.168.x.z DNS1=192.168.x.z DNS2=8.8.8./DNS addresses may be added depending on the local network provider.

最后保存退出,重启网络服务。

Finally saves the exit and restarts the network service.

更新系统 由于CentoS 6 已停止维护更新,我们先输入下面2条命令。 #sed -i "s|enabled=1|enabled=0|g" /etc/yum/pluginconf.d/fastestmirror.conf #curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo 无报错之后,我们继续升级。 #yum -y update //升级时间较长

Update System Since CentoS6 has stopped maintaining the update, we first enter the following two commands. #sed-i & Quot; senabled=1enabled=0g" /etc/yum/pluginconf.d/fastestmirror.conf #curl-o/etc/yum.repos.d/Centos-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo, after no error. #youm-yupdate//upgraded for a longer period.

步骤6.复制软件到指定目录。 将libdnet-1.12.tgz、daq-2.0.4.tar.gz、snort-2.9.7.0.tar.gz、snortrules-snapshot-2970.tar.gz这4个文件复制到CentOS 6.8系统/usr/local/src/目录下。 经过以上6个步骤之后,Snort安装的准备工作完成。另外,Snort安装配置路线图参见《开源安全运维平台OSSIM疑难解析:提高篇》一书中附录中的图1、图2。网络安装包名称及用途参见附录中的表1、表2、表3,这三张表以及按照路线图可以让初学者清晰的完成本文所介绍的各项试验。

Step 6. Copying software to the designated directory. Copying four documents to the Centos 6.8 system/usr/local/src/ directory. After the above six steps, the preparation for the installation of Snowt has been completed. In addition, Snowt installs the configuration road map for the open source security platform OSSIM's troubleshooting: figure 1 and figure 2 of the appendix to the book on upgrading. See tables 1, 2 and 3 of the appendix for the names and uses of the network installation packages and the three tables and the tests described in this paper, which can be clearly completed by early scholars in accordance with the road map.

准备工作完成之后,接着开始正式安装Snort。编译安装Snort需要如下10个步骤。 步骤1.安装基本环境和依赖包。 #yum install -y gcc gcc-c++ flex bison zlib-devel zlib-static libxml2 libpcap pcre-devel pcre-static libpcap-devel.x8664 tcpdump git libtool curl man make

After the preparatory work is completed, the formal installation of Snowt begins. The following 10 steps are required for the compilation and installation of Snowt. Step 1. Install basic environment and dependency packages. #youm install -y gcc gcc-c+freex bitson zlib-devel zlib-static libxml2 libpcap pcre-devel pcre-static libpcap-devel.x8664 tcpdump git libtool curl man make

注意,如果没有安装pcre,在预编译时就会出现以下问题,比如我们执行https://blog.51cto.com/chenguang/configure时,报错提示如下:

notes that, if pcre is not installed, the following problems will arise at the time of pre-enactment, for example, when we implement https://blog.51cto.com/chenguang/configure, with the following false indications:

步骤2.解压libdnet、DAQ及Snort安装包。 在服务器的安装配置过程中,大家很可能会到官网下载最新版本的源码包,但是那样就会遇到各种依赖包缺失的问题,导致无法安装成功。因为有些软件(比如Snort)要在DAQ(Data AcQuisition,数据采集器)library安装好之后才能继续安装,而只有先libdnet安装完成,才能继续安装DAQ,否则会报错找不到依赖文件,具体操作如下: #cd /usr/local/src #tar -zxvf libdnet-1.12.tgz #tar -zxvf daq-2.0.4.tar.gz #tar -zxvf snort-2.9.7.0.tar.gz

Step 2. Decomposition of libdnet, DAQ and Snowt packages. During the installation configuration of the server, it is likely that the latest version of the source package will be downloaded on the web, but there will be problems with the missing dependent packages, which will make it impossible to install them. Some software (e.g. Snowt) will have to be installed in DAQ (Data AcQuisity, data collector) only after the installation of the libdnet, but only if the installation is completed before the installation of the libdnet will continue to install DAQ, otherwise the dependency files will not be reported, as follows: #cd/usr/local/src#tar-zxvf libnet-1.12.tgz#tar-zxvf daq-2.4.tar.gz #tar-zxvfnort-2.9.0.0.tar.gz

下面必须依次安装libdnet、DAQ和Snort这3个包。 ● 安装libdnet-1.12.tgz。 #cd /usr/local/src/libdnet-1.12/ #https://blog.51cto.com/chenguang/configure #make && make install

Three packages of libdnet, DAQ and Snowt must be installed sequentially. #cd/usr/local/src/libdnet-1.12/https://blog.51cto.com/chenguang/configure#make & & make install

● 安装DAQ。 #cd daq-2.0.4 #https://blog.51cto.com/chenguang/configure

• Installation of DAQ. #cd daq 2.0.4 #https://blog.51cto.com/chenguang/configure

Build AFPacket DAQ module.. : yes Build Dump DAQ module...... : yes Build IPFW DAQ module...... : yes Build IPQ DAQ module....... : no Build NFQ DAQ module....... : no Build PCAP DAQ module...... : yes Build netmap DAQ module...... : no 编译环境检查完成之后,我们可以看到AFPacket DAQ module,Dump DAQ module,IPFW DAQ module,PCAP DAQ module的状态都是“yes”只有这样才能继续编译软件包。

Build AFPacket DAQ Module. : yes Build Dump DAQ Module: yes Build IPFW DAQ Module: yes Build IPQ DAQ Module: no Build NFQ DAQ Module. : no Build PAP DAQ Module: yes Build Build Netmap DAQ Module: no compile environment check, we can see AFPacket DAQ Module, Dump DAQ Module, IPFW DAQ Module, PCAP DAQ Module's state is only “yes” so that we can continue to compile the software package.

#make && make install

● 安装Snort 2.9(安装Snort前一定要正确安装libdnet和DAQ以及zlib)。 #cd /usr/local/src/snort-2.9.7.0 #https://blog.51cto.com/chenguang/configure --enable-sourcefire #make && make install 编译过程中没有报错信息即可进行安装。

• Installation of Snowt 2.9 (the correct installation of libdnet and DAQ and zlib must be performed before Snort is installed). #cd/usr/local/src/snort-2.9.7.0 #https://blog.51cto.com/chenguang/configure-enable-sourcefire#make & & make install compiles without false information.

步骤3.添加用户和组。 创建用户和组,并设置权限。在root身份下解包的文件权限都与root有关,所以要修改成Snort用户的属主和相关权限。 #groupadd -g 40000 snort //新添加一个Snort组 #useradd snort -u 40000 -d /var/log/snort -s /sbin/nologin -c SNORT_IDS -g snort //将Snort用户加入Snort组,新建目录/var/log/snort,并且不允许登录系统

Step 3 Adds users and groups. Creates users and groups, and sets permissions. The file permissions for unpackaging under root identity are all connected to root. Therefore, changes are made to Snort user ownership and associated privileges. #groupad-g4000Snort// Add a new Snort group #useradd snort-u 40000 -d/var/log/snort-s/sbin/nologin-cSNORT_IDS-g snort/ add Snort users to Snort group, create a new directory/var/log/snort and do not allow access to the system

步骤4.配置Snort。 ● 新建目录/etc/snort/。 #mkdir /etc/snort/

Step 4. Configure Snowt. New directory/etc/snort/. #mkdir/etc/snort/

● 将snortrules-snapshot-2970.tar.gz解压到/etc/snort/目录下。 #cd /etc/snort # tar –zxvf /usr/local/src/snortrules-snapshot-2970.tar.gz –C .(此步骤很关键,解压到当前目录) 完成此命令之后会在/etc/snort/目录下生成etc 、preproc_rules 、rules、so_rules共4个目录。 #cp /etc/snort/etc/sid-msg.map /etc/snort

• Depress snortrules-snapshot-2970.tar.gz under /etc/snort/ directory. #cd/etc/snort #tar ~zxvf/usr/local/src/snortrules-snapshot-2970.tar.gz -C. (This step is critical and depresses to the current directory) will generate /etc/snort/ catalogues with 4 directories. #cp/etc/snort/preproc_rules, so_rules. #etc/snort/etrc/sid-msg.map /etc/snort

● 将下载的Snort压缩包(snort-2.9.7.0.tar.gz),解压缩后复制到/etc/snort/目录下。 #cd /etc/snort/ #cp /usr/local/src/snort-2.9.7.0/etc/* .

• Downloads of Snowt compressed packages (snort-2.9.7.0.tar.gz) to/etc/snort/ directory. #cd/etc/snort/#cp/usr/local/src/snort-2.9.7.0/etc/*.

● 设置目录/etc/snort及其下所有文件的属主和属组。

• Set the owner and group of directories/etc/snort and all of its files.

#chown -R snort:snort *

● 新建黑白名单规则文件。 #touch /etc/snort/rules/white_list.rules /etc/snort/rules/black_list.rules

• New black and white list rules file. #touch/etc/snort/rules/white_list.rules/etc/snort/rules/black_list.rules

在/etc/snort/rules下新建white_list.rules和black_list.rules两个文件。 ● 编辑配置文件snort.conf,修改以下几行的内容。 #vi /etc/snort/snort.conf

New white_list.rules and black_list.rules under /etc/snort/rules. Edit profile snort.conf, modify the following lines. #vi/etc/snort/snort.conf

官方的snort.conf配置文件注解中包含9个步骤 ? 为了加深大家对这个文件的理解,下面我们会对几个重要概念和主要步骤进行讲解。

The official snort.conf profile annotation contains nine steps?  > in order to deepen our understanding of this document, we will next address several important concepts and key steps.</p>
<p>●	<strong>配置Snort.conf中的变量</strong>
在snort.conf配置文件中有很多变量和选择,这些变量作用于rules目录下的所有规则。作为初学者需要掌握最重要的两个分别是:</p><p>● The variables in <strung' configurationSnort.conf > have a number of variables and options in the snort.conf configuration file, which function as all the rules under the riles directory. The two most important are:</p>
<ul>
<li>$HOME_NET:你想监控的网络(用CIDR格式表示)。</li>
<li>$EXTERNAL_NET:连接外部,不受信任的网络。</li>
<li></li>
</ul>
<p>这两个变量的默认值都是“any”,简单理解就是“默认监控一切”。但是我们需要进行适当修改,下面我们来设置网络变量,首将第45行的ipvar HOME_NET any改为ipvar HOME_NET 192.168.x.x网段,并写成CIDR格式。也可以添加多个网段,本实验中监控网段为192.168.11.0/24,来看下面的例子。
ipvar HOME_NET  [192.168.11.0/24]           //如果不加限制,网段地址也可以改为"any"
将48行ipvar EXTERNAL_NET any     <strong>改为</strong>     ipvar EXTERNAL_NET  $HOME_NET</p><p>The default values for both variables are “any”. The simple understanding is “default monitoring of everything”. But we need to make appropriate changes. Next, we will set up the network variable, first by changing the ipvar HOME_NET any in line 45 to ipvar HOME_NET19168.x.x and writing it in the CIDR format. Several links can also be added, and the monitoring network in this experiment is 192.168.11.0/24, for example. ipvar HOME_NET (192.168.11.04] / If not restricted, the web segment address can also be changed to " any & quot; Replace 48 lines of ipvar EXTERNAL_NETany<strong> with </streng> EXTERNAL_NET $HOME_NET_NET</p>
<p>如果当前网段还有DNS、SMTP、HTTP、SQLServer、SSH服务,我们推荐用如下方法定义变量。</p><p>If the current segment also includes DNS, SMTP, HTTP, SQLServer, SSH services, we recommend the following method for defining variables.</p>
<p>ipvar DNS_SERVERS  $HOME_NET
ipvar SMTP_SERVERS $HOME_NET
ipvar HTTP_SERVERS $HOME_NET
ipvar SQL_SERVERS  $HOME_NET
ipvar SNMP_SERVERS $HOME_NET
ipvar SSH_SERVERS  $HOME_NET
...</p>
<p>注意: 对于修改$HOME_NET、$EXTERNAL_NET变量为非必须项,对于初学者而言,不修改沿用原默认值any也可以。</p><p>N.B. For the change of $HOME_NET, $EXTERNAL_NET variables as non-necessary, for beginners, it is also possible not to change the original default value any.</p>
<p>但下面的相对规则路径就必须改成绝对路径了,否则启动snort时会报错。</p><p>But the relative rule path below has to be changed to an absolute path, otherwise it will be wrong to start snort.</p>
<p>第104行 var RULE_PATH https://blog.51cto.com/ruls   <strong>改为</strong>   var RULE_PATH /etc/snort/rules
第105行 var SO_RULE_PATH  https://blog.51cto.com/so_rules <strong>改为</strong>var SO_RULE_PATH   /etc/snort/so_rules
第106行 var PREPROC_RULE_PATH https://blog.51cto.com/preproc_rules <strong>改为</strong> var PREPROC_RULE_PATH/etc/snort/ preproc_rules
第113行 var WHITE_LIST_PATH https://blog.51cto.com/rules  <strong>改为</strong>  var WHITE_LIST_PATH   /etc/snort/rules
第114行 var BLACK_LIST_PATH https://blog.51cto.com/rules    <strong>改为</strong> var BLACK_LIST_PATH   /etc/snort/rules</p><p>Line 104: var RULE_PATH https://blog.51cto.com/rules <strung> to </strung>var RULE_PATH/etc/snort/rules line 105; var SO_RULE_PATH https://blog.51cto.com/so_rules <strong> to </strongSO_RULE_PATH/etc/snort/sort_rules line 106 var PREPROC_RULE_PATH https://blog.51c.com/preproc_rules<strog<strong> varPREPROC_strOS_RUSE/Hr_Hruz/Snort_prest_Hr_HurTr_Tr_Bart_Tart_KIt_KIt_Tr_Kl_Kr_Kvt_Kr_Kl_Hr_Hr_Tr_Tr_Hr_Hr_Hr_Hr_Hr/Hr_Tr_Tr_Tr_Tr_Tr_Br_Br_</p>
<p>●	设置日志保存路径。
第186行  config logdir:/var/log/snort/</p><p>• Set the log save path. Line 186 config logdir: /var/log/snort/</p>
<p>●	配置输出插件。
Snort可通过数据库插件(spo_database.c和spo_database.h)将预处理器输出的日志写入数据库,但下面的配置一方面将报警写入alert文件,另一方面将预处理器输出的日志写入到unified2格式的二进制文件中,以供Barnyard2读取使用。
将第521行修改成如下内容:
<strong>output unified2:filename snort.log,limit 128</strong></p><p>• Configure output plugins. Snowt can write preprocessor output logs to the database through database plugins (spo_database.c and spo_database.h), but the following configurations write alarms to the aert file on the one hand, and preprocessor output logs to the binary file in unfiled2 format for Barneyard2 to read and use. Amend line 521 to read as follows: <strong>output</p>
<p>以上几处修改完成后,保存退出,对snort.conf配置文件的修改告一段落。</p><p>After these changes have been completed, save the exit and end the changes to the snort.conf configuration file.</p>
<p><strong>步骤5</strong>.新建目录snort_dynamicrules并设置属主和属组权限。
#mkdir -p /usr/local/lib/snort_dynamicrules
#chown -R snort:snort /usr/local/lib/snort_dynamicrules
#chmod -R 755 /usr/local/lib/snort_dynamicrules</p><p><strung> Step 5</strang>. New directory snort_dynamicrules and set main and sub-group privileges. #mkdir-p/usr/local/lib/snort_dynamicrules#chen-R snort:nort/usr/local/lib/snort_dynamicrules#chmod-R 755/usr/local/lib/snort_dynamilcrules</p>
<p><strong>步骤6</strong>.在/usr/sbin/目录下新建名为Snort的软链接文件。
#cd /usr/sbin
#ln -s /usr/local/bin/snort snort</p><p><strung> Step 6</strang>. New soft link file named Snowt under /usr/sbin/dir. #cd/usr/sbin#ln-s/usr/local/bin/nortnort</p>
<p><strong>步骤7</strong>.添加测试规则。
我们在安装Snort时已经复制了很多规则文件,但这些文件内的规则默认都被注销了,先不要管这些注销的规则,下面我们来写一条规则。</p><p><strung> Step 7 </strang>. Adds test rules. We have already copied a number of rule documents when we installed Snowt, but the rules contained in these documents have been written off by default, leaving aside the rules on write-off, and we will write a rule here.</p>
<p>#vi /etc/snort/rules/local.rules</p>
<p>加入如下内容:
alert icmp any any -> $HOME_NET any (msg:"ICMP Packet Detected";sid:1000003;rev:1;)
保存退出,我们就完成了第一条检测规则的编写。</p><p>Add the following: after any - > $HOME_NET any (msg: & quot; ICMP Packet Detected&quat; sid: 1000003; rev: 1; if we save the withdrawal, we have completed the preparation of the first test rule.</p>
<p><strong>步骤8</strong>.测试Snort。
#snort -T -i  eth0 -u snort -g snort -c /etc/snort/snort.conf</p><p><strong> Step 8 </strang>. Test Snowt.</p>
<p>注意:这里的参数“-T”表示测试完成之后即退出snort程序。</p><p>Note: The parameter

如果配置正确,则系统启动后显示如下内容。 pcap DAQ configured to passive. Acquiring network traffic from "eth0". Set gid to 113 Set uid to 109 --==Initialization Complete==-- ,,_ -> Snort! <- o" )~ Version 2.9.3.1 IPv6 GRE (Build 40) '''' By Martin Roesch & The Snort Team: http://www.snort.org/snort/snort-team Copyright (C) 1998-2012 Sourcefire, Inc., et al. Using libpcap version 1.1.1 Using PCRE version: 8.02 2010-03-19 Using ZLIB version: 1.2.3.4 Rules Engine: SF_SNORT_DETECTION_ENGINE Version 1.16 <Build 18> Preprocessor Object: SF_GTP (IPV6) Version 1.1 <Build 1> Preprocessor Object: SF_SIP (IPV6) Version 1.1 <Build 1> Preprocessor Object: SF_SMTP (IPV6) Version 1.1 <Build 9> Preprocessor Object: SF_IMAP (IPV6) Version 1.0 <Build 1> Preprocessor Object: SF_DNS (IPV6) Version 1.1 <Build 4> Preprocessor Object: SF_REPUTATION (IPV6) Version 1.1 <Build 1> Preprocessor Object: SF_DCERPC2 (IPV6) Version 1.0 <Build 3> Preprocessor Object: SF_MODBUS (IPV6) Version 1.1 <Build 1> Preprocessor Object: SF_SSH (IPV6) Version 1.1 <Build 3> Preprocessor Object: SF_SDF (IPV6) Version 1.1 <Build 1> Preprocessor Object: SF_POP (IPV6) Version 1.0 <Build 1> Preprocessor Object: SF_SSLPP (IPV6) Version 1.1 <Build 4> Preprocessor Object: SF_FTPTELNET (IPV6) Version 1.2 <Build 13> Preprocessor Object: SF_DNP3 (IPV6) Version 1.1 <Build 1> Snort successfully validated the configuration! ... ... 按下Ctrl+C组合键可以退出当前程序。 Snort exiting

The system, if configured correctly, shows the following: pcap DAQ configured to passive. Acquiring network truffic from & Quot; & Set gid to 113 Set uid to 109 --=Initiation Complet= --, _em>> Snort! & lt; & & & quot; O& quot;

如出现“Snort successfully validated the configuration!”的提示,则表示安装配置成功。

The installation configuration is successful if a hint of "Snort successfully authenticated the configuration!" appears.

步骤9.用ping命令测试。 用ping命令进行测试的目的是为了让snort产生报警。ping命令使用ICMP协议,在IDS中使用libpcap函数所捕获的也是ICMP数据包。下面在Snort主机上操作: #snort -i eth0 -c /etc/snort/snort.conf -A fast

Step 9. Test with ping command. The test with ping command is designed to cause alarm to snort. Ping command uses the ICMP protocol and uses the libpcap function to capture the ICMP data package in IDS. The following is operated on the Snowt mainframe: #snort-ieth0-c/etc/snort/snort.conf-Afast

Tips:以上命令中-A fast的含义如下。 -A fast含义:该参数报警信息包括以下内容:

Tips: The meaning of -A fast in the above command is as follows. -A fast meaning: This parameter alerts information to include the following:

  • timestamp时间戳
  • 报警消息
  • 源/目的IP地址
  • 端口

输入上面的命令之后,报警记录在/var/log/snort/alert和/var/log/snort/snort.log.timestamp(这是一个存储数据包的二进制文件,用tail命令无法读取)中。用下面的命令直观查看alert报警。 #cd /var/log/snort/ #tail -f /var/log/snort/alert //查看报警

After entering the above command, the alarm is recorded in /var/log/snort/alert and /var/log/snort/snort.log.timestamp (a binary file that stores the data package and cannot be read with the tail command). View the alarm with the following command. #cd/var/log/snort/#tail-f/var/log/snort/alert//see the alarm. #cd/var/log/snort/

实例: ? 可以看到这些都是文本文件。

Example: </p>
<p><em>alert文件收到报警,代表这一步实验成功,如果收不到报警,请大家返回到第一步重新检查。实验步骤环环相扣,每个关键节点必须成功,下面要将这些报警存储到数据库。</em></p><p>The <em>alert file received the alarm, representing the success of this step, and if you do not receive the alarm, please return to the first step of re-examination.</p>
<p>注意:在上面介绍的第6、7步骤中如果没有设置正确的路径,那么在启动Snort时,就会出现找不到动态规则的文件,发生致命错误导致程序异常退出。
</p><p>Note: If the correct path is not set in the 6th and 7th steps described above, then when Snort is activated, there will be a file where no dynamic rules can be found, and a fatal error will cause the program to exit abnormally.</p>
<p>加深理解:我们说理解/etc/snort/sid-msg.map这个文件的意义非常重要,实体signature表示的是报警信息列表规范化,即将报警事件信息按规则编号(sig_id)、规则描述(sig_name)、规则分类编号(sig_class_id)规则优先级(sig_priority)规则版本号(sig_rev),规则在snort中的内部编号(sig_sid;sig-gid)进行规范化存储。</p><p>Deepening understanding: We say that it is important to understand/etc/snort/sid-msg.map, that the entity signature indicates that the alert information list is regularized and that the alarm event information is stored as rule number (sig_id), rule description (sig_name), rule classification number (sig_clas_id) rule priority (sig_priority) version (sig_rev), rule internal number (sig_sid; sig-gid) in snort.</p>
<p>其中的sig_class_id和sig_prority的具体内容包含在classification.config文件中;而sid_sid和sid_gid将文件/etc/snort/gen-msg.map中的一个消息和该snort规则建立一个映射关系。</p><p>The specific content of the sig_clas_id and sig_prority is contained in the record.config document; and the sid_sid and sid_gid create a mapping relationship between a message in the document/etc/snort/gen-msg.map and the snort rule.</p>
<p><strong>对classification的解释</strong>:
文件Classification.config来自于snortrules-snapshot-2970.tar.gz压缩包。
此处单词classification本意是问题分类,用在这里表示记录***签名的分类,各***签名所属的分类在编写对应的Snort规则时通过制定classification属性值来指定。
clasification.config这个配置文件,同时被/etc/snort/snort.conf和/etc/snort/barnyard2.conf这两个关键配置文件所引用。</p><p><strung> Interpretation of transposition</strang>: Document Classification.config is from snortrules-snapshot-2970.tar.gz compression package. This word is intended to be a problem classification and is used here to refer to the classification of the signature*** by recording the classification *** of the signature *** which was assigned by the development of the corresponding snort rule. Classification.config is a configuration document cited in two key configuration documents: /etc/snort/snort.conf and /etc/snort/barnyard2.conf.</p>
<p>稍后我们在进行BASE调试实验过程中会发现classification的身影,如下图所示。
<img src= 做为基础用户我们需要了解 snort将1~1000000做为自己的保留的内部编号,而将大于1000000 编号供使用者自己使用。这是一种习惯,而非强制,所以我们自己编写规则时,需要在sid-msg.map添加自己的规则编号和消息。其中sig_reference、sig_class是对他其中sig_id和sig_class_id属性的扩展描述。

Later in the course of the BASE debugging experiment, we will find the image of classification, as shown in the figure below.  >.</p>

<p>将Snort报警存入MySQL数据库需要如下几个步骤。
<strong>步骤1</strong>.安装MySQL数据库及PHP扩展。
#yum install -y mysql-server mysql-devel php-mysql php-pear php-gd libtool php-imap php-ldap  php-odbc php-xml php-pecl-apc
#chkconfig --level 235 mysqld on  //将MySQL服务设置为在运行级别为2、3、5时都是开启状态
#/etc/init.d/mysqld start</p><p>The following steps are required to alert Snort to MySQL database. <strung> Step 1</strang>. Install MySQL database and PHP extension. #youm install-y mysql-server mysql-devel php-mysql php-pear php-gd libtool php-imap php-ldap php-odbc php-xml php-pecl-apc #chkconfig-level 235 mysqld on/set MySQL services at the operational level for 2, 3 and 5 times #etc/init.d/mysqld start #etc.d/mysqld</p>
<p><strong>步骤2</strong>.为数据库管理员root赋予密码(为调试方便暂设定纯数字密码)。
#/usr/bin/mysqladmin -u root password '123456'</p><p><strung> Step 2 </strang>. Give passwords to database administrator root (user/bin/mysqladmin-u root password '123456' for debugging convenience provisionally).</p>
<p>注意,root用户登录phpMyAdmin时,同样使用这个密码。
<strong>步骤3</strong>.创建Snort数据库并设定读取权限。</p><p>Note that this password is also used when root users log into phpMyAdmin. <strong>step 3</strong>. Creates the Snowt database and sets access.</p>
<p>#mysql -u root -p                 //连接MySQL
输入步骤2中设置的密码“123456”。</p><p>#mysql-u root-p // connection MySQL entered the password

mysql>CREATE DATABASE snort; //新建数据库

Mysql> CREATE DATABASE snort; // new database

mysql>USE snort;

mysql>CREATE USER 'snort'@'localhost' IDENTIFIED BY '123456';

在以上命令中,“123456”是MySQL中用户Snort的密码。 接着创建名为snort、密码为“123456”的数据库用户,并赋予名为“snort”的数据库权限 在进行下面的操作之前,先将barnyard2-1.9.tar.gz解压到/usr/local/src/

In the above command, “123456” is the password of Snowt, the user in MySQL. Then create a database user named snort, the password “123456” and give access to the database named “snort” before proceeding with the operation below, release barnyard2-1.9.tar.gz to/usr/local/src/

下面授权用户snort对数据库的操作权限 mysql>GRANT CREATE,SELECT,UPDATE,INSERT,DELETE ON snort.* TO snort@localhost IDENTIFIED BY '123456';

The following users are authorized to operate the database: mysql> GRANT CREATE, SELECT, UPDATE, INSERT, DELETE ON snort.* TO Snort@localhost IDENTIFED BY '123456';

mysql>SET PASSWORD FOR 'snort'@'localhost'=PASSWORD('123456'); //为用户snort设置访问密码

Mysql> SET PASSWORD FOR'snort'@'localhost'=PASSWORD('123456'); / set access passwords for the user snort

mysql>SOURCE /usr/local/src/barnyard2-1.9/schemas/create_mysql; //通过引入文件create_mysql来创建数据库结构,该命令不可重复输入,在后面的安装BASE步骤中还会在snort库中写入多个表。 该命令执行成功之后大家会看到下列提示信息: Query OK, 0 rows affected (0.01 sec) Query OK, 1 row affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.01 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.01 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 1 row affected (0.00 sec) Query OK, 1 row affected (0.00 sec) Query OK, 1 row affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 1 row affected (0.00 sec) Query OK, 1 row affected (0.00 sec)

Mysql> SOURCE/usr/local/src/barnyard2-1.9/schemas/mysql; / creating database structures by introducing create_mysql, which is not re-entryable, with tables to be included in the subsequent BASE installation steps in the snort library. Query ff ff ff ff ff ff ff ff ff ff ff, < < < < < < < < < < < < < < < >, < < < < < < >, < < < < < < < < <, < < < < <, < < < <, < < < <, < < < < >, < < < / < < < < < < < < < < < < < < < < < < < < < <...................

执行完create_mysql脚本后,用户可以通过在mysql提示符下,运行下面的SQL语句来验证配置的正确性。 mysql> SHOW TABLES; +------------------+ | Tables_in_snort | +------------------+ | data | | detail | | encoding | | event | | icmphdr | | iphdr | | opt | | reference | | reference_system | | schema | | sensor | | sig_class | | sig_reference | | signature | | tcphdr | | udphdr | +------------------+ 16 rows in set (0.00 sec)

After executing the create_mysql script, the user can verify the correctness of the configuration by running the following SQL statement under the Mysql hint. mysql> SHOW TABLES; +------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

mysql>FLUSH PRIVILEGES; //刷新数据库权限

Mysql>FLUSH PRIVILEGES; // refresh database privileges

mysql>exit

注意:在导入barnyard2-1.9中的mysql数据库表时所在路径使用绝对路径。

Note: An absolute path is used when importing the Mysql database table in barnyard2-1.9.

步骤4.安装和配置Barnyard2。 Barnyard2的作用是读取Snort产生的二进制事件文件(/var/log/snort/snort.log.XXXXXXXXXX)并存储到MySQL中。Snort的配置文件自身含有插件,它允许将Snort报警记录到MySQL中,但这样一来,系统数据会激增。当IDS系统检测到**行为时,它会用INSERT语句向数据库中写入数据,导致更新非常慢。所以如果直接将Snort输出到数据库,在数据量增大时这种方案的效率并不高,故使用外部代理将报警输出到Barnyard2。 ●源码包安装。 我们再次进入barnyard2-1.9/目录 #cd /usr/local/src/barnyard2-1.9/ #https://blog.51cto.com/chenguang/configure --with-mysql --with-mysql-libraries=/usr/lib64/mysql //此处配置参数很重要,切勿出错 注意:如果你选用其他Linux发行版,根据上面一行命令输入/usr/lib64/mysql,进行预编译时,有可能找不到.so的路径的提示,此时只要根据提示,采用find命令查到系统实际路径即可。举个例子,例如在Debian 9 Linux系统中: #find / -name "libmysqlclient." /usr/lib/libmysqlclient.so.18.0.0 /usr/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.a /usr/lib/libmysqlclient.so 我们发现mysql的.so文件路径为/usr/lib/。此时只要将上面一条命令修改: #https://blog.51cto.com/chenguang/configure --with-mysql --with-mysql-libraries=/usr/lib/
好了,下面我们继续。 #make //见到如下内容后,才可继续安装 只有确保上面关键两步不出错,才能继续安装。如果报错,需要根据提示查找错误原因,如忽略错误,继续往下做都是徒劳的。 #make install

Step 4. Installing and configuring Barnyard2. Barnyard2 functions as reading the binary event file produced by Snowt (/var/log/snort/snort.log.XXXX) and storing it in MySQL. The configuration document in Snowt contains plugins that allow the Snort to be recorded in MySQL, but then the system data will increase dramatically. When the IDS system detects **r.ffr. behaviour, it can be used to write data in the database (#nort_snort_snort_snort_sat_sn.

● 配置Barnyard2。 首先在/var/log/中创建目录Barnyard2和文件barnyard2.waldo。 #mkdir /var/log/barnyard2 #touch /var/log/snort/barnyard2.waldo

• Configure Barnnard2. First, create a directory of Barnnard2 and a file of Barnnard2.waldo in /var/log/. #mkdir/var/log/barnyard2 #touch/var/log/snort/barnyard2.waldo

● 设置文件barnyard2.waldo的属主和属组。 #chown snort:snort /var/log/snort/barnyard2.waldo

• Set the owner and sub-group of the barnyard2.waldo file. #chensnort:snort/var/log/snort/barnyard2.waldo

● 复制Barnyard2的配置文件。 与Snort配置类似,Barnyard的初始化配置也是通过复制已有的.conf配置文件来完成。因此先将Barnyard2的配置模板文件复制到/etc/snort目录下。 #cp /usr/local/src/barnyard2-1.9/etc/barnyard2.conf /etc/snort

• Copy the configuration file for Barnyard2. Similar to the Snowt configuration, Barnard's initial configuration is done by copying the existing.conf configuration file. Therefore, the configuration template file for Barnyard2 is copied under the /etc/snort directory. #cp/usr/local/src/barnyard2-1.9/etc/barnyard2.conf/etc/snort

● 修改配置文件barnyard2.conf。 #vi /etc/snort/barnyard2.conf

• Modify configuration file barnyard2.conf. #vi/etc/snort/barnyard2.conf

找到对应行并将其修改成如下内容: 第44行 config logdir:/var/log/barnyard2 //注意该目录属主和属组权限为snort.snort,如设置错误会导致实验失败。 第56行 config hostname: localhost 第57行 config interface: eth0 第131行 config waldo_file:/var/log/snort/barnyard2.waldo

Find the corresponding line and modify it to read as follows: Line 44 config logdir: /var/log/barnyard2/ / notes that the directory is owned and subject to group privileges as snort.snort and that an error in setting it will cause the experiment to fail. Line 56 config hostname: localhost 57 config interface: eth0 line 131 config waldo_file: /var/log/snort/barnyard2.waldo: /var/

下面这条语句用来设置数据库访问权限,其中定义了用户名为snort,密码为123456,数据库名称为snort,主机名为localhost。 第318行 output database: log,mysql,user=snort password=123456 dbname=snort host=localhost

The following statement is used to set up access rights to the database, which defines the user as snort, password 123456, database as snort, hostname as localhost. Line 318 output database: log,mysql,user=snort password=123456 dbname=snort host=localhost

编辑完成后保存退出。至此对barnyard2.conf文件的修改到此结束。 ● 修改目录的属主和属组。 #chown snort:snort /var/log/barnyard2

Saves exit after editing has been completed. This is the end of the changes to the barnyard2.conf file. * Changes the directory's owner and sub-group. #chensnort:snort/var/log/barnyard2

● 启动Snort和Barnyard2进行联合测试 #snort -q -u snort -g snort -c /etc/snort/snort.conf -i eth0 –D

• Launch of joint testing by Snowt and Barnard2 #snort-q-u snort-g snort-c/etc/snort/snort.conf-i eth0 ~D

执行完这条命令之后,不会看到大量输出,只会出现以下三行提示信息: Spawning daemon child... My daemon child 12903 lives... Daemon parent exiting (0) Snort程序安静的在后台运行(“-D”参数表示以后台进程运行)。

After this command has been executed, there will be no large output, but only three lines of information: My daemon child 12903 lives... Daemon parent operating (0) Snowt is running quietly in the backstage (the “-D” parameter indicates that the later stage is running).

● 测试Barnyard2。 下面执行的这条命令用于测试Barnyard2程序是否能正常执行。 #barnyard2 -c /etc/snort/barnyard2.conf -d /var/log/snort/ -f snort.log -w /var/log/snort/barnyard2.waldo -g snort -u snort -T 该命令产生输出信息如下: Running in Test mode

• Tests for Barnnard2. The following command is used to test whether the Barnnard 2 program can be carried out properly. #barnyard2 - c/etc/snort/barnyard2.conf -d/var/log/snort/ -f snort.log -w/var/log/snort/barnyard2.waldo -g snort -u snort -T generated the following output information: Running in Test mode


Initializing Input Plugins! Initializing Output Plugins! Parsing config file "/etc/snort/barnyard2.conf" database: compiled support for (mysql) database: configured to use mysql database: schema version=107 database: host=localhost database: user=snort database: database name=snort database: sensor name=localhost:NULL database: sensor id=1 database: sensor cid=1 database: data encoding=hex database: detail level=full database: ignore_bpf=no database: using the "log" facility


______ -> Barnyard2 <- / ,,_ \ Version 2.1.9 (Build 263) |o" )~| By the SecurixLive.com Team: http://www.securixlive.com/about.php

  • '''' + (C) Copyright 2008-2010 SecurixLive.

    
    

Barnyard2 successfully loaded configuration file! Snort exiting database: Closing connection to database "snort"

如果大家的机器也出现上述信息,说明程序可以正常运行,此时我们才能继续下面的操作。

If you have the same information on your machine, which means that the program can function properly, then we can continue the operation below.

同样ping主机,开始正式启动barnyard2程序,继续执行以下命令。 #barnyard2 -c /etc/snort/barnyard2.conf -d /var/log/snort/ -f snort.log –w /var/log/snort/barnyard2.waldo 命令参数的解释如下所示。 ● -c:该选项指定Barnyard配置文件的路径。该参数为必选项。

Similarly, the ping mainframe started the formal launch of the barnyard2 program and continued the following orders. #barnyard2 -c/etc/snort/barnyard2.conf -d/var/log/snort/ -f snort.log –w/var/log/snort/barnyard2.waldo 大家可以看到报警文件格式都是snort.log.时间戳。而为什么格式必须是snort.log.XXXXXXX呢?我们在配置snort.conf的第五步曾经配置过一行语句: output unified2:filename snort.log,limit 128 这里定义了输出报警文件的格式,假如你想把snort.log.XXXXX,改成unified2.alert.XXXXX,请按照下面语句修改: output unified2:filename unified2.alert,limit 128 与此同时 -f参数后面就要跟 unified2.alert,而不是snort.log啦,这里要注意一一对应的关系。

*-f: This option designates the Unified filename of Barniard when running in a continuous manner. Snowt has a UNIX time stamp after each generated Snort Unified file, removing the time stamp from the file name. The results of the execution under the above command will be generated under the /var/log/snort/ directory as follows: 如果在count(*)下方没有数字,则表示报警信息没有存入数据库,那么需要从头检查配置过程。 下面的命令非常重要,再次强调Barnyard2完整启动命令: [root@localhost ~]# barnyard2 -c /etc/snort/barnyard2.conf -d /var/log/snort/ -f snort.log -w /var/log/snort/barnyard2.waldo -g snort -u snort Running in Continuous mode --==Initializing Barnyard2==-- Initializing Input Plugins! Initializing Output Plugins! Parsing config file "/etc/snort/barnyard2.conf" //配置文件路径 Log directory=/var/log/barnyard2 //日志存储路径 database: compiled support for (mysql) database: configured to use mysql database: schema version=107 database: host=localhost database: user=snort //启动程序用户为snort database: database name=snort database: sensor name=localhost:eth0 //Snort传感器在eth0网卡 database: sensor id=1 database: sensor cid=1 database: data encoding=hex database: detail level=full database: ignore_bpf=no database: using the "log" facility

The operational effects are shown below.


______ -> Barnyard2 <- / ,,_ \ Version 2.1.9 (Build 263) |o" )~| By the SecurixLive.com Team: http://www.securixlive.com/about.php

  • '''' + (C) Copyright 2008-2010 SecurixLive.

    
    

WARNING: Ignoring corrupt/truncated waldofile '/var/log/snort/barnyard2.waldo' Waiting for new spool file

注意:程序在启动过程中会弹出很多信息,当出现“Waiting for new spool file”字样表示该命令启动成功,如没有,则从该环节的步骤1开始检查。

N.B. A lot of information will be ejected during the start-up process, and when the words “Waiting for new spool file” appear to indicate that the order has been activated successfully or, if not, it will be checked from step 1 of the chain.

如果在一个简单的模拟环境下实验,该步骤可忽略。

This step can be ignored if tested in a simple simulation environment.

假设场景,我只希望某一个IP能访问Snort服务器上的22、80端口,我们在Snort主机上做如下设置。

Assuming a scenario, I would only like an IP to access the 22-80 ports on the Snowt server, and we'll set up the following settings on the Snowt mainframe.

禁止所有的IP访问Snort服务器的22、80端口。 iptables -I INPUT -p tcp --dport 80 -j DROP iptables -I INPUT -p tcp --dport 22 -j DROP

Disable all IP access to 22-80 ports on the Snowt server. iptables-I INPUT-p tcp-dport 80-j DROP iptables-I INPUT-p tcp-dport 22-j DROP

允许IP地址为192.168.11.2,访问Snort服务器的80、22端口。 iptables -I INPUT -s 192.168.11.2 -ptcp --dport 80 -j ACCEPT iptables -I INPUT -s 192.168.11.2 -ptcp --dport 22 -j ACCEPT

The IP address is 192.168.11.2, allowing access to 80, 22 ports on the Snowt server. iptables-I INPUT-s 192.1681.2 -ptcp-dport 80 -j ACCEPT i INPUT-s192168.11.2 -ptcp-dport 22 -j ACCEPT

保存iptables规则 service iptables save

Save iptables rules service iptables save

重启防火墙 #service iptables restart

Reboot firewalls #service ittablesrestart

如果以上3部分中所有环节均正常,说明已经安装了Snort系统并将报警信息存入数据库。接下来开始安装BASE(Basic Analysis and Security Engine,基于ACID构建)的步骤,Barnyard将MySQL中的Snort报警信息通过Web展示的具体原理如图1所示。 图1 Barnyard存储原理 要将存储在数据库中的日志展现在Web端,需要安装BASE(***检测事件展示的前端程序),这里用到的版本是base-1.4.5.tar.gz。既然用到了Web服务,那么首先需要安装好LAMP环境,然后再安装BASE包。此处服务器IP地址为192.168.1.120。具体安装步骤如下。

If all the components in part 3 above are normal, it is stated that the Snort system has been installed and the alarm information has been placed in the database. Next, steps to install BASE (Basic Analysis and Security Engineering, built on ACID), start installation of BASE.

步骤1.安装httpd、mysql-server、mysql-devel、php、php-mysql。 命令如下所示。 #yum install –y httpd mysql-server php php-mysql mysql-devel php-gd

Step 1. Install httpd,mysql-server,mysql-devel,php,php-mysql.

步骤2.安装PHP插件(mcrypt、libmcrypt、libmcrypt-devel),命令如下所示。 #yum install –y mcrypt libmcrypt libmcrypt-devel php-pear

Step 2 . Installing PHP plugins (mcrypt, libmcrypt-devel), as follows.

更新插件的时间比较长,操作如下所示。 #pear upgrade PEAR ?

#pear upgrade PEAR? ></p>
<p><strong>步骤3</strong>.继续执行下列命令。
#pear channel-update pear.php.net
?<img src=

Step 3 continues to implement the following orders. #pearchannel-update paper.php.net?

安装 Image_Graph-alpha、Image_Canvas-alpha、Image_Color、Numbers_Roman 这 4个包。 操作如下所示。 #pear channel-update pear.php.net #pear install Image_Graph-alpha Image_Canvas-alpha Image_Color Numbers_Roman

Installs Image_Graph-alpha, Image_Canvas-alpha, Image_Color, Numbers_Roman. The operation is described below. #pearImage_Graph-alpha Image_Canvas-alpha Image_Color Numbers_Roman

Tips:Image_graph前身是GraPHPit,它是用于图表操作的包,也是一个开源项目,后来被整合到了Pear之中,被命名为Image_Graph(-alpha是他的版本号),所以它是通过pear命令来完成安装。

Tips: Image_graph's predecessor is GraPHpit, a kit for chart operations and an open-source project, which was later integrated into Pear and named Image_Graph (-alpha is his version number), so it was installed through a pear command.

如没有正确安装pear之中的这几个软件包,在后面使用BASE控制台的环节中会出现报错画面如下: ?

In the absence of the correct installation of these packages in pear, the following misimg src="https://s1.51cto.com/images/blog/202003/05/7880cd5737b538b6659ff8bcb5117e.png?x-oss-process=image/watermark, size_16, text_QDUXQ1RP5Y2a56i, collor_FF,t_30,g_se,x,y_10,shadow_20, type_ZmFuZ3poZW5naGvpdgk=" alt=" >

Package Version State Archive_Tar 1.4.9 stable Console_Getopt 1.3.1 stable Image_Canvas 0.3.5 alpha Image_Color 1.0.4 stable Image_Graph 0.8.0 alpha Numbers_Roman 1.0.2 stable PEAR 1.9.5 stable Structures_Graph 1.0.4 stable XML_RPC 1.5.4 stable XML_Util 1.2.3 stable

步骤4.安装ADOdb包。 虽然PHP是建构Web系统强有力的工具,但是PHP存取数据库的功能并未标准化,MySQL使用了另一种不同且不兼容的应用程序接口。此时需要使用ADOdb作为中介进行转换。ADOdb的最大优点是不管后端数据库如何,存取数据库的方式都是一致的。目前ADOdb的最新版本是5.20,它支持的数据库种类较多,例如MySQL、PostgreSQL、Oracle等。下面开始安装ADOdb,首先将adodb519.tar.gz解压到/var/www/html/目录下。 # tar zxvf adodb519.tar.gz -C /var/www/html/

Step 4. Install ADOdb packages. Although PHP is a powerful tool for building Web systems, PHP access database functionality is not standardized, and MySQL uses another different and incompatible application interface. At this point, ADOdb needs to be used as an intermediary. The best advantage of ADOdb is that access to the database is consistent, regardless of the back end of the database. The latest version of ADOdb is currently 5.20, and it supports more types of databases, such as MySQL, PostgreSQL, Oracle, etc.

解压后发现增加了一个目录adodb5,将这个目录改名为adodb。 #mv /var/www/html/adodb5 /var/www/html/adodb

Dismantling revealed the addition of a directory adodb5, which was renamed adodb. #mv/var/www/html/adodb5/var/www/html/adodb

步骤5.解压BASE包。 [root@localhost src]# pwd /usr/local/src #tar zxvf base-1.4.5.tar.gz -C /var/www/html/

Step 5. Unlock BASE bags. [root@localhost src]# pwd/usr/local/src#tar zxvf base-1.4.5.tar.gz-C/var/www/html/

解压后发现增加了一个目录base-1.4.5,接着需要对它重命名。 #mv /var/www/html/base-1.4.5/ /var/www/html/base

Dismantling revealed the addition of a directory base-1.4.5, which would then need to be renamed. #mv/var/www/html/base-1.4.5//var/www/html/base

步骤6.修改PHP配置文件。 #vi /etc/php.ini

Step 6 . Modify PHP profile. #vi/etc/php.ini

将第513行内容改成如下内容。 error_reporting=E_ALL & ~E_NOTICE 修改完毕保存并退出。

Replace the text of line 513 with the following. error_reporting=E_ALL & ~E_NOTICE changes are saved and withdrawn.

注意:对于error_reporting()函数的解释: error_reporting() 设置 PHP 的报错级别并返回当前级别,错误报告是分级的,下面我们了解一下这个函数错误报告等级。

Note : The explanation for the error_reporting() function: Error_reporting() sets the PHP error level and returns the current level. The error report is graded. Here we understand the error reporting level for this function.

  • E_ALL - 所有的错误和警告
  • E_ERROR - 致命性运行时错
  • E_WARNING - 运行时警告(非致命性错)
  • E_PARSE - 编译时解析错误
  • **E_NOTICE **- 运行时提醒(这些经常是是你的代码的BUG引起的。

步骤7.改变/var/www/html/目录的属主和属组权限。 #chown -R apache:apache /var/www/html/

Step 7 . Changes/var/www/html/ Principal and group privileges for directories. #chown-R apache:apache/var/www/html/

注意:如果该步骤设置不对,有可能在后期配置BASE过程中出现“Config Writeable:No”的错误提示,从而导致无法完成BASE的配置任务。

Note : If this step is not set correctly, there is a risk that an error tip “Config Writer: No” will appear in the configuration of BASE at a later stage, which will result in the failure to complete the BASE configuration task.

步骤8.分别重启MySQL和Web服务,最后停止Firewall服务。 #service mysqld restart //启动数据库服务 #service httpd restart //重启Web服务 #service iptables stop //为了调试方便暂时关闭防火墙。

Step 8. Restart MySQL and Web services, respectively, and eventually stop Firewall services. #service httpd start// reboot Web services #service ittables stop/// temporarily close firewalls for debugging convenience.

步骤9.在Web界面设置BASE。 首先测试Web,我们打开Apache的页面http://yourip/,看到测试页面之后,开始正式打开BASE的页面。 打开浏览器输入网址http://yourip/base/setup/index.php,输入完毕后弹出安装界面,如图1-7所示。 Tips:yourip表示你的IP地址。

Step 9. Setup BASE at the Web interface. First test Web, we open Apache's page at http://yourip/, see the test page and start officially opening BASE's page. Open the browser to enter the web site at http://yourip/base/setup/index.php and post the installation interface as shown in Figure 1-7. Tips:yourip indicates your IP address.

单击Continue按钮,开始选择语言和ADOdb路径,如图1-8所示。 语言项选择中文,ADOdb路径中输入/var/www/html/adodb,单击Continue按钮。接下来输入数据库名称、访问用户名和密码,如图1-9所示。 图1-7 开始设置BASE 图1-8 设置ADOdb路径 图1-9 设置数据库

Continue. Next, enter the name of the database, user names and passwords, as shown in figure 1-9. ,

这里不需要设置归档数据库,所以在图1-9中,红色大括号所包含的五项内容无需填写。下一步将管理员名称设置为root,密码依然是“123456”,Full Name不必设置,如图1-10所示。 图1-10 设置root密码 下一步开始创建BASE表结构,如图1-11、图1-12所示。 图1-11 准备创建BASE表结构 Tip:上图中“BASE AG”中的AG表示报警分组Alert Group。 图1-12 BASE表创建完成 如果看到表acid有创建完成的提示并且BASE tables状态显示为“DONE”,则表示安装完成。单击屏幕最下方的step5…按钮结束安装。在客户机终端命令行中ping主机192.168.1.120,随后就能在BASE界面中收到ICMP报警,如图1-13所示。 图1-13 收到报警 如果在Web的BASE界面中收到ICMP报警,则表明BASE安装设置完成。

#yum install phpmyadmin Modify Profile #vi/etc/httpd/conf.d/phpMyAdmin.conf Write-off line 24 by Deny from ALL?

重启Web服务 #service httpd restart

Restart Web Services #servicehttpd Restart

打开phpMyAdmin的Web UI 网址:http://yourip/phpmyadmin/ ? 图14

Open phpMyAdmin web site Web 图15

Enter the username snort under the Web interface, password 123456? ></p>
<p>此时我们可以更加直观的查看报警。
?<img src= 图16

如果要删除报警,首先勾选需要删除的报警,然后在“动作”下拉菜单中选择“删除报警”选项,如图1-17所示。 图1-17 删除报警

If you want to delete the alarm, first check the alarm that needs to be deleted and then select the "Delete the alarm" option in the Action menu, as shown in figure 1-17. 17"</p

注意:在步骤3中需要特别留意Image_Graph的安装情况如果安装报错或者漏装,当你打开BASE界面时会出现无法绘制图象的错误。以上这些错误有很多都是准备工作(安装Snort和PHP组件)做的不充分。

Note : In step 3, special attention needs to be paid to Image_Graph's installation if it is installed wrongly or leaked, and when you open the BASE interface, there will be errors in not drawing images. Many of these errors are not sufficiently prepared (installation of Snowt and PHP components).

假设Snort服务器中只有一块网卡设备名称为eth0。为让Snort和Barnyard2自动运行,我们需要编写如下SHELL代码(Centos 7需要修改代码,使用yum install psmisc -y命令安装killall):

Assuming that there is only one webcard device named eth0 on the Snowt server. In order for Snort and Barnyard to run automatically, we need to create the following SHELL code (Centos 7 needs to change the code and install the killall using the yum install psmisc-y command):


将以上代码保存在文件/root/idsrun.sh中,赋予可执行权限,为设置自启动服务,我们只需要将下面两行命令加入到/etc/rc.d/rc.local末尾即可。注意rc.local文件需要具有可执行权限。

Saves the above code in a file/root/idsrun.sh with executable privileges. For setting up a self-starter service, we simply need to add the following two lines to the end of /etc/rc.d/rc.local. Note that the rc.local file requires executable privileges.


保存退出即可,如果没有执行,请检查是否加入了可执行权限。通常没有可执行权限会导致脚本无法执行。

Saves exit is sufficient, and if not executed, check if executable privileges have been added.

至此我们已经将Snort安装过程讲解完毕,下面的时间就留给大家反复练习。另外大家网络环境可能各不相同,但操作系统和软件版本最好和本文中介绍的保持一致,实验时需要留意命令之间的大小写,空格,句点,单引号双引号等一些特殊符号的输入,为加深印象所有命令请大家一定要手动输入,不要使用^C ^V。

Now that we have finished the Snort installation process, the time will be left to practice again and again. There may be different web environments, but the operating systems and software versions are best aligned with what is described in this paper. The experiment will need to be sensitive to the case between commands, spaces, stop points, single quotes, etc., to the entry of special symbols, so as to enhance the impression that all commands must be entered manually, rather than using CV.

1.为了在OSSIM前端能显示丰富的图形,系统中必须安装( )库,它是一种图形库,可以让PHP绘制各种图形,能够创建Jpg、PNG和BMP图像。 A.Zlib B.GD C.Glibc

In order to display a wealth of graphics at the front end of OSIM, the system must install () library, which is a graphic library that allows PHP to draw various graphics that can create Jpg, PNG and BMP images. A. Zlib B.GD C. Glibc

2.下列选项中属于HIDS优势的选项包括( ),属于HIDS局限性包括( )。 A.HIDS需要将代理程序部署到要监视的每个主机,部署繁琐。 B.HIDS不能检测网络侦察或扫描 C.HIDS可以检测到***是否成功 D.HIDS监视系统活动 E.HIDS可检测文件或应用程序的变化

2. Options with HIDS advantages in the following options include ( ) HIDS limitations, including ( ). A. HIDS requires deployment of proxy programs to each mainframe to be monitored and deployment is cumbersome. B. HIDS cannot detect network detection or scanning C. HIDS can detect *** success in D. HIDS surveillance system activities E. HIDS detects changes in files or applications

  1. 为了提高libpcap处理数据包的效率,OSSIM 2.3平台上采用了基于零拷贝思想的( ) 机制,由于这种机制避免了多次内存复制并减少CPU的干预,故可以在高速网环境下进行数据抓包分析。 A.PF_RING B.NAPI C.DMA

4.snort规则中由reference选项定义所支持的外部系统,这些网址的内容保存在文件 ( ) 中。 A . /etc/snort/reference.config B /etc/snort/snort.conf C /etc/snort.conf 分析: 使用reference选项表示引用外部链接信息来源,从而为规则提供附加的背景资料,在snort和suricata系统中使用reference.config文件定义引用类型,该文件的名称和存储路径可以在snort.conf和suricata.yaml文件中配置。

The external system supported by the definition of the reference option in the rules is maintained in the document (). A. /etc/snort/reference.config B/etc/snort/snort.conf C/etc/snort.conf Analysis: The use of the reference option provides additional background information on the rules, and the use of the reference.config file definition type in the snort and suricata system, where the name and storage path of the document can be configured in the snort.conf and suricata.yaml files.

  1. 在CentOS 7.0平台里安装Snort和Cent OS6.8有什么不同?

在CentOS 7.x下配置,有些配置习惯会有些不同,在新系统中ip add代替了ifconfig命令,网卡设备名称由eth0变为ens33等,那么在监听网络设备的时候,只要将配置命令中有关网卡的名称用新设备名称替换即可,另外在BASE配置期间,对于CentOS 7及其以上系统强烈建议临时关闭SELinux服务。 整个系统配置过程基本上大同小异,只要你理解了,就可以轻松从Centos 6.x过渡到CentOS 7.x系统。

When configured under Centos 7.x, some configuration habits may be somewhat different, when ip add replaces the ifconfig command in the new system, and the name of the network card equipment is changed from eth0 to ens33 etc., then when listening to network devices, it is sufficient to replace the name of the network card in the configuration command with the name of the new device, and during the BASE configuration, the temporary closure of SELinux services is strongly recommended for Centos 7 and above.

6.为什么/var/log/snort/alert的大小总是没有变化? 请检查确保执行了snort -i eth0 -c /etc/snort/snort.conf -A fast命令,以及snort的规则已经正确加载。

6. Why does the size of /var/log/snort/alert always change? Please check to ensure that the snort-i eth0-c/etc/snort/snort.conf-Afast command has been correctly loaded with the snort rules.

7.如何在屏幕上输出Snort报警信息? 在屏幕上输出报警信息命令如下: #snort -A console -u snort -g snort -i eth0 -c /etc/snort/snort.conf

How to export Snort's alarm information on the screen?

8.用vi编辑器查看,snort生成的unified2格式的数据,为什么都显示乱码? unified2是snort插件的一种输出方式,可以用来以二进制方式存储报警数据,如果你想手动查看他们,发现无法读取,Unified2这种输出格式并非设计为命令行可以读取的,而是为Barnyard2或者pigsty(Snortby中的小工具)工具使用做准备的。

If you want to view them manually and find them unreadable, Unifield2 is not designed to be readable by the command line, but prepared for the use of the Barneyard2 or Pigsty (small tool in Snowtby) tool.

9.我们在本地添加一条测试规则alert icmp any any -> $HOME_NET any (msg:"ICMP Packet Detected";sid:1000003;rev:1;),其中msg,sid,rev表示什么含义?

9. We add a test rule locally for any -> $HOME_NET any (msg:&quat; ICMP Packet Detected&quat; sid:100003; rev: 1) in which msg, sid, rev indicates what it means?

msg: 该选项用于规则相关文本的描述,这里设置为ICMP Packet Detected,当我们设置好BASE控制台之后,在页面上最直观展现出来的IDS引擎报警就是这条信息,所以这条信息尽可能详细。

msg: This option is used for the description of the text of the rules, set here as ICMP Packet Detected, and when we set up the BASE Console, the most visual IDS engine alarm on the page is this information, so this information is as detailed as possible.

sid: 特征标识符,用来唯一性标记规则。snort中每个规则不能重复,取值范围按如下习惯分布: 0~1000000,为Sourcefire VRT保留。 2000001-2999999 ,用于Emerging Threats (ET规则) 3000000+,为自定义。

Sid: Identity identifiers, used for unique marking rules. Each rule in snort cannot be repeated. The range of values is distributed as follows: 0 to 1,000,000, reserved for Sourcefire VRT. 2000001-2999999, used for Emerging Threats (ET Rules) 3000000+, custom-defined.

rev,表示版本修订,该选项永固表示规则发生了修改,从1开始,数字越大,修订次数越多,每次修订我们不用修改SID,而是修改rev.

Rev, meaning revision of the version, this option is a constant sign that the rule has been modified, starting with 1 and the number increases and the number of revisions increases, and we don't have to change the SID for each revision, but we have to change the rev.

10.当重新启动httpd服务时出现下面报错提示,应该如何处理? #service httpd restart [root@snort ~]# service httpd restart Stopping httpd: [ OK ] Starting httpd: httpd: apr_sockaddr_info_get() failed for snort.localdomain httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName (98)Address already in use: make_sock: could not bind to address [::]:80 (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs [FAILED] 分析:出现上面的报错提示大家可以先检查/etc/sysconfig/network文件,在该文件中HOSTNAME=localhost.localdomain定义了主机名的原始参数,如果修改了HOSTNAME则会导致上面故障的发送。

#Service httpd recall [root@snort~]#serving httpd Restart Stopping httpd: [OK] Starting httpd: httpd: apr_sockaddr_info_get()

11.BASE安装成功之后,想切换界面中/英文显示,要如何操作?

11. After successful installation of BASE, how do you want to operate by switching the interface to medium/English?

系统安装完成之后,有中文界面想转英文的,有英文想转中文界面 的,下面以英文转中文为例,开始下面的操作。 我们首先进入/var/www/html/base/目录下要找到base_config.php这个配置文件。 将$BASE_Language='english'; 改为:$BASE_Language='simplified_chinese'; 修改完成之后,保存退出,还需要重启Web服务,才能生效 #service httpd restart 刷新页面,搞定!

When the system is installed, there is a Chinese interface to be converted to English, and there is a Chinese interface to be converted to Chinese. The following operations will be started, for example, in English. We first enter /var/www/html/base/ directory to find the base_config.php configuration file. Replace $BASE_Language=`english' with: $BASE_Language='ssimplied_chinese'; save the exit after the changes have been completed and we need to restart the Web service before #service httpd restart brushes the new page and is done!

12.出现下面故障页面,最有可能是什么问题造成? 目录需要加入可写权限,我们可以尝试改变/var/www/html/目录的属主和属组并设置其权限。 #chown –R apache:apache /var/www/html #chmod -R 755 /var/www/html 为了安全起见,尽量不要给目录设置777权限。

) directory needs to be added writeable and we can try to change /var/www/html/ catalog owner and sub-groups of FF_t_30,g_se,x_10,y_shadow_20, type_ZmfuZ3po/ZW5Gpd-R755/html to keep the catalogue as secure as possible.</p>
<p>13.Zlib、Libdnet、DAQ、ADOdb这些组件在整个系统中各起到什么作用?
对于这几道问题的解答,大家可以到我的新书中找到。</p><p>13. What are the components of Zlib, Libdnet, DAQ and ADOdb working in the system? The answers to these questions can be found in my new book.</p>
<p>备注:已经安装好的Snort+barnyard+BASE的试验环境,虚拟机(OVA格式的文件采用最新版Virtual Box虚拟机导入)<strong>下载</strong>: https://pan.baidu.com/s/1dFeMX9n
<img src=

Note: The test environment of Snowt+barnyard+BASE has been installed and the virtual machine (obdde4828705c0185ec5cf6bdfc6a9.jpg?x-oss-process=image/watermark, size_16,text_QDuxQ1RP5Y2a5a6i, color_FFA,t_30,g_se,x_10,y_shadow_20,ty_ZmF3ZZZW5vpk" >.

美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明

分享:

扫一扫在手机阅读、分享本文

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
热门文章
  • 支付領域投下震撼彈!美國數位銀行Chime疑與GuardPay 神盾支付合作!

    支付領域投下震撼彈!美國數位銀行Chime疑與GuardPay 神盾支付合作!
    2020年,新冠肺炎(COVID-19)疫情加速數位貨幣進展。例如:2019年4月,國際清算銀行(BIS)的調查顯示,在全球66家中央銀行中,沒有一家計畫發行跨境支付的數位貨幣。惟到了2020年10月,BIS支付委員會主席康利夫(Jon Cunliffe)指出,肺炎疫情拉高民眾對無現金支付的需求,迫使各國加快數位貨幣的研發進程日本與韓國於2021年進入數位貨幣試驗階段。直到2019年12月,美國聯邦準備理事會(Fed)都尚無數位貨幣規劃,惟到了2020年2月,Fed已開始研擬...
  • 区块链:交易系统开发指南

    区块链:交易系统开发指南
    播报编辑《区块链:交易系统开发指南》使用通俗易懂的语言,从技术的角度详细介绍了区块链交易系统应有的功能架构及工作原理,让人们能够张开双臂轻松地拥抱区块链技术,享受区块链交易系统带来的惊喜与成就感。《区块链:交易系统开发指南》共分 7 章,第 1~2 章主要介绍区块链及数字货币的基本概念,以及各种公有链的 API 接口;第3~5 章主要介绍区块链交易系统的分类架构及功能; 6 章主要介绍区块链交易系统面临的问题及演进方向;第 7 章对全书做了总结。《区块链:交易系统开发指南》是...
  • 5.14加密货币价格:BTC突破6.2万美元以太坊和山寨币反映市场情绪

    5.14加密货币价格:BTC突破6.2万美元以太坊和山寨币反映市场情绪
    今天,随着比特币(BTC)的价格突破62 000美元的门槛,顶级加密货币的价格反弹了。 此外,以铁大幅上涨,维持在2 900美元的水平。 此外,其他顶尖山硬币,如索拉纳(SOL )、XRP、卡达诺(ADA )也大幅上涨。    今天密钥加密货币价格 1. 比特币价格    在5月14日星期二撰写本文时,比特币价格上升了2.57%,达到62 487.50美元。 另一方面,在过去24小时内,交易量从65.26 % 急剧上升至277亿美元。 与此同时,加密货币的市场价值为...
  • OKEx回应用户质疑:合约交易非期货 平台无机器人

    OKEx回应用户质疑:合约交易非期货 平台无机器人
       热点点 自选股份 数据中心 数据中心 研究和资料中心 资金流动 模拟交易 客户客户 具体来说,OKEx回答用户的问题:合同交易不是期货,平台不是机器人。 金融同步化,3月22日。    昨天下午,OKEx公司就维护先前用户线下的权利问题对同步财务公司作出了回应,指出OKEx公司提供的合同交易不是期货交易,在旗下的业务中没有正式的机器人。 同时,OKEX称,它不会以非法为由对任何投资损失索赔作出答复。 答复全文如下: 同步你的财务! 近日来,...
  • 0.00006694个比特币等于多少人民币/美金

    0.00006694个比特币等于多少人民币/美金
    0.00006694比特币等于多少人民币?根据比特币对人民币的最新汇率,0.00006694比特币等于4.53424784美元/32.5436 16人民币。比特币(BTC)美元(USDT)人民币(CNY)0.000066944.53424784【比特币密码】32.82795436 16比特币对人民币的最新汇率为:490408.64 CNY(1比特币=490408.64人民币)(1美元=7.24人民币)(0.00006694USDT=0.0004846456 CNY)汇率更新时...
标签列表