Table of Contents
来源:http://hi.baidu.com/pia_ca/blog/item/2767d3f386376edd7931aa28.html
一、      前言
二、      准备工作
三、      配置APM环境
四、      安装Barnyard 2
五、      安装Suricata
六、      配置Suricata、Barnyard 2
七、      配置Base
八、      最后
Home Database Mysql Tutorial CentOS 6.2下安装基于Suricata + Barnyard 2 + Base的入侵检测系

CentOS 6.2下安装基于Suricata + Barnyard 2 + Base的入侵检测系

Jun 07, 2016 pm 03:30 PM
bar centos based on Install

来源:http://hi.baidu.com/pia_ca/blog/item/2767d3f386376edd7931aa28.html 一、前言 算了,这部分就省了吧。下面直奔主题。 二、准备工作 CentOS 6.2 我是最小化安装,同时使用 163 的源进行 update ,所以还需要安装如下的依赖包: [piaca@piaca ~]$ sud

来源:http://hi.baidu.com/pia_ca/blog/item/2767d3f386376edd7931aa28.html

一、      前言

         算了,这部分就省了吧。下面直奔主题。

二、      准备工作

         CentOS 6.2我是最小化安装,同时使用163的源进行update,所以还需要安装如下的依赖包:

         [piaca@piaca ~]$ sudo yum install gcc make pcre pcre-devel libpcap libpcap-devel

        

     同时需要关闭iptablesip6tables

         [piaca@piaca ~]$ sudo service iptables stop

         [piaca@piaca ~]$ sudo service ip6tables stop

         [piaca@piaca ~]$ sudo chkconfig --level 2345 iptables off

         [piaca@piaca ~]$ sudo chkconfig --level 2345 ip6tables off

 

         需要下载的软件:

          Suricata

          http://www.openinfosecfoundation.org/index.php/downloads

          Barnyard 2

          http://www.securixlive.com/barnyard2/

          Base

          http://base.secureideas.net/

          yaml

          http://pyyaml.org/

          adodb

          http://sourceforge.net/projects/adodb/

          rules

          http://rules.emergingthreats.net/open/suricata/emerging.rules.tar.gz

          Image_Canvas

          http://download.pear.php.net/package/Image_Canvas-0.3.3.tgz

          Image_Graph

          http://download.pear.php.net/package/Image_Graph-0.8.0.tgz

 

三、      配置APM环境

     Base需要APMApachePHPMysql)环境,通过yum来进行安装。

     [piaca@piaca ids]$ sudo yum install httpd php mysql mysql-server mysql-devel php-mysql php-gd php-pear

 

  启动httpdmysql服务

  [piaca@piaca ids]$ sudo /etc/init.d/httpd start

  [piaca@piaca ids]$ sudo /etc/init.d/mysqld start

 

     默认的web根目录是/var/www/html,在此目录新建phpinfo测试文件,来确认配置是否正确。

        PSmysql安装后root账号默认口令为空,通过下面命令可以修改root账号口令

        [piaca@piaca ~]$ mysqladmin -uroot -p password [新密码]

四、      安装Barnyard 2

  安装过程如下:

  [piaca@piaca ids]$ tar zxvf barnyard2-1.9.tar.gz

  [piaca@piaca ids]$ cd barnyard2-1.9

  [piaca@piaca barnyard2-1.9]$ ./configure --with-mysql

  [piaca@piaca barnyard2-1.9]$ make

  [piaca@piaca barnyard2-1.9]$ sudo make install

 

五、      安装Suricata

  安装过程如下:

  Suricata需要依赖yaml,首先安装yaml

  [piaca@piaca ids]$ tar zxvf yaml-0.1.4.tar.gz

  [piaca@piaca ids]$ cd yaml-0.1.4

  [piaca@piaca yaml-0.1.4]$ ./configure

  [piaca@piaca yaml-0.1.4]$ make

  [piaca@piaca yaml-0.1.4]$ sudo make install

 

  [piaca@piaca ids]$ tar zxvf suricata-1.1.1.tar.gz

  [piaca@piaca ids]$ cd suricata-1.1.1

  [piaca@piaca suricata-1.1.1]$ ./configure

  [piaca@piaca suricata-1.1.1]$ make

  [piaca@piaca suricata-1.1.1]$ sudo make install

 

六、      配置Suricata、Barnyard 2

  配置Barnyard 2

  把Barnyard 2安装源文件中的etc/barnyard2.conf文件拷贝到Suricata的配置目录下

   [piaca@piaca ids]$ cd barnyard2-1.9

   [piaca@piaca barnyard2-1.9]$ sudo cp etc/barnyard2.conf /etc/suricata/

  创建barnyard2日志目录/var/log/barnyard2

   [piaca@piaca ~]$ sudo mkdir /var/log/barnyard2

 

