[Pkg-nagios-changes] nagios-nrpe/debian/patches 00list, 1.1, 1.2 02_global-cmd-prefix.dpatch, NONE, 1.1

seanius at haydn.debian.org seanius at haydn.debian.org
Tue Oct 25 14:06:15 UTC 2005


Update of /cvsroot/pkg-nagios/nagios-nrpe/debian/patches
In directory haydn:/org/alioth.debian.org/chroot/home/users/seanius/tmp/cvs-serv21915/debian/patches

Modified Files:
	00list 
Added Files:
	02_global-cmd-prefix.dpatch 
Log Message:
global command prefix

Index: 00list
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios-nrpe/debian/patches/00list,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- 00list	25 Oct 2005 13:08:39 -0000	1.1
+++ 00list	25 Oct 2005 14:06:10 -0000	1.2
@@ -1 +1,2 @@
 01_nodevrandom-and-docoptions.dpatch
+02_global-cmd-prefix.dpatch

--- NEW FILE: 02_global-cmd-prefix.dpatch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 
## debian/patches/02_global-cmd-prefix.dpatch
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
diff -ru ../../ee/nagios-nrpe-2.0/nrpe.cfg.in ./nrpe.cfg.in
--- ../../ee/nagios-nrpe-2.0/nrpe.cfg.in	2003-03-06 05:10:33.000000000 +0100
+++ ./nrpe.cfg.in	2005-10-05 15:15:44.000000000 +0200
@@ -80,6 +80,25 @@
 dont_blame_nrpe=0
 
 
+# COMMAND PREFIX
+# This option gives the possibility to prefix commands to be run with a prefix.
+# There is no default, so no prefix, a good example could be /usr/bin/sudo.
+# It is important to have at least one space after the command, or it wont work.
+#
+# Usage scenario: Have your whole nagios (and nrpe) configuration autogenerated
+# on a central place. Now you dont need to redefine it, just because on one
+# host you need extra rights to do the checks.
+# Or alternatively: You want to watch restricted things. Give nagios user read
+# access via sudo and be done.
+# Note: You need nagios in your /etc/sudoers. An example for the plugins from
+# the nagios-plugins package is:
+# nagios          ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/
+# This lets the nagios user run all commands in that directory (and only them)
+# without asking for a password. Of course you shouldnt give random users write
+# access there!
+
+# command_prefix=/usr/bin/sudo 
+
 
 # DEBUGGING OPTION
 # This option determines whether or not debugging messages are logged to the
diff -ru ../../ee/nagios-nrpe-2.0/src/nrpe.c ./src/nrpe.c
--- ../../ee/nagios-nrpe-2.0/src/nrpe.c	2003-09-09 04:52:37.000000000 +0200
+++ ./src/nrpe.c	2005-10-05 15:09:25.000000000 +0200
@@ -60,6 +60,7 @@
 char    server_address[16]="0.0.0.0";
 int     socket_timeout=DEFAULT_SOCKET_TIMEOUT;
 int     command_timeout=DEFAULT_COMMAND_TIMEOUT;
+char    command_prefix[1024]="";
 
 command *command_list=NULL;
 
@@ -339,6 +340,8 @@
 				return ERROR;
 			        }
 		        }
+		else if(!strcmp(varname,"command_prefix"))
+		  strncpy(command_prefix,varvalue,sizeof(command_prefix) -1);
 
 		else if(!strcmp(varname,"server_address")){
                         strncpy(server_address,varvalue,sizeof(server_address) - 1);
@@ -483,7 +486,7 @@
 		return ERROR;
 
 	strcpy(new_command->command_name,command_name);
-	strcpy(new_command->command_line,command_line);
+	snprintf(new_command->command_line, MAX_COMMANDLINE_LENGTH, "%s%s", command_prefix, command_line);
 
 	/* add new command to head of list in memory */
 	new_command->next=command_list;







More information about the Pkg-nagios-changes mailing list