OpenNetAdmin

Track. Automate. Configure.

Home About Features Community Develop
Download this project as a tar.gz file

nmap plugin

caleb99

09-11-2010 09:26:58

I have a new install of ONA on a Ubuntu 10.04 server. I have everything up and running but the nmap cron job. I can manually submit the command and specify a subnet to scan with the -n parm, but I can not run the command any other way. If I do the -l parm I get an "ERROR => The requested module is not valid!" message. It seems like it will not look at the ONA database to get the list of subnets to scan.

Matt

09-11-2010 11:58:06

Its possible your environment does not have all it needs when running from cron. If you are able to use dcm.pl with no issues from your normal login then I think you'll need to check into crons environment. It needs to be able to find its config file etc

my /etc/cron.d/ona file looks like this:

# Please store only OpenNetAdmin related cron entries here.
#ONABASE=`cat /etc/onabase`
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin/:/opt/ona/bin

# Perform a daily nmap ping scan and update last_response
# Found it is best to ping during the day to pick up laptops that might be gone at night
0 11 * * * root nmap_scan_cron -u -a > /dev/null 2>&1


The PATH statement at the top ensures it can find stuff in the ONA bin directory.

One other thing to make sure of is that the command "dcm.pl --list" returns a list of modules. specifically look for "ona_sql"..

then try this command to see if it works correctly for you

dcm.pl -l admin -r ona_sql header=no sql=nmap_subnets_only_yes.sql


This is what nmap_scan_cron does to get the list of subnets from the database. You must set the -a option for nmap_scan_cron to get all subnets or you must set the custom attribute "nmap_scan" to Y for the subnets you want to scan.

hope that helps. Thanks