Created
March 19, 2014 16:23
-
-
Save lancechentw/9645385 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DOMAIN="" | |
| SECRET_FILE="/etc/postfix/pfix-srsd.secrets" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| generate_secrets() { | |
| for i in {1..10}; do | |
| dd if=/dev/urandom count=1 2> /dev/null | base64 -w 1000 >> /etc/postfix/pfix-srsd.secrets; | |
| done | |
| chown pfix-srsd:pfix-srsd /etc/postfix/pfix-srsd.secrets | |
| chmod 400 /etc/postfix/pfix-srsd.secrets | |
| } | |
| post_install() { | |
| getent group pfix-srsd &>/dev/null || groupadd pfix-srsd >/dev/null | |
| getent passwd pfix-srsd &>/dev/null || useradd -d /var/lib/pfix-srsd -g pfix-srsd -s /bin/false pfix-srsd >/dev/null | |
| chown pfix-srsd:pfix-srsd /var/lib/pfix-srsd | |
| [ -e /etc/postfix/pfix-srsd.secrets ] || generate_secrets | |
| } | |
| post_upgrade() { | |
| post_install | |
| } | |
| pre_remove() { | |
| getent passwd pfix-srsd &>/dev/null && userdel pfix-srsd >/dev/null | |
| getent group pfix-srsd &>/dev/null && groupdel pfix-srsd >/dev/null | |
| true | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Unit] | |
| Description=postfix srsd lookup service | |
| [Service] | |
| Type=simple | |
| #User=pfix-srsd | |
| #Group=pfix-srsd | |
| PIDFile=/run/pfix-srsd.pid | |
| EnvironmentFile=-/etc/default/pfix-srsd | |
| ExecStart=/usr/bin/pfix-srsd -U pfix-srsd -G pfix-srsd -p /run/pfix-srsd.pid -f -v ${DOMAIN} ${SECRET_FILE} | |
| [Install] | |
| WantedBy=multi-user.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Maintainer: Nikolay Amiantov <nikoamia@gmail.com> | |
| # pkgbase=pfixtools-git | |
| # pkgname=(pfix-srsd-git postlicyd-git) | |
| pkgname=pfix-srsd-git | |
| pkgver=0.8.r110.g6096375 | |
| pkgrel=1 | |
| # pkgdesc="Collection of postfix-related tools." | |
| pkgdesc="This daemon brings SRS to postfix using its tcp_table or socketmap_table mechanisms." | |
| # makedepends=(libsrs2 libev pcre unbound libsrs2 tokyocabinet | |
| # xmlto docbook-xsl asciidoc) | |
| backup=('etc/default/pfix-srsd' | |
| 'etc/postfix/pfix-srsd') | |
| depends=(libsrs2 libev) | |
| makedepends=(xmlto docbook-xsl asciidoc) | |
| provides=(pfix-srsd) | |
| conflicts=(pfix-srsd) | |
| arch=(i686 x86_64) | |
| url="https://github.com/Fruneau/pfixtools" | |
| license=(BSD) | |
| install=pfix-srsd.install | |
| source=('git+https://github.com/Fruneau/pfixtools.git' | |
| 'git+https://github.com/Fruneau/libcommon.git' | |
| 'use-usr-bin.patch' | |
| 'pfix-srsd.service' | |
| 'pfix-srsd.default') | |
| sha1sums=('SKIP' | |
| 'SKIP' | |
| '9fa564ee0659bdcbe1e40908c8738e02bd8caffe' | |
| 'a7cfecd9dff559c97824328c4b668deb63b4ded9' | |
| '2c1cf3350e15b7ada51be4bc07f982ef82475f17') | |
| pkgver() { | |
| cd "$srcdir/pfixtools" | |
| git describe --long | sed -r 's/^pfixtools-//;s/([^-]*-g)/r\1/;s/-/./g' | |
| } | |
| prepare() { | |
| cd "$srcdir/pfixtools" | |
| git submodule init | |
| git config submodule.common.url "$srcdir/libcommon" | |
| git submodule update | |
| cd common | |
| patch -p1 -i "$srcdir/use-usr-bin.patch" | |
| } | |
| build() { | |
| cd "$srcdir/pfixtools" | |
| cd common | |
| make | |
| cd .. | |
| #make prefix=/usr all doc | |
| cd pfix-srsd | |
| make prefix=/usr all doc | |
| } | |
| # check() { | |
| # cd "$srcdir/pfixtools/tests" | |
| # | |
| # for i in ./tst-*; do | |
| # [ -x "$i" ] && "$i" | |
| # done | |
| # } | |
| # package_pfix-srsd-git() { | |
| package() { | |
| # pkgdesc="This daemon brings SRS to postfix using its tcp_table or socketmap_table mechanisms." | |
| # depends=(libsrs2 libev) | |
| # provides=(pfix-srsd) | |
| # conflicts=(pfix-srsd) | |
| cd "$srcdir/pfixtools/pfix-srsd" | |
| mkdir -p "$pkgdir/usr/bin" | |
| mkdir -p "$pkgdir/usr/share/doc/pfixtools" | |
| mkdir -p "$pkgdir/usr/lib/systemd/system" | |
| mkdir -p "$pkgdir/var/lib/pfix-srsd" | |
| mkdir -p "$pkgdir/etc/default/" | |
| make prefix=/usr DESTDIR="$pkgdir" install install-doc | |
| install -D -m644 ../LICENSE "$pkgdir/usr/share/licenses/$pkgname" | |
| install -D -m644 "$srcdir/pfix-srsd.service" "$pkgdir/usr/lib/systemd/system/" | |
| install -D -m644 "$srcdir/pfix-srsd.default" "$pkgdir/etc/default/pfix-srsd" | |
| } | |
| # package_postlicyd-git() { | |
| # pkgdesc="This is a postfix policy daemon. It includes greylisting, rbl lookups, counters, SMTP session tracking, in a way that allow very fine grained schemes." | |
| # depends=(libev pcre unbound libsrs2 gperf tokyocabinet) | |
| # provides=(postlicyd) | |
| # conflicts=(postlicyd) | |
| # cd "$srcdir/pfixtools/postlicyd" | |
| # mkdir -p "$pkgdir/usr/bin" | |
| # mkdir -p "$pkgdir/usr/share/doc/pfixtools" | |
| # make prefix=/usr DESTDIR="$pkgdir" install install-doc | |
| # cd "$srcdir/pfixtools" | |
| # make prefix=/usr DESTDIR="$pkgdir" install-postlicyd-conf \ | |
| # install-postlicyd-tools | |
| # install -D -m644 LICENSE "$pkgdir/usr/share/licenses/$pkgname" | |
| # } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment