| Summary: | Enhancements to init script and configuration for postgrey | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | Jeremy Clifton <j.clifton> |
| Component: | New packages | Assignee: | Net-Mail Packages <net-mail+disabled> |
| Status: | RESOLVED FIXED | ||
| Severity: | enhancement | CC: | askwar, asl, craig, dertobi123, gokdenizk, pmw+gentoo, radek, reuben-gentoo-bugzilla, rockoo |
| Priority: | Lowest | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
| Attachments: |
Updated init file
Updated init file |
||
|
Description
Jeremy Clifton
2006-01-15 11:40:29 UTC
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 |