阅读量:0
在Ubuntu上部署Snort的NIDS模式,需要以下几个步骤:
- 安装依赖项: 首先,确保系统已更新并安装了必要的依赖项。打开终端并运行以下命令:
sudo apt-get update sudo apt-get install -y build-essential libpcap-dev libpcre3-dev libdumbnet-dev zlib1g-dev
- 下载并编译Snort: 从Snort官方网站下载最新版本的源代码,然后解压缩并进入解压后的目录。以下是一个示例:
wget https://www.snort.org/downloads/snort/snort-2.9.16.tar.gz tar -xvf snort-2.9.16.tar.gz cd snort-2.9.16
接下来,配置并编译Snort:
./configure --enable-ipv6 --enable-gre --enable-mpls --with-dnet-includes=/usr/include/dnet --with-dnet-libraries=/usr/lib make sudo make install
- 配置Snort: 创建一个新的Snort配置文件,或者从现有的示例文件开始。将配置文件保存为
/etc/snort/snort.conf
。以下是一个基本的Snort配置文件示例:
# /etc/snort/snort.conf include /usr/local/etc/snort/rules/snort.rules preprocessor decoder_preprocessor_rules: /usr/local/etc/snort/preproc_rules/decoder.rules preprocessor http_inspect: global iis_unicode_map unicode.map 1252 compress_depth 65535 decompress_depth 65535 preprocessor http_inspect_server: server default \ http_methods { GET POST PUT DELETE HEAD OPTIONS CONNECT PATCH } \ chunk_length 500000 \ server_flow_depth 0 \ client_flow_depth 0 \ post_depth 65495 \ oversize_dir_length 500 \ max_header_length 750 \ max_headers 100 \ max_spaces 200 \ small_chunk_length { 10 5 } \ ascii { 32 126 } \ double_decode on \ bare_byte on \ iis_backslash on \ directory_traversals on \ utf_8 on \ u_encode on \ bare_byte on \ webroot "c:\inetpub\wwwroot" \ xff_headers on
- 创建规则文件: 在
/usr/local/etc/snort/rules
目录下创建一个名为snort.rules
的文件。在此文件中,添加您希望Snort检测的规则。以下是一个简单的示例规则:
alert tcp any any -> any any (msg:"Test Rule"; sid:1000000; rev:1;)
- 运行Snort: 使用以下命令启动Snort:
sudo snort -i<interface> -c /etc/snort/snort.conf -l /var/log/snort/
将<interface>
替换为要监控的网络接口(例如,eth0)。
现在,Snort应该已经在NIDS模式下运行,并根据配置的规则检测流量。要查看Snort生成的警报,请查看/var/log/snort/
目录下的日志文件。