• 配置snort


    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 
  • 相关阅读:
    AspNetPager.dll 分页控件使用方法、含有代码示例 [转]
    XmlDocument序列化到Session[转]
    静态构造函数
    错误日志[常用方法]
    Vss 源代码管理中的目录问题
    StopWatch 获得更精确的运行时间
    最近写的一个验证码.
    windowsservice 中的 currentdirectory
    vs2005常用快捷键(转贴)
    一个mapyEasy 图片切割工具 及源码
  • 原文地址:https://www.cnblogs.com/tswcypy/p/3961737.html
Copyright © 2020-2023  润新知