From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- web/attachments/263441-check_mailq-add-sudo.patch | 57 +++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 web/attachments/263441-check_mailq-add-sudo.patch (limited to 'web/attachments/263441-check_mailq-add-sudo.patch') diff --git a/web/attachments/263441-check_mailq-add-sudo.patch b/web/attachments/263441-check_mailq-add-sudo.patch new file mode 100644 index 0000000..dff08c3 --- /dev/null +++ b/web/attachments/263441-check_mailq-add-sudo.patch @@ -0,0 +1,57 @@ +diff -Naur /home/qqnagio/software/nagios/nagios-plugins-1.4.11/plugins-scripts/check_mailq.pl /home/qqnagio/software/nagios/nagios-plugins-1.4.11.sudomailq/plugins-scripts/check_mailq.pl +--- /home/qqnagio/software/nagios/nagios-plugins-1.4.11/plugins-scripts/check_mailq.pl 2006-07-05 15:45:57.000000000 +0200 ++++ /home/qqnagio/software/nagios/nagios-plugins-1.4.11.sudomailq/plugins-scripts/check_mailq.pl 2008-01-23 14:52:01.556368612 +0100 +@@ -62,12 +62,29 @@ + }; + alarm($opt_t); + ++# if there is an entry in the sudoers file which allows the caller of this ++# plugin to execute the $utils::PATH_TO_MAILQ command with superuser privileges ++# then prepend $utils::PATH_TO_MAILQ with "sudo " ++ ++sub sudoize { ++ my $ppath_to_mailq = shift; ++ if (grep(/$$ppath_to_mailq/, ++ map { s/^\s+//g; s/\s+$//g; $_; } ++ map { split /, / } ++ map { s/^.*?://g; $_; } ++ do { local (@ARGV) = "/usr/bin/sudo -l |"; <> })) { ++ $$ppath_to_mailq = "/usr/bin/sudo ".$$ppath_to_mailq; ++ } ++} ++ ++ + # switch based on MTA + + if ($mailq eq "sendmail") { + + ## open mailq + if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { ++ sudoize(\$utils::PATH_TO_MAILQ); + if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { + print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; + exit $ERRORS{'UNKNOWN'}; +@@ -297,6 +314,7 @@ + + ## open mailq + if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { ++ sudoize(\$utils::PATH_TO_MAILQ); + if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { + print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; + exit $ERRORS{'UNKNOWN'}; +@@ -379,6 +397,7 @@ + + # open qmail-qstat + if ( defined $utils::PATH_TO_QMAIL_QSTAT && -x $utils::PATH_TO_QMAIL_QSTAT ) { ++ sudoize(\$utils::PATH_TO_MAILQ); + if (! open (MAILQ, "$utils::PATH_TO_QMAIL_QSTAT | " ) ) { + print "ERROR: could not open $utils::PATH_TO_QMAIL_QSTAT \n"; + exit $ERRORS{'UNKNOWN'}; +@@ -461,6 +480,7 @@ + elsif ( $mailq eq "exim" ) { + ## open mailq + if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { ++ sudoize(\$utils::PATH_TO_MAILQ); + if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { + print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; + exit $ERRORS{'UNKNOWN'}; -- cgit v1.2.3-74-g34f1