From 4d664293de9a57c9f3fe85a5923d4c6eb3f806ea Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 31 Oct 2008 08:25:06 +0000 Subject: [PATCH] fix init script and example-cfg2.txt --- debian/changelog | 5 +++++ debian/example-cfg2.txt | 22 +++++++++++----------- debian/init.d | 9 ++++----- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/debian/changelog b/debian/changelog index c7f61c8..eab8b89 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,11 @@ postfwd (1.10pre7c-3) unstable; urgency=low * implement machine-interpretable copyright file + * fix init script + - let daemon write pid file for his own + - point start-stop daemon to pidfile when stoping + - fix reload by fixing the way how to get the pid + * fix example-cfg2.txt to work with 1.10pre7 -- Jan Wagner Sun, 20 Jul 2008 13:27:42 +0200 diff --git a/debian/example-cfg2.txt b/debian/example-cfg2.txt index b8baf21..e8ef10a 100644 --- a/debian/example-cfg2.txt +++ b/debian/example-cfg2.txt @@ -2,7 +2,7 @@ # check for more recent versions! ### -### Example config for postfwd 1.10pre8+ +### Example config for postfwd 1.10pre7+ ### ## Check DNS whitelists, maybe we don't need more checks @@ -31,7 +31,7 @@ id=REJECT_HELO_NODNS; \ id=REJECT_RBL_ZEN; \ rbl=zen.spamhaus.org; \ - action=REJECT Blocked - contact postmaster@example.net for help - DNSBL [$$dnsbltext] + action=REJECT Blocked - contact postmaster@example.net for help - zen.spamhaus.org RBL ## Check other DNSBLs in parallel @@ -50,11 +50,11 @@ id=REJECT_RBL_ZEN; \ id=EVAL_DNSBLS; \ &&DNSBLS; rblcount=all; \ - action=set(HIT_rbls=$$rblcount,HIT_dtxt=$$dnsbltext) + action=set(HIT_rbls=$$rblcount) id=REJECT_RBL_MULTI; \ HIT_rbls>=2; \ - action=REJECT Blocked - contact postmaster@example.net for help - Multiple DNSBLs [$$HIT_dtxt] + action=REJECT Blocked - contact postmaster@example.net for help - Multiple DNSBLs ## Check RHSBLs if there wasn't enough DNSBLs hit @@ -73,33 +73,33 @@ id=REJECT_RBL_MULTI; \ id=EVAL_RHSBLS; \ &&RHSBLS_REVERSE; &&RHSBLS_SENDER; rhsblcount=all; \ - action=set(HIT_rhsbls=$$rhsblcount,HIT_rtxt=$$dnsbltext) + action=set(HIT_rhsbls=$$rhsblcount) id=REJECT_RHSBL_MULTI; \ HIT_rhsbls>=2; \ - action=REJECT Blocked - contact postmaster@example.net for help - Multiple RHSBLs [$$HIT_rtxt] + action=REJECT Blocked - contact postmaster@example.net for help - Multiple RHSBLs ## See if we get any combined hits from rules before id=REJECT_RBL_RHSBL; \ HIT_rbls>=1; HIT_rhsbls>=1; \ - action=REJECT Blocked - contact postmaster@example.net for help - RHSBL and DNSBL [$$HIT_rtxt] [$$HIT_dtxt] + action=REJECT Blocked - contact postmaster@example.net for help - RHSBL and DNSBL id=REJECT_RBL_HELO; \ HIT_rbls>=1; HIT_helo==1; \ - action=REJECT Blocked - contact postmaster@example.net for help - DNSBL [$$HIT_dtxt] and suspicious HELO [$$helo_name] + action=REJECT Blocked - contact postmaster@example.net for help - DNSBL and suspicious HELO [$$helo_name] id=REJECT_RBL_NODNS; \ HIT_rbls>=1; HIT_nodns==1; \ - action=REJECT Blocked - contact postmaster@example.net for help - DNSBL [$$HIT_dtxt] and missing reverse DNS [$$client_address] + action=REJECT Blocked - contact postmaster@example.net for help - DNSBL and missing reverse DNS [$$client_address] id=REJECT_RHSBL_HELO; \ HIT_rhsbls>=1; HIT_helo==1; \ - action=REJECT Blocked - contact postmaster@example.net for help - RHSBL [$$HIT_rtxt] and suspicious HELO [$$helo_name] + action=REJECT Blocked - contact postmaster@example.net for help - RHSBL and suspicious HELO [$$helo_name] id=REJECT_RHSBL_NODNS; \ HIT_rhsbls>=1; HIT_nodns==1; \ - action=REJECT Blocked - contact postmaster@example.net for help - RHSBL [$$HIT_rtxt] and missing reverse DNS [$$client_address] + action=REJECT Blocked - contact postmaster@example.net for help - RHSBL and missing reverse DNS [$$client_address] ## Finally greylist all lesser hits. ## diff --git a/debian/init.d b/debian/init.d index 2672648..dcbd703 100644 --- a/debian/init.d +++ b/debian/init.d @@ -19,6 +19,7 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin NAME=postfwd DAEMON=/usr/sbin/${NAME} +PIDFILE=/var/run/$NAME.pid DESC=postfwd test -x $DAEMON || exit 0 @@ -70,19 +71,17 @@ case "$1" in echo -n "Starting $DESC: " start-stop-daemon --start --quiet \ --name ${RUNAS} \ - --exec $DAEMON -- ${ARGS} --daemon --file=${CONF} --interface=${INET} --port=${PORT} --user=${RUNAS} --group=${RUNAS} + --exec $DAEMON -- ${ARGS} --daemon --file=${CONF} --interface=${INET} --port=${PORT} --user=${RUNAS} --group=${RUNAS} --pidfile=$PIDFILE echo "$NAME." ;; stop) echo -n "Stopping $DESC: " - start-stop-daemon --stop --quiet --oknodo \ - --exec $DAEMON + start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE && rm -rf $PIDFILE echo "$NAME." - rm -f /var/run/$NAME.pid ;; reload) echo "Reloading $DESC configuration files." - for pid in `pidof ${NAME}`; do kill -HUP ${pid}; done ; + kill -HUP $(cat $PIDFILE) ;; restart|force-reload) echo -n "Restarting $DESC (incl. cache): "