I have postgrey 1.21 installed on my box. I modified the init script and conf.d file such that it was possible to configure the greylist delay period and greylist response text from the conf.d/postgrey file. The modified init script checks to make sure that the POSTGREY_DELAY var has been set, and will issue an error if it has not. It also will append the value of POSTGREY_RESPONSE (with the appropriate flag) to the options passed to start-stop-daemon only if the POSTGREY_RESPONSE var is set or not an empty string. I believe that this will be of use to other Gentoo users ... especially the addition of the info for the --greylist-text option, as simply adding this flag and the message to the POSTGREY_OPTIONS var in the conf.d file won't work (see the following links to information about the Debian implementation for more details) http://lists.ee.ethz.ch/postgrey/msg00584.html http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=298832 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=309515 diff for /etc/init.d/postgrey: ---------- --- postgrey.old 2006-01-15 14:23:45.000000000 -0500 +++ postgrey 2006-01-15 13:14:18.000000000 -0500 @@ -49,6 +49,15 @@ [ -z "${POSTGREY_PID}" ] && einfo " - POSTGREY_PID" conf_error fi + + # Make sure the greylisting delay time period is set. + if [ -z "${POSTGREY_DELAY}" ] + then + einfo "The following entries are missing in ${conf}:" + [ -z "${POSTGREY_DELAY}" ] && einfo " - POSTGREY_DELAY" + conf_error + fi + } start() { @@ -61,12 +70,19 @@ while ! test -S ${POSTGREY_SOCKET}; do sleep 1; done; chmod a+rw,a-x ${POSTGREY_SOCKET}; fi ) & + # Check for a greylist message. + if [ "$POSTGREY_RESPONSE" != "" ] + then + POSTGREY_RESPONSE_OPT="--greylist-text=$POSTGREY_RESPONSE" + fi + start-stop-daemon --start --quiet --background \ --exec /usr/sbin/postgrey -- \ --${POSTGREY_ADDR} \ --daemonize \ --pidfile=${POSTGREY_PID} \ - ${POSTGREY_OPTS} + ${POSTGREY_OPTS} \ + "${POSTGREY_RESPONSE_OPT}" eend ${?} } ---------- diff for /etc/conf.d/postgrey: ---------- --- postgrey.old 2006-01-15 14:23:31.000000000 -0500 +++ postgrey 2006-01-15 13:15:03.000000000 -0500 @@ -1,5 +1,11 @@ # Config file for /etc/init.d/postgrey +# How long to delay mail that is greylisted in seconds. +POSTGREY_DELAY=900 + +# The response we'll send back with delayed mail. +POSTGREY_RESPONSE='This account is temporarily disabled. Please try again in %s seconds.' + # LISTEN TYPE # Set to 'inet' if you want to use a TCP socket. # Set to 'unix' if you want to use an UNIX socket. @@ -48,4 +54,4 @@ # per default /etc/postfix/postgrey_whitelist_clients.local is also read, so # that you can put there local entries. # -POSTGREY_OPTS="" +POSTGREY_OPTS="--delay=$POSTGREY_DELAY" ----------
I'll have a look at this today. Looks good.
In portage now, for newly added postgrey-1.24. I added some sanity checks for when new options are commented in the .conf file (and thus empty). Thanks for your contribution!
I recently upgraded to this ebuild, but there is a problem with postgrey response text. The problem is, only the first word of the POSTGREY_TEXT is sent to the remote server. There is a thread about this at: http://lists.ee.ethz.ch/postgrey/msg01062.html it mentions quotes, but when I look at /etc/init.d/postgrey, quotes are all in place. Here is an example log line from a spam being rejected; Apr 5 17:32:56 thostname postfix/smtpd[2393]: NOQUEUE: reject: RCPT from WLL-23-pppoe081.t-net.net.ve[200.31.137.81]: 450 <xxxx@tttt.yy>: Recipient address rejected: "Temporariliy; from=<georgiy_b05@list.ru> to=<xxxx@tttt.yy> proto=ESMTP helo=<r95di.ohuby5.comcast.net>
You're right, I can experience this too, despite it looking alright in ps: 18182 ? Ss 0:00 /usr/sbin/postgrey --unix=/var/spool/postfix/private/postgrey --daemonize --pidfile=/var/run/postgrey.pid --delay=300 --greylist-text "Greylisted for %s seconds"
I have this problem, too -- and worse: postgrey just die after delaying the first mail... Works fine when I comment the greylist text option in the conf file.
Same problem here. Another thread on the postgrey list: http://lists.ee.ethz.ch/postgrey/msg01105.html > 18182 ? Ss 0:00 /usr/sbin/postgrey > --unix=/var/spool/postfix/private/postgrey --daemonize > --pidfile=/var/run/postgrey.pid --delay=300 --greylist-text "Greylisted for %s > seconds" Interestingly (?) my PS output looks a bit different: askwar@hetzner ~ $ ps axwww|grep postgrey 26719 ? Ss 0:00 /usr/sbin/postgrey --unix=/var/spool/postfix/private/postgrey --daemonize --pidfile=/var/run/postgrey.pid --delay=300 --greylist-text="Greylisted for %s seconds" The difference is, that I've got a = before the "Greylisted.
I changed start-stop-daemon --start --quiet --background \ --exec /usr/sbin/postgrey -- \ --${POSTGREY_ADDR} \ --daemonize \ --pidfile=${POSTGREY_PID} \ ${POSTGREY_DELAY_ARG} \ ${POSTGREY_TEXT_ARG} \ ${POSTGREY_OPTS} to start-stop-daemon --start --quiet --background \ --exec /usr/sbin/postgrey -- \ --${POSTGREY_ADDR} \ --daemonize \ --pidfile=${POSTGREY_PID} \ ${POSTGREY_DELAY_ARG} \ "${POSTGREY_TEXT_ARG}" \ ${POSTGREY_OPTS} and it magically works =) Also, how come --background is being passed to start-stop-daemon?
Comment #7 fixes this problem for me as well.
Created attachment 95431 [details] Updated init file As per comment #7, this updated init file puts the POSTGREY_TEXT_ARG into double quotes to prevent the parameter from being cut off at the first whitespace character.
Comment on attachment 95431 [details] Updated init file >#!/sbin/runscript ># Copyright 1999-2004 Gentoo Foundation ># Distributed under the terms of the GNU General Public License v2 ># $Header: /var/cvsroot/gentoo-x86/mail-filter/postgrey/files/postgrey.rc.new,v 1.3 2006/02/25 17:59:13 ticho Exp $ > >conf="/etc/conf.d/postgrey" > >depend() { > need net > before postfix > provide postfix_greylist >} > >conf_error() { > eerror "You need to setup ${conf} first" > return 1 >} > >checkconfig() { >if [ -z "${POSTGREY_TYPE}" ] > then > einfo "You need to choose the server type you want" > einfo "by setting the POSTGREY_TYPE variable in ${conf}." > else > if [ "x${POSTGREY_TYPE}" = "xinet" ] > then > if [ -z "${POSTGREY_PORT}" ] || [ -z "${POSTGREY_HOST}" ] > then > einfo "The following entries are missing in ${conf}:" > [ -z "${POSTGREY_HOST}" ] && einfo " - POSTGREY_HOST" > [ -z "${POSTGREY_PORT}" ] && einfo " - POSTGREY_PORT" > conf_error > fi > POSTGREY_ADDR="${POSTGREY_TYPE}=${POSTGREY_HOST}:${POSTGREY_PORT}" > else > if [ -z "${POSTGREY_SOCKET}" ] > then > einfo "The following entries are missing in ${conf}:" > [ -z "${POSTGREY_SOCKET}" ] && einfo " - POSTGREY_SOCKET" > conf_error > fi > POSTGREY_ADDR="${POSTGREY_TYPE}=${POSTGREY_SOCKET}" > fi >fi > > if [ -z "${POSTGREY_PID}" ] > then > einfo "The following entries are missing in ${conf}:" > [ -z "${POSTGREY_PID}" ] && einfo " - POSTGREY_PID" > conf_error > fi >} > >start() { > checkconfig || return 1 > ebegin "Starting Postgrey" > > # HACK -- start a subshell and corrects perms on the socket... > ( if [ "x${POSTGREY_TYPE}" = "xunix" ]; then > rm -f ${POSTGREY_SOCKET}; > while ! test -S ${POSTGREY_SOCKET}; do sleep 1; done; > chmod a+rw,a-x ${POSTGREY_SOCKET}; fi ) & > > if [ -z ${POSTGREY_DELAY} ] ; then > POSTGREY_DELAY_ARG="" > else > POSTGREY_DELAY_ARG="--delay=${POSTGREY_DELAY}" > fi > > if [ -z "${POSTGREY_TEXT}" ] ; then > POSTGREY_TEXT_ARG="" > else > POSTGREY_TEXT_ARG="--greylist-text="${POSTGREY_TEXT} > fi > > start-stop-daemon --start --quiet --background \ > --exec /usr/sbin/postgrey -- \ > --${POSTGREY_ADDR} \ > --daemonize \ > --pidfile=${POSTGREY_PID} \ > ${POSTGREY_DELAY_ARG} \ > "${POSTGREY_TEXT_ARG}" \ > ${POSTGREY_OPTS} > eend ${?} >} > >stop() { > ebegin "Stopping Postgrey" > start-stop-daemon --stop --quiet --pidfile ${POSTGREY_PID} > eend ${?} >}
Created attachment 96552 [details] Updated init file The change is that it prevents nested quotes. The previous patch would include the quotation marks in the server reply, like so: Recipient address rejected: "Greylisted for 60 seconds"; to= Now it says: Recipient address rejected: Greylisted for 60 seconds; to= It uses direct concatenation of quoted text with a shell variable. And apologies for the previous comment spam: I did not realize what my action would cause.
I have the same issue. This is my quick fix (without starting to edit perl scripts): /etc/conf.d/postgrey: POSTGREY_TEXT="Cyberlogic_Greylisted_for_%s_seconds_(http://postmaster.cyberlogic.net/greylist.php)" 8830 ? Ss 0:02 /usr/sbin/postgrey --inet=127.0.0.1:10030 --daemonize --pidfile=/var/run/postgrey.pid --delay=300 --greylist-text="Cyberlogic_Greylisted_for_%s_seconds_(http://postmaster.cyberlogic.net/greylist.php)" -v --whitelist-clients=/etc/postfix/postgrey_whitelist_clients
Still seeing this problem with only the word "Greylisted;" in the URL as of 04-Feb-07.
(In reply to comment #13) > Still seeing this problem with only the word "Greylisted;" in the URL as of > 04-Feb-07. > Still not fixed, as of 2007-06-21.
*** Bug 177443 has been marked as a duplicate of this bug. ***
This one is supposed to be fixed in 1.30-r2.
(In reply to comment #16) > This one is supposed to be fixed in 1.30-r2. > s/1.30-r2/1.31