0.如果要输出到mysql,请安装barnyard2

在此之前,请启动并配置mysql

git clone https://github.com/firnsy/barnyard2
cd barnyard2
./autogen.sh
./configure --with-mysql-libraries=/usr/lib64/mysql

make
make install

1.配置snort.conf

mkdir /etc/snort
mkdir /usr/local/lib/snort_dynamicrules
mkdir /var/log/snort

把安装文件etc目录的文件全部复制到/etc/snort里面,进入snort源码目录(sid-msg.map在规则包里面),然后

cp /etc/* /etc/snort/

把rule文件拷贝至/etc/snort/下面

拷贝rules、so_rules、preproc_rules到/etc/snort/下

(或者下载snort规则直接解压到/etc/snort/)

进入snort源码目录的/so_rules/precompiled/RHEL-6-0/x86-64/2.9.6.2

cp * /usr/local/lib/snort_dynamicrules

snort.conf分为9部分

1:Set the network variables

2:Configure the decoder

3:Configure the base detection engine

4:Configure dynamic loaded libraries

5:Configure preprocessors

6:Configure output plugins

7:Customize your rule set

8:Customize preprocessor and decoder rule set

9:Customize shared object rule set

第一部分:

a.最新的snort版本支持ipv6,如果你的网络没有ipv6的话,把ipvar都改成var

b.把变量HOME_NET改为自己的网络 如 192.168.0.1/24

c.把EXTERNAL_NET改为!$HOME_NET

var RULE_PATH ../rules
var SO_RULE_PATH ../so_rules
var PREPROC_RULE_PATH ../preproc_rules

都改成相应的绝对路径,比如/etc/snort/rules等

然后

touch  /etc/snort/rules/white_list.rules
touch /etc/snort/rules/black_list.rules

第二部分:

只需要把最后一行改为:config logdir: /var/log/snort 注意:去掉前面的#

第三部分:不需要修改

第四部分:不需要修改

第五部分:不需要修改

第六部分:配置输入插件,注意同时只能有一个插件同时存在,在output unified2:后另加一行

output unified2: filename snort.log, limit 128

第七部分:这里主要是配置snort启动时候需要读取哪些规则文件,这里根据实际情况决定是否保留,刚开始建议注释掉除local.rules之外所有的规则文件。

第八部分:取消注释所有

第九部分:取消注释所有

至此snort安装并配置完毕,下面说下barnyard2的安装和配置

2.配置barnyard2.conf

复制barnyard2.conf文件至/etc/snort

建立barnyard2日志目录

mkdir /var/log/barnyard2

建立一个barnyard2需要的空白文件

touch /var/log/snort/barnyard2.waldo

Barnyard2.conf有三部分:

1:configure the variable declarations

2:setup the input plugins

3 :setup the output plugins

第一部分:

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 logdir: /var/log/barnyard2

config hostname: localhost

config interface: eth0

config waldo_file: /var/log/snort/barnyard2.waldo

第二部分:不需要修改

第三部分:注释掉alert_fast

在最后新增

output database: log, mysql, user=snort password=snortpass dbname=snort host=localhost

PS密码不需要加引号

至此Barnyard2安装完成

(如果继续安装snorby,则暂时不需要简历mysql表)

运行:

barnyard2 -c /etc/snort/barnyard2.conf -d /var/log/snort -f snort.log -w /etc/snort/bylog.waldo -C /etc/snort/classification.config
snort --daq-dir=/usr/local/lib/daq --daq pfring --daq-mode passive -u root -g root -c /etc/snort/snort.conf -i eth0 -v -e

配置snort的更多相关文章

  1. Windows 下如何安装配置Snort视频教程

    Windows 下如何安装配置Snort视频教程: 第一步: http://www.tudou.com/programs/view/UUbIQCng360/ 第二部: http://www.tudou ...

  2. wstngfw中配置snort

    wstngfw中配置snort 概述 Snort是入侵检测和预防系统.它可以将检测到的网络事件记录到日志并阻止它们.Snort使用称为规则的检测签名进行操作. Snort规则可以由用户自定义创建,或者 ...

  3. 安装配置Snort和barnyard2

    1.安装依赖包 yum install –y gcc flex bison zlib* libpcap* tcpdump gcc-c++ zlib* libdnet libdnet-devel pcr ...

  4. 实验 snort安装配置与规则编写

    1 实验目的 在linux或windows任意一个平台下完成snort的安装,使snort工作在NIDS模式下,并编写符合相关情景要求的snort规则. 2 实验环境 物理机:windows 8.1 ...

  5. Snort - 配置文件

    Snort.conf 版本 2.9.8.3 编译可用选项: --enable-gre --enable-mpls --enable-targetbased --enable-ppm --enable- ...

  6. Aho-Corasick算法、多模正则匹配、Snort入门学习

    希望解决的问题 . 在一些高流量.高IO的WAF中,是如何对规则库(POST.GET)中的字符串进行多正则匹配的,是单条轮询执行,还是多模式并发执行 . Snort是怎么组织.匹配高达上千条的正则规则 ...

  7. snort使用

    http://jingyan.baidu.com/article/d8072ac45a626fec95cefd85.html 接上篇,如果编译安装snort并指定了prefix,那么须指定一个软链接, ...

  8. ubuntu 12.04 安装snort acidbase相关注意事项

    一.安装Snort 1.安装libpcap 1 apt-get install libpcap-dev 2.安装snort 1 2 apt-get install snort apt-get inst ...

  9. 配置suricata

    yum -y install libpcap libpcap-devel libnet libnet-devel pcre \ pcre-devel gcc gcc-c++ automake auto ...

随机推荐

  1. 关于PS的一些总结

    1.设计给的图,单独用里边的个别图层 打开图 — 新建一个图层(ctrl+n) — (点开上面的窗口排列-垂直排列,左下边下边自动选择改成图层)—选择移动工具,选中要移动的图层,拉到新建文件夹中.  ...

  2. 在Java 线程中返回值的用法

    http://icgemu.iteye.com/blog/467848 在Java 线程中返回值的用法 博客分类: Java Javathread  有时在执行线程中需要在线程中返回一个值:常规中我们 ...

  3. centos 命令行 连接无线网卡

    ifconfig wlan0 up 1 ifconfig wlan0 iwlist wlan0 scan wpa_passphrase naizhongnai naizhong >> /e ...

  4. iOS应用程序内存查看工具

    我要找的是一个可以检查应用程序中哪一个数组存贮的什么内容的工具. 网上搜到的工具名称是Allocations Instrument,后来一试发现不是我想要的.这还是一个后期调试阶段的内存检查工具. h ...

  5. xib storyboard

    initWithNibName加载xib或者storyboard BLEViewController *controller = [[BLEViewController alloc] initWith ...

  6. Hibernate创建SessionFactory实例

    private static SessionFactory sessionFactory = null;  static {  Configuration configuration =new Con ...

  7. php发送get、post请求获取内容的几种方法

    方法1: 用file_get_contents 以get方式获取内容 <?php $url='http://www.domain.com/'; $html = file_get_contents ...

  8. Local declaration of 'XXX' hides instance variable

    今天调试程序遇到这么一个警告! Local declaration of 'XXX' hides instance variable 遇到这种原因,是因为本地变量跟函数参数变量同名.改变其一即可.

  9. Tinyxml封装类COperatorXml

    OperatorXml.h头文件 #ifndef _OPERATOR_XML_H_ #define _OPERATOR_XML_H_ #include <string> class TiX ...

  10. oracle数据库的一次异常起停处理。

    在重启数据库的时候,忘记把一个应用关停了,想起来的时候,就ctrl+c,把数据库shutdown immediate 给强制停下了,把该应用再停止,然后shutdown immdiate,这时候数据报 ...