diff --git a/manifests/client/target.pp b/manifests/client/target.pp index 7ddeee6..b35af5c 100644 --- a/manifests/client/target.pp +++ b/manifests/client/target.pp @@ -41,7 +41,7 @@ class cd_nagios::client::target ( group => 'nagios', mode => '0664', check_command => "check_ping!${ng_ping_warn}!${ng_ping_crit}", - notify => Service ['nagios'], + notify => Service['nagios'], } @@nagios_service { "root_partition_${::hostname}": diff --git a/manifests/params.pp b/manifests/params.pp index df74e86..7a0e6ea 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -194,9 +194,12 @@ # "Send Notification" to be unchecked. # @param [boolean] ng_use_selinux_tools Whether to enable selinux tools and # policies. only effective if selinux is enabled. -# @param [array] ng_required_hosts Array of FQDNs for hosts which should be -# allowed/required. every entry in the array creates a new line in the -# configuration file. +# @param [array] ng_required_hosts Array of **__FQDNs__** for hosts which +# should be allowed/required. every entry in the array creates a new line in +# the configuration file. +# @param [array] ng_required_ips Array of **__Ip addresses __** for hosts which +# should be allowed/reqired. every entry in the array creates a new line in +# the configuration file ############################################################################### class cd_nagios::params ( @@ -306,6 +309,7 @@ $ng_use_selinux_tools = true, # httpd $ng_required_hosts = [''], +$ng_required_ips = ['127.0.0.0/8'], ) { diff --git a/manifests/server/access.pp b/manifests/server/access.pp index 6637997..14d1c7a 100644 --- a/manifests/server/access.pp +++ b/manifests/server/access.pp @@ -19,6 +19,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # @summary Define manages user- and password rules for accessing nagios. +# @param [string] ng_htpasswd_user user name for the /etc/nagios/passwd file +# @param [string] ng_htpasswd_password the encrypted password for the +# /etc/nagios/passwd file. ############################################################################## define cd_nagios::server::access ( diff --git a/templates/httpd/nagios_conf.erb b/templates/httpd/nagios_conf.erb index 92bd19d..afb6f4d 100644 --- a/templates/httpd/nagios_conf.erb +++ b/templates/httpd/nagios_conf.erb @@ -19,10 +19,14 @@ ScriptAlias /nagios/cgi-bin/ "/usr/lib64/nagios/cgi-bin/" = 2.3> Require all granted - Require local +<% if @ng_required_hosts %> <% @ng_required_hosts.each do |required_host| -%> Require host <%= required_host %> -<% end -%> +<% end end -%> +<% if @ng_required_ips %> +<% @ng_required_hosts.each do |required_ips| -%> + Require ip <%= required_ips %> +<% end end -%> AuthName "Nagios Access" AuthType Basic AuthUserFile /etc/nagios/passwd @@ -52,11 +56,14 @@ Alias /nagios "/usr/share/nagios/html" = 2.3> Require all granted - Require local +<% if @ng_required_hosts %> <% @ng_required_hosts.each do |required_host| -%> Require host <%= required_host %> -<% end -%> - +<% end end -%> +<% if @ng_required_ips %> +<% @ng_required_hosts.each do |required_ips| -%> + Require ip <%= required_ips %> +<% end end -%> AuthName "Nagios Access" AuthType Basic AuthUserFile /etc/nagios/passwd