freebsd-ports/security/stunnel/pkg-install
Peter Pentchev 4afa9507f4 Reserve a user and group ID for the stunnel daemon.
Loosely based on the PR, although I just used the next available UID/GID.

PR:		108784
Submitted by:	Alex Kozlov <spam@rm-rf.kiev.ua>
2007-08-28 10:01:00 +00:00

41 lines
842 B
Bash

#! /bin/sh
#
# $FreeBSD$
# taken from devel/perforce
PATH=/bin:/usr/sbin
STUNNEL_USER=${STUNNEL_USER:-stunnel}
STUNNEL_GROUP=${STUNNEL_GROUP:-stunnel}
case $2 in
POST-INSTALL)
USER=${STUNNEL_USER}
GROUP=${STUNNEL_GROUP}
if pw group show "${GROUP}" 2>/dev/null; then
echo "You already have a group \"${GROUP}\", so I will use it."
else
if pw groupadd -g 341 -n ${GROUP} ; then
echo "Added group \"${GROUP}\"."
else
echo "Adding group \"${GROUP}\" failed..."
exit 1
fi
fi
if pw user show "${USER}" 2>/dev/null; then
echo "You already have a user \"${USER}\", so I will use it."
else
if pw useradd -u 341 -n ${USER} -g ${GROUP} -h - \
-d /nonexistent -c "stunnel Daemon" -s /sbin/nologin
then
echo "Added user \"${USER}\"."
else
echo "Adding user \"${USER}\" failed..."
exit 1
fi
fi
;;
esac