initial import
This commit is contained in:
68
postgrey/PKGBUILD
Normal file
68
postgrey/PKGBUILD
Normal file
@@ -0,0 +1,68 @@
|
||||
# Maintainer: Jesus E. <heckyel@riseup.net>
|
||||
|
||||
pkgname=postgrey
|
||||
pkgver=1.36
|
||||
_debver=$pkgver
|
||||
_debrel=5.2
|
||||
pkgrel=2
|
||||
pkgdesc="A postfix policy server implementing greylisting"
|
||||
arch=('any')
|
||||
url="https://postgrey.schweikert.ch/"
|
||||
options=(emptydirs)
|
||||
license=('GPL-2')
|
||||
depends=('perl-net-server' 'perl' 'perl-berkeleydb' 'perl-io-multiplex'
|
||||
"db>=4.1" 'perl-netaddr-ip')
|
||||
makedepends=('quilt')
|
||||
optdepends=('postfix: the recommended MTA for use with postgrey'
|
||||
'exim: an alternative MTA'
|
||||
'perl-net-dns: for postgreyreport tool')
|
||||
backup=(etc/postgrey/whitelist_recipients
|
||||
etc/postgrey/whitelist_clients)
|
||||
install=$pkgname.install
|
||||
source=("https://postgrey.schweikert.ch/pub/$pkgname-$pkgver.tar.gz"
|
||||
"https://deb.debian.org/debian/pool/main/p/postgrey/postgrey_$_debver-$_debrel.debian.tar.xz"
|
||||
"$pkgname.initd"
|
||||
"$pkgname.confd"
|
||||
"$pkgname.run")
|
||||
sha512sums=('9b2502b873658c1ef8a86bff091d61b8dc8d66f7395bc0a869f9e6ec60b691a317c084ae326f49ce8dd926f0fa2620a58f3ad76c25e1b1c9606557d2802d1395'
|
||||
'00bd8410b343db2697298dcbe81869d481854d2480cf63ad09c7514e9e44ef8564f578dd3616970c07444454f8c484c226bade3f39c3354c180c3f941bbe5de5'
|
||||
'9e2b76272d2ac780ec1c43486504c7ebe62ca9bf90fb5f6f6bc938a108bd10b6ca515a81648619ecdce8976aec9ff5f498be9f3894fd05787cc6c7d14624fa84'
|
||||
'75341bf097eda87427a91bf9243229a2f7dc330f97a739042e7b9ce85be3ca7cba86c59fd8f9ba2ce5532e850cb80a51febad0ce58a2c92253e2a3fabd2185ad'
|
||||
'2393192cb60aecc730ff43791e81dfffa4be90d399f53216b22ac3cf006d88fe3f4a82300a9e310f88e4efec0694c4dec299560fa5749bf1b2df12bd73783e68')
|
||||
|
||||
prepare() {
|
||||
cd "$srcdir"/$pkgname-$pkgver
|
||||
if [[ ${pkgver%.*} = ${_debver%.*} ]]; then
|
||||
# Debian patches
|
||||
export QUILT_PATCHES=debian/patches
|
||||
export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
|
||||
export QUILT_DIFF_ARGS='--no-timestamps'
|
||||
|
||||
mv "$srcdir"/debian .
|
||||
|
||||
quilt push -av
|
||||
fi
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$srcdir"/$pkgname-$pkgver
|
||||
|
||||
# folder structure
|
||||
mkdir -p "$pkgdir"/var/lib/$pkgname
|
||||
chmod 770 "$pkgdir"/var/lib/$pkgname
|
||||
|
||||
# binary data
|
||||
install -D -m 0755 postgrey "$pkgdir"/usr/sbin/postgrey
|
||||
install -D -m 0755 policy-test "$pkgdir"/usr/sbin/policy-test
|
||||
install -D -m 0755 contrib/postgreyreport "$pkgdir"/usr/bin/postgreyreport
|
||||
install -D -m 0644 postgrey_whitelist_recipients "$pkgdir"/etc/postgrey/whitelist_recipients
|
||||
install -D -m 0644 postgrey_whitelist_clients "$pkgdir"/etc/postgrey/whitelist_clients
|
||||
|
||||
# services
|
||||
install -Dm 644 "$srcdir/$pkgname.confd" "$pkgdir/etc/conf.d/$pkgname"
|
||||
install -Dm 755 "$srcdir/$pkgname.initd" "$pkgdir/etc/init.d/$pkgname"
|
||||
install -Dm 755 "$srcdir/$pkgname.run" "$pkgdir/etc/sv/$pkgname/run"
|
||||
|
||||
# license
|
||||
install -Dm644 COPYING -t "$pkgdir/usr/share/licenses/$pkgname"
|
||||
}
|
||||
55
postgrey/postgrey.confd
Normal file
55
postgrey/postgrey.confd
Normal file
@@ -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 a 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="10023"
|
||||
|
||||
# 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/lib/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=""
|
||||
100
postgrey/postgrey.initd
Normal file
100
postgrey/postgrey.initd
Normal file
@@ -0,0 +1,100 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2014 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
conf="/etc/conf.d/postgrey"
|
||||
|
||||
extra_started_commands="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 $?
|
||||
}
|
||||
23
postgrey/postgrey.install
Normal file
23
postgrey/postgrey.install
Normal file
@@ -0,0 +1,23 @@
|
||||
post_install() {
|
||||
if ! getent group postgrey &>/dev/null; then
|
||||
groupadd -r postgrey >& /dev/null
|
||||
fi
|
||||
if ! getent passwd postgrey &>/dev/null; then
|
||||
useradd -r -d /var/spool/postfix/postgrey -g postgrey -s /bin/false postgrey
|
||||
fi
|
||||
|
||||
chown postgrey:postgrey /var/lib/postgrey
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
post_install $1
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
if getent passwd postgrey &>/dev/null; then
|
||||
userdel postgrey >/dev/null
|
||||
fi
|
||||
if getent group postgrey &>/dev/null; then
|
||||
groupdel postgrey >/dev/null
|
||||
fi
|
||||
}
|
||||
2
postgrey/postgrey.run
Normal file
2
postgrey/postgrey.run
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exec /usr/sbin/postgrey --inet=127.0.0.1:10030 --user=postgrey --group=postgrey --greylist-text="Greylisted for %%s seconds"
|
||||
Reference in New Issue
Block a user