summaryrefslogtreecommitdiff
path: root/pcr/postsrsd
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2014-07-28 16:37:30 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2014-07-28 16:37:30 -0300
commit749931b987f1e81d31c14e18c43081f44b5a2bca (patch)
treea4a2c9d8394f4a733efcf50ff2bf9318ce5de295 /pcr/postsrsd
parentcec8a1cddabfaa4cc9f56631a50a028e1dbd03de (diff)
parent1f1c232541ccc261b8484cc4d72039b36ba323d2 (diff)
downloadabslibre-749931b987f1e81d31c14e18c43081f44b5a2bca.tar.gz
abslibre-749931b987f1e81d31c14e18c43081f44b5a2bca.tar.bz2
abslibre-749931b987f1e81d31c14e18c43081f44b5a2bca.zip
Merge branch 'master' of ssh://projects.parabolagnulinux.org:1863/~git/abslibre
Diffstat (limited to 'pcr/postsrsd')
-rw-r--r--pcr/postsrsd/PKGBUILD41
-rw-r--r--pcr/postsrsd/postsrsd.install15
-rw-r--r--pcr/postsrsd/postsrsd.service15
3 files changed, 71 insertions, 0 deletions
diff --git a/pcr/postsrsd/PKGBUILD b/pcr/postsrsd/PKGBUILD
new file mode 100644
index 000000000..d377f36ad
--- /dev/null
+++ b/pcr/postsrsd/PKGBUILD
@@ -0,0 +1,41 @@
+# 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')
+
+prepare() {
+ cd "$srcdir/${pkgname}-${pkgver}"
+ mkdir build
+}
+
+build() {
+ cd "$srcdir/${pkgname}-${pkgver}"
+ cd build
+ cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DGENERATE_SRS_SECRET=OFF
+ make all
+}
+
+package() {
+ cd "$srcdir/${pkgname}-${pkgver}/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