at 17.09-beta 2.6 kB view raw
1From 75a3ec48814e7b9a9b22259a04009076363be3f1 Mon Sep 17 00:00:00 2001 2From: Igor Kolar <igor.kolar@gmail.com> 3Date: Thu, 17 Oct 2013 00:48:23 +0200 4Subject: [PATCH 1/2] node: added --servicedir switch to munin-node 5 6This code is copied over from munin-node-config, that already does the same 7--- 8 node/sbin/munin-node | 7 ++++++- 9 1 file changed, 6 insertions(+), 1 deletion(-) 10 11diff --git a/node/sbin/munin-node b/node/sbin/munin-node 12index 7b2e180..0a93450 100755 13--- a/node/sbin/munin-node 14+++ b/node/sbin/munin-node 15@@ -35,7 +35,7 @@ use Munin::Node::OS; 16 use Munin::Node::Service; 17 use Munin::Node::Server; 18 19-my $servicedir; 20+my $servicedir = "$Munin::Common::Defaults::MUNIN_CONFDIR/plugins"; 21 my $sconfdir = "$Munin::Common::Defaults::MUNIN_CONFDIR/plugin-conf.d"; 22 my $conffile = "$Munin::Common::Defaults::MUNIN_CONFDIR/munin-node.conf"; 23 my $DEBUG = 0; 24@@ -101,6 +101,7 @@ sub parse_args 25 26 print_usage_and_exit() unless GetOptions( 27 "config=s" => \$conffile, 28+ "servicedir=s" => \$servicedir, 29 "debug!" => \$DEBUG, 30 "pidebug!" => \$PIDEBUG, 31 "paranoia!" => \$paranoia, 32@@ -166,6 +167,10 @@ and returning the output they produce. 33 34 Use E<lt>fileE<gt> as configuration file. [@@CONFDIR@@/munin-node.conf] 35 36+=item B<< --servicedir <dir> >> 37+ 38+Override plugin directory [@@CONFDIR@@/plugins/] 39+ 40 =item B< --[no]paranoia > 41 42 Only run plugins owned by root. Check permissions as well. [--noparanoia] 43-- 441.8.4 45 46 47From b8e17cbe73ae4c71b93ff5687ba86db1d0c1f5bd Mon Sep 17 00:00:00 2001 48From: Steve Schnepp <steve.schnepp@pwkf.org> 49Date: Thu, 17 Oct 2013 11:52:10 +0200 50Subject: [PATCH 2/2] node: untaint the service-dir args 51 52--- 53 node/sbin/munin-node | 6 +++++- 54 1 file changed, 5 insertions(+), 1 deletion(-) 55 56diff --git a/node/sbin/munin-node b/node/sbin/munin-node 57index 0a93450..909c8c4 100755 58--- a/node/sbin/munin-node 59+++ b/node/sbin/munin-node 60@@ -99,9 +99,10 @@ sub parse_args 61 { 62 my @ORIG_ARGV = @ARGV; 63 64+ my $servicedir_cmdline; 65 print_usage_and_exit() unless GetOptions( 66 "config=s" => \$conffile, 67- "servicedir=s" => \$servicedir, 68+ "servicedir=s" => \$servicedir_cmdline, 69 "debug!" => \$DEBUG, 70 "pidebug!" => \$PIDEBUG, 71 "paranoia!" => \$paranoia, 72@@ -109,6 +110,9 @@ sub parse_args 73 "help" => \&print_usage_and_exit, 74 ); 75 76+ # We untaint the args brutally, since the sysadm should know what he does 77+ $servicedir = $1 if defined $servicedir_cmdline && $servicedir_cmdline =~ m/(.*)/; 78+ 79 # Reset ARGV (for HUPing) 80 @ARGV = @ORIG_ARGV; 81 82-- 831.8.4 84