[Pkg-nagios-changes] [pkg-nagios] r689 - nagios2/trunk/debian

Sean Finney seanius at costa.debian.org
Tue Jan 31 21:09:15 UTC 2006


Author: seanius
Date: 2006-01-31 21:09:14 +0000 (Tue, 31 Jan 2006)
New Revision: 689

Modified:
   nagios2/trunk/debian/README.Debian
   nagios2/trunk/debian/changelog
   nagios2/trunk/debian/nagios2-common.config
   nagios2/trunk/debian/nagios2-common.postinst
   nagios2/trunk/debian/nagios2-common.postrm
   nagios2/trunk/debian/nagios2-common.templates
Log:
  * cleanup/simplification of http admin username/password handling
    in maintscripts.
  * documentation in README.Debian regarding this.
  * fix in the determining $servers in postinst.
  * the directory removals in the postrm have been updated to reflect
    the nagios2 directory layout.


Modified: nagios2/trunk/debian/README.Debian
===================================================================
--- nagios2/trunk/debian/README.Debian	2006-01-24 21:33:22 UTC (rev 688)
+++ nagios2/trunk/debian/README.Debian	2006-01-31 21:09:14 UTC (rev 689)
@@ -40,3 +40,14 @@
 
 After doing this, both apache and nagios need restarting so that the
 new permissions are picked up by the processes.
+
+Manually Providing / Overriding Authentication Configuration
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The default debian configuration for nagios+apache is to use
+an htpasswd style file in /etc/nagios2/htpasswd.users.  if you
+chose not to (or otherwise didn't) provide a password during package
+configuration, we assume that you know what you're doing and will
+not get in your way.  however, if you don't know what you're doing,
+you should either dpkg-reconfigure nagios2-common and provide
+a password, or read the fine manual for htpasswd(1).

Modified: nagios2/trunk/debian/changelog
===================================================================
--- nagios2/trunk/debian/changelog	2006-01-24 21:33:22 UTC (rev 688)
+++ nagios2/trunk/debian/changelog	2006-01-31 21:09:14 UTC (rev 689)
@@ -1,6 +1,13 @@
-nagios2 (0rc2-2.0-2.0) UNRELEASED; urgency=low
+nagios2 (0rc2-2.0-3) UNRELEASED; urgency=low
 
   * NOT RELEASED YET
+  [sean finney]
+  * cleanup/simplification of http admin username/password handling
+    in maintscripts.
+  * documentation in README.Debian regarding this.
+  * fix in the determining $servers in postinst.
+  * the directory removals in the postrm have been updated to reflect
+    the nagios2 directory layout.
 
  -- Marc Haber <mh+debian-packages at zugschlus.de>  Mon, 23 Jan 2006 19:11:32 +0000
 

Modified: nagios2/trunk/debian/nagios2-common.config
===================================================================
--- nagios2/trunk/debian/nagios2-common.config	2006-01-24 21:33:22 UTC (rev 688)
+++ nagios2/trunk/debian/nagios2-common.config	2006-01-31 21:09:14 UTC (rev 689)
@@ -8,8 +8,6 @@
 default_servers=`wc_httpd_installed $wc_httpd_apaches`
 # convert list to comma seperated list
 server_list=`echo $default_servers | sed -e 's/[[:space:]][[:space:]]*/, /g'`
-# location of default htpasswd access file
-htpwfile="/etc/nagios2/htpasswd.users"
 
 # if they haven't already been prompted, preseed the server selection
 db_fget nagios2/httpd seen
@@ -24,10 +22,10 @@
 
 if [ "$keepgoing" ]; then
 	db_input medium nagios2/nagios1-in-apacheconf || true
-fi
 
-if [ "$keepgoing" ] && [ ! -f "$htpwfile" ] || [ "$1" = "reconfigure" ]; then
-	db_input low nagios2/adminusername || true
+	# the passwords are reset at the end of every postinst run,
+	# however, they are left in the "seen" state so that the
+	# admin is not prompted for them at every upgrade.
 	while [ ! "$passwordsmatch" ]; do
 		db_input medium nagios2/adminpassword || true
 		db_input medium nagios2/adminpassword-repeat || true
@@ -39,7 +37,7 @@
 		if [ "$p1" = "$p2" ]; then
 			passwordsmatch="yes"
 		else
-			db_fset nagios2/adminusername seen false
+			db_fset nagios2/adminpassword seen false
 			db_fset nagios2/adminpassword-repeat seen false
 			db_fset nagios2/adminpassword-mismatch seen false
 			db_input critical nagios2/adminpassword-mismatch || true

Modified: nagios2/trunk/debian/nagios2-common.postinst
===================================================================
--- nagios2/trunk/debian/nagios2-common.postinst	2006-01-24 21:33:22 UTC (rev 688)
+++ nagios2/trunk/debian/nagios2-common.postinst	2006-01-31 21:09:14 UTC (rev 689)
@@ -10,7 +10,10 @@
   set -x
 fi
 
+# location of the default apache configuration for nagios.
 apacheconf=/etc/nagios2/apache2.conf
+# location of the default htpasswd authentication file.
+htpw=/etc/nagios2/htpasswd.users
 
 case "$1" in
   configure)
