"Chris, the Young One" <[EMAIL PROTECTED]> writes:

> On Thu, Jul 27, 2000 at 12:28:39PM -0400, Bryan Ischo wrote:
> ! Can anyone point to me the best and easiest way to do this?
> ! I would need to somehow check the IP address of the remote host
> ! sending the mail, and the To: address to the mail, and I am not
> ! sure where in the qmail process these two pieces of information
> ! are readily available.
> 
> There's a simpler way. If you use tcpserver (as opposed to tcp-env)
> to invoke qmail-smtpd, just put this in your rules file (assuming
> 10.*.*.* is your internal network):
> 
> 10.:allow,INTERNAL="yes"
> 
> Then, in the .qmail file that handles your internal mailing list,
> put in the first line,
> 
> |bouncesaying "You can't send to this address" [ -z "$INTERNAL" ]
> 
> I haven't tested the above, but that's the basic gist of it.

Thank you Chris.  Actually I am not running tcpserver to start qmail;
my line from inetd.conf looks like this:

smtp    stream  tcp     nowait  qmaild  /usr/sbin/tcpd \
/var/qmail/bin/tcp-env /var/qmail/bin/selective.sh smtpd

Here is selective.sh:

----------------------------------------------------------------------
#!/bin/bash

ADDR=${TCPREMOTEIP##63.75.128.}

if [ -z $ADDR ]; then
    unset RELAYCLIENT
elif [ $ADDR = 127.0.0.1 ]; then
    export RELAYCLIENT=""
elif [ $ADDR = $TCPREMOTEIP ]; then
    unset RELAYCLIENT
elif [ $ADDR -lt 130 -o $ADDR -gt 254 ]; then
    unset RELAYCLIENT
else
    export RELAYCLIENT=""
fi

/var/qmail/bin/qmail-$1
----------------------------------------------------------------------

I didn't want to install tcpserver when I first installed qmail, so I
came up with the above script instead, which, while probably not the
most efficient thing in the world (starting a new bash shell for every
incoming mail!), works great.

But I can just add extra code to my selective.sh script to set the
INTERNAL variable myself, and then use the bouncesaying program as
you have described.

Thank you for the pointer!

Best wishes,
Bryan

-- 
________________________________________________________________________
        
        p l u m b d e s i g n 
 
        Bryan Ischo | Software Developer 
        157 chambers st ny ny 10007
        p.212-285-8600 x233 f.212-285-8999

Reply via email to