網絡技術是從1990年代中期發展起來的新技術,它把互聯網上分散的資源融為有機整體,實現資源的全面共享和有機協作,使人們能夠透明地使用資源的整體能力并按需獲取信息。資源包括高性能計算機、存儲資源、數據資源、信息資源、知識資源、專家資源、大型數據庫、網絡、傳感器等。 當前的互聯網只限于信息共享,網絡則被認為是互聯網發展的第三階段。 snort 是一個強大的輕量級的網絡入侵檢測系統。它具有實時數據流量分析和日志IP 網絡數據包的能力,能夠進行協議分析,對內容進行搜索/匹配。它能夠檢測各種不同的攻擊方式,對攻擊進行實時報警。Snort 可以運行在*nix/Win32 平臺上。
本文將主要介紹Win2003 Server 下Snort 的安裝與配置,關于Snort 的體系結構和規則,可以參考其他相關資。
安裝與配置
首先下載以下軟件包: acid-0.9.6b23.tar.gz http://www.cert.org/kb/acid 基于php 的入侵檢測數據庫分析控制臺 adodb360.zip http://php.weblogs.com/adodb ADOdb(Active Data Objects Data Base)庫for PHP apache_2.0.46-win32-x86-no_src.msi http://www.apache.org Windows 版本的Apache Web 服務器 jpgraph-1.12.2.tar.gz http://www.aditus.nu/jpgraph OO 圖形庫for PHP mysql-4.0.13-win.zip http://www.mysql.com Windows 版本的Mysql 數據庫服務器 php-4.3.2-Win32.zip http://www.php.net Windows 版本的php 腳本環境支持 snort-2_0_0.exe http://www.snort.org Windows 版本的Snort 安裝包 WinPcap_3_0.exe http://winpcap.polito.it/ 網絡數據包截取驅動程序 phpmyadmin-2.5.1-php.zip http://www.phpmyadmin.net 基于php 的Mysql 數據庫管理程序 (需要國外代理訪問)
首先安裝Apache_2.0.46 For Windows
安裝的時候注意,如果你已經安裝了IIS 并且啟動了Web Server,因為IIS WebServer 默認在TCP 80 端口監聽,所以會和Apache WebServer 沖突,我們可以修改Apache WebServer為其他端口。選擇定制安裝,安裝路徑修改為c:\apache 安裝程序會自動建立c:\apache2 目錄,繼續以完成安裝。
安裝完成后首先修改c:\apache2\conf\httpd.conf,定制安裝完成后,apache web server 默認在8080 端口監聽,我們修改為其他不常用的高端端口: 修改Listen 8080 為Listen 50080
安裝apache 為服務方式運行 c:\apache2\bin\apache –k install
添加Apache 對PHP 的支持: 解壓縮php-4.3.2-Win32.zip 至c:\php 拷貝php4ts.dll 至%systemroot%\system32 拷貝php.ini-dist 至%systemroot%\php.ini 修改php.ini extension=php_gd2.dll 同時拷貝c:\php\extension\php_gd2.dll 至%systemroot%\ 以上添加gd 圖形庫支持 在httpd.conf 中添加LoadModule php4_module "c:/php/sapi/php4apache2.dll" AddType application/x-httpd-php .php 啟動Apache 服務 net start apache2 在c:\apache2\htdocs 目錄下新建test.php, test.php 文件內容: <?phpinfo();?> 使用http://192.168.0.15:50080/test.php 測試php 是否安裝成功
安裝Snort_2_0_0 使用默認安裝路徑c:\snort
安裝Mysql 默認安裝Mysql 至c:\mysql, 安裝mysql 為服務方式運行 c:\mysql\bin\mysqld-nt –install 啟動mysql 服務 net start mysql
ps:Win2003 Server 下如果出現不能啟動mysql,新建my.ini 內容為: [mysqld] basedir=C:\MySQL bind-address=127.0.0.1 datadir=C:\MySQL\data
注意其中的basedir 和datadir 目錄是否指向了正確的目錄. 把my.ini 拷貝至%systemroot%目錄下就可以了
配置mysql
為默認root 帳號添加口令: c:\>cd mysql\bin c:\>mysql mysql mysql>set password for "root"@"localhost" = password('erFl87tr32Gk');
刪除默認的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 連接
建立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 c:\mysql\bin\mysql -D snort_archive -u root -p < c:\snort\contrib\create_mysql
建立acid 和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";
安裝adodb: 解壓縮adodb360.zip 至c:\php\adodb 目錄下
安裝acid 解壓縮acid-0.9.6b23.tar.gz 至c:\apache2\htdocs\acid 目錄下
修改acid_conf.php 文件
$DBlib_path = "c:\php\adodb";
$alert_dbname = "snort"; $alert_host = "localhost"; $alert_port = ""; $alert_user = "acid"; $alert_password = "log_snort";
/* Archive DB connection parameters */ $archive_dbname = "snort_archive"; $archive_host = "localhost"; $archive_port = ""; $archive_user = "acid"; $archive_password = "archive_snort";
$ChartLib_path = "c:\php\jpgraph\src";
建立acid 運行必須的數據庫:
http://192.168.0.15:50080/acid/acid_db_setup.php 按照系統提示建立
安裝jpgrapg 庫
解壓縮jpgraph-1.12.2.tar.gz 至c:\php\ jpgraph 修改jpgraph.php DEFINE("CACHE_DIR","/tmp/jpgraph_cache/");
安裝winpcap 配置Snort 編輯c:\snort\etc\snort.conf 需要修改的地方: include classification.config include reference.config 改為絕對路徑 include c:\snort\etc\classification.config include c:\snort\etc\reference.config 設置snort 輸出alert 到mysql server output database: alert, mysql, host=localhost user=snort password=snort dbname=snort encoding=hex detail=full
測試snort 是否正常工作: c:\snort\bin>snort -c "c:\snort\etc\snort.conf" -l "c:\snort\logs" -d -e -X
-X 參數用于在數據鏈接層記錄raw packet 數據 -d 參數記錄應用層的數據 -e 參數顯示/記錄第二層報文頭數據 -c 參數用以指定snort 的配置文件的路徑
本文轉自極度深寒網絡安全技術站 http://www.ellenzp.com/
網絡的神奇作用吸引著越來越多的用戶加入其中,正因如此,網絡的承受能力也面臨著越來越嚴峻的考驗―從硬件上、軟件上、所用標準上......,各項技術都需要適時應勢,對應發展,這正是網絡迅速走向進步的催化劑。
|