Snort是一款来自国外的,专为电脑安全打造的网络入侵检测/防御系统,软件支持实时(Real-Time)流量分析,网络IP数据包(Pocket)记录等特性,能够帮助用户捕捉从外部网络上下载到本地的数据包,然后将捕获的数据包送到包解码器进行解码,并根据检测结果采取一定的动作! 1、Snort在WINDOWS下安装过程比较麻烦,主要是配置麻烦,下载软件压缩包文件,点击“Snort_2_9_15_Installer.exe”根据提示安装即可 2、安装好后,需要配置etc里面的snort.conf文件: ①windows下snort.conf文件必须修改的几处: 原: var RULE_PATH ../rules 改为: var RULE_PATH C:\Snort\rules 原: #dynamicpreprocessor directory /usr/local/lib/snort_dynamicpreprocessor/ 改为:dynamicpreprocessor directory C:\Snort\lib\snort_dynamicpreprocessor(后面一定不要有/) 原: #dynamicengine /usr/local/lib/snort_dynamicengine/libsf_engine.so 改为:dynamicengine C:\Snort\lib\snort_dynamicengine\sf_engine.dll 原:dynamicdetection directory /usr/local/lib/snort_dynamicrules 改为:dynamicdetection directory C:\Snort\lib\snort_dynamicrules 然后将C:\Snort\so_rules\precompiled\FC-9\i386\2.9.0.1里的所有文件拷贝到C:\Snort\lib\snort_dynamicrules //上面的FC-9不一定对,可以先试一下。看各自的系统都不一样。 原: include classification.config 改为: include C:\Snort\etc\classification.config 原: include reference.config 改为: include C:\Snort\etc\reference.config 原: # include threshold.conf 改为: include C:\Snort\etc\threshold.conf 原:# Does nothing in IDS mode #preprocessor normalize_ip4 #preprocessor normalize_tcp: ips ecn stream #preprocessor normalize_icmp4 #preprocessor normalize_ip6 #preprocessor normalize_icmp6 在之前加上#,注释掉。 原:preprocessor http_inspect: global iis_unicode_map unicode.map 1252 compress_depth 65535 decompress_depth 65535 改为:preprocessor http_inspect: global iis_unicode_map C:\Snort\etc\unicode.map 1252 compress_depth 65535 decompress_depth 65535 因为在windows下unicode.map这个文件在etc文件夹下。 配置好后,保存。 ②下载规则库 windows下安装好snort后默认是没有规则库,需要自己下载。 ③设置预处理器 在snort.conf里面可以直接设置某些检测的预处理器,当然也可以通过某些前端软件来实现,比如下面将要提到的IDSCENTER。 比如: 设置端口扫描的预处理器,把第二行的注释取消,并在最后加上log的保存文件。 # Portscan detection. For more information, see README.sfportscan # preprocessor sfportscan: proto { all } memcap { 10000000 } sense_level { low }logfile { postscan.log } 设置arp欺骗的预处理器,同样取消注释,把IP和MAC改为你的IP和MAC值。 # preprocessor arpspoof # preprocessor arpspoof_detect_host: 172.26.75.114 BC:AE:C5:81:BE:95 其他预处理器设置类似。 ④设置输出 在这下面设置你的输出,需要输出什么就注释掉对应的行。 ################################################### # Step #6: Configure output plugins # For more information, see Snort Manual, Configuring Snort - Output Modules ################################################### 比如: # syslog # output alert_syslog: LOG_AUTH LOG_ALERT # pcap # output log_tcpdump: tcpdump.log 插入output alert_fast: alert.ids(输出fast模式的报警日志) ⑤选择网卡: 进入命令行,在snort.exe文件所在目录用snort -W查看系统可用网络接口。记住需要监视的网卡的编号,比如为2,那么在以后的使用中,用-i 2就可以选择对应的网卡。 #将snort安装为系统服务: C:\Snort\bin>snort /SERVICE /INSTALL -c ../etc/snort.conf -i 2 -l ../snort/log -de [SNORT_SERVICE] Successfully added the Snort service to the Services database. 如果看到上面的提示说明是成功的。 ⑥将snort服务设置为自启动 可以在services.msc中设置snort为自动启动。 ⑦如果改变了snort.conf,则需要重启snort来加载配置文件: net stop snortsvc net start snortsvc ⑧如果有误,可以删除snort服务: sc delete snortsvc 完成后通过命令启动IDS模式的snort snort -i2 -de -l ../log -c ../etc/snort.conf 也可以安装IDSCENTER来进行图形界面的Snort管理。 order改变规则顺序( snort -o ) alertfile建立警告输出档,例如:config alertfile: alertlog classification将规则分类。 decode_arp开启arp解码功能。 (snort -a) dump_chars_only开启字元撷取功能。 (snort -C) dump_payload撷取应用层资料。 (snort -d) decode_data_link解码资料连结层的标头档。 (snort -e) bpf_file指定BPF筛检程式(snort -F)。例如:config bpf_file: filename.bpf set_gid改变GID (snort -g)。例如:config set_gid: snort_group daemon以背景方式执行。 (snort -D) reference_net设置该区域的网路。 (snort -h)。例如:config reference_net:192.168.1.0/24 interface设置网路介面(snort –i)。例如:config interface: xl0 alert_with_interface_name警示时附加上介面资讯。 (snort -I) logdir设置记录目录(snort -l)。例如:config logdir: /var/log/snort umask设置snort输出档的权限。 (snort -m). Example: config umask: 022 pkt_count处理n个封包后,退出。 (snort -n). Example: config pkt_count: 13 nolog关闭记录功能(警示仍然运作)。 (snort -N) quiet安静模式,不显示状态报告。 (snort -q) checksum_mode计算checksum的协定类型。类型值:none, noip, notcp, noicmp, noudp, all utc在时间纪录上,用UTC时间代替本地时间。 (snort -U) verbose将详细记录资讯列印到标准输出。 (snort -v) dump_payload_verbose撷取资料连结层的封包( snort -X ) show_year在时间纪录上显示年份。 (snort -y) stateful为stream4设置保证模式。 min_ttl设置一个snort内部的ttl值以忽略所有的流量。 disable_decode_alerts关闭解码时发出的警示。 disable_tcpopt_experimental_alerts关闭tcp实验选项所发出的警示。 disable_tcpopt_obsolete_alerts关闭tcp过时选项所发出的警示。 disable_tcpopt_ttcp_alerts关闭ttcp选项所发出的警示。 disable_tcpopt_alerts关闭选项长度确认警示。 disable_ipopt_alerts关闭IP选项长度确认警示。 detection配置侦测引擎。 (例如:search-method lowmem) reference帮Snort加入一个新的参考系统。安装教程
主要指令