diff options
author | will <will@FreeBSD.org> | 2004-09-02 06:11:21 +0800 |
---|---|---|
committer | will <will@FreeBSD.org> | 2004-09-02 06:11:21 +0800 |
commit | 58504c650edc6b8d6fb63e88f4d53d2962b022e2 (patch) | |
tree | c49a50bc6b4cd3953f823572cacee3d11dad5694 | |
parent | bcd68e03fe098d314e600cc0b604831762a26935 (diff) | |
download | freebsd-ports-gnome-58504c650edc6b8d6fb63e88f4d53d2962b022e2.tar.gz freebsd-ports-gnome-58504c650edc6b8d6fb63e88f4d53d2962b022e2.tar.zst freebsd-ports-gnome-58504c650edc6b8d6fb63e88f4d53d2962b022e2.zip |
Add postgrey 1.15, a greylisting policy server for Postfix.
Assistance from: Harold Paulson <haroldp@internal.org>
-rw-r--r-- | mail/Makefile | 1 | ||||
-rw-r--r-- | mail/postgrey/Makefile | 72 | ||||
-rw-r--r-- | mail/postgrey/distinfo | 2 | ||||
-rw-r--r-- | mail/postgrey/files/postgrey.sh | 46 | ||||
-rw-r--r-- | mail/postgrey/pkg-descr | 4 | ||||
-rw-r--r-- | mail/postgrey/pkg-install | 63 | ||||
-rw-r--r-- | mail/postgrey/pkg-plist | 7 | ||||
-rw-r--r-- | mail/postgrey/pkg-req | 15 |
8 files changed, 210 insertions, 0 deletions
diff --git a/mail/Makefile b/mail/Makefile index c656eba023dd..fbfe77d3e0b3 100644 --- a/mail/Makefile +++ b/mail/Makefile @@ -327,6 +327,7 @@ SUBDIR += postfix1 SUBDIR += postfix20 SUBDIR += postfixadmin + SUBDIR += postgrey SUBDIR += postilion SUBDIR += prayer SUBDIR += premail diff --git a/mail/postgrey/Makefile b/mail/postgrey/Makefile new file mode 100644 index 000000000000..5e5ad9dbcd5c --- /dev/null +++ b/mail/postgrey/Makefile @@ -0,0 +1,72 @@ +# New ports collection makefile for: postgrey +# Date created: 24 August 2004 +# Whom: Will Andrews <will@freebsd.org> +# +# $FreeBSD$ +# + +PORTNAME= postgrey +PORTVERSION= 1.15 +CATEGORIES= mail +MASTER_SITES= http://isg.ee.ethz.ch/tools/postgrey/pub/ + +MAINTAINER= haroldp@internal.org +COMMENT= Greylisting policy server for Postfix + +RUN_DEPENDS= ${SITE_PERL}/Net/Server.pm:${PORTSDIR}/net/p5-Net-Server \ + ${SITE_PERL}/IO/Multiplex.pm:${PORTSDIR}/devel/p5-IO-Multiplex \ + ${SITE_PERL}/${PERL_ARCH}/BerkeleyDB.pm:${PORTSDIR}/databases/p5-BerkeleyDB + +USE_PERL5= yes +USE_RC_SUBR= yes +NO_BUILD= yes + +ETCFILES= whitelist_clients whitelist_recipients +PGY_USERNAME?= postgrey +PGY_USERID?= 225 +PGY_GROUPNAME?= ${PGY_USERNAME} +PGY_GROUPID?= ${PGY_USERID} +PGY_DIR?= /var/db/postgrey + +PKGINSTALL= ${WRKDIR}/pkg-install +PKGDEINSTALL= ${WRKDIR}/pkg-deinstall + +pre-everything:: +.if !defined(SKIP_BDB_CHECK) && !defined(PACKAGE_BUILDING) +.if !defined(WITH_BDB_VER) + @${ECHO} "This port requires databases/p5-BerkeleyDB to be built with" + @${ECHO} "WITH_BDB_VER=41 or later." + exit 1 +.else +.if ${WITH_BDB_VER} < 41 + @${ECHO} "This port requires databases/p5-BerkeleyDB to be built with" + @${ECHO} "WITH_BDB_VER=41 or later." + exit 1 +.endif +.endif +.endif + +pre-install: + ${SED} -e 's#%%PREFIX%%#${PREFIX}#g' -e 's#%%RC_SUBR%%#${RC_SUBR}#g' \ + ${FILESDIR}/postgrey.sh > ${WRKDIR}/postgrey.sh + ${SED} -e 's#%%USER%%#${PGY_USERNAME}#g' -e 's#%%UID%%#${PGY_USERID}#g' \ + -e 's#%%GROUP%%#${PGY_GROUPNAME}#g' -e 's#%%GID%%#${PGY_GROUPID}#g' \ + -e 's#%%PREFIX%%#${PREFIX}#g' -e 's#%%ETCFILES%%#${ETCFILES}#g' \ + -e 's#%%POSTGREYDIR%%#${PGY_DIR}#g' ${MASTERDIR}/pkg-install > \ + ${PKGINSTALL} +.if !defined(SKIP_BDB_CHECK) && !defined(PACKAGE_BUILDING) + ${SH} ${PKGREQ} INSTALL +.endif + ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL + +do-install: + ${INSTALL_SCRIPT} ${WRKSRC}/postgrey ${PREFIX}/sbin + ${INSTALL_SCRIPT} ${WRKDIR}/postgrey.sh ${PREFIX}/etc/rc.d +.for i in ${ETCFILES} + ${INSTALL_DATA} ${WRKSRC}/postgrey_${i} ${PREFIX}/etc/postfix/dist-postgrey_${i} +.endfor + +post-install: + ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL + +.include <bsd.port.mk> diff --git a/mail/postgrey/distinfo b/mail/postgrey/distinfo new file mode 100644 index 000000000000..0c4426270832 --- /dev/null +++ b/mail/postgrey/distinfo @@ -0,0 +1,2 @@ +MD5 (postgrey-1.15.tar.gz) = 656e2b0992c95bad51e9bb0e5004bee1 +SIZE (postgrey-1.15.tar.gz) = 23382 diff --git a/mail/postgrey/files/postgrey.sh b/mail/postgrey/files/postgrey.sh new file mode 100644 index 000000000000..9c6ae060f2a7 --- /dev/null +++ b/mail/postgrey/files/postgrey.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# $FreeBSD$ +# + +# PROVIDE: postgrey +# REQUIRE: LOGIN +# BEFORE: mail +# KEYWORD: FreeBSD shutdown + +# +# Add the following lines to /etc/rc.conf to enable postgrey: +# +# postgrey_enable="YES" +# +# See perldoc postgrey for flags +# + +. %%RC_SUBR%% + +name=postgrey +rcvar=`set_rcvar` + +command=%%PREFIX%%/sbin/postgrey +command_interpreter=/usr/bin/perl +required_dirs=/var/db/postgrey + +stop_postcmd=stop_postcmd + +stop_postcmd() +{ + rm -f $pidfile +} + +# set defaults + +postgrey_enable=${postgrey_enable:-"NO"} +postgrey_pidfile=${postgrey_pidfile:-"/var/run/postgrey.pid"} +postgrey_flags=${postgrey_flags:-"--pidfile=${postgrey_pidfile} \ + --inet=10023 -d --user=postgrey --dbdir=/var/db/postgrey \ + --whitelist-clients=%%PREFIX%%/etc/postfix/postgrey_whitelist_clients \ + --whitelist-recipients=%%PREFIX%%/etc/postfix/postgrey_whitelist_recipients"} + +pidfile="${postgrey_pidfile}" + +load_rc_config $name +run_rc_command "$1" diff --git a/mail/postgrey/pkg-descr b/mail/postgrey/pkg-descr new file mode 100644 index 000000000000..ffd931c2794a --- /dev/null +++ b/mail/postgrey/pkg-descr @@ -0,0 +1,4 @@ +Postgrey is a program which implements greylisting and is +designed to work with the Postfix MTA. + +WWW: http://isg.ee.ethz.ch/tools/postgrey/ diff --git a/mail/postgrey/pkg-install b/mail/postgrey/pkg-install new file mode 100644 index 000000000000..19c0559c570a --- /dev/null +++ b/mail/postgrey/pkg-install @@ -0,0 +1,63 @@ +#! /bin/sh +# +# $FreeBSD$ + +PATH=/bin:/usr/bin:/usr/sbin + +case $2 in + +PRE-INSTALL) + echo "---> Starting install script:" + + if [ -z "%%POSTGREYDIR%%" -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 "%%POSTGREYDIR%%" -s "/sbin/nologin" -c "Postgrey Owner" || exit 1 + fi + + # Create home directory if required + if [ -d "%%POSTGREYDIR%%" ]; then + echo "---> Using existing Postgrey database directory (%%POSTGREYDIR%%)" + echo " (There may be existing active postgrey databases - this installation" + echo " will attempt to preserve them.)" + else + echo "---> Creating Postgrey database directory (%%POSTGREYDIR%%)" + (umask 002 && /bin/mkdir -p "%%POSTGREYDIR%%") || exit 1 + /usr/sbin/chown -R "%%USER%%:%%GROUP%%" "%%POSTGREYDIR%%" || exit 1 + /bin/chmod g+s "%%POSTGREYDIR%%" || exit 1 + fi + ;; + +POST-INSTALL) + echo "---> Starting post-install script:" + + for i in %%ETCFILES%%; do + if [ ! -f "%%PREFIX%%/etc/postfix/postgrey_${i}" ]; then + echo "---> Installing new config file %%PREFIX%%/etc/postfix/postgrey_${i}" + cp -p %%PREFIX%%/etc/postfix/dist-postgrey_${i} \ + %%PREFIX%%/etc/postfix/postgrey_${i} + else + echo "---> Keeping existing config file %%PREFIX%%/etc/postfix/postgrey_${i}" + fi + done + ;; + +esac diff --git a/mail/postgrey/pkg-plist b/mail/postgrey/pkg-plist new file mode 100644 index 000000000000..15c9e60ae1bc --- /dev/null +++ b/mail/postgrey/pkg-plist @@ -0,0 +1,7 @@ +@unexec if cmp -s %D/etc/postfix/dist-postgrey_whitelist_recipients %D/etc/postfix/postgrey_whitelist_recipients; then rm -f %D/etc/postfix/postgrey_whitelist_recipients; fi +@unexec if cmp -s %D/etc/postfix/dist-postgrey_whitelist_clients %D/etc/postfix/postgrey_whitelist_clients; then rm -f %D/etc/postfix/postgrey_whitelist_clients; fi +sbin/postgrey +etc/rc.d/postgrey.sh +etc/postfix/dist-postgrey_whitelist_recipients +etc/postfix/dist-postgrey_whitelist_clients +@unexec rmdir %D/etc/postfix 2>/dev/null || true diff --git a/mail/postgrey/pkg-req b/mail/postgrey/pkg-req new file mode 100644 index 000000000000..085629b82510 --- /dev/null +++ b/mail/postgrey/pkg-req @@ -0,0 +1,15 @@ +#!/bin/sh + +PATH=$PATH:/usr/local/bin + +if [ "x$1" = "xINSTALL" -o "x$2" = "xINSTALL" ]; then + perl -e "use BerkeleyDB;BerkeleyDB::Env->new(-Home => 'test',-Flags => DB_CREATE|DB_RECOVER|DB_INIT_TXN|DB_INIT_MPOOL|DB_INIT_LOG,-SetFlags => DB_AUTO_COMMIT|DB_TXN_NOSYNC);" + if [ $? != 0 ]; then + echo "-----------------------------------------------------------" + echo "Postgrey requires databases/p5-BerkeleyDB to be built with" + echo "Berkeley DB 4.1 or newer. Please reinstall it with the" + echo "WITH_BDB_VER set to 41 or newer." + echo "-----------------------------------------------------------" + exit 1 + fi +fi |