Exim 4.20 on RedHat 8
We have a fairly small site (< 20 users) and I'm playing around trying to
create a dynamic spam whitelist. It's the kind of thing where someone sends
out a message to a remote address and the remote address gets added to a db
table that is later consulted to allow incoming mail from that address to
bypass Sender Verification & Spam Assassin.
I can't seem to get the expansion syntax to work. I'm doing all of this in
a transport of all places, b/c that appears to be the only place I can get
access to both the remote destination address ($local_part@$domain, which
doesn't work in my dnslookup router), and the local sender's username.
[There's a long story there based on the users using a WebMailer that
injects messages locally (non-SMTP). So I can't use the regular
check_message ACL to "route" the recipient's address, hence I end up back in
a transport.] Anyway, long story short, I'm able to get the destination
address in the transport with no problem. And I've found that the WebMailer
inserts the sending user's actual account name (which due to aliasing may be
different from $sender_address_local_part, which is why I can't use that)
into one of the Received headers. So here's the line I've come up with,
which is failing miserably...
headers_add = ${lookup pgsql{insert into filter_private (username, address)
values ('${expand:{match{$h_Received:}{\Nas user (\w+)@\N} }}',
'$local_part@$domain')}}
I'm doing it in a headers_add directive b/c I couldn't find a better place
to do the expansion. In this case, I only care if the INSERT actually
works, not any resulting header. So I'm trying to use the regex "as
user(\w+)@" to pull the sender's username out of the Received header. The
$local_part@$domain part works great. But the expansion fails with:
2003-06-05 15:25:43 19O0Mn-00071c-NW == sdsdfsdf333332@??? R=dns_mx
T=remote_smtp defer (-25): failed to expand headers_add or headers_remove:
lookup of "insert into filter_private (username, address) values
('{match{from nobody by han.ecloud.net with local (Exim 4.20)\n id
19O0Mn-00071c-NW\n for sdsdfsdf333332@???; Thu, 05 Jun 2003
15:25:41 -0400\nfrom 66.31.42.79 ( [66.31.42.79])\n as user
ennis@192.168.0.2 by ecloud.net with HTTP;\n Thu, 5 Jun 2003
15:25:41 -0400{as user (\w+)@" gave DEFER: PGSQL: query failed: ERROR:
parser: unterminated quoted string at or near "'{match{from nobody by
han.ecl
Could this be a quoting issue like it says? I'm using \N on the regex and
${quote: on the received header.
I'm out of ideas. Any suggestions?
--
Rick Ennis