From 465faeb58374e6722723f9abad3dc37128dadad0 Mon Sep 17 00:00:00 2001 From: Michael Mason Date: Wed, 26 Aug 2009 01:42:48 +0000 Subject: unstable/postgrey Initial Commit --- unstable/postgrey/APKBUILD | 35 ++++++++++++ unstable/postgrey/postgrey.confd | 55 ++++++++++++++++++ unstable/postgrey/postgrey.initd | 101 +++++++++++++++++++++++++++++++++ unstable/postgrey/postgrey.pre-install | 6 ++ 4 files changed, 197 insertions(+) create mode 100644 unstable/postgrey/APKBUILD create mode 100644 unstable/postgrey/postgrey.confd create mode 100644 unstable/postgrey/postgrey.initd create mode 100644 unstable/postgrey/postgrey.pre-install diff --git a/unstable/postgrey/APKBUILD b/unstable/postgrey/APKBUILD new file mode 100644 index 000000000..71dc8c586 --- /dev/null +++ b/unstable/postgrey/APKBUILD @@ -0,0 +1,35 @@ +# Contributor: Michael Mason +# Maintainer: Michael Mason +pkgname=postgrey +pkgver=1.32 +pkgrel=0 +pkgdesc="Postfix policy server implementing greylisting" +url="http://postgrey.schweikert.ch/" +license="GPL" +depends="perl perl-db perl-net-dns perl-net-server" +makedepends="" +install= +subpackages="" +source="http://postgrey.schweikert.ch/pub/$pkgname-$pkgver.tar.gz + postgrey.confd + postgrey.initd + postgrey.pre-install" +#still need PERL-IO Multiplex and PERL-PARSE-SYSLOG and NET-RBLClient +build() { + cd "$srcdir"/$pkgname-$pkgver + + install -m755 -D $pkgname "$pkgdir"/usr/sbin/$pkgname + mkdir -p "$pkgdir"/var/spool/postfix/$pkgname + chown postgrey:postgrey "$pkgdir"/var/spool/postfix/$pkgname + chmod 770 "$pkgdir"/var/spool/postfix/$pkgname + install -m755 -D contrib/postgreyreport "$pkgdir"/usr/bin/postgreyreport + install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname + install -m644 -D postgrey_whitelist_clients "$pkgdir"/etc/postfix/postgrey_whitelist_clients + install -m644 -D postgrey_whitelist_recipients "$pkgdir"/etc/postfix/postgrey_whitelist_recipients + install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname +} + +md5sums="524a4e165bf997996f3bccade394712f postgrey-1.32.tar.gz +caaad5770ab07fb5af3bbd522a05b84f postgrey.confd +3bf81886c02d2879c1310bf1027e9c07 postgrey.initd +4231489e2cfbbb4b0a354826cbe40695 postgrey.pre-install" diff --git a/unstable/postgrey/postgrey.confd b/unstable/postgrey/postgrey.confd new file mode 100644 index 000000000..7a6deb587 --- /dev/null +++ b/unstable/postgrey/postgrey.confd @@ -0,0 +1,55 @@ +# Config file for /etc/init.d/postgrey + +# LISTEN TYPE +# Set to 'inet' if you want to use a TCP socket. +# Set to 'unix' if you want to use an UNIX socket. +POSTGREY_TYPE="inet" + +# HOST +# What IP should postgrey bind to? +# Leave unchanged unless you know what you are doing. +# (ignored if POSTGREY_TYPE is set to 'unix') +POSTGREY_HOST="127.0.0.1" + +# PORT +# What TCP port should postgrey listen on? +# (ignored if POSTGREY_TYPE is set to 'unix') +POSTGREY_PORT="10030" + +# SOCKET +# Unix socket to listen on, if POSTGREY_TYPE is set to 'unix'. +# Leave unchanged unless you know what you are doing. +# (ignored if POSTGREY_TYPE is set to 'inet') +POSTGREY_SOCKET="/var/spool/postfix/private/postgrey" + +# PID +# Postgrey pid file. +# Do not change, if you don't know what this is! +POSTGREY_PID="/var/run/postgrey.pid" + +# DELAY +# How long to delay mail that is greylisted in seconds. +POSTGREY_DELAY=300 + +# TEXT +# The response we'll send back with delayed mail. +POSTGREY_TEXT="Greylisted for %s seconds" + +# Additional Postgrey options +# +# -v, --verbose increase verbosity level +# --max-age=N delete entries older than N days since the last time +# that they have been seen (default: 30) +# --retry-window=N allow only N days for the first retrial (default: 2) +# append 'h' if you want to specify it in hours +# --greylist-action=A if greylisted, return A to Postfix (default: DEFER_IF_PERMIT) +# --lookup-by-subnet strip the last 8 bits from IP addresses (default) +# --lookup-by-host do not strip the last 8 bits from IP addresses +# --whitelist-clients=FILE default: /etc/postfix/postgrey_whitelist_clients +# --whitelist-recipients=FILE default: /etc/postfix/postgrey_whitelist_recipients +# +# Note that the --whitelist-x options can be specified multiple times, and that +# per default /etc/postfix/postgrey_whitelist_clients.local is also read, so +# that you can put there local entries. +# +POSTGREY_OPTS="" diff --git a/unstable/postgrey/postgrey.initd b/unstable/postgrey/postgrey.initd new file mode 100644 index 000000000..d38538de1 --- /dev/null +++ b/unstable/postgrey/postgrey.initd @@ -0,0 +1,101 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/mail-filter/postgrey/files/postgrey.rc.new,v 1.10 2008/05/21 18:45:44 dertobi123 Exp $ + +conf="/etc/conf.d/postgrey" + +opts="${opts} reload" + +depend() { + need net + before postfix + provide postfix_greylist +} + +conf_error() { + eerror "You need to setup ${conf} first" + return 1 +} + +checkconfig() { +if [ -z "${POSTGREY_TYPE}" ] + then + einfo "You need to choose the server type you want" + einfo "by setting the POSTGREY_TYPE variable in ${conf}." + else + if [ "x${POSTGREY_TYPE}" = "xinet" ] + then + if [ -z "${POSTGREY_PORT}" ] || [ -z "${POSTGREY_HOST}" ] + then + einfo "The following entries are missing in ${conf}:" + [ -z "${POSTGREY_HOST}" ] && einfo " - POSTGREY_HOST" + [ -z "${POSTGREY_PORT}" ] && einfo " - POSTGREY_PORT" + conf_error + fi + POSTGREY_ADDR="${POSTGREY_TYPE}=${POSTGREY_HOST}:${POSTGREY_PORT}" + else + if [ -z "${POSTGREY_SOCKET}" ] + then + einfo "The following entries are missing in ${conf}:" + [ -z "${POSTGREY_SOCKET}" ] && einfo " - POSTGREY_SOCKET" + conf_error + fi + POSTGREY_ADDR="${POSTGREY_TYPE}=${POSTGREY_SOCKET}" + fi +fi + + if [ -z "${POSTGREY_PID}" ] + then + einfo "The following entries are missing in ${conf}:" + [ -z "${POSTGREY_PID}" ] && einfo " - POSTGREY_PID" + conf_error + fi +} + +start() { + checkconfig || return 1 + ebegin "Starting Postgrey" + + # HACK -- start a subshell and corrects perms on the socket... + ( if [ "x${POSTGREY_TYPE}" = "xunix" ]; then + rm -f ${POSTGREY_SOCKET}; + while ! test -S ${POSTGREY_SOCKET}; do sleep 1; done; + chmod a+rw,a-x ${POSTGREY_SOCKET}; fi ) & + + if [ -z ${POSTGREY_DELAY} ] ; then + POSTGREY_DELAY_ARG="" + else + POSTGREY_DELAY_ARG="--delay=${POSTGREY_DELAY}" + fi + + if [ -z "${POSTGREY_TEXT}" ] ; then + POSTGREY_TEXT_ARG="" + else + POSTGREY_TEXT_ARG="--greylist-text=${POSTGREY_TEXT}" + fi + + start-stop-daemon --start --quiet --background \ + --pidfile=${POSTGREY_PID} \ + --name postgrey \ + --exec /usr/sbin/postgrey -- \ + --${POSTGREY_ADDR} \ + --daemonize \ + --pidfile=${POSTGREY_PID} \ + ${POSTGREY_DELAY_ARG} \ + ${POSTGREY_OPTS} \ + "${POSTGREY_TEXT_ARG}" + eend ${?} +} + +stop() { + ebegin "Stopping Postgrey" + start-stop-daemon --stop --quiet --pidfile ${POSTGREY_PID} + eend ${?} +} + +reload() { + ebegin "Reloading Postgrey" + start-stop-daemon --stop --signal HUP --oknodo --pidfile ${POSTGREY_PID} + eend $? +} diff --git a/unstable/postgrey/postgrey.pre-install b/unstable/postgrey/postgrey.pre-install new file mode 100644 index 000000000..3c34c3fd5 --- /dev/null +++ b/unstable/postgrey/postgrey.pre-install @@ -0,0 +1,6 @@ +#!/bin/sh + +addgroup postgrey 2>/dev/null +adduser -H -h /dev/null -s /bin/false -D postgrey 2>/dev/null + +exit 0 -- cgit v1.2.3