Friday, June 25, 2010

Install Nessus server in Debian - part 2

หลังจากที่เราสร้าง Nessus server ด้วย nessus เวอร์ชั่นใหม่ ๆ ไปแล้ว เรามาลองใช้เวอร์ชั่นเก่า ๆ ดูบ้างไหม




สำหรับคนที่ติดกับการใช้ nessus client เหมือนผม คงจะยอมรับไม่ได้แน่ ๆ หากจะต้องไปทำงานผ่าน web browser เนื่องจากข้อดีของการใช้ nessus client ที่ผมนึกออกคือ

1. สามารถ export report ของ nessus ออกมาในรูปแบบของ .nessus file เพื่อเก็บไว้ และสามารถ import เข้าไปเพื่อดูผ่านโปรแกรม nessus client ได้


2. สามารถเลือกรูปแบบการออก report ได้ ว่า จะให้ report ออกมาในรูปแบบไหน



ในเวอร์ชั่นใหม่ หากเราจะทำให้ได้แบบนี้ คงต้องเสียเงินซื้อ License1 แบบ professional feed ล่ะครับ

เมื่อเราเห็นข้อดีเหล่านี้แล้ว ลองมาติดตั้งกันดูเลยครับ โดยจะมีขั้นตอนการติดตั้ง nessus ดังนี้

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

ไป download เวอร์ชั่นของ nessus ที่เป็นเวอร์ชั่นต่ำกว่า 4.0.2 (ของผมใช้เวอร์ชั่น 4.0.1)

เริ่ม ติดตั้ง โดยใช้คำสั่ง dpkg -i Nessus-4.0.1-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

จากนั้นให้เรา Update Plugins ล่าสุด โดยใช้คำสั่ง

/opt/nessus/sbin/nessusd -R

รอจนกระทั่ง Update เรียบร้อย ให้ restart เครื่อง

หลังจาก restart แล้ว ให้เริ่มใช้งานโดยใช้คำสั่ง

/etc/init.d/nessusd start


วิธี ตรวจสอบว่า service ยังทำงานอยู่หรือเปล่า ให้เราใช้คำสั่ง netstat -anp | grep nessus

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

scan:~# netstat -anp | grep nessus
tcp 0 0 0.0.0.0:1241 0.0.0.0:* LISTEN 2333/nessusd
tcp6 0 0 :::1241 :::* LISTEN 2333/nessusd
unix 2 [ ACC ] STREAM LISTENING 5573 2333/nessusd /opt/nessus//var/nessus/nessusd.sock

เท่านี้ ก็สามารถใช้งานได้แล้วครับ

PS สำหรับใครที่อ่านบทความนี้แล้ว อยากลองทำดูบ้าง แต่ไปหา Download version ของ nessus 4.0.1 ไม่ได้ ส่งเมล์มาหาผมเลย จะจัดส่งให้ครับ

ที่มา : www.nessus.org