歡迎您光臨本站 註冊首頁

哈哈!真高興!snort+acid終於搞定了!

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

哈哈!真高興!snort+acid終於搞定了!

參考了很多的帖子,終於OK了,功能很強大,具體如圖:
《解決方案》

哈哈!真高興!snort+acid終於搞定了!

兄弟,介紹點經驗吧.
《解決方案》

哈哈!真高興!snort+acid終於搞定了!

能貼出你的安裝筆記嗎?
《解決方案》

哈哈!真高興!snort+acid終於搞定了!

這兩天忙串門了,OK,我寫一下安裝筆記。

打造免費的網路入侵檢測系統——「低成本 + 高效益 = 企業獲利」


作者:CU-squall  
發表於:2005年5月3日 01:00  可以不經作者同意自由傳播,請註明作者出處。
主頁:http://www.grlinux.net  
E-mail:squall@grlinux.net

【簡 介】
  Snort是一個輕便的網路入侵檢測系統,可以完成實時流量分析和對網路上的IP包登錄進行測試等功能,能完成協議分析,內容查找/匹配,能用來探測多種攻擊和嗅探(如緩衝區溢出、秘密斷口掃描、CGI攻擊、SMB嗅探、拇紋採集嘗試等)。

前提:Apache要支持PHP,這樣我們才能在瀏覽器上通過acid分析日誌,喜歡看文本日誌的除外more /var/log/snort/alert

需要的軟體包:
①httpd-2.0.52.tar.gz,http://httpd.apache.org/download.cgi
②mysql-standard-4.1.9-pc-linux-gnu-i686.tar.gz,
http://dev.mysql.com/get/Downloads/MySQL-4.1/mysql-standard-4.1.9-pc-linux-gnu-i686.tar.gz/from/pick
③php-4.3.10.tar.gz,http://www.php.net/downloads.php
④snort+acid+adodb+jpgraph+libpcap+pcre這些包我已經打包好放我網站里了,地址:
http://www.grlinux.net/squall/snort_soft.tar.bz2

apache+mysql+php這裡不介紹了,不清楚的到我那拿PDF的吧。

(這裡說明一下,最新的snort-2.3.3.tar.gz的contrib目錄里很多重要文件都沒有,所以按照參考教程又下了一個snort-2.0.0.tar.gz)

一、準備工作
# 把所有tar包放到/usr/local/src/下。
# tar zxvf libpcap-0.7.2.tar.gz
# cd libpcap-0.7.2
# ./configure
# make
# make install
# cd ..
# tar zxvf pcre-5.0.tar.gz
# ./configure
# make
# make install
# 我這裡沒有安裝zlib,因為我的系統里有,如果你要安裝新的zlib包,請先卸載自帶的包。

二、安裝snort
我們還是要編譯snort-2.3.3.tar.gz,因為很多規則都是最新的,至於contrib目錄里的文件我們用snort-2.0.0.tar.gz這個。

# tar zxvf snort-2.3.3.tar.gz
# tar zxvf snort-2.0.0.tar.gz
# cd snort-2.3.3
# ./configure --with-mysql=/usr/local/mysql
# make
# make install
# cd rules
# mkdir /etc/snort
# mkdir /var/log/snort
# cp * /etc/snort
# cd ../etc
# cp snort.conf /etc/snort
# cp *.config /etc/snort
# cd
# vi /etc/snort/snort.conf

# 把「# var HOME_NET 10.1.1.0/24」改成「var HOME_NET 192.168.0.0/24」你自己LAN內的地址,把前面的#號去掉。

# 把「var RULE_PATH ../rules」改成「var RULE_PATH /etc/snort」

# 把「# output database: log, mysql, user=root password=test dbname=db host=localhost」改成「output database: log, mysql, user=root password=123456 dbname=snort host=localhost」密碼改成你自己的,把前面的#號去掉。

