procmail
[Top] [All Lists]

Procmail + Sendmail + rblcheck

2000-09-01 01:27:21
Hi,

Just wanted to check if anyone is currently using rblcheck with procmail
and sendmail and if so, if you are successfully able to pull the client
address via an environment variable.

I've been doing some testing and I've met with failure.  It seems procmail
eats the variable.

For example, my Mprog looks like so in sendmail:

---
Mprog,          P=/usr/bin/env, F=lsDFMoqeu9, S=10/30, R=20/40, D=$z:/,
                T=X-Unix,
                A=env TCPREMOTEIP="${client_addr}" /bin/sh -c $u 
---

and I have an alias like so:

---
# test to see if mprog is getting client address
rbltest: "| /usr/bin/mail -s \"ip of client $TCPREMOTEIP\" 
foo(_at_)inch(_dot_)com
---

Sure enough, I can send mail to this address and it shows up with the
client IP address in the subject.

My Mlocal line looks like so:
---
Mlocal,         P=/usr/bin/env, F=lsDFMAw5:/|@qSPhn9, S=10/30, R=20/40,
                T=DNS/RFC822/X-Unix,
                A=env TCPREMOTEIP="${client_addr}" /usr/local/bin/procmail
-Y -p -a $h -d $u
---

The relevant section of my .procmailrc looks like:
---
:0
* ! ? if [ -n "$TCPREMOTEIP" ]; then /usr/local/bin/rblcheck -q 
"$TCPREMOTEIP"; fi
{
        EXITCODE=100
        LOGABSTRACT=all
        LOG="Filter: RBL-filtered address: \"$TCPREMOTEIP\" "
        :0:
        RBL
}
---

Doing a test of the procmail rule like this:

cat message | env - TCPREMOTEIP=127.0.0.2 /usr/local/bin/procmail -p

results in the mail going into the RBL folder.  If I change the IP to
127.0.0.1 (or any unfiltered address) the message goes to my normal inbox,
as expected.

Mail still gets delivered fine, but the variable $TCPREMOTEIP is
gone.  Note that I have called procmail with "-p" which is supposed to
preserve all environment variables...  This usage is from the rblcheck
docs.

Does anyone have this working?  It seems much more sane than running a
perl script on every message to parse the address or to cook up a formula
in procmail to try and find the correct ip address; I mean sendmail
already has the address, and no extra work was done to find it...

This definitely seems like voodoo territory, as the procmail list has no
answers in the archives, and comp.mail.sendmail is mum about this as well,
so if anyone has any hints, I'm all ears!

Thanks,

Charles

| Charles Sprickman                  | Internet Channel
| INCH System Administration Team    | (212)243-5200 
| spork(_at_)inch(_dot_)com                     | access(_at_)inch(_dot_)com



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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