Registrations to Open-AudIT forums are now closed. To ask any new questions please visit Opmantek Community Questions.

Open-AudIT

What's on your network?
It is currently Sat Apr 20, 2024 10:47 am

All times are UTC + 10 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 21 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Tue Apr 15, 2014 2:19 am 
Offline
Newbie
User avatar

Joined: Sat Apr 12, 2014 7:10 am
Posts: 10
Anyone else seeing this? I supply an SNMP community string either through configuring the default string or specifically stating in the discovery form, and the string is not used during discovery--in fact, the debug shows the SNMP status as FALSE.

[code]LOG - Apr 14 10:10:08 oae.somedomain.com 15709 C:discovery F:discover_subnet U:NMIS Discovery submitted for 10.0.0.1.

Command: /usr/local/open-audit/other/discover_subnet.sh subnet=10.0.0.1 url=http://10.0.0.11/open-audit/index.php/discovery/process_subnet submit_online=n echo_output=y create_file=n debugging=0 subnet_timestamp="2014-04-14 10:10:08"

Return Code: 0 (0 indicates success).
Output of the command (as an array):
<devices>
<device>
<subnet>10.0.0.1</subnet>
<man_ip_address>10.0.0.1</man_ip_address>
<mac_address></mac_address>
<manufacturer></manufacturer>
<type>unknown</type>
<os_name></os_name>
<description>
<![CDATA[]]></description>
<org_id></org_id>
<snmp_status>false</snmp_status>
<ssh_status>true</ssh_status>
<wmi_status>false</wmi_status>
<p80_status>true</p80_status>
<p443_status>false</p443_status>
<tel_status>true</tel_status>
<subnet_timestamp>2014-04-14 10:10:08</subnet_timestamp>
</device>
</devices>
DEBUG - Starting process_subnet.
DEBUG - Back to input page
DEBUG - Front Page
LOG - Apr 14 10:10:08 oae.somedomain.com 15709 C:discovery F:process_subnet Start processing 10.0.0.1.
DEBUG - find system_key: 708
DEBUG - SNMP Status: false
DEBUG - WMI Status: false
DEBUG - SSH Status: true
LOG - Apr 14 10:10:08 oae.somedomain.com 15709 C:discovery F:process_subnet WMI Status: false 10.0.0.1.
LOG - Apr 14 10:10:08 oae.somedomain.com 15709 C:discovery F:process_subnet SNMP Status: false 10.0.0.1.
LOG - Apr 14 10:10:08 oae.somedomain.com 15709 C:discovery F:process_subnet SSH Status: true 10.0.0.1.
DEBUG - Nmap update for 708
LOG - Apr 14 10:10:08 oae.somedomain.com 15709 C:discovery F:process_subnet Nmap update for 10.0.0.1 (System ID 708).
DEBUG - System ID 708
LOG - Apr 14 10:10:09 oae.somedomain.com 15709 C:discovery F:process_subnet No credentials supplied for SSH audit for 10.0.0.1 (System ID 708).
Finish processing 10.0.0.1
LOG - Apr 14 10:10:09 oae.somedomain.com 15709 C:discovery F:process_subnet Completed processing 10.0.0.1.[/code]

_________________
~R0cketman

Server Info:
OS : CentOS 6.x
Auditing: 1366 machines (and counting)
LDAP: OpenLDAP


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 15, 2014 2:58 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1259
discover_subnet.sh does this to determine snmp_status:
[code] # test for SNMP
snmp_status="false"
command=$(nmap -n -sU -p161 "$host" 2>/dev/null | grep "161/udp open")
if [[ "$command" == *"161/udp open"* ]]; then
snmp_status="true"
fi[/code]
So what does the following output?
[code]nmap -n -sU -p161 "10.0.0.1"[/code]


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 15, 2014 3:05 am 
Offline
Newbie
User avatar

Joined: Sat Apr 12, 2014 7:10 am
Posts: 10
It shows as open:

[code][root@oae ~]# nmap -n -sU -p161 "10.0.0.1"

