From 3bd54a36afb4f35cdeaa7d578dfaf4d30bfd35b7 Mon Sep 17 00:00:00 2001
From: Arne Teuke
Date: Sun, 30 Jul 2017 17:51:22 +0100
Subject: [PATCH 1/5] added details to sudo rule
---
README.md | 1 +
manifests/params.pp | 2 +-
manifests/selinux/config.pp | 37 +++++++++++++++++++++++++++++++++++++
templates/sudo_rule.erb | 3 +++
4 files changed, 42 insertions(+), 1 deletion(-)
create mode 100644 manifests/selinux/config.pp
diff --git a/README.md b/README.md
index 2f48d87..fb30a83 100644
--- a/README.md
+++ b/README.md
@@ -88,6 +88,7 @@ There are currently no mandatory parameters, i.e. the module will function right
* `$ne_incl_fw` : Whether to manage relevant firewall rules through this modules. Defaults to `true`.
* `$ne_include_selinux` : Whether to manage selinux exception rules. Defaults to `true`.
* `$ne_enable_ssl` : Whether to allow SSL settings. See [known problems](#konwn-problems) for more details.
+* `$ne_allow_sudo : Whether to allow the nagios / nrpe user to use sudo by default. Controls both the setting `command_prefix` and application of a sudo rule. Defaults to `false` as it usually is not required for most of the checks.
### Managing Check Commands
In order to connect a Nagios monitoring server to clients through NRPE, you must define commands and the desired argument strings on the clients. The default NRPE installation comes with a few examples of such commands, which are also included in this module. However, every environment is very different in their requirements and Nagios via Puppet is all about the ability to dynamicically set command arguments based on default variables / overrides. For that reason no hard-coded commands are included, but instead all commands are set via argument strings, where possible.
diff --git a/manifests/params.pp b/manifests/params.pp
index b87607e..fe6231a 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -123,7 +123,7 @@ $ne_listen_queue_size = '5',
$ne_nagios_server = $::nagios_server,
$ne_dont_blame_nrpe = '1',
$ne_allow_bash_cmd_subst = '1',
-$ne_allow_sudo = true,
+$ne_allow_sudo = false,
$ne_command_prefix = '/usr/bin/sudo',
$ne_command_timeout = '60',
$ne_connection_timeout = '300',
diff --git a/manifests/selinux/config.pp b/manifests/selinux/config.pp
new file mode 100644
index 0000000..06d9168
--- /dev/null
+++ b/manifests/selinux/config.pp
@@ -0,0 +1,37 @@
+## cd_nrpe::selinux::config.pp # Module name: cd_nrpe
+# Author: Arne Teuke (arne_teuke@ConfDroid.com)
+# # License:
+# This file is part of cd_nrpe.
+#
+# cd_nrpe is used for providing automatic configuration of NRPE
+# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+# @summary Class manages all aspects of configuring selinux for NRPE.
+##############################################################################
+class cd_nrpe::selinux::config (
+
+) inherits cd_nrpe::params {
+
+ if $ne_include_selinux == true
+
+ # manage allow nagios sudo
+
+ exec { 'nagios_run_sudo':
+ command => 'setsebool -P nagios_run_sudo 1',
+ path => ['/usr/bin','/usr/sbin'],
+ cwd => '/tmp',
+ unless => 'getsebool nagios_run_sudo | awk '{print$3}' | grep -ic "on"'
+ }
+ }
+}
diff --git a/templates/sudo_rule.erb b/templates/sudo_rule.erb
index b69acca..269df3a 100644
--- a/templates/sudo_rule.erb
+++ b/templates/sudo_rule.erb
@@ -2,5 +2,8 @@
##### sudo_rule managed by Puppet | manual changes will be overwritten #####
################################################################################
+Defaults:nrpe !requiretty
+Defaults:nagios !requiretty
+
nagios ALL=(ALL) NOPASSWD: /usr/lib64/nagios/plugins/
nrpe ALL=(ALL) NOPASSWD: /usr/lib64/nagios/plugins/
From 97ae206fc0ae30a993bf029cc471dc27b942eae5 Mon Sep 17 00:00:00 2001
From: Arne Teuke
Date: Sun, 30 Jul 2017 17:52:17 +0100
Subject: [PATCH 2/5] added selinux boolean
---
manifests/main/service.pp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/manifests/main/service.pp b/manifests/main/service.pp
index 7c41593..5669ca4 100644
--- a/manifests/main/service.pp
+++ b/manifests/main/service.pp
@@ -34,6 +34,10 @@ class cd_nrpe::main::service (
require cd_nrpe::commands::definition_rules
}
+ if $ne_include_selinux == true {
+ require cd_nrpe::selinux::config
+ }
+
service { $ne_service:
ensure => running,
hasstatus => true,
From fb36a697dfe257d5b178f3012c060a77d5e15edd Mon Sep 17 00:00:00 2001
From: Arne Teuke
Date: Sun, 30 Jul 2017 17:55:59 +0100
Subject: [PATCH 3/5] added selinux boolean
---
manifests/selinux/config.pp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/manifests/selinux/config.pp b/manifests/selinux/config.pp
index 06d9168..5e30685 100644
--- a/manifests/selinux/config.pp
+++ b/manifests/selinux/config.pp
@@ -23,7 +23,7 @@ class cd_nrpe::selinux::config (
) inherits cd_nrpe::params {
- if $ne_include_selinux == true
+ if $ne_include_selinux == true {
# manage allow nagios sudo
From 27d1b70d6198a0bf595eb30e9f571f480db7b0ff Mon Sep 17 00:00:00 2001
From: Arne Teuke
Date: Sun, 30 Jul 2017 17:58:43 +0100
Subject: [PATCH 4/5] added selinux boolean
---
manifests/selinux/config.pp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/manifests/selinux/config.pp b/manifests/selinux/config.pp
index 5e30685..ee0200b 100644
--- a/manifests/selinux/config.pp
+++ b/manifests/selinux/config.pp
@@ -31,7 +31,7 @@ class cd_nrpe::selinux::config (
command => 'setsebool -P nagios_run_sudo 1',
path => ['/usr/bin','/usr/sbin'],
cwd => '/tmp',
- unless => 'getsebool nagios_run_sudo | awk '{print$3}' | grep -ic "on"'
+ unless => 'getsebool nagios_run_sudo | awk \'{print$3}\' | grep -ic "on"'
}
}
}
From ec7f399399f478df4a255c2ebd5a7d5a0751bacb Mon Sep 17 00:00:00 2001
From: Jenkins Server
Date: Sun, 30 Jul 2017 18:58:35 +0200
Subject: [PATCH 5/5] recommit for updates in build 56
---
CHANGELOG.md | 10 +
REPOSTRUCTURE.md | 4 +-
doc/_index.html | 7 +-
doc/file.README.html | 7 +-
doc/index.html | 7 +-
doc/puppet_class_list.html | 7 +
doc/puppet_classes/cd_nrpe.html | 2 +-
...e_3A_3Acommands_3A_3Adefinition_rules.html | 2 +-
.../cd_nrpe_3A_3Afirewall_3A_3Aiptables.html | 2 +-
.../cd_nrpe_3A_3Amain_3A_3Aconfig.html | 2 +-
.../cd_nrpe_3A_3Amain_3A_3Adirs.html | 2 +-
.../cd_nrpe_3A_3Amain_3A_3Afiles.html | 2 +-
.../cd_nrpe_3A_3Amain_3A_3Ainstall.html | 2 +-
.../cd_nrpe_3A_3Amain_3A_3Aservice.html | 12 +-
.../cd_nrpe_3A_3Amain_3A_3Auser.html | 2 +-
doc/puppet_classes/cd_nrpe_3A_3Aparams.html | 8 +-
.../cd_nrpe_3A_3Aselinux_3A_3Aconfig.html | 180 ++++++++++++++++++
...d_nrpe_3A_3Acommands_3A_3Adefinitions.html | 2 +-
doc/top-level-namespace.html | 2 +-
19 files changed, 243 insertions(+), 19 deletions(-)
create mode 100644 doc/puppet_classes/cd_nrpe_3A_3Aselinux_3A_3Aconfig.html
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6e75469..3912976 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,16 @@ Changelog of Git Changelog.
$ne_enable_ssl : Whether to allow SSL settings. See known problems for more details.
+
+
$ne_allow_sudo : Whether to allow the nagios / nrpe user to
+use sudo by default. Controls both the
+settingcommand_prefixand application of a sudo rule. Defaults
+tofalse` as it usually is not required for most of the checks.
$ne_enable_ssl : Whether to allow SSL settings. See known problems for more details.
+
+
$ne_allow_sudo : Whether to allow the nagios / nrpe user to
+use sudo by default. Controls both the
+settingcommand_prefixand application of a sudo rule. Defaults
+tofalse` as it usually is not required for most of the checks.
+ Class manages all aspects of configuring selinux for NRPE.
+
+
Overview
+
+
+
+
cd_nrpe::selinux::config.pp # Module name: cd_nrpe
+Author: Arne Teuke
+(arne_teuke@ConfDroid.com)
+
+
License:
+
+
This file is part of cd_nrpe.
+
+
cd_nrpe is used for providing automatic configuration of NRPE
+ Copyright
+(C) 2016 ConfDroid (copyright@ConfDroid.com)
+ This program is free
+software: you can redistribute it and/or modify
+ it under the terms of the
+GNU General Public License as published by
+ the Free Software Foundation,
+either version 3 of the License, or
+ (at your option) any later version.
+
+
This program is distributed in the hope that it will be useful,
+ but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License
+for more details.
+
+
You should have received a copy of the GNU General Public License
+ along
+with this program. If not, see www.gnu.org/licenses/.