@@ -22,17 +25,12 @@
 
 	# get the list of selected servers
 	db_get nagios2/httpd
-	servers="echo $RET | sed -e"
-	# get the nagios admin username and password
-	db_get nagios2/adminusername
-	admuser="$RET"
+	servers=`echo $RET | sed -e 's/,/ /g'`
 	db_get nagios2/adminpassword
 	admpass="$RET"
 	# get whether they want support for 1.x urls:
 	db_get nagios2/nagios1-in-apacheconf
 	nagiosone="$RET"
-	# ... done with debconf here
-	db_stop
 
 	# register apache2.conf via ucf:
 	if [ "$nagiosone" = "true" ]; then
@@ -51,14 +49,17 @@
 		fi
 	fi
 
-	# create the htpasswd.users file if it does not exist
-	# XXX this passes the password on the cmdline but i can't
-	# XXX find a better way...
-	htpw="/etc/nagios2/htpasswd.users"
-	if [ -n "$admpass" ] && [ ! -f "$htpw" ]; then
-		htpasswd -bc "$htpw" "$admuser" "$admpass"
+
+	# we reset the password every run, so if it exists we're running
+	# after being specifically given a password and can unconditionally set it.
+	# XXX there's no way of setting the pw w/out giving it on the cmdline? wtf?
+	if [ -n "$admpass" ]; then
+		touch "$htpw"
+		htpasswd -b "$htpw" nagiosadmin "$admpass"
 	fi
 
+	# explicitly set permissions on some files that are dependent
+	# on the uid/gid of the nagios user, which is dynamically created.
 	chown root:nagios /etc/nagios2/resource.cfg
 	chmod 640 /etc/nagios2/resource.cfg
     install -d -onagios -gadm -m2751 /var/log/nagios2
@@ -66,6 +67,12 @@
     install -d -onagios -gnagios -m750 /var/lib/nagios2
     install -d -onagios -gnagios -m750 /var/lib/nagios2/rw
     install -d -onagios -gwww-data -m2750 /var/cache/nagios2
+
+	# everything went well, so now let's reset the password
+	db_reset nagios2/adminpassword
+	db_reset nagios2/adminpassword-repeat
+	# ... done with debconf here
+	db_stop
     ;;
   abort-upgrade|abort-remove|abort-deconfigure)
     ;;

Modified: nagios2/trunk/debian/nagios2-common.postrm
===================================================================
--- nagios2/trunk/debian/nagios2-common.postrm	2006-01-24 21:33:22 UTC (rev 688)
+++ nagios2/trunk/debian/nagios2-common.postrm	2006-01-31 21:09:14 UTC (rev 689)
@@ -1,13 +1,11 @@
-#!/bin/sh
+#!/bin/sh -e
 
-set -e
-
 case "$1" in
   remove)
   	;;
   purge)
-    rm -rf /var/run/nagios /var/log/nagios /var/lib/nagios \
-           /var/cache/nagios
+    rm -rf /var/run/nagios2 /var/log/nagios2 /var/lib/nagios2 \
+	       /var/cache/nagios2
 	rm -f /etc/nagios2/htpasswd.users
 	rm -f /etc/nagios2/apache2.conf
 	ucf --purge /etc/nagios2/apache2.conf

Modified: nagios2/trunk/debian/nagios2-common.templates
===================================================================
--- nagios2/trunk/debian/nagios2-common.templates	2006-01-24 21:33:22 UTC (rev 688)
+++ nagios2/trunk/debian/nagios2-common.templates	2006-01-31 21:09:14 UTC (rev 689)
@@ -13,23 +13,14 @@
  If you would prefer to perform configuration manually, leave all
  servers unselected.
 
-Template: nagios2/adminusername
-Type: string
-_Default: nagiosadmin
-_Description: Nagios web administrative username?
- Please provide the username to be used for administrative access to the
- nagios web interface.  
- .
- This is the username you will use to log in to your nagios installation
- after configuration is complete.
-
 Template: nagios2/adminpassword
 Type: password
 _Description: Nagios web administration password?
- Please provide the password to be created with the nagios web admin user.
+ Please provide the password to be created with the "nagiosadmin" user
  .
- This is the password you will use to log in to your nagios installation
- after configuration is complete.
+ This is the username and password you will use to log in to your nagios
+ installation after configuration is complete.  If you do not provide
+ a password, you will have to configure access to nagios yourself.
 
 Template: nagios2/adminpassword-repeat
 Type: password




More information about the Pkg-nagios-changes mailing list