Starting Nmap 5.51 ( http://nmap.org ) at 2014-04-14 11:04 MDT
Nmap scan report for 10.0.0.1
Host is up (0.00074s latency).
PORT STATE SERVICE
161/udp open snmp

Nmap done: 1 IP address (1 host up) scanned in 0.10 seconds[/code]

_________________
~R0cketman

Server Info:
OS : CentOS 6.x
Auditing: 1366 machines (and counting)
LDAP: OpenLDAP


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 15, 2014 6:49 am 
Offline
Newbie
User avatar

Joined: Sat Apr 12, 2014 7:10 am
Posts: 10
From the OAE guest, I can even run an snmp walk to/from this device as well...

[code][root@oae ~]# snmpwalk -v2c -cattask 10.0.0.1 | head
SNMPv2-MIB::sysDescr.0 = STRING: Brocade Communications Systems, Inc. Stacking System FCX648S-PREM, IronWare Version 07.2.02eT7f3 Compiled on Oct 12 2011 at 15:18:01 labeled as FCXR07202f
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.1991.1.3.48.2.4
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2740159404) 317 days, 3:33:14.04
SNMPv2-MIB::sysContact.0 = STRING:
SNMPv2-MIB::sysName.0 = STRING: core
SNMPv2-MIB::sysLocation.0 = STRING: AtTask Corporate Office
SNMPv2-MIB::sysServices.0 = INTEGER: 6
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORID.1 = OID: SNMPv2-SMI::zeroDotZero
SNMPv2-MIB::sysORDescr.1 = STRING:[/code]

_________________
~R0cketman

Server Info:
OS : CentOS 6.x
Auditing: 1366 machines (and counting)
LDAP: OpenLDAP


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 15, 2014 8:53 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1259
If this command requires root maybe Apache isn't seeing the same output?


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 16, 2014 1:54 am 
Offline
Newbie
User avatar

Joined: Sat Apr 12, 2014 7:10 am
Posts: 10
Is the command actually being run as the apache user? It looks to me like the same return:

[quote]bash-4.1$ snmpwalk -v2c -cattask 10.0.0.1 | head
SNMPv2-MIB::sysDescr.0 = STRING: Brocade Communications Systems, Inc. Stacking System FCX648S-PREM, IronWare Version 07.2.02eT7f3 Compiled on Oct 12 2011 at 15:18:01 labeled as FCXR07202e
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.1991.1.3.48.2.4
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2746969004) 317 days, 22:28:10.04
SNMPv2-MIB::sysContact.0 = STRING:
SNMPv2-MIB::sysName.0 = STRING: core
SNMPv2-MIB::sysLocation.0 = STRING: AtTask Corporate Office
SNMPv2-MIB::sysServices.0 = INTEGER: 6
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORID.1 = OID: SNMPv2-SMI::zeroDotZero
SNMPv2-MIB::sysORDescr.1 = STRING:


By the logs, it looks to me like the string isn't even being passed along to the 'agent', otherwise, I think we'd see a failure rather than a false in the logs? Here's something interesting, however. When running nmap as the apache user, I see:

[code]bash-4.1$ nmap -n -sU -p161 10.0.0.1
You requested a scan type which requires root privileges.
QUITTING![/code]

It must be the flags the script uses, because permissions on the /usr/bin/nmap file are 755. In fact, for whatever reason, it looks to me to be the -sU as I can run the -n (no DNS resolution) alone without problem.

_________________
~R0cketman

Server Info:
OS : CentOS 6.x
Auditing: 1366 machines (and counting)
LDAP: OpenLDAP


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 16, 2014 2:24 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1259
You need to run the discovery script as root from a cron or something.

It looks like when you run the discovery from the web server the Apache process runs the discovery script which tries to see if the target is running SNMP but fails because NMAP doesn't have privileges for the type of scan it needs. The script then reports back to the server that a particular target does not support SNMP and thus the server does not probe SNMP when adding the target to the database.

The trick you may be missing is that the script does not use any SNMP information at all. It only reports back to the server if the target has something listening on the SNMP port. This is the snmp_status true/false you see in the log. If the script returns snmp_status= true then the server will probe for SNMP info using the community string when adding the system to the database.


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 16, 2014 3:10 am 
Offline
Newbie
User avatar

