diff options
Diffstat (limited to 'pcr')
-rw-r--r-- | pcr/postsrsd/PKGBUILD | 37 | ||||
-rw-r--r-- | pcr/postsrsd/postsrsd.install | 15 | ||||
-rw-r--r-- | pcr/postsrsd/postsrsd.service | 15 |
3 files changed, 67 insertions, 0 deletions
diff --git a/pcr/postsrsd/PKGBUILD b/pcr/postsrsd/PKGBUILD new file mode 100644 index 000000000..d42ed0ccb --- /dev/null +++ b/pcr/postsrsd/PKGBUILD @@ -0,0 +1,37 @@ +# Based on +# Maintainer: Thomas Haider <t.haider@deprecate.de> + +pkgname=postsrsd +pkgver=1.1 +pkgrel=1 +pkgdesc="Provides the Sender Rewriting Scheme (SRS) via TCP-based lookup tables for Postfix" +arch=('i686' 'x86_64') +depends=('glibc') +makedepends=('cmake' 'help2man') +backup=('etc/postsrsd/postsrsd.conf') +url="https://github.com/roehling/postsrsd" +install=postsrsd.install +license=('GPL2') +source=('https://github.com/roehling/postsrsd/archive/1.1.tar.gz' 'postsrsd.service') +md5sums=('5cde2c2ae7046347f5e17aef2ea8a4a8' + '64f31e8914f5063297371d36f699302d') + +build() { + cd "$srcdir/${pkgname}-${pkgver}" + mkdir build + cd build + cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DGENERATE_SRS_SECRET=OFF + make all +} + +package() { + cd "$srcdir/postsrsd/build" + make DESTDIR="$pkgdir/" install + + rm -rf $pkgdir/usr/lib + mv "$pkgdir/usr/sbin" "$pkgdir/usr/bin" + sed -e 's/^\(RUN_AS=\)nobody/#\1postsrsd/;s/\(\/etc\/postsrsd\)\(\.secret\)/\1\/postsrsd\2/' \ + -e 's/^\(# is \).*$/\1localhost\.localdomain/'< ../postsrsd.default > postsrsd.conf + install -D -m644 "postsrsd.conf" "$pkgdir/etc/postsrsd/postsrsd.conf" + install -D -m644 "$srcdir/postsrsd.service" "$pkgdir/usr/lib/systemd/system/postsrsd.service" +} diff --git a/pcr/postsrsd/postsrsd.install b/pcr/postsrsd/postsrsd.install new file mode 100644 index 000000000..b8e7f8d5a --- /dev/null +++ b/pcr/postsrsd/postsrsd.install @@ -0,0 +1,15 @@ +post_install() { + useradd -r -g mail -d / postsrsd + chown -R postsrsd:root etc/postsrsd + + [ -e /etc/postsrsd/postsrsd.secret ] || dd if=/dev/urandom bs=18 count=1 status=none | base64 > /etc/postsrsd/postsrsd.secret + chown postsrsd:root /etc/postsrsd/postsrsd.secret + chmod 400 /etc/postsrsd/postsrsd.secret + cat << _EOF +Don't forget to set your domainname in /etc/postsrsd/postsrsd.conf +_EOF +} + +post_remove() { + userdel postsrsd +} diff --git a/pcr/postsrsd/postsrsd.service b/pcr/postsrsd/postsrsd.service new file mode 100644 index 000000000..e72f97045 --- /dev/null +++ b/pcr/postsrsd/postsrsd.service @@ -0,0 +1,15 @@ +[Unit] +Description=Postfix Sender Rewriting Scheme daemon + +[Service] +Type=forking +RuntimeDirectory=postsrsd +PIDFile=/run/postsrsd/postsrsd.pid +Environment=SRS_DOMAIN=localhost.localdomain SRS_FORWARD_PORT=10001 SRS_REVERSE_PORT=10002 SRS_SECRET=/etc/postsrsd/postsrsd.secret \ + SRS_EXCLUDE_DOMAINS= RUN_AS=postsrsd CHROOT=/run/postsrsd +EnvironmentFile=/etc/postsrsd/postsrsd.conf +ExecStart=/usr/bin/postsrsd -D -4 -f${SRS_FORWARD_PORT} -r${SRS_REVERSE_PORT} -d${SRS_DOMAIN} -s${SRS_SECRET} -u${RUN_AS} \ + -c${CHROOT} -X${SRS_EXCLUDE_DOMAINS} -p/run/postsrsd/postsrsd.pid + +[Install] +WantedBy=multi-user.target |