Snort安裝教程
Ncool-soft ncool_kk[ http://ncool.56.com ] 2006-1-9
首先得到我們需要的軟件包(最新軟件包):
1、snort2.0.exe(在windows平臺下的snort最新版本,linux平臺的已經是snort2.4.3)
http://www.snort.org
MySQL的安裝步驟,2、WinPcap_3_2_alpha1.exe(windows版本的PCAP)
http://winpcap.polito.it
3、idscenter11rc4.zip(windows版本的基于snort的圖形控制臺)
http://www.packx.net
4、sam_20050206_bin.zip(*uinx、windows版本下的與snort配合使用的實時分析軟件 )
http://www.lookandfeel.com
mysql decimal范圍,5、mysql-5.0.16-win32.zip(windows版本的mysql數據庫服務器)
http://www.mysql.com
6、ACID-0.9.6b23.tar.gz(基于php的***檢測數據庫分析控制臺)
http://www.cert.org/kb/acid
7、adodb465.tgz(ADOdb(Active Data Objects Data Base)庫for PHP)
http://jaist.dl.sourceforge.net/sourceforge/adodb/adodb465.zip
索引mysql?8、apache_2055-win32.msi(windows版本的apache Web服務器)
http://www.apache.org
9、php-5.1.1-Win32.zip(windows版本的php腳本環境支持)
http://www.php.net
10、jpgraph-2.0.tar.gz(php下面的圖形庫)
http://www.aditus.nu/jpgraph
mysql5.7安裝教程。11、phpMyAdmin-2.2.7-pl1-php3.zip(基于php的mysql數據庫管理程序)
http://www.phpmyadmin.net
開始環境安裝:
安裝Mysql
筆者采用默認安裝后,Mysql的位置為c:\mysql5,之后設置Mysql為服務方式運行,在命令提示符里面輸入:c:\mysql5\bin>mysqld-nt –install
啟動Mysql服務:
win7安裝MySQL所需環境。方法1、在命令提示符里輸入:net start mysql
方法2、開始—>設置—>控制面板—>管理工具—>服務—>啟動“MYSQL”服務
注意:
如果你的windows版本不能啟動Mysql,新建my.ini文件,其內容為:
[mysqld]
basedir=C:\MySQL5
mysql,bind-address=127.0.0.1
datadir=C:\MySQL5\data
注意其中的basedir 和datadir 目錄是否指向了正確的目錄
把my.ini 拷貝至%systemroot%目錄下就可以了
安裝apache
在安裝時要注意,如果你安裝了IIS并起用了web server ,由于IIS web server的默認監聽端口是80,會和apache web server沖突,為辟免沖突我們將apache的監聽端口配置成其他不常用端口(筆者使用的8027)。
table has no partition for value,默認安裝后在c盤C:\apache\Apache2\conf文件夾下面找到httpd.conf文件修改:
Listen 80 為 Listen 8027
安裝apache后將它做為服務方式運行,在命令提示符下輸入:
c:\apache\apache2\bin>apahce –k install
安裝php5,并添加Apache對PHP的支持與PHP對Mysql的支持。
解壓文件php-5.1.1-Win32.zip到c:\php5
MySQL安裝失敗、拷貝php5ts.dll文件到%systemroot%\system32
拷貝php.ini-dist 至%systemroot%\php.ini
修改php.ini
extension=php_gd2.dll
extension=php_mysql.dll
同時拷貝c:\php\extension下的php_gd2.dll與php_mysql.dll 至%systemroot%\
MySQL installer,添加gd庫的支持在C:\apache\Apache2\conf\httpd.conf中添加
LoadModule php5_module "c:/php5/php5apache2.dll"
AddType application/x-httpd-php .php
啟動Apache服務:
方法1 使用Apache Service Monitor (Apache自帶的啟動工具)如下圖:
方法2 開始—>設置—>控制面板—>管理工具—>服務—>啟動“Apache2”服務
MySQL for visual studio1.2.8。在C:\apache\Apache2\htdocs目錄下新建webinf.php,文件內容為:
使用http://localhost:8027/webinf.php 或是 http://127.0.0.1:8027/webinf.php
你將看到你服務器的PHP 、Mysql 、Aapche等配置信息,細細閱讀,并根據該信息配置你的服務器,至于如何詳細配置PHP、Mysql、Apache請參考其他資料!
安裝snort2.0.exe與winPCAP
兩者都采用默認安裝。
為安全起見,我們配置Mysql帳號
mysql索引使用。為默認root 帳號添加口令:
c:\>cd mysql\bin
c:\>mysql mysql
mysql>set password for "root"@"localhost" = password('your password ');
在安裝Mysql5時,程序會提示你是否設置root帳號和密碼中已,經默認存在root帳號了,就不用配置這步。
刪除默認的any@%帳號
mysql>delete from user where user='' and host = '%'
mysql>delete from db where user='' and host = '%'
mysql>delete from tables_priv where user='' and host = '%'
mysql>delete from columns_priv where user='' and host = '%'
刪除默認的any@localhost 帳號
mysql>delete from user where user ='' and host = 'localhost'
mysql>delete from db where user = '' and host = 'localhost'
mysql>delete from tables_priv where user='' and host = 'localhost'
mysql>delete from columns_priv where user='' and host= 'localhost'
刪除默認的root@%帳號
mysql>delete from user where user = 'root' and host = '%'
mysql>delete from db where user = 'root' and `host` = '%'
mysql>delete from tables_priv where user= 'root' and host = '%'
mysql>delete from columns_priv where user = 'root' and host = '%'
這樣只允許root 從localhost 連接。更多的Mysql配置資料請參考其他。
建立snort 運行必須的snort 庫和snort_archive 庫
mysql>create database snort;
mysql>create database snort_archive;
使用c:\snort\contrib 目錄下的create_mysql 腳本建立Snort 運行必須的數據表
c:\mysql\bin\mysql -D snort -u root -p < c:\snort\contrib\create_mysql
enter password : *********
c:\mysql\bin\mysql -D snort_archive -u root -p < c:\snort\contrib\create_mysql
enter password : *********
或是
將C:\Snort\contrib下的create_mysql文件拷貝到C:\mysql5\bin目錄下后
mysql>source create_mysql
注意:
由于筆者的配置經歷,發現snort2.0.exe安裝后的C:\Snort\contrib\create_mysql文件不能正確的創建到Mysql的服務器中,使用上面的方法報告語法錯誤。解決這個問題的辦法就是在http://www.snort.org 上下載linux 版本的snort2.4.3.tar.gz安裝軟件包利用winRAR解壓后,找到 ./contrib/create_mysql文件,使用這個新版本的的create_mysql才能成功的創建數據文件到Mysql中。
為Mysql 建立snort 和acid 帳號,使IDSCenter或acid能正常訪問Mysql中與snort相關的數據文件。
mysql> grant usage on *.* to "acid"@"localhost" identified by "acidtest";
mysql> grant usage on *.* to "snort"@"localhost" identified by "snorttest";
為acid 用戶和snort 用戶分配相關權限
mysql> grant select,insert,update,delete,create,alter on snort .* to "acid"@"localhost";
mysql> grant select,insert on snort .* to "snort"@"localhost";
mysql> grant select,insert,update,delete,create,alter on snort_archive .* to
>"acid"@"localhost";
為acid擁護和snort 擁護設置密碼
mysql>set password for "snort"@"localhost" = password('your password ');
mysql>set password for "acid"@"localhost" = password('your password ');
安裝adodb:
解壓縮adodb456.zip 至c:\php5\adodb 目錄下。
安裝安裝jpgrapg 庫
解壓縮jpgraph-2.0.tar.gz 至c:\php5\jpgraph
修改jpgraph.php
DEFINE("CACHE_DIR","/tmp/jpgraph_cache/");
安裝acid
解壓縮acid-0.9.6b23.tar.gz 至c:\apache\apache2\htdocs\acid 目錄下。
修改acid_conf.php 文件
$DBlib_path = "c:\php5\adodb";
$alert_dbname = "snort";
$alert_host = "localhost";
$alert_port = "3306";
$alert_user = "acid";
$alert_password = "your password";
/* Archive DB connection parameters */
$archive_dbname = "snort_archive";
$archive_host = "localhost";
$archive_port = "3306";
$archive_user = "acid";
$archive_password = "your password";
$ChartLib_path = "c:\php5\jpgraph\src";
建立acid 運行必須的數據庫:
http://localhost:8027/acid/acid_db_setup.php 或是
http:/127.0.0.1:8027/acid/acid_db_setup.php
按照網業上的提示操作既可。
簡單的snort配置
打開C:\Snort\etc下的snort.conf文件(可以使用記事本或是寫字板打開)
配置:
var RULE_PATH c:/snort/rules(配置rules的絕對路徑)
include c:\snort\etc\classification.config(classification.config的絕對路徑)
include C:\Snort\etc\reference.config(……)
配置snort的輸出插件:
output database: alert, Mysql, host=localhost port=3306 dbname=snort user=root password=your_password sensor_name=n encoding=ascii detail=Full
由于我的Mysql和snort在同一臺服務器上,所以用的是root帳號登陸,如果不是在本地的Mysql服務器,使用:
output database: alert, Mysql, host=192.168.22.139 port=3306 dbname=snort_ncool_1 user=snort password=your_password sensor_name=n encoding=ascii detail=Full
其他的設定及命令含義請參考snort相關資料。(可以進入我的主頁http://ncool.56.com得到部分資料)
現在你可以在命令提示符里輸入:
c:\snort\bin>snort –c c:\snort\etc\snort.conf –l c:\snort\log –d –e –v
測試你的snort的配置情況。
安裝IDSCenter,并使用IDSCenter 配置snort項
這三個軟件筆者都是采用的默認安裝,當然對與安裝路徑等,你也可以按照自己的需要設定,配置與此也是大同小異。
在很多網絡流傳的資料里,很多都是用文本方式配置snort.conf文件來對snort 進行配置的,在這里筆者就不講述這種方法,以及snort.conf里的每個配置項代表的意思這里也不講述,請參考相關資料,我使用的是IDSCenter 1.1 RC4 來做的這些配置工作,感覺更加簡單。
啟動IDSCenter 1.1 RC4,如下圖: < IDSCenter 1.1 RC4主窗口 >
關于DISCenter的配置,請參考其他資料或進我的個人主頁http://ncool.56.com [請您使用Microsoft Internet Explorer5.5及以上版本的瀏覽器訪問] 我的BLOG 里面有筆者的使用心得。
安裝 SAM
下載完成后,由于它是*.jar包,如果你沒有安裝J2SE Runtime Environment 5.0 Update 6 那么就到http://java.com/zh_CN/download/index.jsp 下載并安裝。安裝好后,你直接點擊 sam.jar運行SAM軟件。
在命令提示符中輸入:
c:\snort\bin>snort -c "c:\snort\etc\snort.conf" -l "c:\snort\logs" -d -e -X
-X 參數用于在數據鏈接層記錄raw packet 數據
-d 參數記錄應用層的數據
-e 參數顯示/記錄第二層報文頭數據
-c 參數用以指定snort 的配置文件的路徑
運行snort檢測網絡數據包,并使用SAM 和ACID 監視服務器情況。你的服務器就這樣輕松全在你的監視中了。
最后:
SNORT的更多輔助工具:
Snortsnarf http://www.silicondefense.com/software/snortsnarf
Snortplot.php http://www.snort.org/dl/contrib/data_analysis/snortplot.pl
Swatch http://acidlab.sourceforge.net
Demarc http://www.demarc.com
Razorback http://www.intersectalliance.com/projects/razorback/index.html
Incident.pl http://www.cse.fau.edu/~valankar/incident
Loghog http://sourceforge.net/project/loghog
Oinkmaster http://www.algonet.se/~nitzer/oinkmaster
Sneakyman http://sneak.sourceforge.net
Snortreport http://www.circurtsmaximus.com/download.html
………
上面軟件的功能及特性,參見該軟件的下載網站。
上面做的只是一個HIDS(主機IDS),這是我在做基于snort
的NIDS前練兵配置經歷。現在做的NIDS(基于windows平臺)模式如下:
( 具體布置的由網絡決定 )
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态