On Fri, Jun 01, 2001 at 08:48:42AM -0700, Ross Davis - Data Anywhere wrote:
> >>
> >> here is my smtpd run from the supervise directory
> >>  /var/qmail/bin/qmail-smtpd 2>&1
> >> env - PATH="/var/qmail/bin:/usr/local/bin" \
> >> tcpserver -v -p -u vpopmail -g vchkpw 0 smtp /var/qmail/bin/qmail-smtpd
> 2>&1
>> attribution Re-added by GW: Karsten W. Rohrbach wrote:
> >                                        ^
> >this is the address to bind to.
> >http://cr.yp.to/ucspi-tcp/tcpserver.html
> >
> >cheers
> >/k
> 
> I must be missing something then.  I see that I can tell it what IP to send
> out on for all domains, but how do I tell mail.domain1.com to use IP
> xxx.xxx.xxx.xxx and mail.domain2.com to use yyy.yyy.yyy.yyy
> 
> That is the part I don't understand.
> 

You misunderstand the tcpserver options. Karsten has supplied the
correct answer above. When an address is supplied in place of the '0'
option to tcpserver, that is the address that the child process binds
to. You have no control whatsoever as to which IP is used to send
outbound mail*. Simply run two qmail-smtpd's, one each bound to the two
IPs in question. I think that to get what you seem to want, you may have
to run a second copy of qmail -- if you simply run two different
qmail-smtpds, both will use the same control files. Depends on why you
want separate instances of qmail-smtpd.

Examples:

Where mail1.example.com is IP 192.168.0.1 and mail2.example.com is
172.16.0.1, with appropriate MX records:

run file for mail1.example.com:

#!/bin/sh 
QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`
MAXSMTPD=`/bin/cat /var/qmail/control/concurrencyincoming`
exec /usr/local/bin/softlimit -m 2000000 /usr/local/bin/tcpserver \
        -vPHR -c "$MAXSMTPD" -x /var/qmail/cdb/smtp.cdb \
        -u "$QMAILDUID" -g "$NOFILESGID" 192.168.0.1 smtp /var/qmail/bin/qmail-smtpd 
2>&1


run file for mail2.example.com:

#!/bin/sh 
QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`
MAXSMTPD=`/bin/cat /var/qmail/control/concurrencyincoming`
exec /usr/local/bin/softlimit -m 2000000 /usr/local/bin/tcpserver \
        -vPHR -c "$MAXSMTPD" -x /var/qmail/cdb/smtp.cdb \
        -u "$QMAILDUID" -g "$NOFILESGID" 172.16.0.1 smtp /var/qmail/bin/qmail-smtpd 
2>&1

Note that your run file differs from mine, I simply mangled my own
rather than hand-type one...

If this is simply for traffic analysis purposes, this should do the
trick...

* Your operating system's routing table, or NAT method, or whatever, may
provide you with a way to control which IP address is used to send
outbound mail. IIRC, there are patches that force qmail to always send
using a specified IP address. Stock qmail, in and of itself, provides no
way to control the IP address used to send mail on, AFAIK.

-- 
Greg White
Those who make peaceful revolution impossible will make violent
revolution inevitable.
                -- John F. Kennedy

Reply via email to