Joined: Sat Apr 12, 2014 7:10 am
Posts: 10
Ultimately, running a cron job on the collector is really not a problem--we were planning on doing it anyway. However, I can't imagine I'm the only person running into this problem. I'm using the virtual appliance provided by Opmantek. Can you duplicate the issue?

Running the discovery script manually appears to work:

[code][root@oae other]# /usr/local/open-audit/other/discover_subnet.sh subnet=10.0.0.1 url=http://10.0.0.11/open-audit/index.php/discovery/process_subnet submit_online=y echo_output=y create_file=n debugging=0
Nmap scan report for 10.0.0.1
<devices>
<device>
<subnet>10.0.0.1</subnet>
<man_ip_address>10.0.0.1</man_ip_address>
<mac_address></mac_address>
<manufacturer></manufacturer>
<type>unknown</type>
<os_name></os_name>
<description><![CDATA[]]></description>
<org_id></org_id>
<snmp_status>true</snmp_status>
<ssh_status>true</ssh_status>
<wmi_status>false</wmi_status>
<p80_status>true</p80_status>
<p443_status>false</p443_status>
<tel_status>false</tel_status>
<subnet_timestamp></subnet_timestamp>
</device>
</devices>

<devices><device><subnet>10.0.0.1</subnet><subnet_timestamp></subnet_timestamp><complete>y</complete></device></devices>[/code]

_________________
~R0cketman

Server Info:
OS : CentOS 6.x
Auditing: 1366 machines (and counting)
LDAP: OpenLDAP


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 16, 2014 3:22 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1259
We run Windows here but I did try the nmap command on a Linux box and saw the root required message and guessed that is what is happening.

It would be up to the OpenAudit developers how to deal with this. I think the only way would be some sore of capabilities set up that allows non-root users the minimal capabilities necessary (raw packet access, etc.) I'm not a fan of the web scanning stuff and think it's easier just to set up cron jobs for full functionality.


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 16, 2014 3:27 am 
Offline
Newbie
User avatar

Joined: Sat Apr 12, 2014 7:10 am
Posts: 10
[quote="jpa"]It would be up to the OpenAudit developers how to deal with this. I think the only way would be some sore of capabilities set up that allows non-root users the minimal capabilities necessary (raw packet access, etc.) I'm not a fan of the web scanning stuff and think it's easier just to set up cron jobs for full functionality.

I don't see in a cron job how to specify the snmp community string so these devices get fully scanned. Could you please provide an example?

When Mark gets back from holiday, I'll check with him to see what we can do to get the discover_subnet script fully-functional for the apache user (or whatever user(s) is/are running the scripts).

_________________
~R0cketman

Server Info:
OS : CentOS 6.x
Auditing: 1366 machines (and counting)
LDAP: OpenLDAP


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 16, 2014 3:35 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1259
I am doing a horrible job of explaining how this works but....

The OpenAudit server does the SNMP scanning when a system is added to the database by the script. There are no scripts that use SNMP. So the discover subnet script scans the subnet and finds a system at 10.0.0.1, checks to see if something is listening on the SNMP port and posts back to the server that it found a system at 10.0.0.1 that seems to be listening to SNMP. The server accepts the post, sees that the system might have SNMP enabled and does it's own scan of 10.0.0.1 using the default SNMP community string, or the system specific one if the system is already in the database and has a custom community string defined.


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 16, 2014 5:47 am 
Offline
Newbie
User avatar

Joined: Sat Apr 12, 2014 7:10 am
Posts: 10
Ha! No worries. What you've said clarifies things.

I'm running a scan now against an entire Class C subnet and it's been running now for almost 2 hours. Does that seem slow? The command I used was:
[code]/usr/local/open-audit/other/discover_subnet.sh subnet=10.0.0.0/24 url=http://10.0.0.11/open-audit/index.php/discovery/process_subnet submit_online=y echo_output=y create_file=n debugging=0[/code]

_________________
~R0cketman

Server Info:
OS : CentOS 6.x
Auditing: 1366 machines (and counting)
LDAP: OpenLDAP


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 16, 2014 6:05 am 
Offline
Moderator

