Date: Wed, 30 May 2007 11:23:17 +0200 (CEST) From: Robin Gruyters <r.gruyters@yirdis.nl> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/113153: [MAINTAINER] security/prelude-manager: fix user creation and permissions Message-ID: <200705300923.l4U9NHoY036998@server.yirdis.net> Resent-Message-ID: <200705300930.l4U9U5ht021515@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 113153 >Category: ports >Synopsis: [MAINTAINER] security/prelude-manager: fix user creation and permissions >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Wed May 30 09:30:04 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Robin Gruyters >Release: FreeBSD 6.1-RELEASE-p10 i386 >Organization: YIRDIS B.V. >Environment: System: FreeBSD server.yirdis.net 6.1-RELEASE-p10 FreeBSD 6.1-RELEASE-p10 #1: Tue Oct 24 10:44:15 CEST 2006 >Description: Fix issues when creating new user. This port needs latest Libprelude report/112703 Added file(s): - files/pkg-deinstall.in - files/pkg-install.in Generated with FreeBSD Port Tools 0.77 >How-To-Repeat: >Fix: --- prelude-manager-0.9.8.patch begins here --- diff -ruN --exclude=CVS /usr/ports/security/prelude-manager/Makefile /data2/FreeBSD/custom_ports/security/prelude-manager/Makefile --- /usr/ports/security/prelude-manager/Makefile Wed May 30 11:07:52 2007 +++ /data2/FreeBSD/custom_ports/security/prelude-manager/Makefile Wed May 30 11:16:10 2007 @@ -13,7 +13,7 @@ MAINTAINER= r.gruyters@yirdis.nl COMMENT= Prelude Network Intrusion Detection System central logging point -LIB_DEPENDS+= prelude.11:${PORTSDIR}/security/libprelude \ +LIB_DEPENDS+= prelude.12:${PORTSDIR}/security/libprelude \ gnutls.15:${PORTSDIR}/security/gnutls USE_GMAKE= yes @@ -33,6 +33,18 @@ .include <bsd.port.pre.mk> +PLIST_SUB= PRELUDEUSER=${PRELUDEUSER} \ + PRELUDEGROUP=${PRELUDEGROUP} \ + PRELUDEUID=${PRELUDEUID} \ + PRELUDEGID=${PRELUDEGID} \ + PRELUDEDIR=${PRELUDEDIR} + +SUB_FILES= pkg-install \ + pkg-deinstall + +SUB_LIST= PREFIX=${PREFIX} \ + ${PLIST_SUB} + .if defined(WITHOUT_XML) PLIST_SUB+= WITH_XML="@comment " CONFIGURE_ARGS+= --disable-xmltest --without-xml @@ -48,10 +60,20 @@ PLIST_SUB+= WITH_PRELUDEDB="" .endif +pre-install: + @${SH} ${PKGINSTALL} ${DISTNAME} PRE-INSTALL + post-install: @if [ ! -f ${PREFIX}/etc/prelude-manager/prelude-manager.conf ]; then \ ${CP} -p ${PREFIX}/etc/prelude-manager/prelude-manager.conf-dist \ ${PREFIX}/etc/prelude-manager/prelude-manager.conf ; \ fi + + @${CHMOD} 700 /var/spool/${PORTNAME} \ + /var/spool/${PORTNAME}/failover \ + /var/spool/${PORTNAME}/scheduler + @${CHOWN} ${PRELUDEUSER}:${PRELUDEGROUP} /var/run/${PORTNAME} \ + /var/spool/${PORTNAME} /var/spool/${PORTNAME}/failover \ + /var/spool/${PORTNAME}/scheduler .include <bsd.port.post.mk> diff -ruN --exclude=CVS /usr/ports/security/prelude-manager/files/pkg-deinstall.in /data2/FreeBSD/custom_ports/security/prelude-manager/files/pkg-deinstall.in --- /usr/ports/security/prelude-manager/files/pkg-deinstall.in Thu Jan 1 01:00:00 1970 +++ /data2/FreeBSD/custom_ports/security/prelude-manager/files/pkg-deinstall.in Thu May 24 13:02:22 2007 @@ -0,0 +1,22 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +PRELUDEDIR=%%PRELUDEDIR%% +PRELUDEUSER=%%PRELUDEUSER%% +PRELUDEGROUP=%%PRELUDEGROUP%% + +if [ "$2" = "POST-DEINSTALL" ]; then + if /usr/sbin/pw group show "${PRELUDEGROUP}" 2>&1 >/dev/null; then + echo "You should manually remove the \"${PRELUDEGROUP}\" group." + fi + + if /usr/sbin/pw user show "${PRELUDEUSER}" 2>&1 >/dev/null; then + echo "You should manually remove the \"${PRELUDEUSER}\" user." + fi + + if [ -e "${PRELUDEDIR}" ]; then + echo "You should manually remove the \"${PRELUDEDIR}\" directory." + fi +fi diff -ruN --exclude=CVS /usr/ports/security/prelude-manager/files/pkg-install.in /data2/FreeBSD/custom_ports/security/prelude-manager/files/pkg-install.in --- /usr/ports/security/prelude-manager/files/pkg-install.in Thu Jan 1 01:00:00 1970 +++ /data2/FreeBSD/custom_ports/security/prelude-manager/files/pkg-install.in Thu May 24 13:06:00 2007 @@ -0,0 +1,74 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +PRELUDEDIR=%%PRELUDEDIR%% +PRELUDEUSER=%%PRELUDEUSER%% +PRELUDEGROUP=%%PRELUDEGROUP%% +PRELUDEUID=%%PRELUDEUID%% +PRELUDEGID=%%PRELUDEGID%% + +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 "${PRELUDEGROUP}" 2>&1 >/dev/null; then + echo "You already have a \"${PRELUDEGROUP}\" group, so I will use it." + else + echo "You need a \"${PRELUDEGROUP}\" group." + if yesno "Would you like me to create it" "YES"; then + /usr/sbin/pw groupadd "${PRELUDEGROUP}" -g "${PRELUDEGID}" -h - || \ + /usr/sbin/pw groupadd "${PRELUDEGROUP}" -h - || exit + echo "Done." + else + echo "Please create the \"${PRELUDEGROUP}\" group manually and try again." + exit 1 + fi + fi + + if /usr/sbin/pw user show "${PRELUDEUSER}" 2>&1 >/dev/null; then + echo "You already have a \"${PRELUDEUSER}\" user, so I will use it." + else + echo "You need a \"${PRELUDEUSER}\" user." + if yesno "Would you like me to create it" "YES"; then + /usr/sbin/pw useradd "${PRELUDEUSER}" -u "${PRELUDEUID}" -g "${PRELUDEGROUP}" -h - -d "${PRELUDEDIR}" \ + -s /sbin/nologin -c "Prelude user" || \ + /usr/sbin/pw useradd "${PRELUDEUSER}" -g "${PRELUDEGROUP}" -h - -d "${PRELUDEDIR}" \ + -s /sbin/nologin -c "Prelude user" || exit + else + echo "Please create the \"${PRELUDEUSER}\" user manually and try again." + exit 1 + fi + fi +fi --- prelude-manager-0.9.8.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705300923.l4U9NHoY036998>