Passive checks with NSCA

Marc Powell marc at ena.com
Thu Dec 4 20:22:50 CET 2003



> -----Original Message-----
> From: Colin A. White [mailto:colin at trematon.com]
> Sent: Thursday, December 04, 2003 12:39 PM
> To: nagios-users at lists.sourceforge.net
> Subject: Re: [Nagios-users] Passive checks with NSCA
> 
> Thanks for the feedback, but this was the crux of my original question
> -  the remote host I'm trying to monitor (running send_nsca) has a
> dynamic private IP... and hence an unresolvable hostname.
> 
> By commenting out this allowed_hosts in ncsa.cfg on the nagios host,
am
> I effectively allowing any/all hosts to submit passive checks?  Or no
> hosts at all?

Ah, yes. Looking at the code, it'll reject all connections because none
will match <null>. I have a potential solution though that may help. A
one line code change to nsca.c will allow you to do a rudimentary
substring match (starting at the left and working right). This may help
you if say the first, second, and/or third octet of the IP is always the
same. For example, I could set
allowed_hosts=127.0.0.1,12.153.6.,208.182. NSCA will now accept all
connections from localhost, any IP's in the 12.153.6 class C or any that
start with 208.182. If I had '12.153.6' with no trailing . it would
match 12.153.6, 12.153.60, 12.153.61, etc... It does open you up a
little from a security perspective, but it's better than accepting from
the whole world. By the way, YMMV as far as the functionality of this
patch. I've tested it and it appears to work as advertised but I haven't
tested all possible values for the allowed_hosts. I would encourage you
to use encryption of the data if you're not already using it for the
most secure implementation.

--- nsca.orig   2003-12-04 13:13:41.000000000 -0600
+++ nsca.c      2003-12-04 13:15:21.000000000 -0600
@@ -1013,7 +1013,8 @@
         temp_buffer[sizeof(temp_buffer)-1]='\0';
 
 
for(temp_ptr=strtok(temp_buffer,",");temp_ptr!=NULL;temp_ptr=strtok(NULL
,",")){
-                if(!strcmp(connecting_host,temp_ptr))
+/*                if(!strcmp(connecting_host,temp_ptr)) */
+
if(!memcmp(connecting_host,temp_ptr,strlen(temp_ptr)))
                         return 1;
                 }

 

--
Marc


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list