配置数据库

  需要创建数据库和相应的账号

   [piaca@piaca ~]$ mysql -uroot –p

   mysql> create database ids;

   mysql> grant create,select,update,insert,delete on ids.* to ids@localhost identified by 'ids123';

 

          Barnyard 2安装源文件中的schemas/create_mysql是创建表的sql文件,通过如下方式建表:

          [piaca@piaca ~]$ mysql -uids -p -Dids

 

    配置Suricata

  创建Suricata配置目录和日志目录

   [piaca@piaca ~]$ sudo mkdir /var/log/suricata

   [piaca@piaca ~]$ sudo mkdir /etc/suricata

 

  把规则文件拷贝到Suricata配置目录下

   [piaca@piaca ids]$ tar zxvf emerging.rules.tar.gz

   [piaca@piaca ids]$ sudo cp -R rules/ /etc/suricata/

 

      把Suricata安装源文件中的suricata.yaml/classification.config/reference.config文件拷贝到Suricata的配置目录下

   [piaca@piaca ids]$ cd suricata-1.1.1

   [piaca@piaca suricata-1.1.1]$ sudo cp suricata.yaml classification.config reference.config /etc/suricata/

 

      编辑barnyard2.conf文件

          [piaca@piaca ~]$ cd /etc/suricata/

          [piaca@piaca suricata]$ sudo vim barnyard2.conf

      找到下面的内容

           config reference_file:      /etc/snort/reference.config

           config classification_file: /etc/snort/classification.config

           config gen_file:            /etc/snort/gen-msg.map

           config sid_file:                /etc/snort/sid-msg.map

      更改红色的内容如下:

          config reference_file:      /etc/suricata/reference.config

          config classification_file: /etc/suricata/classification.config

          config gen_file:            /etc/suricata/rules/gen-msg.map

          config sid_file:            /etc/suricata/rules/sid-msg.map

 

      同时在文件的末尾添加如下行,红色的mysql数据库、账号信息根据实际情况填写

          output database: log, mysql, user=ids password=ids123 dbname=ids host=localhost

 

      编辑suricata.yaml文件

          [piaca@piaca suricata]$ sudo vim suricata.yaml

      找到HOME_NET: "[192.168.0.0/16,10.0.0.0/8,172.16.0.0/12]"这一行,根据实际的网络情况来修改,在这里我修改为HOME_NET: "[192.168.0.0/16]"

      找到下面的内容:

          host-os-policy:

          # Make the default policy windows.

          windows: [0.0.0.0/0]

          bsd: []

          bsd_right: []

         old_linux: []

         linux: [10.0.0.0/8, 192.168.1.100, "8762:2352:6241:7245:E000:0000:0000:0000"]

         old_solaris: []

         solaris: ["::1"]

         hpux10: []

         hpux11: []

         irix: []

         macos: []

         vista: []

         windows2k3: []

         根据实际网络情况修改。

 

         启动SuricataBarnyard 2

         [piaca@piaca ~]$ sudo /usr/local/bin/barnyard2 -c /etc/suricata/barnyard2.conf -d /var/log/suricata -f unified2.alert -w /var/log/suricata/suricata.waldo -D

         [piaca@piaca ~]$ sudo /usr/local/bin/suricata -c /etc/suricata/suricata.yaml -i eth1 -D

         启动suricata-i参数是镜像流量的网卡。

 

         测试suricata工作是否正常,可以通过如下命令:

         [piaca@piaca suricata]$ curl www.testmyids.com

         执行后,/var/log/suricata目录下的fast.log/suricata.waldo/unified2.alert*文件大小发生变化,同时查看fast.log文件有如下类似的内容则表示suricata工作正常:

01/12/2012-02:16:27.964981  [**] [1:2013028:3] ET POLICY curl User-Agent Outbound [**] [Classification: Attempted Informa

tion Leak] [Priority: 2] {TCP} 192.168.230.100:56260 -> 217.160.51.31:80

01/12/2012-02:16:28.309707  [**] [1:2100498:7] GPL ATTACK_RESPONSE id check returned root [**] [Classification: Potential

ly Bad Traffic] [Priority: 2] {TCP} 217.160.51.31:80 -> 192.168.230.100:56260

        

七、      配置Base

Base需要用到adodb以及Image_CanvasImage_Graph绘图组件,配置过程如下:

解压adodb514.zip

[piaca@piaca ids]$ unzip adodb514.zip

adodb5拷贝到/usr/local/lib/目录下,这个目录随意指定,记下来后面要用到

[piaca@piaca ids]$ sudo cp -R adodb5 /usr/local/lib/

         安装Image_CanvasImage_Graph

         [piaca@piaca ids]$ sudo pear install Image_Canvas-0.3.3.tgz

[piaca@piaca ids]$ sudo pear install Image_Graph-0.8.0.tgz  

解压base-1.4.5.tar.gz

[piaca@piaca ids]$ tar zxvf base-1.4.5.tar.gz

拷贝base-1.4.5/var/www/html目录下

