I got Nessus 3.0.6 and the Nessus 3.0 beta5 GUI Client working very nicely on BackTrack2, so I would like to share with you guys how to install it and build a module for it. I am a real Linux newbie, and BackTrack2 is probably the first distro that I am seriously experimenting with(and it was damn good choice), so go easy :-)

EDIT: This tutorial has been updated to use the beta5 version of the Nessus client

Installing Nessus
---------------
1. Download Nessus and the Nessus client, they can be found at http://www.nessus.org/download/index.php, you need to register download Nessus. You MUST register with a valid e-mail address in order to get plugin updates.

You should have the following files:

Nessus-3.0.6-fc5.i386.rpm
NessusClient-3.0.0-es4.i386.rpm

You should NOT have any other RPM's. They will not work! These packages are distro version specific and as far as I know, these distro versions(FC5 and RHELES4) are the only ones that work on BT2.

2. Convert the RPMs
Code:
 rpm2tgz Nessus-3.0.6-fc5.i386.rpm
 rpm2tgz NessusClient-3.0.0.beta5-es4.i386.rpm
3. Run pkgtool in the same directory where you converted the RPM's
Code:
pkgtool
4. From the pkgtool menu, choose Current(Install packages from the current directory) and follow the steps to install Nessus and the Nessus client

5. Pkgtool(I don't know if it supposed to or not) does not add the library links in ld.so.conf, so we are going to have to add them manually, as follows:
Code:
vi /etc/ld.so.conf
add a new line, and enter the following /opt/nessus/lib
save and close
ldconfig
6. Were not done yet! We need to make some symlinks for libcrypto and libssl versions that Nessus and the Nessus client require, as follows:
Code:
cd /usr/lib
ln -s libcrypto.so libcrypto.so.4 //client
ln -s libcrypto.so libcrypto.so.6 //nessus
ln -s libssl.so libssl.so.4
ln -s libssl.so libssl.so.6
EDIT: At this point, you might want to run ldconfig for good measure

7. The bin paths do not get added to the path variable($PATH) so need to add the paths as follows:

Code:
 export PATH=$PATH:/opt/nessus/sbin:/opt/nessus/bin:
You MUST edit /etc/profile in order to make the paths stick, locate the PATH line and add /opt/nessus/bin and /opt/nessus/sbin. It should look something like this:

Code:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/apache/bin:/usr/local/pgsql/bin:/opt/mono/bin:/usr/local/pgsql/bin:/opt/nessus/bin:/opt/nessus/sbin:."
You should be able to run nessus now

8. To fix the Nessus Client menu icon, open /usr/share/applications/NessusClient.desktop with your text editor of choice and edit the following line as follows:
Code:
 Icon=/usr/share/pixmaps/NessusClient.png
Building a Nessus module
------------------------
1. Follow steps 1 and 2 above.

2. Once you have converted the RPM's, create a directory for the Nessus installation files.
Code:
 mkdir <dir/path>
I am going to use /tmp/nessus-3.0.0.6 and /tmp/nessusclient-3.0.0b5 for this example.

3. Run installpkg to copy the installation files to the directory that you created above. The '-root' switch is very important, it redirects the package installation to the directory that you created in the previous step.
Code:
 installpkg -root /tmp/nessus-3.0.0.6 Nessus-3.0.6-fc5.i386.rpm
 installpkg -root /tmp/nessusclient-3.0.0b5 NessusClient-3.0.0.beta5-es4.i386.rpm
You can delete the var directory that installpkg creates.

You should have the following directory structure:
Code:
/tmp/nessus-3.0.0.6
-opt
-etc

/tmp/nessusclient-3.0.0b5
-opt
-usr
4. Now we need to create the symlinks needed by nessus and the nessus client, see step 7 above:
Code:
Nessus:
 cd /tmp/nessus-3.0.0.6
 mkdir usr
 mkdir usr/lib
 cd usr/lib
 ln -s /usr/lib/libcrypto.so libcrypto.so.6
 ln -s /usr/lib/libssl.so libssl.so.6
 
Client
 cd /tmp/nessusclient-3.0.0b5 
 mkdir usr/lib
 cd usr/lib
 ln -s /usr/lib/libcrypto.so libcrypto.so.4
 ln -s /usr/lib/libssl.so libssl.so.4
5. If you wish, fix the menu icon for the Nessus client, see step 9 above.

6. Create your module using either the 'Build SLAX module' from the Konqueror context menu or dir2lzm .

7. When you boot up BT with the module, the lib path is added to /etc/ld.so.conf, however it seems that ldconfig runs before this happens so you MUST run ldconfig again BEFORE running Nessus.
Code:
 make sure the path is in ld.so.conf
 cat /etc/ld.so.conf
 look for /opt/nessus/lib
 ldconfig
8. The /opt/nessus/sbin path does not get added to the path variable($PATH) so you need to add the path as follows, in order to run the Nessus daemon:
Code:
 export PATH=PATH$:/opt/nessus/sbin:
You should be able to run Nessus now...

Configuration
-------------
Follow The_Captain's how-to or for a basic configuration, run the following:
Code:
 cd /opt/nessus/sbin
 nessus-mkcert
 nessus-add-first-user
 nessusd -D
EDIT: Here is a quick start/stop/restart script that I put together:
Code:
#!/bin/sh

clear

nessusBasePath=/opt/nessus

test -x $nessusBasePath/sbin/nessusd || {
 echo "Unable to locate the Nessus daemon(nessusd), Nessus may not be installed correctly!"
 exit 1
}

getPid() 
{
 if test -f  $nessusBasePath/var/nessus/nessusd.pid; then
  echo $(cat $nessusBasePath/var/nessus/nessusd.pid)
 else
  echo 0
 fi
}

start() 
{
 if [ $(getPid) != 0 ]; then
  echo "The Nessus daemon has already been started!"
  exit 1
 fi

 echo "Starting the Nessus daemon..."

 $nessusBasePath/sbin/nessusd -D
 
 sleep 4

 nessusdPID=$(getPid)

 if [ $nessusdPID != 0 ]; then
  echo "nessusd PID:" $nessusdPID
  echo "The Nessus daemon had been started"
  exit 1 
 else
  echo "Failed to start the Nessus daemon!"
  exit 1
 fi
}


stop() 
{
 echo "Stopping the Nessus daemon..."
 nessusdPID=$(getPid)
 if [ $nessusdPID != 0 ]; then
  echo "Killing PID:" $nessusdPID
  kill $nessusdPID
  echo "The Nessus daemon has been stopped"
  return 0
 else
  echo "Failed to stop the Nessus daemon!"
  exit 1
 fi
}

restart() 
{
 stop
 sleep 4
 start
}

case $1 in 
 start)
  start
  ;;
 stop)
  stop
  ;;
 restart)
  restart
  ;;
*)
  echo "Usage $0 {start|stop|restart}"
  exit 1

esac
Last but not least, check your e-mail for the Nessus plugin feed code. This will allow you to register Nessus and update the plugins. You should receive and e-mail from them with a code. Register Nessus as follows:

Code:
 /opt/nessus/bin/nessus-fetch --register  XXXX-XXXX-XXXX-XXXX-XXXX
Where XXXX-XXXX-XXXX-XXXX-XXXX is your feed code. They usually include the command in the e-mail so all you have to do is copy and paste.

Just a quick note, I ran BT off of a USB drive on a machine that had 256MB RAM, and after starting nessusd, X would partially start and then hang, killing the nessusd process solved the problem. It looks like nessus is a bit of a memory hog, so if you plan on using nessus and the nessus GUI client, make sure the machine that you are using has 512+ MB RAM.


HTH

E