سلام دوستان
خوب این مقاله برای امنیت سرورهای لینوکسی با استفاده از یک سیستم ids بسیار قوی با نام
OSSEC HIDS هست .
این مقاله ای که توضیح میدم روی روی Debian هست . (یه مقداری از دستورات) .
کار با این IDS خیلی ساده هست و فقط باید دانلود کنید و نصب کنید .
اول از همه این دستورات را اجرا کنید تا این IDS را دانلود کنید .
برای دانلود :
cd /tmp
wget http://www.ossec.net/files/ossec-hids-0.9-1a.tar.gz
و برای نصب پکیج tarbal:
tar xvfz ossec-hids-1.5.1.tar.gz
حالا install script رو اجرا میکنیم :
cd ossec-hids-0.9-1a
./install.sh
حالا install script از شما سوال میپرسه :
** Para instalação em português, escolha
.
** Fur eine deutsche Installation wohlen Sie [de].
** For installation in English, choose [en].
** Para instalar en Español , eliga [es].
** Pour une installation en français, choisissez [fr]
** Per l'installazione in Italiano, scegli [it].
** æ¥æ¬èªã§ã¤ã³ã¹ãã¼ã«ãã¾ãï¼é¸æãã¦ä¸ãã
ï¼[jp].
** Aby instalowaÄ w jÄzyku Polskim, wybierz [pl].
** ÐÐ»Ñ Ð¸Ð½ÑÑÑÑкÑий по ÑÑÑановке на ÑÑÑÑком ,введиÑе [ru].
** Türkçe kurulum için seçin
. (en/br/de/es/fr/it/jp/pl/ru/tr) [en]: <-- en (or one of the other options, if you don't want to use English)
OSSEC HIDS v0.9-1 Installation Script - http://www.ossec.net
You are about to start the installation process of the OSSEC HIDS. You must have a C compiler pre-installed in your system. If you have any questions or comments, please send an e-mail to dcid@ossec.net (or daniel.cid@gmail.com).
- System: Linux server1.example.com 2.6.8-2-386 - User: root - Host: server1.example.com
-- Press ENTER to continue or Ctrl-C to abort. -- <-- [ENTER]
1- What kind of installation do you want (server, agent, local or help)? <-- local
- Choose where to install the OSSEC HIDS [/var/ossec]: <-- /var/ossec
3.1- Do you want e-mail notification? (y/n) [y]: <-- y
- What's your e-mail address? <-- example@example.com (please enter your own email address here)
- We found your SMTP server as: mail.example.com. - Do you want to use it? (y/n) [y]: <-- y (normally you can accept the installer's proposal, unless you want to use another SMTP server)
3.2- Do you want to run the integrity check daemon? (y/n) [y]: <-- y
3.3- Do you want to run the rootkit detection engine? (y/n) [y]: <-- y
- Do you want to enable active response? (y/n) [y]: <-- y
- Do you want to enable the firewall-drop response? (y/n) [y]: <-- y
- Do you want to add more IPs to the white list? (y/n)? [n]: <-- n (unless you want to whitelist more IP addresses) |
جوابها جلوشون هست .
- System is Linux (SysV).
- Init script modified to start OSSEC HIDS during boot.
Adding system startup for /etc/init.d/ossec ...
/etc/rc0.d/K20ossec -> ../init.d/ossec
/etc/rc1.d/K20ossec -> ../init.d/ossec
/etc/rc6.d/K20ossec -> ../init.d/ossec
/etc/rc2.d/S20ossec -> ../init.d/ossec
/etc/rc3.d/S20ossec -> ../init.d/ossec
/etc/rc4.d/S20ossec -> ../init.d/ossec
/etc/rc5.d/S20ossec -> ../init.d/ossec
- Configuration finished properly.
- To start OSSEC HIDS:
/var/ossec/bin/ossec-control start
- To stop OSSEC HIDS:
/var/ossec/bin/ossec-control stop
- The configuration can be viewed or modified at /var/ossec/etc/ossec.conf
Thanks for using the OSSEC HIDS.
If you have any question, suggestion or if you find any bug,
contact us at
contact@ossec.net or using our public maillist at
ossec-list@ossec.net(
http://mailman.underlinux.com.br/mailman/listinfo/ossec-list).
More information can be found at
http://www.ossec.net--- Press ENTER to finish (maybe more information below). --- <-- [ENTER]
آفرین درسته .... حالا سرویس نصب شده و آماده برای شروع کار هست .
حالا این دستور را توی terminal تایپ کنید تا سرویس run بشه :
/etc/init.d/ossec start
خروجی به صورت زیر هست :
server1:/etc/init.d# /etc/init.d/ossec start
Starting OSSEC HIDS v0.9-1 (by Daniel B. Cid)...
Started ossec-maild...
Started ossec-execd...
Started ossec-analysisd...
Started ossec-logcollector...
Started ossec-syscheckd...
Completed.
server1:/etc/init.d#
همونطور که دوستان ملاحظه کردن طی مراحل نصب .... یک سری فایلهای start up رو هم نصب کرده .
موقعی که سیستم restart بشه به صورت اتوماتیک سرویس ران میشه .
بعد از این مراحل از پروسه های در حال اجرا یه لیست میگیریم .
ps aux
خروجی مشابه زیر هست :
ossecm 2038 0.0 0.4 1860 792 ? S 12:40 0:00 /var/ossec/bin/ossec-maild root 2042 0.0 0.3 1736 648 ? S 12:40 0:00 /var/ossec/bin/ossec-execd ossec 2046 0.2 0.5 2192 1136 ? S 12:40 0:00 /var/ossec/bin/ossec-analysisd root 2050 0.0 0.2 1592 556 ? S 12:40 0:00 /var/ossec/bin/ossec-logcollector root 2054 12.2 0.3 1756 616 ? S 12:40 0:05 /var/ossec/bin/ossec-syscheckd
فایلهای log درون این مسیر هستند :
/var/ossec/logs/ossec.log
حالا میریم با دستور tail ببینیم چه خبره ؟!
tail -f /var/ossec/logs/ossec.log
با این دستور هم 100 خط از log files را مشاهده میکنیم :
tail -n 100 /var/ossec/logs/ossec.log
به محض اینکه این IDS چیز مشکوکی را مشاهده کنه خبر چینی به mail شما شروع میشه :
حالا این سوال پیش میاد که چطوری ایمیل را ثبت کنیم داخل این نرم افزار .
برای تغئیر setting ها این کار انجام دهید :
vi /var/ossec/etc/ossec.conf
با این کار ویرایشگر vi فایل پیکربندی را برای شما باز میکنه و این ظاهر میشه :
<ossec_config>
<global>
<email_notification>yes</email_notification>
<email_to>example@example.com</email_to>
<smtp_server>mail.example.com.</smtp_server>
<email_from>ossecm@example.com</email_from>
</global>
[...]
موقعی که تغیرات را داخل این فایل انجام دادین این دستور را اجرا کنین برای restart کردن تنظیمات .
/etc/init.d/ossec restart
خوب تمام شد .
کپی رایت این مقاله برای دوست عزیزم آرش (kernel|2007) هست که یه سری تغییرات را توش انجام دادم .
متشکر .
thanks to kernel|2007
L0pht
Snoop-Security