From 5f5e2e7debf4597da79c86f4a101e27313dd579c Mon Sep 17 00:00:00 2001 From: 12ww1160 <12ww1160@confdroid.com> Date: Sat, 14 Feb 2026 21:21:43 +0100 Subject: [PATCH] OP#436 add user access --- README.md | 4 ++++ manifests/params.pp | 6 ++++++ manifests/server/access_rules.pp | 9 ++++++++- templates/nagios/htpasswd_head.erb | 2 ++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 templates/nagios/htpasswd_head.erb diff --git a/README.md b/README.md index 6d74bc9..7e33389 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ - [Synopsis](#synopsis) - [WARNING](#warning) - [Features](#features) + - [configuring user access](#configuring-user-access) - [Repo Documentation](#repo-documentation) - [Dependencies](#dependencies) - [Deployment](#deployment) @@ -33,6 +34,9 @@ Nagios is a powerful open source software solution for monitoring your IT enviro - if FQDN equals the specified `ng_nagios_server`, nagios server with all required specs is installed, else only nagios client packages and the target specs - if `ng_include_nrpe`is set to `true`, the confdroid_nrpe module is automatically applied on clients ([confdroid_nrpe](https://sourcecode.confdroid.com/confdroid/confdroid_nrpe) must be in the catalogue then ) +### configuring user access +ToDo + ## Repo Documentation See the full Puppet documentation including parameters in `docs/index.html` diff --git a/manifests/params.pp b/manifests/params.pp index 152b037..bcfa512 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -28,6 +28,10 @@ # to use HTTPS. Default is false. We recommend using a reverse proxy # with SSL termination in front of the Nagios web interface, so this is # disabled by default. +# @param [String] ng_main_user The username for the Nagios web interface. +# Default is 'nagios'. +# @param [String] ng_main_password The encrypted password for the Nagios web +# interface. Default is 'nagios'. ############################################################################### class confdroid_nagios::params ( @@ -37,6 +41,8 @@ class confdroid_nagios::params ( Array $ng_reqpackages_client = ['net-snmp-utils','nagios-plugins','nagios-plugins-all','nagios-plugins-nrpe','nagios-common'], String $ng_pkg_ensure = 'present', Boolean $ng_include_nrpe = true, + String $ng_main_user = 'nagios', + String $ng_main_password = 'nagios', # httpd Boolean $ng_use_https = false, diff --git a/manifests/server/access_rules.pp b/manifests/server/access_rules.pp index e60556d..1a98341 100644 --- a/manifests/server/access_rules.pp +++ b/manifests/server/access_rules.pp @@ -21,5 +21,12 @@ class confdroid_nagios::server::access_rules ( seluser => system_u, notify => Service[$ng_nagios_service], } - } + + # manage file header + concat::fragment { 'fle_header': + target => $ng_htpasswd_file, + content => template($ng_htpasswd_head), + order => '000', + } + } } diff --git a/templates/nagios/htpasswd_head.erb b/templates/nagios/htpasswd_head.erb new file mode 100644 index 0000000..56a99c1 --- /dev/null +++ b/templates/nagios/htpasswd_head.erb @@ -0,0 +1,2 @@ +<%= @ng_main_user %>:<%= @ng_main_password %> +# custom lines below