ports/111345: [maintainer-update] net-mgmt/nagios: Consistent UID and GID of 181 on installation

Jarrod Sayers jarrod at wallace.netleader.com.au
Sat Apr 7 05:10:03 UTC 2007


>Number:         111345
>Category:       ports
>Synopsis:       [maintainer-update] net-mgmt/nagios: Consistent UID and GID of 181 on installation
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr 07 05:10:01 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Jarrod Sayers
>Release:        FreeBSD 6.2-RELEASE-p3 i386
>Organization:
>Environment:
System: FreeBSD wallace.netleader.com.au 6.2-RELEASE-p3 FreeBSD 6.2-RELEASE-p3 #71: Fri Mar 16 20:09:23 CST 2007 root at wallace.netleader.com.au:/usr/obj/usr/src/sys/WALLACE i386
>Description:
The changes contained within this patch force the ports pkg-install script to
use a statically assigned UID and GID of 181 as per ports/[UG]IDs.  Attempts to
install the port on a fresh system will use the new ID's however where the user
or group name already exists, no attempt is made to renumber anything.

To quickly shift dynamic ID's over to the new static ones, the following may be
of some help:

wallace# /usr/local/etc/rc.d/nagios stop
Stopping nagios.
wallace# find / -user nagios -exec chown 181 {} \;
wallace# find / -group nagios -exec chgrp 181 {} \;
wallace# pw usermod nagios -u 181
wallace# pw groupmod nagios -g 181
wallace# /usr/local/etc/rc.d/nagios start
Performing sanity check of nagios configuration: OK
Starting nagios.
wallace# 

Thanks to Peter Losher and Kris Kennaway for their occasional prodding, reminding
me to complete this ;-)
>How-To-Repeat:
>Fix:
Downloadable diff from:
http://www.netleader.com.au/~jarrod/FreeBSD/net-mgmt-nagios-181-uid-gid.diff

--- net-mgmt-nagios-181-uid-gid.diff begins here ---
--- ports/net-mgmt/nagios/Makefile.orig	Tue Mar 13 23:57:13 2007
+++ ports/net-mgmt/nagios/Makefile	Sat Apr  7 14:14:23 2007
@@ -7,6 +7,7 @@
 
 PORTNAME=	nagios
 PORTVERSION=	2.8
+PORTREVISION=	1
 CATEGORIES=	net-mgmt
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	nagios
@@ -32,6 +33,9 @@
 NAGIOSGROUP?=	nagios
 NAGIOSDIR?=	/var/spool/nagios
 
+NAGIOSUID=	181
+NAGIOSGID=	${NAGIOSUID}
+
 NAGIOSWWWDIR?=	www/nagios
 NAGIOSHTMURL?=	/nagios
 NAGIOSCGIURL?=	${NAGIOSHTMURL}/cgi-bin
@@ -74,6 +78,8 @@
 		NAGIOSWWWDIR=${NAGIOSWWWDIR} \
 		NAGIOSUSER=${NAGIOSUSER} \
 		NAGIOSGROUP=${NAGIOSGROUP} \
+		NAGIOSUID=${NAGIOSUID} \
+		NAGIOSGID=${NAGIOSGID} \
 		NAGIOSHTMURL=${NAGIOSHTMURL} \
 		NAGIOSCGIURL=${NAGIOSCGIURL} \
 		WWWGRP=${WWWGRP}
--- ports/net-mgmt/nagios/files/pkg-install.in.orig	Mon Jan  9 11:24:01 2006
+++ ports/net-mgmt/nagios/files/pkg-install.in	Sat Apr  7 14:13:03 2007
@@ -6,6 +6,8 @@
 NAGIOSDIR=%%NAGIOSDIR%%
 NAGIOSUSER=%%NAGIOSUSER%%
 NAGIOSGROUP=%%NAGIOSGROUP%%
+NAGIOSUID=%%NAGIOSUID%%
+NAGIOSGID=%%NAGIOSGID%%
 
 ask() {
   local question default answer
@@ -46,7 +48,8 @@
   else
     echo "You need a \"${NAGIOSGROUP}\" group."
     if yesno "Would you like me to create it" "YES"; then
-      /usr/sbin/pw groupadd "${NAGIOSGROUP}" -h - || exit
+      /usr/sbin/pw groupadd "${NAGIOSGROUP}" -g "${NAGIOSGID}" -h - || \
+        /usr/sbin/pw groupadd "${NAGIOSGROUP}" -h - || exit
       echo "Done."
     else
       echo "Please create the \"${NAGIOSGROUP}\" group manually and try again."
@@ -59,7 +62,9 @@
   else
     echo "You need a \"${NAGIOSUSER}\" user."
     if yesno "Would you like me to create it" "YES"; then
-      /usr/sbin/pw useradd "${NAGIOSUSER}" -g "${NAGIOSGROUP}" -h - -d "${NAGIOSDIR}" \
+      /usr/sbin/pw useradd "${NAGIOSUSER}" -u "${NAGIOSUID}" -g "${NAGIOSGROUP}" -h - -d "${NAGIOSDIR}" \
+        -s /sbin/nologin -c "Nagios pseudo-user" || \
+        /usr/sbin/pw useradd "${NAGIOSUSER}" -g "${NAGIOSGROUP}" -h - -d "${NAGIOSDIR}" \
         -s /sbin/nologin -c "Nagios pseudo-user" || exit
     else
       echo "Please create the \"${NAGIOSUSER}\" user manually and try again."
--- net-mgmt-nagios-181-uid-gid.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list