wok rev 1211
Add postgrey
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Aug 09 15:11:38 2008 +0000 (2008-08-09) |
parents | ac4e45db7a32 |
children | 534023d6e005 |
files | postgrey/receipt postgrey/stuff/etc/init.d/postgrey |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/postgrey/receipt Sat Aug 09 15:11:38 2008 +0000 1.3 @@ -0,0 +1,54 @@ 1.4 +# SliTaz package receipt. 1.5 + 1.6 +PACKAGE="postgrey" 1.7 +VERSION="1.32" 1.8 +CATEGORY="network" 1.9 +SHORT_DESC="Postfix policy server implementing greylisting." 1.10 +MAINTAINER="pascal.bellard@slitaz.org" 1.11 +TARBALL="$PACKAGE-$VERSION.tar.gz" 1.12 +WEB_SITE="http://postgrey.schweikert.ch/" 1.13 +WGET_URL="$WEB_SITE/pub/$TARBALL" 1.14 +CONFIG_FILES="/etc/postgrey" 1.15 +DEPENDS="postfix perl db perl-net-server perl-io-multiplex perl-berkeleydb" 1.16 + 1.17 + 1.18 +# Rules to gen a SliTaz package suitable for Tazpkg. 1.19 +genpkg_rules() 1.20 +{ 1.21 + mkdir -p $fs/usr/bin $fs/etc/postfix $fs/var/spool/postfix/postgrey 1.22 + cp $src/contrib/postgreyreport $src/postgrey $fs/usr/bin 1.23 + cp $src/postgrey_whitelist* $fs/etc/postfix 1.24 + cp -a stuff/etc $fs 1.25 +} 1.26 + 1.27 +# Pre and post install commands for Tazpkg. 1.28 +post_install() 1.29 +{ 1.30 + ( cd $1/ ; cpio -o -H newc | gzip -9 ) > \ 1.31 + $1/$INSTALLED/$PACKAGE/volatile.cpio.gz <<EOT 1.32 +$(cd $1/ ; find etc/postgrey -type f) 1.33 +EOT 1.34 + chown postfix /var/spool/postfix/postgrey 1.35 + cat <<EOF 1.36 +---- 1.37 +To use $PACKAGE with postfix, add check_policy_service inet:127.0.0.1:60000 in 1.38 +smtpd_recipient_restrictions of /etc/postfix/main.cf, i.e: 1.39 + 1.40 + smtpd_recipient_restrictions = 1.41 + .... 1.42 + check_policy_service inet:127.0.0.1:60000, 1.43 + permit 1.44 + 1.45 +To start $PACKAGE server you can run : 1.46 + 1.47 + /etc/init.d/$PACKAGE start 1.48 + 1.49 +Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf 1.50 +---- 1.51 +EOF 1.52 +} 1.53 + 1.54 +repack_cleanup() 1.55 +{ 1.56 + zcat $INSTALLED/$PACKAGE/volatile.cpio.gz | ( cd $1 ; cpio -id ) 1.57 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/postgrey/stuff/etc/init.d/postgrey Sat Aug 09 15:11:38 2008 +0000 2.3 @@ -0,0 +1,68 @@ 2.4 +#!/bin/sh 2.5 +# /etc/init.d/postgrey : Start, stop and restart Grey list server on SliTaz, at 2.6 +# boot time or with the command line. 2.7 +# 2.8 +# To start Grey list server at boot time, just put postgrey in the $RUN_DAEMONS 2.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf 2.10 +# 2.11 +. /etc/init.d/rc.functions 2.12 +. /etc/daemons.conf 2.13 + 2.14 +NAME=Postgrey 2.15 +DESC="Grey list server" 2.16 +DAEMON=/usr/bin/postgrey 2.17 +OPTIONS=$POSTGREY_OPTIONS 2.18 +PIDFILE=/var/run/postgrey.pid 2.19 +[ -n "$OPTIONS" ] || OPTIONS="--pidfile=$PIDFILE -d --inet=127.0.0.1:60000 --user=postfix" 2.20 + 2.21 +case "$1" in 2.22 + start) 2.23 + if [ -f $PIDFILE ] ; then 2.24 + echo "$NAME already running." 2.25 + exit 1 2.26 + fi 2.27 + if ! grep -q ^smtpd_recipient_restrictions /etc/postfix/main.cf; then 2.28 + echo -n "Updating /etc/postfix/main.cf" 2.29 + cat >> /etc/postfix/main.cf <<EOF 2.30 + 2.31 +# Add by $0 2.32 +smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination, 2.33 + check_policy_service inet:127.0.0.1:60000, 2.34 + permit 2.35 + 2.36 +EOF 2.37 + /etc/init.d/postfix reload 2.38 + fi 2.39 + echo -n "Starting $DESC: $NAME... " 2.40 + $DAEMON $OPTIONS 2.41 + status 2.42 + ;; 2.43 + stop) 2.44 + if [ ! -f $PIDFILE ] ; then 2.45 + echo "$NAME is not running." 2.46 + exit 1 2.47 + fi 2.48 + echo -n "Stopping $DESC: $NAME... " 2.49 + kill `cat $PIDFILE` 2.50 + status 2.51 + ;; 2.52 + restart) 2.53 + if [ ! -f $PIDFILE ] ; then 2.54 + echo "$NAME is not running." 2.55 + exit 1 2.56 + fi 2.57 + echo -n "Restarting $DESC: $NAME... " 2.58 + kill `cat $PIDFILE` 2.59 + sleep 2 2.60 + $DAEMON $OPTIONS 2.61 + status 2.62 + ;; 2.63 + *) 2.64 + echo "" 2.65 + echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart|reload]" 2.66 + echo "" 2.67 + exit 1 2.68 + ;; 2.69 +esac 2.70 + 2.71 +exit 0