Joined: Fri Jul 20, 2007 8:27 am
Posts: 1259
I would set debugging=1 to see where it's going slow.


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 16, 2014 4:31 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 07, 2004 11:48 am
Posts: 1964
Location: Brisbane, Australia
Quick post because I'm away with very limited internet. Install guide states to use the sticky bit on nmap. Look it up. Enables apache user to run nmap as if it's root.

_________________
Support and Development hours available from [url=https://opmantek.com]Opmantek[/url].
Please consider a purchase to help make Open-AudIT better for everyone.


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 22, 2014 2:55 am 
Offline
Newbie
User avatar

Joined: Sat Apr 12, 2014 7:10 am
Posts: 10
[quote="Mark"]Quick post because I'm away with very limited internet. Install guide states to use the sticky bit on nmap. Look it up. Enables apache user to run nmap as if it's root.

Mark: I assume you're meaning the 'chmod u+s /usr/bin/nmap' from the documentation? I made an assumption that in the virtual appliance, it was already done. ;-) Lots of assumptions made here by me, I know. I made the modification but still see the same 'false' for the snmp status:

[code]
[root@oae ~]# ls -alh /usr/bin/nmap
-rwsr-xr-x 1 root root 766K May 30 2013 /usr/bin/nmap

LOG - Apr 21 10:37:17 oae.domain.com 16942 C:discovery F:discover_subnet U:NMIS Discovery submitted for 10.0.0.1.

Command: /usr/local/open-audit/other/discover_subnet.sh subnet=10.0.0.1 url=http://10.0.0.11/open-audit/index.php/discovery/process_subnet submit_online=n echo_output=y create_file=n debugging=0 subnet_timestamp="2014-04-21 10:37:17"

Return Code: 0 (0 indicates success).
Output of the command (as an array):
<devices>
<device>
<subnet>10.0.0.1</subnet>
<man_ip_address>10.0.0.1</man_ip_address>
<mac_address></mac_address>
<manufacturer></manufacturer>
<type>general purpose</type>
<os_name>OpenBSD 4.0</os_name>
<description>
<![CDATA[OpenBSD 4.0 (85%)]]></description>
<org_id></org_id>
<snmp_status>false</snmp_status>
<ssh_status>true</ssh_status>
<wmi_status>false</wmi_status>
<p80_status>true</p80_status>
<p443_status>true</p443_status>
<tel_status>false</tel_status>
<subnet_timestamp>2014-04-21 10:37:17</subnet_timestamp>
</device>
</devices>
DEBUG - Starting process_subnet.
DEBUG - Back to input page
DEBUG - Front Page
LOG - Apr 21 10:37:27 oae.domain.com 16942 C:discovery F:process_subnet Start processing 10.0.0.1.
DEBUG - find system_key: 1357
DEBUG - SNMP Status: false
DEBUG - WMI Status: false
DEBUG - SSH Status: true
LOG - Apr 21 10:37:27 oae.domain.com 16942 C:discovery F:process_subnet WMI Status: false 10.0.0.1.
LOG - Apr 21 10:37:27 oae.domain.com 16942 C:discovery F:process_subnet SNMP Status: false 10.0.0.1.
LOG - Apr 21 10:37:27 oae.domain.com 16942 C:discovery F:process_subnet SSH Status: true 10.0.0.1.
DEBUG - Nmap update for 1357
LOG - Apr 21 10:37:27 oae.domain.com 16942 C:discovery F:process_subnet Nmap update for 10.0.0.1 (System ID 1357).
DEBUG - System ID 1357
LOG - Apr 21 10:37:27 oae.domain.com 16942 C:discovery F:process_subnet No credentials supplied for SSH audit for 10.0.0.1 (System ID 1357).
Finish processing 10.0.0.1
LOG - Apr 21 10:37:27 oae.domain.com 16942 C:discovery F:process_subnet Completed processing 10.0.0.1.[/code]

_________________
~R0cketman

Server Info:
OS : CentOS 6.x
Auditing: 1366 machines (and counting)
LDAP: OpenLDAP


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC + 10 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group