Wednesday, June 16, 2010

Install Nessus server in Debian

หลังจากที่เราสร้าง Linux Server เปล่า ๆ ขึ้นมาแล้ว ถ้าจะทำให้เป็น vulnerability scanning server
Application แรก ๆ ที่เรานึกถึง คือ Nessus

ซึ่งเราจะมีขั้นตอนการติดตั้ง nessus ดังนี้

Login ด้วยสิทธิ์ของ root หรือจะใช้ sudo ก็ได้

ไป download version ล่าสุดของ nessus ที่ http://www.nessus.org/download/nessus_download.php
เริ่มติดตั้ง โดยใช้คำสั่ง dpkg -i Nessus-4.2.2-debian5_i386.deb

หลังจากติดตั้งเรียบร้อยก็เปิดใช้งาน โดยใช้คำสั่ง /etc/init.d/nessusd start

ไปขอรหัสลงทะเบียนใช้งาน nessus ที่ http://www.nessus.org/plugins/index.php?view=register
เมื่อเข้าไประบบจะให้กรอก e-mail แล้วทาง nessus จะส่ง e-mail รหัสในการลงทะเบียนมาให้

เมื่อได้รหัสมาแล้ว ซึ่งรหัสจะเป็นชุดตัวอักษรผสมตัวเลข อยู่ 5 ชุด ให้เรา พิมพ์คำสั่งนี้ลงไป

/opt/nessus/bin/nessus-fetch --register xxxx-xxxx-xxxx-xxxx-xxxx

ระบบจะขึ้นข้อความว่า

Your activation code has been registered properly - thank you.
Now fetching the newest plugin set from plugins.nessus.org...
Your Nessus installation is now up-to-date.
If auto_update is set to 'yes' in nessusd.conf, Nessus will
update the plugins by itself.


ซึ่งเมื่อเราเข้าไปดูที่ /opt/nessus/etc/nessus/nessusd.conf จะเห็นว่า auto_update เป็น yes อยู่แล้ว แสดงว่าระบบจะ Update ให้เราอัตโนมัติอยู่แล้ว ไม่ต้องไปแก้ไขอะไร

เพื่อเป็นการป้องกันไม่ให้ใครเข้ามาใช้ Nessus นี้ เราต้องระบุ user ที่เข้าใช้งาน โดยใช้คำสั่ง

/opt/nessus/sbin/nessus-adduser

Login : user1
Login password : ********
Login password (again) : ********
Do you want this user to be a Nessus 'admin' user ? (can upload plugins, etc...) (y/n) [n]: กด n

User rules
----------
nessusd has a rules system which allows you to restrict the hosts
that user1 has the right to test. For instance, you may want
him to be able to scan his own host only.
Please see the nessus-adduser manual for the rules syntax
Enter the rules for this user, and enter a BLANK LINE once you are done :
(the user can have an empty rules set)

กด Enter

Login : user1
Password : ***********
Rules :

Is that ok ? (y/n) [y] กด y
User added
วิธีตรวจสอบว่า service ยังทำงานอยู่หรือเปล่า ให้เราใช้คำสั่ง ps –ef | grep nessus

จะขึ้นรายละเอียดมาประมาณนี้

scan:~# ps -ef | grep nessus
root 17133 1 0 12:37 ? 00:00:00 /opt/nessus/sbin/nessus-service -D -q
root 17134 17133 78 12:37 pts/1 00:08:33 nessusd -q
root 17163 17046 0 12:48 pts/1 00:00:00 grep nessus


Edit : เนื่องจาก Nessus Server เวอร์ชั่น 4.2.2 ที่เป็น license แบบ Homefeed ไม่ support การใช้งาน Nessus client ที่ port TCP/1241 อีกต่อไป ดังนั้น การเข้าใช้งาน จึงต้องเข้าผ่านทาง Web browser เท่านั้น โดยเข้าไปที่ https://Servername or Server IP:8834


ที่มา : www.nessus.org