Snort是一款來(lái)自國(guó)外的,專(zhuān)為電腦安全打造的網(wǎng)絡(luò)入侵檢測(cè)/防御系統(tǒng),軟件支持實(shí)時(shí)(Real-Time)流量分析,網(wǎng)絡(luò)IP數(shù)據(jù)包(Pocket)記錄等特性,能夠幫助用戶捕捉從外部網(wǎng)絡(luò)上下載到本地的數(shù)據(jù)包,然后將捕獲的數(shù)據(jù)包送到包解碼器進(jìn)行解碼,并根據(jù)檢測(cè)結(jié)果采取一定的動(dòng)作!
安裝教程
1、Snort在WINDOWS下安裝過(guò)程比較麻煩,主要是配置麻煩,下載軟件壓縮包文件,點(diǎn)擊“Snort_2_9_15_Installer.exe”根據(jù)提示安裝即可
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不一定對(duì),可以先試一下??锤髯缘南到y(tǒng)都不一樣。
原: 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
因?yàn)樵趙indows下unicode.map這個(gè)文件在etc文件夾下。
配置好后,保存。
②下載規(guī)則庫(kù)
windows下安裝好snort后默認(rèn)是沒(méi)有規(guī)則庫(kù),需要自己下載。
③設(shè)置預(yù)處理器
在snort.conf里面可以直接設(shè)置某些檢測(cè)的預(yù)處理器,當(dāng)然也可以通過(guò)某些前端軟件來(lái)實(shí)現(xiàn),比如下面將要提到的IDSCENTER。
比如:
設(shè)置端口掃描的預(yù)處理器,把第二行的注釋取消,并在最后加上log的保存文件。
# Portscan detection. For more information, see README.sfportscan
# preprocessor sfportscan: proto { all } memcap { 10000000 } sense_level { low }logfile { postscan.log }
設(shè)置arp欺騙的預(yù)處理器,同樣取消注釋?zhuān)袸P和MAC改為你的IP和MAC值。
# preprocessor arpspoof
# preprocessor arpspoof_detect_host: 172.26.75.114 BC:AE:C5:81:BE:95
其他預(yù)處理器設(shè)置類(lèi)似。
④設(shè)置輸出
在這下面設(shè)置你的輸出,需要輸出什么就注釋掉對(duì)應(yīng)的行。
###################################################
# 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模式的報(bào)警日志)
⑤選擇網(wǎng)卡:
進(jìn)入命令行,在snort.exe文件所在目錄用snort -W查看系統(tǒng)可用網(wǎng)絡(luò)接口。記住需要監(jiān)視的網(wǎng)卡的編號(hào),比如為2,那么在以后的使用中,用-i 2就可以選擇對(duì)應(yīng)的網(wǎng)卡。
#將snort安裝為系統(tǒng)服務(wù):
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. 如果看到上面的提示說(shuō)明是成功的。
⑥將snort服務(wù)設(shè)置為自啟動(dòng)
可以在services.msc中設(shè)置snort為自動(dòng)啟動(dòng)。
⑦如果改變了snort.conf,則需要重啟snort來(lái)加載配置文件:
net stop snortsvc
net start snortsvc
⑧如果有誤,可以刪除snort服務(wù):
sc delete snortsvc
完成后通過(guò)命令啟動(dòng)IDS模式的snort
snort -i2 -de -l ../log -c ../etc/snort.conf
也可以安裝IDSCENTER來(lái)進(jìn)行圖形界面的Snort管理。
主要指令
order改變規(guī)則順序( snort -o )
alertfile建立警告輸出檔,例如:config alertfile: alertlog
classification將規(guī)則分類(lèi)。
decode_arp開(kāi)啟arp解碼功能。 (snort -a)
dump_chars_only開(kāi)啟字元擷取功能。 (snort -C)
dump_payload擷取應(yīng)用層資料。 (snort -d)
decode_data_link解碼資料連結(jié)層的標(biāo)頭檔。 (snort -e)
bpf_file指定BPF篩檢程式(snort -F)。例如:config bpf_file: filename.bpf
set_gid改變GID (snort -g)。例如:config set_gid: snort_group
daemon以背景方式執(zhí)行。 (snort -D)
reference_net設(shè)置該區(qū)域的網(wǎng)路。 (snort -h)。例如:config reference_net:192.168.1.0/24
interface設(shè)置網(wǎng)路介面(snort –i)。例如:config interface: xl0
alert_with_interface_name警示時(shí)附加上介面資訊。 (snort -I)
logdir設(shè)置記錄目錄(snort -l)。例如:config logdir: /var/log/snort
umask設(shè)置snort輸出檔的權(quán)限。 (snort -m). Example: config umask: 022
pkt_count處理n個(gè)封包后,退出。 (snort -n). Example: config pkt_count: 13
nolog關(guān)閉記錄功能(警示仍然運(yùn)作)。 (snort -N)
quiet安靜模式,不顯示狀態(tài)報(bào)告。 (snort -q)
checksum_mode計(jì)算checksum的協(xié)定類(lèi)型。類(lèi)型值:none, noip, notcp, noicmp, noudp, all
utc在時(shí)間紀(jì)錄上,用UTC時(shí)間代替本地時(shí)間。 (snort -U)
verbose將詳細(xì)記錄資訊列印到標(biāo)準(zhǔn)輸出。 (snort -v)
dump_payload_verbose擷取資料連結(jié)層的封包( snort -X )
show_year在時(shí)間紀(jì)錄上顯示年份。 (snort -y)
stateful為stream4設(shè)置保證模式。
min_ttl設(shè)置一個(gè)snort內(nèi)部的ttl值以忽略所有的流量。
disable_decode_alerts關(guān)閉解碼時(shí)發(fā)出的警示。
disable_tcpopt_experimental_alerts關(guān)閉tcp實(shí)驗(yàn)選項(xiàng)所發(fā)出的警示。
disable_tcpopt_obsolete_alerts關(guān)閉tcp過(guò)時(shí)選項(xiàng)所發(fā)出的警示。
disable_tcpopt_ttcp_alerts關(guān)閉ttcp選項(xiàng)所發(fā)出的警示。
disable_tcpopt_alerts關(guān)閉選項(xiàng)長(zhǎng)度確認(rèn)警示。
disable_ipopt_alerts關(guān)閉IP選項(xiàng)長(zhǎng)度確認(rèn)警示。
detection配置偵測(cè)引擎。 (例如:search-method lowmem)
reference幫Snort加入一個(gè)新的參考系統(tǒng)。