Qmail
[Top] [All Lists]

Re: rblsmtpd with relay-ctrl

To: qmail@list.cr.yp.to
Subject: Re: rblsmtpd with relay-ctrl
From: Amitai Schlair <schmonz@schmonz.com>
Date: Sat, 03 Mar 2007 15:14:03 -0500
Delivered-to: sp-com-lists@consult.net
Delivered-to: gmail-qmail@securepoint.com
Delivered-to: sp.com.list@gmail.com
Delivered-to: mailing list qmail@list.cr.yp.to
In-reply-to: <45E84863.7000707@sysec.com.mx>
Mailing-list: contact qmail-help@list.cr.yp.to; run by ezmlm
Organization: Schmonz Enterprises
References: <45E84863.7000707@sysec.com.mx>
User-agent: Thunderbird 1.5.0.10 (Macintosh/20070221)
Mario Salazar Baños wrote:

I use qmail with rblsmtpd and relay-ctrl , one month ago I activate rblsmtpd and now my users outside from my network are rejected, is possible that relay-ctrl conditioned to rblsmtpd?, ie, if relay-ctrl is valid then don't use rblsmtpd?

If you have to use the same SMTP port for both incoming mail and relaying, then you need to make sure nothing gets in the way when RELAYCLIENT is set. I use a script called "ifrelayclient" which runs the first command only if RELAYCLIENT is set, running the remaining commands regardless. (It expects the first command to end with --.) So you could put the following in your qmail-smtpd run script after relay-ctrl-check and before rblsmtpd:

/path/to/ifrelayclient /usr/bin/env RBLSMTPD='' --

I also set GREETDELAY='' because my qmail-smtpd is wrapped by greetdelay as well. qgreylist already DTRT when RELAYCLIENT is set.

Here's ifrelayclient (substitute paths to @PROGRAM@ for your system):

#!@SH@
#
# Wrapper for qmail-smtpd command chain that runs the first command
#   only if RELAYCLIENT is set, running the remaining commands
#   regardless. End the first command with "--".
#
# Useful for e.g. setting RBLSMTPD="" to avoid RBL-blocking an
#   authenticated user.

relayclient_isset()
{
        @SETENV@ | @GREP@ -q '^RELAYCLIENT=' >/dev/null 2>&1
}

main()
{
        local cmd1 arg
        cmd1=""
        while [ $# -gt 0 ]; do
                arg="$1"; shift
                if [ "${arg}" = '--' ]; then
                        break
                else
                        cmd1="${cmd1} ${arg}"
                fi
        done
        if [ $# -eq 0 ]; then
                @ECHO@ >&2 "usage: $0 command args -- command args"
                exit 111
        fi
        if relayclient_isset; then
                exec ${cmd1} "$@"
        else
                exec "$@"
        fi
}

main "$@"
exit $?

<Prev in Thread] Current Thread [Next in Thread>