ports/114035: net-mgmt/nrpe2: Add support for static UID/GID found in main Nagios port
Jarrod Sayers
jarrod at netleader.com.au
Tue Jun 26 11:20:05 UTC 2007
>Number: 114035
>Category: ports
>Synopsis: net-mgmt/nrpe2: Add support for static UID/GID found in main Nagios port
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Tue Jun 26 11:20:04 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator: Jarrod Sayers
>Release: FreeBSD 6.2-RELEASE-p5 i386
>Organization:
>Environment:
System: FreeBSD wallace.netleader.com.au 6.2-RELEASE-p5 FreeBSD 6.2-RELEASE-p5 #84: Sat Jun 23 20:23:56 CST 2007 root at wallace.netleader.com.au:/usr/obj/usr/src/sys/WALLACE i386
>Description:
Various changes, including:
- Add support for the static UID and GID's assigned to the main Nagios port as
per ports/111345, includes reworking of Makefile to keep things consistent.
Both pkg-install.in and pkg-deinstall.in sync'd from net-mgmt/nagios.
- Patch sample configuration file to use correct location of sudo and plugins.
- Change ports maintainer (with blessing from current maintainer).
Files modified:
- ports/net-mgmt/nrpe2/Makefile
- ports/net-mgmt/nrpe2/files/patch-sample-config-nrpe.cfg.in
Files added:
- ports/net-mgmt/nrpe2/files/pkg-deinstall.in
- ports/net-mgmt/nrpe2/files/pkg-install.in
Files removed:
- ports/net-mgmt/nrpe2/pkg-deinstall
- ports/net-mgmt/nrpe2/pkg-install
>How-To-Repeat:
>Fix:
Downloadable diff from:
http://www.netleader.com.au/~jarrod/FreeBSD/net-mgmt-nrpe2-2.7_2.diff
--- net-mgmt-nrpe2-2.7_2.diff begins here ---
diff -ruN ports/net-mgmt/nrpe2.orig/Makefile ports/net-mgmt/nrpe2/Makefile
--- ports/net-mgmt/nrpe2.orig/Makefile Sat Apr 7 23:45:53 2007
+++ ports/net-mgmt/nrpe2/Makefile Tue Jun 26 19:23:59 2007
@@ -7,30 +7,53 @@
PORTNAME= nrpe2
PORTVERSION= 2.7
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= net-mgmt
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= nagios
DISTNAME= nrpe-${PORTVERSION}
-MAINTAINER= dan at langille.org
+MAINTAINER= jarrod at netleader.com.au
COMMENT= Nagios Remote Plugin Executor
RUN_DEPENDS= ${LOCALBASE}/libexec/nagios/check_nagios:${PORTSDIR}/net-mgmt/nagios-plugins
-GNU_CONFIGURE= yes
USE_PERL5_BUILD= yes
-
USE_RC_SUBR= nrpe2.sh
-SUB_FILES= pkg-message
+
+OPTIONS= SSL "SSL support" off \
+ ARGS "Enable command arguments *POTENTIAL SECURITY RISK*" off
+
+GNU_CONFIGURE= yes
+
+NAGIOSUSER?= nagios
+NAGIOSGROUP?= nagios
+NAGIOSDIR?= /var/spool/nagios
+
+NAGIOSUID= 181
+NAGIOSGID= ${NAGIOSUID}
+
+CONFIGURE_ARGS= --bindir=${PREFIX}/sbin \
+ --libexecdir=${PREFIX}/libexec/nagios \
+ --sysconfdir=${PREFIX}/etc \
+ --with-nrpe-user=${NAGIOSUSER} \
+ --with-nrpe-group=${NAGIOSGROUP} \
+ --prefix=${PREFIX}
PLIST_FILES= sbin/nrpe2 etc/nrpe.cfg-sample libexec/nagios/check_nrpe2
-CONFIGURE_ARGS= --libexecdir=${PREFIX}/libexec/nagios \
- --bindir=${PREFIX}/sbin --sysconfdir=${PREFIX}/etc
+PLIST_SUB= NAGIOSDIR=${NAGIOSDIR} \
+ NAGIOSUSER=${NAGIOSUSER} \
+ NAGIOSGROUP=${NAGIOSGROUP} \
+ NAGIOSUID=${NAGIOSUID} \
+ NAGIOSGID=${NAGIOSGID}
+
+SUB_FILES= pkg-install \
+ pkg-deinstall \
+ pkg-message
-OPTIONS= SSL "SSL support" off \
- ARGS "Enable command arguments *POTENTIAL SECURITY RISK*" off
+SUB_LIST= PREFIX=${PREFIX} \
+ ${PLIST_SUB}
.include <bsd.port.pre.mk>
@@ -46,23 +69,17 @@
.endif
post-build:
- @${REINPLACE_CMD} -e 's|nrpe.pid|nrpe2.pid|g' \
- ${WRKSRC}/sample-config/nrpe.cfg
+ @${REINPLACE_CMD} -e 's#nrpe.pid#nrpe2.pid#g' ${WRKSRC}/sample-config/nrpe.cfg
pre-install:
- PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
+ @${SH} ${PKGINSTALL} ${DISTNAME} PRE-INSTALL
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/src/nrpe ${PREFIX}/sbin/nrpe2
- ${INSTALL_PROGRAM} ${WRKSRC}/src/check_nrpe \
- ${PREFIX}/libexec/nagios/check_nrpe2
- ${INSTALL_DATA} ${WRKSRC}/sample-config/nrpe.cfg \
- ${PREFIX}/etc/nrpe.cfg-sample
+ ${INSTALL_PROGRAM} ${WRKSRC}/src/check_nrpe ${PREFIX}/libexec/nagios/check_nrpe2
+ ${INSTALL_DATA} ${WRKSRC}/sample-config/nrpe.cfg ${PREFIX}/etc/nrpe.cfg-sample
post-install:
- ${CAT} ${PKGMESSAGE}
-
-post-deinstall:
- PKG_PREFIX=${PREFIX} ${SH} ${PKGDEINSTALL} ${PKGNAME} DEINSTALL
+ @${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk>
diff -ruN ports/net-mgmt/nrpe2.orig/files/patch-sample-config-nrpe.cfg.in ports/net-mgmt/nrpe2/files/patch-sample-config-nrpe.cfg.in
--- ports/net-mgmt/nrpe2.orig/files/patch-sample-config-nrpe.cfg.in Tue Feb 6 05:37:48 2007
+++ ports/net-mgmt/nrpe2/files/patch-sample-config-nrpe.cfg.in Tue Jun 26 20:17:11 2007
@@ -1,7 +1,23 @@
---- sample-config/nrpe.cfg.in~ Mon Dec 11 21:04:00 2006
-+++ sample-config/nrpe.cfg.in Wed Jan 31 20:40:28 2007
+--- sample-config/nrpe.cfg.in.orig Tue Dec 12 12:34:00 2006
++++ sample-config/nrpe.cfg.in Tue Jun 26 20:16:45 2007
+@@ -100,13 +100,13 @@
+ # the nagios user to your /etc/sudoers. An example entry for alllowing
+ # execution of the plugins from might be:
+ #
+-# nagios ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/
++# nagios ALL=(ALL) NOPASSWD: /usr/local/libexec/nagios/
+ #
+ # This lets the nagios user run all commands in that directory (and only them)
+ # without asking for a password. If you do this, make sure you don't give
+ # random users write access to that directory or its contents!
+
+-# command_prefix=/usr/bin/sudo
++# command_prefix=/usr/local/bin/sudo
+
+
+
@@ -190,8 +190,10 @@
-
+
command[check_users]=@libexecdir@/check_users -w 5 -c 10
command[check_load]=@libexecdir@/check_load -w 15,10,5 -c 30,25,20
-command[check_disk1]=@libexecdir@/check_disk -w 20 -c 10 -p /dev/hda1
@@ -11,5 +27,5 @@
+command[check_disk_tmp]=@libexecdir@/check_disk -w 20 -c 10 --path /tmp
+command[check_disk_usr]=@libexecdir@/check_disk -w 20 -c 10 --path /usr
command[check_zombie_procs]=@libexecdir@/check_procs -w 5 -c 10 -s Z
- command[check_total_procs]=@libexecdir@/check_procs -w 150 -c 200
-
+ command[check_total_procs]=@libexecdir@/check_procs -w 150 -c 200
+
diff -ruN ports/net-mgmt/nrpe2.orig/files/pkg-deinstall.in ports/net-mgmt/nrpe2/files/pkg-deinstall.in
--- ports/net-mgmt/nrpe2.orig/files/pkg-deinstall.in Thu Jan 1 09:30:00 1970
+++ ports/net-mgmt/nrpe2/files/pkg-deinstall.in Tue Jun 26 19:19:06 2007
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+NAGIOSDIR=%%NAGIOSDIR%%
+NAGIOSUSER=%%NAGIOSUSER%%
+NAGIOSGROUP=%%NAGIOSGROUP%%
+
+if [ "$2" = "POST-DEINSTALL" ]; then
+ if /usr/sbin/pw group show "${NAGIOSGROUP}" 2>&1 >/dev/null; then
+ echo "You should manually remove the \"${NAGIOSGROUP}\" group."
+ fi
+
+ if /usr/sbin/pw user show "${NAGIOSUSER}" 2>&1 >/dev/null; then
+ echo "You should manually remove the \"${NAGIOSUSER}\" user."
+ fi
+
+ if [ -e "${NAGIOSDIR}" ]; then
+ echo "You should manually remove the \"${NAGIOSDIR}\" directory."
+ fi
+fi
diff -ruN ports/net-mgmt/nrpe2.orig/files/pkg-install.in ports/net-mgmt/nrpe2/files/pkg-install.in
--- ports/net-mgmt/nrpe2.orig/files/pkg-install.in Thu Jan 1 09:30:00 1970
+++ ports/net-mgmt/nrpe2/files/pkg-install.in Tue Jun 26 19:18:59 2007
@@ -0,0 +1,74 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+NAGIOSDIR=%%NAGIOSDIR%%
+NAGIOSUSER=%%NAGIOSUSER%%
+NAGIOSGROUP=%%NAGIOSGROUP%%
+NAGIOSUID=%%NAGIOSUID%%
+NAGIOSGID=%%NAGIOSGID%%
+
+ask() {
+ local question default answer
+
+ question=$1
+ default=$2
+ if [ -z "${PACKAGE_BUILDING}" ]; then
+ read -p "${question} [${default}]? " answer
+ fi
+ if [ "x${answer}" = "x" ]; then
+ answer=${default}
+ fi
+ echo ${answer}
+}
+
+yesno() {
+ local default question answer
+
+ question=$1
+ default=$2
+ while :; do
+ answer=$(ask "${question}" "${default}")
+ case "${answer}" in
+ [Yy][Ee][Ss]|[Yy])
+ return 0
+ ;;
+ [Nn][Oo]|[Nn])
+ return 1
+ ;;
+ esac
+ echo "Please answer yes or no."
+ done
+}
+
+if [ "$2" = "PRE-INSTALL" ]; then
+ if /usr/sbin/pw group show "${NAGIOSGROUP}" 2>&1 >/dev/null; then
+ echo "You already have a \"${NAGIOSGROUP}\" group, so I will use it."
+ else
+ echo "You need a \"${NAGIOSGROUP}\" group."
+ if yesno "Would you like me to create it" "YES"; then
+ /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."
+ exit 1
+ fi
+ fi
+
+ if /usr/sbin/pw user show "${NAGIOSUSER}" 2>&1 >/dev/null; then
+ echo "You already have a \"${NAGIOSUSER}\" user, so I will use it."
+ else
+ echo "You need a \"${NAGIOSUSER}\" user."
+ if yesno "Would you like me to create it" "YES"; then
+ /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."
+ exit 1
+ fi
+ fi
+fi
diff -ruN ports/net-mgmt/nrpe2.orig/pkg-deinstall ports/net-mgmt/nrpe2/pkg-deinstall
--- ports/net-mgmt/nrpe2.orig/pkg-deinstall Tue Dec 26 01:02:44 2006
+++ ports/net-mgmt/nrpe2/pkg-deinstall Thu Jan 1 09:30:00 1970
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-PATH=/bin:/usr/bin:/usr/sbin
-TMPFILE=/tmp/services-$RANDOM-$$
-
-
-PKG_PREFIX=${PKG_PREFIX:=/usr/local}
-
-case "$2" in
-"DEINSTALL")
- # Note how to delete UID/GID
- USER=nagios
- GROUP=nagios
- if pw usershow "${USER}" 2>/dev/null 1>&2; then
- echo "To delete nagios user permanently, use 'pw userdel ${USER}'"
- echo "To delete nagios group permanently, use 'pw groupdel ${GROUP}'"
- fi
- ;;
-esac
diff -ruN ports/net-mgmt/nrpe2.orig/pkg-install ports/net-mgmt/nrpe2/pkg-install
--- ports/net-mgmt/nrpe2.orig/pkg-install Fri Jan 10 08:43:58 2003
+++ ports/net-mgmt/nrpe2/pkg-install Thu Jan 1 09:30:00 1970
@@ -1,68 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD: ports/net-mgmt/nrpe2/pkg-install,v 1.1 2003/01/09 22:13:58 edwin Exp $
-#
-
-PKG_PREFIX=${PKG_PREFIX:=/usr/local}
-
-user=nagios
-group=nagios
-
-ask() {
- local question default answer
-
- question=$1
- default=$2
- if [ -z "${PACKAGE_BUILDING}" ]; then
- read -p "${question} [${default}]? " answer
- fi
- if [ x${answer} = x ]; then
- answer=${default}
- fi
- echo ${answer}
-}
-
-yesno() {
- local dflt question answer
-
- question=$1
- dflt=$2
- while :; do
- answer=$(ask "${question}" "${dflt}")
- case "${answer}" in
- [Yy]*) return 0;;
- [Nn]*) return 1;;
- esac
- echo "Please answer yes or no."
- done
-}
-
-if [ x"$2" = xPRE-INSTALL ]; then
- if /usr/sbin/pw groupshow "${group}" 2>/dev/null; then
- echo "You already have a group \"${group}\", so I will use it."
- else
- echo "You need a group \"${group}\"."
- if yesno "Would you like me to create it" y; then
- /usr/sbin/pw groupadd ${group} -h - || exit
- echo "Done."
- else
- echo "Please create it, and try again."
- exit 1
- fi
- fi
-
- if /usr/sbin/pw user show "${user}" 2>/dev/null; then
- echo "You already have a user \"${user}\", so I will use it."
- else
- echo "You need a user \"${user}\"."
- if yesno "Would you like me to create it" y; then
- /usr/sbin/pw useradd ${user} -g ${group} -h - -d ${PKG_PREFIX}/var/nagios \
- -s /nonexistent -c "Nagios pseudo-user" || exit
- echo "Done."
- else
- echo "Please create it, and try again."
- exit 1
- fi
- fi
-
-fi
--- net-mgmt-nrpe2-2.7_2.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list