# 把「
# include $RULE_PATH/web-attacks.rules
# include $RULE_PATH/backdoor.rules
# include $RULE_PATH/shellcode.rules
# include $RULE_PATH/policy.rules
# include $RULE_PATH/porn.rules
# include $RULE_PATH/info.rules
# include $RULE_PATH/icmp-info.rules
include $RULE_PATH/virus.rules
# include $RULE_PATH/chat.rules
# include $RULE_PATH/multimedia.rules
# include $RULE_PATH/p2p.rules」前面的#號刪除。

# 修改完畢后,保存退出。

三、建立snort資料庫
# /usr/local/mysql/bin/mysql -uroot -p123456
# create database snort;
# grant INSERT,SELECT on root.* to snort@localhost;
# exit
# 這時我們進入snort2.0的contrib的目錄
# cd /usr/local/src/snort-2.0.0/contrib/
# /usr/local/mysql/bin/mysql -uroot -p123456 < create_mysql snort
# zcat snortdb-extra.gz | /usr/local/mysql/bin/mysql -p123456 snort
# 這裡我加-uroot會報錯,等半根煙的功夫。
# 進入mysql資料庫,看看snort資料庫中的表:
# /usr/local/mysql/bin/mysql -uroot -p123456
mysql>;show databases;
+------------+
| Database
+------------+
| mysql
| snort
| test
+------------+
3 rows in set (0.00 sec)
mysql>;use snort;
mysql>;show tables; 將會有這些:
+------------------+
| Tables_in_snort |
+------------------+
| data
| detail
| encoding
| event
| flags
| icmphdr
| iphdr
| opt
| protocols
| reference
| reference_system
| schema
| sensor
| services
| sig_class
| sig_reference
| signature
| tcphdr
| udphdr
+------------------+
19 rows in set (0.00 sec)
mysql>;exit

四、安裝配置Acid
# 把acid-0.9.6b23.tar.gz、adodb330.tgz、jpgraph-1.11.tar.gz放到網頁根目錄,我這裡是默認的。
# cp a*.* /usr/local/apache/htdocs
# cp jpgraph-1.11.tar.gz /usr/local/apache/htdocs
# tar zxvf adodb330.tgz
# tar zxvf jpgraph-1.11.tar.gz
# mv jpgraph-1.11 jpgraph
# tar zxvf acid-0.9.6b23.tar.gz
# cd acid
# vi acid_conf.php
# 把「$DBlib_path = "";」  改成「$DBlib_path = "/usr/local/apache/htdocs/adodb"」

# $alert_dbname   = "snort_log";  //改成snort
  $alert_host     = "localhost";
  $alert_port     = "";
  $alert_user     = "root";
  $alert_password = "mypassword"; //改成你的資料庫密碼

  /* Archive DB connection parameters */
  $archive_dbname   = "snort_archive";  //改成snort
  $archive_host     = "localhost";
  $archive_port     = "";
  $archive_user     = "root";
  $archive_password = "mypassword";」  //改成你的資料庫密碼

# 把「$ChartLib_path = "";」  改成「$ChartLib_path = "/usr/local/apache/htdocs/jpgraph/src";」

# 修改完畢后,保存退出。

五、寫一個snort規則
# cd /usr/local/
# vi snort.sh
#!/bin/sh
snort -d -h 192.168.0.0/24 -l /var/log/snort -c /etc/snort/snort.conf -i eth0 -A full
# 保存退出。
# chmod 755 snort.sh

六,啟動服務
# /usr/local/apache/bin/apachectl start
# cd /usr/local/mysql/
# vi mysql_start.sh
#!/bin/sh
/usr/local/mysql/bin/mysqld_safe --user=mysql &
# 保存退出。
# chmod 755 mysql_start.sh
# cp mysql_start.sh /usr/sbin/
# ./mysql_start.sh
# /usr/local/snort.sh
# service named start

七、進入web界面:
# http://yourhost/acid/acid_main.php,點"Setup Page"鏈接 ->;Create Acid AG
# 訪問http://yourhost/acid將會看到ACID界面。

八、測試IDS
# 利用nmap,nessus,CIS或者X-scan對系統進行掃描,產生告警紀錄。
# http://yourhost/acid 察看紀錄。
# 至此,一個功能強大的IDS配置完畢。各位可以利用web界面遠程登陸,監控主機所處區域網,同時安裝  phpMyAdmin或webmin對mysql資料庫進行操控。

參考:《構建小型的入侵檢測系統》以及bbs.chinaunix.net搜索引擎的帖子和《Snort(入侵檢測系統)中文手冊》
《解決方案》

哈哈!真高興!snort+acid終於搞定了!

圖1和2:
《解決方案》

哈哈!真高興!snort+acid終於搞定了!

圖3和4:
《解決方案》

哈哈!真高興!snort+acid終於搞定了!

snort-2.3.3.tar.gz的create_mysql在schema里
《解決方案》

哈哈!真高興!snort+acid終於搞定了!

1.增加目錄驗證功能
在httpd.conf尾部加:

<Directory /usr/local/apache/htdocs/acid>;

Options Indexes FollowSymLinks

allowoverride authconfig

order allow,deny

allow from all

</Directory>;


# touch /usr/bin/apache/users_passwd.txt
# cd /usr/bin/apache/
# bin/htpasswd -bc users_passwd.txt squall 123456
# bin/htpasswd -b users_passwd.txt sqlunix 123456

在acid目錄里vi .htaccess

AuthName "please input your username and password:"

AuthType basic

AuthUserFile /usr/local/apache/users_passwd.txtrequire

valid-user

《解決方案》

哈哈!真高興!snort+acid終於搞定了!

2.增加snort頁面啟動管理功能

SnortCenter是一個基於Web的snort探針和規則管理系統,用於遠程修改snort探針的配置,起動、停止探針,編輯、分發snort特徵碼規則。

下載地址:
http://users.pandora.be/larc/download/

# cp snortcenter-v1.0-RC1.tar.gz /usr/local/apache/htdocs
# tar zxvf snortcenter-v1.0-RC1.tar.gz
# mv www sc
# vi sc/
# 改以下內容:
$DBlib_path = "/usr/local/apache/htdocs/adodb/";

$curl_path = "/usr/bin";

$DBtype = "mysql";

$DB_dbname   = "snortcenter";           # $DB_dbname   : MySQL database name of
SnortCenter DB
$DB_host     = "localhost";             # $DB_host     : host on which the DB is
stored
$DB_user     = "root";                  # $DB_user     : login to the database w
ith this user
$DB_password = "123456";                        # $DB_password : password of the
DB user
$DB_port     = "";                      # $DB_port     : port on which to access
the DB (blank is default)
(資料庫密碼改成你自己的)
# 修改好后,保存退出。
# 然後創建snortcenter的資料庫
# mysql -uroot -p123456
# create database snortcenter;
# quit;
# 在瀏覽器上鍵入http://192.168.0.11/sc,它會自動創建數據表,然後再次登入會讓你輸入用戶名和密碼,初始是admin,change.

# 然後我們安裝snortcenter-agent-v1.0-RC1.tar.gz
# cp snortcenter-agent-v1.0-RC1.tar.gz /opt
# cd /opt
# tar zxvf snortcenter-agent-v1.0-RC1.tar.gz
# cd sensor
# ./setup.sh,回答幾個問題即完成安裝,默認埠2525。
# cp /etc/snort.conf /etc/snort.eth0.conf
# 具體如圖:
# 如要卸載到/etc/snort/目錄下,有一個uninstall文件,./uninstall即可卸載。
《解決方案》

哈哈!真高興!snort+acid終於搞定了!

圖3和4:

[火星人 ] 哈哈!真高興!snort+acid終於搞定了!已經有586次圍觀

http://coctec.com/docs/service/show-post-22885.html