VnLamp

Go Back   VnLamp > Linux Resources > VnLAMP.com - Articles

Trả lời
 
LinkBack Ðiều Chỉnh Xếp Bài
Setup Base theo dõi Snort trên CentOS 4/5
Old
  (#1 (permalink))
LM
 
Status: Offline
Posts: 195
Tham gia: Dec 2007
BQT VNLAMP
 
LM's Avatar
Default Setup Base theo dõi Snort trên CentOS 4/5 - 10-01-2008, 20:10 10-01-2008

Bài viết này sẽ hướng dẫn các bước thực hiện.

1. Chuẩn bị các gói phần mềm trước

-
snort-2.8.0.1.tar.gz download từ: http://www.snort.org
- http://jaist.dl.sourceforge.net/sour...e-1.3.9.tar.gz
- adodb.tar http://easynews.dl.sourceforge.net/s...b/adodb480.tgz
- Máy đã có cài mysql, mysql-server, mysql-devel
- libpcap-devel
- libnet 1.0.2 http://www.packetfactory.net/libnet/...-1.0.2a.tar.gz
- snortrules-snapshot-2.6 http://www.snort.org/pub-bin/downloa...hot-2.6.tar.gz

2. Compile & Install Libnet

tar zxvf libnet-1.0.2a.tar.gz
cd libnet-1.0.2.a
./configure
make && make install


3. Compile & Install Snort


tar zxvf snort-2.8.0.1.tar.gz
cd snort-2.8.0.1
./configure --with-mysql --enable-dynamicplugin
make && make install

Xong tiếp:

groupadd snort
useradd -g snort snort –s /sbin/nologin
mkdir /etc/snort
mkdir /etc/snort/rules
mkdir /var/log/snort

Vào thư mục source của snort-2.8.0.1, vào tiếp thư mục etc, xong:

cp * /etc/snort

Xả nén gói rule snort

tar zxvf snortrules-snapshot-2.6.tar.gz
cd snortrules-snapshot-2.6/rules
cp * /etc/snort/rules

Setup script startup cho snort

cd /etc/init.d/
wget http://internetsecurityguru.com/snortinit/snort
chmod 755 snort
chkconfig --add snort
chkconfig snort on

Edit file /etc/snort/snort.conf

Uncomment line: 773

output database: log, mysql, user=root password=root dbname=snort host=localhost

NOTE: ở đây config dùng user root/root, bạn nên chọn user khác cho snort.

Tạo DB cho snort

mysql -u root -proot
mysql>create database `snort`;
mysql>quit

Vào thư mục source của snort-2.8.0.1, vào tiếp thư mục schemas

mysql -u root -proot snort < create_mysql

4. Cấu hình BASE và ADODB

Bạn phải có web server, php, các pear của php

yum install -y httpd php php-mysql php-common php-cli php-gd*
pear install Image_Graph-alpha Image_Canvas-alpha Image_Color Numbers_Roman

copy 02 file mới download base và adodb vào thư mục chứa web, thường là /var/www/htdocs hoăc /var/www/html [1]

Xong, xả 02 gói đó, đổi tên folder basexxx thành base.

Vào thư mục base:

mv base_conf.php.dist base_conf.php

Xong, edit file base_conf.php

Thiết lập các thông số:

$BASE_urlpath = "http://<yoursite>/base";

$DBlib_path = '<đường dẫn web chỗ [1]>/adodb/';

$alert_dbname = 'snort';
$alert_host = 'localhost';
$alert_port = '';
$alert_user = 'root';
$alert_password = 'root';

5.Start Snort và test

service snort start

Nếu ... [ OK ] thì vào http://<yoursite>/base

Còn fail thì debug check bằng command

/usr/local/bin/snort -i eth0 -c /etc/snort/snort.conf -D

Good Luck.


LM
   
Trả Lời Với Trích Dẫn
Old
  (#2 (permalink))
 
Status: Offline
Posts: 2
Tham gia: Feb 2008
Junior Member
 
jackythanh's Avatar
Default 19-02-2008, 16:19 19-02-2008

Chào Admin,

Mình vừa cài gói source của snort 2.8.0.1 trên nền CentOS 5, nhưng không chạy được. Nó báo lỗi thế này khi mình chạy với lệnh snort -c /etc/snort/snort.conf :

Trích:
database: compiled support for ( )
database: configured to use mysql
database: 'mysql' support is not compiled into this build of snort

ERROR: If this build of snort was obtained as a binary distribution (e.g., rpm,
or Windows), then check for alternate builds that contains the necessary
'mysql' support.

If this build of snort was compiled by you, then re-run the
the ./configure script using the '--with-mysql' switch.
For non-standard installations of a database, the '--with-mysql=DIR'
syntax may need to be used to specify the base directory of the DB install.

See the database documentation for cursory details (doc/README.database).
and the URL to the most recent database plugin documentation.
Fatal Error, Quitting..
Lúc mình cài gói source snort thì mình chạy với các lệnh:configure --with-mysql; make; make install. Việc cài đặt thành công, khi configure thì checking mysql báo là yes. Còn tập tin cấu hình snort có dòng:
Trích:
output database: log, mysql, user=snort password=xyz dbname=snort host=localhost
với user snort có toàn quyền trên csdl snort.
Mình đang dùng Mysql version: 5.0.22-2.2.el5_1.1

JT
   
Trả Lời Với Trích Dẫn
Old
  (#3 (permalink))
LM
 
Status: Offline
Posts: 195
Tham gia: Dec 2007
BQT VNLAMP
 
LM's Avatar
Default 19-02-2008, 17:19 19-02-2008

Cho mình hỏi tí, bạn cài trên i386 hay 64bit? Và rpm -qa | grep mysql show cho mình check các deps


I'm quit.
   
Trả Lời Với Trích Dẫn
Old
  (#4 (permalink))
 
Status: Offline
Posts: 2
Tham gia: Feb 2008
Junior Member
 
jackythanh's Avatar
Default 03-03-2008, 15:3 03-03-2008

Chào Admin,

Dòng rpm -qa | grep mysql cho ra dòng sau:
Trích:
mysql-devel-5.0.22-2.2.el5_1.1
mysql-bench-5.0.22-2.2.el5_1.1
libdbi-dbd-mysql-0.8.1a-1.2.2
php-mysql-5.1.6-15.el5
mysql-connector-odbc-3.51.12-2.2
mysql-5.0.22-2.2.el5_1.1
mysql-server-5.0.22-2.2.el5_1.1
Dòng uname -a ra dòng sau đây

Trích:
Linux CentOS5 2.6.18-8.el5 #1 SMP Thu Mar 15 19:57:35 EDT 2007 i686 i686 i386 GNU/Linux
Mình cài trên CentOS4 xong rồi, tất cả đều chạy tốt (với mysql-4.xxxx).

Từ trước tới giờ có trục trặc trong lúc cài là chổ pear install, không thể nào chạy y chang "pear install Image_Graph-alpha Image_Canvas-alpha Image_Color Numbers_Roman". Mình phải cài theo kiểu bỏ các gói cũ, sau đó install theo kiểu pear upgrade --force http://pear....../....tgz
   
Trả Lời Với Trích Dẫn
Old
  (#5 (permalink))
 
Status: Offline
Posts: 2
Tham gia: Aug 2008
Junior Member
Default 15-09-2008, 16:15 15-09-2008

mình đã làm và cấu hình đầy đủ nhưng sao base vẫn không hiển thị được các gói tin mà snort bắt được.
   
Trả Lời Với Trích Dẫn
Old
  (#6 (permalink))
 
Status: Offline
Posts: 7
Tham gia: Apr 2008
Học viên VNLAMP
Default 12-10-2009, 17:12 12-10-2009

Chào các anh!

Mình gặp phải vấn đề sau: mình đã cài đặt Snort và Base thành công, chạy thử và cũng có alert. Nhưng base không hiển thị traffic gì hết, còn alert thì chỉ hiển thị một thông tin ngắn ngủi là Added 3 alert(s) to the Alert cache, khi refesh lại là thông tin này lập tức biến mất và cũng không thể tìm thấy lại chúng.
Mình đã kiểm tra trong acid_event table thì có rất nhiều alert còn lưu lại, nhưng Base không thể hiển thị.

Thanks các anh trước!

thay đổi nội dung bởi: blackhs, 12-10-2009 lúc 17:12 12-10-2009.
   
Trả Lời Với Trích Dẫn
Old
  (#7 (permalink))
 
Status: Online
Posts: 459
Tham gia: Dec 2007
Administrator
 
patrick's Avatar
Default 12-10-2009, 21:12 12-10-2009

Chao cac ban,

Cac ban coi lai cac buoc tren LM viet rat ro rang roi do. cai la chay.

Chuc cac ban thanh cong


Kinh nghiệm của chúng tôi là kiến thức của bạn
  Send a message via Yahoo to patrick  
Trả Lời Với Trích Dẫn
Old
  (#8 (permalink))
 
Status: Offline
Posts: 511
Tham gia: Dec 2007
BQT VNLAMP
 
goldenbook's Avatar
Default 13-10-2009, 16:13 13-10-2009

Hi all,
Tôi thấy bài của LM làm theo sure là chạy. còn bị lỗi thì các bạn phải xem kỹ mình đã làm đúng các bước LM đã chỉ chưa nha.
Tôi làm trên CnetOS5.3 chạy vù vù nè!


Success inlife isn't a given. It's costs attitude, ambition and acceptance.
   
Trả Lời Với Trích Dẫn
Old
  (#9 (permalink))
 
Status: Offline
Posts: 7
Tham gia: Apr 2008
Học viên VNLAMP
Default 14-10-2009, 17:14 14-10-2009

Hi all!

Các anh có thể cho mình hỏi là khái niệm Alert Cache trong Base phải hiểu như thế nào được không?

Thanks!
   
Trả Lời Với Trích Dẫn
Old
  (#10 (permalink))
 
Status: Offline
Posts: 7
Tham gia: Apr 2008
Học viên VNLAMP
Default 20-10-2009, 11:20 20-10-2009

Chào các anh!

Khi em chạy dòng:
Code:
pear install Image_Graph-alpha Image_Canvas-alpha Image_Color Numbers_Roman
Thì hiện ra thông báo sau:
Code:
HTTP error, got response: HTTP/1.1 410 Gone
Didn't receive 200 OK from remote server. (HTTP/1.1 410 Gone)
Theo em hiểu thì dòng trên phục vụ cho việc vẽ đồ thị và các mức TCP,UDP,ICMP...phải không các anh?

Thanks!
   
Trả Lời Với Trích Dẫn
Trả lời


Ðiều Chỉnh
Xếp Bài

Quyền Sử Dụng Ở Diễn Ðàn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Smilies đang Mở
[IMG] đang Mở
HTML đang Tắt
Trackbacks are Mở
Pingbacks are Mở
Refbacks are Mở


Múi giờ GMT. Hiện tại là 14:23 23-05-2012.