[piaca@piaca ids]$ sudo cp -R base-1.4.5 /var/www/html/base

更改/var/www/html/base的属主为apache

[piaca@piaca ids]$ cd /var/www/html/

[piaca@piaca html]$ sudo chown -R apache:apache base

 

然后通过浏览器访问http://192.168.230.100/base

根据页面中红色的部分提示来进行操作。

修改php.ini

[piaca@piaca html]$ sudo vim /etc/php.ini

找到error_reporting = E_ALL & ~E_DEPRECATED内容,修改为如下:error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE

重新载入apache配置

[piaca@piaca html]$ sudo /etc/init.d/httpd reload

 

然后点击“Continue”到下一步

选择语言,和前面我们的adodb5的路径,然后点击“Continue

填写mysql相关信息,点击“Continue”继续

填写认证的相关信息,如果需要验证身份,请勾上“Use Authentication System,点击“Continue

点击“Create BASE AG

点击“step 5”,跳到首页。

八、      最后

以上是整个安装过程,IDS的价值在于规则设置的是否合适,根据实际情况设置合适的规则才能够体现IDS的强大。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to input Chinese in centos How to input Chinese in centos Apr 07, 2024 pm 08:21 PM

Methods for using Chinese input in CentOS include: using the fcitx input method: install and enable fcitx, set shortcut keys, press the shortcut keys to switch input methods, and input pinyin to generate candidate words. Use iBus input method: Install and enable iBus, set shortcut keys, press the shortcut keys to switch input methods, and input pinyin to generate candidate words.

How to read USB disk files in centos7 How to read USB disk files in centos7 Apr 07, 2024 pm 08:18 PM

To read U disk files in CentOS 7, you need to first connect the U disk and confirm its device name. Then, use the following steps to read the file: Mount the USB flash drive: mount /dev/sdb1 /media/sdb1 (replace "/dev/sdb1" with the actual device name) Browse the USB flash drive file: ls /media/sdb1; cd /media /sdb1/directory; cat file name

How to enter root permissions in centos7 How to enter root permissions in centos7 Apr 02, 2024 pm 08:57 PM

There are two ways to enter the root authority of CentOS 7: use the sudo command: enter sudo su - in the terminal and enter the current user password. Log in directly as the root user: Select "Other" on the login screen, enter "root" and the root password. Note: Operate carefully with root privileges, perform tasks with sudo privileges, and change the root password regularly.

SCP usage tips-recursively exclude files SCP usage tips-recursively exclude files Apr 22, 2024 am 09:04 AM

One can use the scp command to securely copy files between network hosts. It uses ssh for data transfer and authentication. Typical syntax is: scpfile1user@host:/path/to/dest/scp -r/path/to/source/user@host:/path/to/dest/scp exclude files I don't think you can when using scp command Filter or exclude files. However, there is a good workaround to exclude the file and copy it securely using ssh. This page explains how to filter or exclude files when copying directories recursively using scp. How to use rsync command to exclude files The syntax is: rsyncav-essh-

What to do if you forget your password to log in to centos What to do if you forget your password to log in to centos Apr 07, 2024 pm 07:33 PM

Solutions for forgotten CentOS passwords include: Single-user mode: Enter single-user mode and reset the password using passwd root. Rescue Mode: Boot from CentOS Live CD/USB, mount root partition and reset password. Remote access: Use SSH to connect remotely and reset the password with sudo passwd root.

What should I do if I forget my centos username and password? What should I do if I forget my centos username and password? Apr 02, 2024 pm 08:54 PM

After forgetting your CentOS username and password, there are two ways to restore access: Reset the root password: Restart the server, edit the kernel command line in the GRUB menu, add "rw init=/sysroot/bin/sh" and press Ctrl+x ;Mount the root file system and reset the password in single-user mode. Use rescue mode: Start the server from the CentOS installation ISO image, select rescue mode; mount the root file system, copy the chroot environment from the ISO image, reset the password, exit the chroot environment and restart the server.

How to enable root permissions in centos7 How to enable root permissions in centos7 Apr 07, 2024 pm 08:03 PM

CentOS 7 disables root permissions by default. You can enable it by following the following steps: Temporarily enable it: Enter "su root" on the terminal and enter the root password. Permanently enabled: Edit "/etc/ssh/sshd_config", change "PermitRootLogin no" to "yes", and restart the SSH service.

What should I do if I forget my centos7 password? What should I do if I forget my centos7 password? Apr 02, 2024 pm 08:51 PM

Three solutions for forgotten passwords in CentOS 7: Single-user mode: Restart the system, edit the kernel options, change ro to rw init=/sysroot/bin/sh, and use the passwd command to reset the root password. Rescue mode: Boot from the installation media, select rescue mode, mount the root file system, chroot to the root file system, and use the passwd command to reset the root password. Grub2 command line: Restart the system, press c to enter the command line, load the kernel, mount the root file system, chroot to the root file system, and use the passwd command to reset the root password.

See all articles