diff options
author | Nishant Limbachia <nishant@mnspace.net> | 2010-05-13 23:21:07 -0500 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2010-05-16 22:24:33 -0500 |
commit | 58d3760cc703f1527a213560cc71b97cd31f4521 (patch) | |
tree | d498dd0f34921edbf92d8ba0d0461a73b1637860 /network/policyd2 | |
parent | c300db04940ef5b0e82bf05f7f2f84ce26720fd4 (diff) | |
download | slackbuilds-58d3760cc703f1527a213560cc71b97cd31f4521.tar.gz |
network/policyd2: Added (policy server for MTAs).
Diffstat (limited to 'network/policyd2')
-rw-r--r-- | network/policyd2/README | 8 | ||||
-rw-r--r-- | network/policyd2/doinst.sh | 26 | ||||
-rw-r--r-- | network/policyd2/logrotate.policyd2 | 8 | ||||
-rw-r--r-- | network/policyd2/patches/cbpadmin.patch | 20 | ||||
-rw-r--r-- | network/policyd2/patches/cbpolicyd.patch | 28 | ||||
-rw-r--r-- | network/policyd2/patches/httpd_policyd2_conf.patch | 14 | ||||
-rw-r--r-- | network/policyd2/patches/policyd2_config.patch | 26 | ||||
-rwxr-xr-x | network/policyd2/policyd2.SlackBuild | 144 | ||||
-rw-r--r-- | network/policyd2/policyd2.info | 10 | ||||
-rw-r--r-- | network/policyd2/rc.policyd2 | 67 | ||||
-rw-r--r-- | network/policyd2/slack-desc | 19 |
11 files changed, 370 insertions, 0 deletions
diff --git a/network/policyd2/README b/network/policyd2/README new file mode 100644 index 0000000000..73717016a4 --- /dev/null +++ b/network/policyd2/README @@ -0,0 +1,8 @@ +Policyd v2 (codenamed "cluebringer") is a multi-platform policy server for +popular MTAs. This policy daemon is designed mostly for large scale mail +hosting environments. The main goal is to implement as many spam combating +and email compliance features as possible while at the same time maintaining +the portability, stability and performance. + +This requires perl-Net-CIDR, perl-Net-Server, perl-Config-IniFiles, +perl-Cache-FastMmap, and perl-Mail-SPF . diff --git a/network/policyd2/doinst.sh b/network/policyd2/doinst.sh new file mode 100644 index 0000000000..0a90760749 --- /dev/null +++ b/network/policyd2/doinst.sh @@ -0,0 +1,26 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +# Keep same perms on rc.policyd.new: +if [ -e etc/rc.d/rc.policyd2 ]; then + cp -a etc/rc.d/rc.policyd2 etc/rc.d/rc.policyd2.new.incoming + cat etc/rc.d/rc.policyd2.new > etc/rc.d/rc.policyd2.new.incoming + mv etc/rc.d/rc.policyd2.new.incoming etc/rc.d/rc.policyd2.new +fi + +config etc/rc.d/rc.policyd2.new +config etc/policyd2.conf.new +config @DOCROOT@/policyd2-webui/includes/config.php.new +config etc/httpd/extra/httpd-policyd2.conf.new +config etc/logrotate.d/policyd2.new + diff --git a/network/policyd2/logrotate.policyd2 b/network/policyd2/logrotate.policyd2 new file mode 100644 index 0000000000..9a25024a50 --- /dev/null +++ b/network/policyd2/logrotate.policyd2 @@ -0,0 +1,8 @@ +/var/log/policyd2.log { + rotate 5 + notifempty + missingok + size 1M + nocompress + copytruncate +}
\ No newline at end of file diff --git a/network/policyd2/patches/cbpadmin.patch b/network/policyd2/patches/cbpadmin.patch new file mode 100644 index 0000000000..bcc8ede9a9 --- /dev/null +++ b/network/policyd2/patches/cbpadmin.patch @@ -0,0 +1,20 @@ +--- cbpadmin.orig 2010-01-02 10:38:04.625362848 -0600 ++++ cbpadmin 2010-01-02 10:42:26.850146337 -0600 +@@ -22,7 +22,7 @@ + use warnings; + + +-use lib('/usr/local/lib/policyd-2.0','/usr/lib/policyd-2.0'); ++use lib('/usr/lib/policyd-2.0','/usr/lib64/policyd-2.0'); + + use Config::IniFiles; + use Getopt::Long; +@@ -52,7 +52,7 @@ + + # Set defaults + my $cfg; +-$cfg->{'config_file'} = "/etc/cluebringer.conf"; ++$cfg->{'config_file'} = "/etc/policyd2.conf"; + + # Check if we must override + if (defined($opts{'config'}) && $opts{'config'} ne "") { diff --git a/network/policyd2/patches/cbpolicyd.patch b/network/policyd2/patches/cbpolicyd.patch new file mode 100644 index 0000000000..4a6efc4d18 --- /dev/null +++ b/network/policyd2/patches/cbpolicyd.patch @@ -0,0 +1,28 @@ +--- cbpolicyd.orig 2010-01-02 10:38:11.820144965 -0600 ++++ cbpolicyd 2010-01-02 10:41:45.097397504 -0600 +@@ -22,7 +22,7 @@ + use strict; + use warnings; + +-use lib('/usr/local/lib/policyd-2.0','/usr/lib/policyd-2.0'); ++use lib('/usr/lib/policyd-2.0','/usr/lib64/policyd-2.0'); + + package cbp; + +@@ -53,13 +53,13 @@ + + + # Set defaults +- $cfg->{'config_file'} = "/etc/cluebringer.conf"; ++ $cfg->{'config_file'} = "/etc/policyd2.conf"; + + $server->{'timeout'} = 120; + $server->{'background'} = "yes"; +- $server->{'pid_file'} = "/var/run/cbpolicyd.pid"; ++ $server->{'pid_file'} = "/var/run/policyd2.pid"; + $server->{'log_level'} = 2; +- $server->{'log_file'} = "/var/log/cbpolicyd.log"; ++ $server->{'log_file'} = "/var/log/policyd2.log"; + + $server->{'host'} = "*"; + $server->{'port'} = 10031; diff --git a/network/policyd2/patches/httpd_policyd2_conf.patch b/network/policyd2/patches/httpd_policyd2_conf.patch new file mode 100644 index 0000000000..d1f539d60e --- /dev/null +++ b/network/policyd2/patches/httpd_policyd2_conf.patch @@ -0,0 +1,14 @@ +--- httpd-policyd2.conf.orig 2009-01-06 00:53:09.000000000 -0600 ++++ httpd-policyd2.conf.new 2009-12-25 15:25:50.593040339 -0600 +@@ -8,9 +8,9 @@ + # as well as the authors' long time involvement in large scale mail + # hosting industry. + +-Alias /cluebringer /usr/share/cluebringer/webui ++Alias /policyd2 @DOCROOT@/policyd2-webui + +-<Directory /usr/share/cluebringer/webui> ++<Directory @DOCROOT@/policyd2-webui> + # Comment out the following 3 lines to make web ui accessible from anywhere + Order Deny,Allow + Deny from all diff --git a/network/policyd2/patches/policyd2_config.patch b/network/policyd2/patches/policyd2_config.patch new file mode 100644 index 0000000000..e5750fa669 --- /dev/null +++ b/network/policyd2/patches/policyd2_config.patch @@ -0,0 +1,26 @@ +--- policyd2.conf.orig 2010-01-02 11:12:18.047653694 -0600 ++++ policyd2.conf.new 2010-01-02 11:13:16.250398479 -0600 +@@ -20,11 +20,11 @@ + EOT + + # User to run this daemon as +-#user= +-#group= ++user=policyd ++group=policyd + + # Filename to store pid of parent process +-#pid_file=/var/run/cbpolicyd.pid ++pid_file=/var/run/policyd2.pid + + # Uncommenting the below option will prevent cbpolicyd going into the background + #background=no +@@ -60,7 +60,7 @@ + #log_level=2 + + # File to log to instead of stdout +-#log_file=/var/log/cbpolicyd.log ++log_file=/var/log/policyd2.log + + # Log destination for mail logs... + # main - Default. Log to policyd's main log mechanism, accepts NO args diff --git a/network/policyd2/policyd2.SlackBuild b/network/policyd2/policyd2.SlackBuild new file mode 100755 index 0000000000..bcee7dc791 --- /dev/null +++ b/network/policyd2/policyd2.SlackBuild @@ -0,0 +1,144 @@ +#!/bin/sh + +# Slackware Package Build Script for policyd2 (a.k.a cluebringer) +# Home Page http://www.policyd.org/ + +# Copyright (c) 2008-2010, Nishant Limbachia, Hoffman Estates, IL, USA +# <nishant _AT_ mnspace _DOT_ net> +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of script must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=policyd2 +VERSION=2.0.10 +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +SRCNAM=cluebringer + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +fi + +# Create system user and group for policyd2 +if ! grep -q ^policyd: /etc/group ; then + echo " Please add a dedicated group to run policyd2." + echo " # groupadd -g 223 policyd" + echo " Or something similar." + exit 1 +fi + +if ! grep -q ^policyd: /etc/passwd ; then + echo " Please add a dedicated user to run policyd2." + echo " # useradd -d /dev/null -s /bin/false -u 223 -g 223 policyd" + echo " Or something similar." + exit 1 +fi + +### default database is mysql, but postgresql (pgsql) and SQlite (sqlite) are supported as well +### please use exact words, mysql, pgsql or sqlite +DATABASE=${DATABASE:-mysql} + +### web user and group +WEBUSER=${WEBUSER:-root} +WEBGROUP=${WEBGROUP:-apache} + +### system user and group +USER=${USER:-policyd} +GROUP=${GROUP:-policyd} + +### define docroot to copy web admin files +DOCROOT=${DOCROOT:-/var/www/htdocs} + +DOCS="AUTHORS CHANGELOG INSTALL TODO LICENSE WISHLIST" + +set -e + +rm -fr $TMP/$PRGNAM-$VERSION $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +tar xvf $CWD/$SRCNAM-$VERSION.tar.bz2 +cd $TMP/$SRCNAM-$VERSION +chown -R root.root . + +find . \ + \( -perm 1755 -o -perm 2755 -o -perm 777 -o -perm 555 -o -perm 711 -o -perm 511 \) \ + -exec chmod 755 {} \; +find . \ + \( -perm 666 -o -perm 664 -o -perm 644 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +### patch cbpolicyd and cbpadmin to correct library paths and defaults +patch -p0 < $CWD/patches/cbpolicyd.patch +patch -p0 < $CWD/patches/cbpadmin.patch + +mkdir -p $PKG/$DOCROOT +mkdir -p $PKG/usr/{bin,sbin,lib${LIBDIRSUFFIX}/policyd-2.0,doc/$PRGNAM-$VERSION} +cp -a cbp $PKG/usr/lib${LIBDIRSUFFIX}/policyd-2.0 +install -m 0755 -D cbpadmin $PKG/usr/bin/cbpadmin +install -m 0755 -D cbpolicyd $PKG/usr/sbin/cbpolicyd +install -m 0644 $DOCS $PKG/usr/doc/$PRGNAM-$VERSION +cp -a webui $PKG/$DOCROOT/policyd2-webui + +### move config.php to new file +mv $PKG/$DOCROOT/policyd2-webui/includes/config.php $PKG/$DOCROOT/policyd2-webui/includes/config.php.new + +### change perms on webui files +chown -R $WEBUSER:$WEBGROUP $PKG/$DOCROOT/policyd2-webui + +### install and patch httpd include file +install -m 0640 -D contrib/httpd/$SRCNAM-httpd.conf $PKG/etc/httpd/extra/httpd-$PRGNAM.conf.new +( cd $PKG/etc/httpd/extra; patch -p0 < $CWD/patches/httpd_policyd2_conf.patch; sed -i s:@DOCROOT@:$DOCROOT: $PKG/etc/httpd/extra/httpd-$PRGNAM.conf.new ) + +### install rc script +install -m 0755 -D $CWD/rc.policyd2 $PKG/etc/rc.d/rc.policyd2.new + +### install and patch config file +install -m 0640 -D $SRCNAM.conf $PKG/etc/$PRGNAM.conf.new +( cd $PKG/etc; patch -p0 < $CWD/patches/policyd2_config.patch ) + +### install logrotate script +install -m 0644 -D $CWD/logrotate.policyd2 $PKG/etc/logrotate.d/policyd2.new + +### create database template +( cd database + for i in core.tsql access_control.tsql quotas.tsql amavis.tsql checkhelo.tsql checkspf.tsql greylisting.tsql; do + ./convert-tsql $DATABASE $i + done > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.$DATABASE || true +) + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +sed s:@DOCROOT@:$(echo $DOCROOT | sed s:/::): $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/network/policyd2/policyd2.info b/network/policyd2/policyd2.info new file mode 100644 index 0000000000..3ab0b3b666 --- /dev/null +++ b/network/policyd2/policyd2.info @@ -0,0 +1,10 @@ +PRGNAM="policyd2" +VERSION="2.0.10" +HOMEPAGE="http://www.policyd.org/" +DOWNLOAD="http://downloads.sourceforge.net/policyd/cluebringer-2.0.10.tar.bz2" +MD5SUM="cdff8f8e7c0e95143f7108159aed80c6" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="Nishant Limbachia" +EMAIL="nishant@mnspace.net" +APPROVED="rworkman" diff --git a/network/policyd2/rc.policyd2 b/network/policyd2/rc.policyd2 new file mode 100644 index 0000000000..80c9598635 --- /dev/null +++ b/network/policyd2/rc.policyd2 @@ -0,0 +1,67 @@ +#!/bin/sh +# +# Copyright (c) 2008-2010, Nishant Limbachia, Hoffman Estates, IL, USA +# +# /etc/rc.d/rc.policyd2 +# start|stop|restart|status Policyd2 daemon +# +# The PIDFILE is setup in the config file. Default is /var/run/policyd2.pid +# If you change the location in the config file then it **needs** to be +# changed here too for the script to work correctly + +PIDFILE="/var/run/policyd2.pid" +CONFIG="/etc/policyd2.conf" + +policyd2_start() { + if [ -x /etc/rc.d/rc.policyd2 ]; then + if [ -f $PIDFILE ]; then + echo "Policyd2 daemon running with PID: $(cat $PIDFILE)" + exit 1 + else + echo "Starting Policyd2 daemon" + /usr/sbin/cbpolicyd -c $CONFIG + fi + fi +} + +policyd2_stop() { + if [ -f $PIDFILE ]; then + echo "Stopping Policyd2 daemon" + killall cbpolicyd && rm -f $PIDFILE + else + echo "Policyd2 daemon is not running" + fi +} + +policyd2_restart() { + policyd2_stop + sleep 5 + policyd2_start +} + +policyd2_status() { + if [ -f $PIDFILE ]; then + echo "Policyd2 daemon running with PID: $(cat $PIDFILE)" + else + echo "Policyd2 daemon doesn't seem to be running!" + fi +} + +case "$1" in +'start') + policyd2_start + ;; +'stop') + policyd2_stop + ;; +'restart') + policyd2_restart + ;; +'status') + policyd2_status + ;; +*) + echo "USAGE: $0 start|stop|restart|status" + exit 1 + ;; +esac diff --git a/network/policyd2/slack-desc b/network/policyd2/slack-desc new file mode 100644 index 0000000000..fa475d846b --- /dev/null +++ b/network/policyd2/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler-----------------------------------------------------| +policyd2: policyd2 (policy server for MTA) +policyd2: +policyd2: policyd2 is is a multi-platform policy server for popular MTAs. +policyd2: policyd2 aims to implement as many spam combating and email compliance +policyd2: features as possible while at the same time maintaining the portability, +policyd2: stability and performance. +policyd2: +policyd2: Home Page: http://www.policyd.org/ +policyd2: +policyd2: +policyd2: |