1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-01 01:17:02 +00:00
freebsd-ports/mail/mailman/pkg-install
Pav Lucistnik 78a9a5c49e - Fix a security problem in private mailing list archives could allow anyone to
read any file on web server.
- Minor port changes

PR:		ports/77364
Submitted by:	Vivek Khera <vivek@khera.org> (maintainer)
Security:	CVE number CAN-2005-0202
2005-02-10 22:25:02 +00:00

74 lines
2.3 KiB
Bash

#! /bin/sh
#
# $FreeBSD$
PATH=/bin:/usr/bin:/usr/sbin
case $2 in
PRE-INSTALL)
echo "---> Starting install script:"
if [ -z "%%MAILMANDIR%%" -o \
-z "%%USER%%" -o -z "%%GROUP%%" -o \
-z "%%UID%%" -o -z "%%GID%%" ]; then
echo "ERROR: A required pragma was empty"
exit 1
fi
# Create group if required
if pw group show "%%GROUP%%" >/dev/null 2>&1; then
echo "---> Using existing group \"%%GROUP%%\""
else
echo "---> Adding group \"%%GROUP%%\" (%%GID%%)"
/usr/sbin/pw groupadd %%GROUP%% -g %%GID%% || exit 1
fi
# Create user if required
if pw user show "%%USER%%" >/dev/null 2>&1; then
echo "---> Using existing user \"%%USER%%\""
else
echo "---> Adding user \"%%USER%%\" (%%UID%%)"
pw useradd "%%USER%%" -u "%%UID%%" -g "%%GROUP%%" -h - \
-d "%%MAILMANDIR%%" -s "/sbin/nologin" -c "Mailman Owner" || exit 1
fi
# Create home directory if required
if [ -d "%%MAILMANDIR%%" ]; then
echo "---> Using existing Mailman directory (%%MAILMANDIR%%)"
echo " (There may be existing active mailing lists - this installation will"
echo " attempt to preserve them.)"
else
echo "---> Creating Mailman directory (%%MAILMANDIR%%)"
(umask 002 && /bin/mkdir -p "%%MAILMANDIR%%") || exit 1
/usr/sbin/chown -R "%%USER%%:%%GROUP%%" "%%MAILMANDIR%%" || exit 1
/bin/chmod g+s "%%MAILMANDIR%%" || exit 1
fi
;;
POST-INSTALL)
echo "---> Starting post-install script:"
echo "---> Checking crontab(5) file for user \"%%USER%%\""
if /usr/bin/crontab -u "%%USER%%" -l >/tmp/mmctab$$ 2>&1 ; then
if test -s /tmp/mmctab$$; then
echo "---> \"%%USER%%\" already has a crontab. Not overwriting it"
echo "---> Please merge any changes from the standard crontab file"
echo "---> %%MAILMANDIR%%/cron/crontab.in"
else
echo "---> Installing crontab(5) file for user \"%%USER%%\""
/usr/bin/crontab -u "%%USER%%" "%%MAILMANDIR%%/cron/crontab.in" || exit 1
fi
else
echo "---> Creating crontab(5) file for user \"%%USER%%\""
/usr/bin/crontab -u "%%USER%%" "%%MAILMANDIR%%/cron/crontab.in" || exit 1
fi
rm -f /tmp/mmctab$$
echo "---> Checking (and fixing) file and directory permissions"
%%MAILMANDIR%%/bin/check_perms -f >/dev/null 2>&1
;;
esac