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. HDU 1969 Pie

    二分答案+验证(这题精度卡的比较死) #include<stdio.h> #include<math.h> #define eps 1e-7 ; double a[ff]; d ...

  2. jQuery实现的简单分页功能的详细解析

    分页功能在项目开发中不可或缺,老司机操作起来就和呼吸一样简单,新手恐怕就会吃力一些. 今天我回顾了一下具体的操作步骤,决定详细的分析一下每一步的实现目的及原理. 我们会创建一个简单的json文件来模拟 ...

  3. MFC中将编辑框文本转换成整数,从而实现两个整数相加。

    在头文件中,定义三个控件变量,如m_data1,m_data2,m_sum; void Cuse_demo_dllDlg::OnBnClickedButton1(){ CString data1; C ...

  4. java常量和变量的定义规则,变长参数的使用

    首先是定义的一般规则,类名首字母全部大写,常量全部大写用下划线分隔,变量用驼峰形式.注意使用long赋值用L时不能写小写的L要写大写的,不然会和数字“1”傻傻分不清. 下面是举例: public cl ...

  5. LeetCode OJ 27. Remove Element

    Given an array and a value, remove all instances of that value in place and return the new length. D ...

  6. hdu 1425 sort

    Problem Description 给你n个整数,请按从大到小的顺序输出其中前m大的数.   Input 每组测试数据有两行,第一行有两个数n,m(0<n,m<1000000),第二行 ...

  7. 循环语句 ,for语句

    for语句主要用来反复执行某段代码: for(初始条件:循环条件:状态改变) { 循环体 } 问题类型: 1.穷举(例:0-100以内与7有关的数) <body><input typ ...

  8. IT人为什么难以拿到高薪?【转帖】

    最近在论坛里看到很多人发牢骚,说薪水少,可在我看来,你们这样的人拿得到高薪才怪! 我先问一句:这里有多少人是本科的?有多少人是正规本科的(不算自考,成考和专升本)?有多少人是有学位的?有多少有学位的是 ...

  9. 抛弃jQuery,拥抱原生JavaScript

    前端发展很快,现代浏览器原生 API 已经足够好用.我们并不需要为了操作 DOM.Event 等再学习一下 jQuery 的 API.同时由于 React.Angular.Vue 等框架的流行,直接操 ...

  10. PHP正则表达式试题

    1.POSIX正则表达式扩展在PHP哪个版本被废弃了 2.请写出匹配任意数字,任意空白字符,任意单词字符的符号? 3.执行一个正则表达式匹配的函数是什么?返回的结果有哪些? 4.执行一个全局正则表达式 ...