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. 【第四篇】androidEventbus源代码阅读和分析

    1,分析androidEventbus的注册源代码: 我们在使用androidEventbus的第一步是注册eventbus,如下代码: EventBus.getDefault().register( ...

  2. linux脚本Shell之awk详解(二)

    三.printf的使用   print format 生成报表 %d        十进制有符号整数 %u        十进制无符号整数 %f        浮点数 %s        字符串 %c ...

  3. 导入Excel后绑定GridView实例

    http://blog.csdn.net/loveheronly/article/details/6715552 项目中经常用到导入导出的例子,前面做了导出的例子,现在把导入Excel的数据的例子也把 ...

  4. 16.按要求编写Java应用程序。 编写一个名为Test的主类,类中只有一个主方法; 在主方法中定义一个大小为50的一维整型数组,数组名为x,数组中存放着{1, 3,5,…,99}输出这个数组中的所有元素,每输出十个换一行;在主方法中定义一 个大小为10*10的二维字符型数组,数组名为y,正反对角线上存的是‘*’,其余 位置存的是‘#’;输出这个数组中的所有元素。

    //分类 package com.bao; public class Shuchu { int[]yi=new int[50]; String[][]er=new String[10][10]; vo ...

  5. nodejs 命令篇

    1.npm init // 生成package.json 2.npm install --save-dev gulp-jslint // 安装gulp-jslint模块,并把模块名和版本保存到pack ...

  6. Linux查看CPU和内存使用情况 【转】

    Linux查看CPU和内存使用情况 在系统维护的过程中,随时可能有需要查看 CPU 使用率,并根据相应信息分析系统状况的需要.在 CentOS 中,可以通过 top 命令来查看 CPU 使用状况.运行 ...

  7. Stu Website

    GIT: 分支的新建与合并 https://git-scm.com/book/zh/v2/Git-分支-分支的新建与合并 分支的管理 https://git-scm.com/book/zh/v1/Gi ...

  8. C语言 - pthread

    pthread_create函数 原型:int  pthread_create((pthread_t  *thread,  pthread_attr_t  *attr,  void  *(*start ...

  9. auto_ptr浅析

    auto_ptr是C++标准库中(<utility>)为了解决资源泄漏的问题提供的一个智能指针类模板(注意:这只是一种简单的智能指针) auto_ptr的实现原理其实就是RAII,在构造的 ...

  10. Servlet Filter 过滤器

    Filter也称之为过滤器,它是Servlet技术中最激动人心的技术,WEB开发人员通过Filter技术,对web服务器管理的所有web资源: 例如Jsp, Servlet, 静态图片文件或静态 ht ...