Dear Exim Experts,
I'm trying to selectively invoke SpamAssassin from Exim based on the
recipient address, but it doesn't seem to be working - all messages are
being filtered. I suspect that the problem is in my Exim ACL stuff
where I am using an ACL variable. Can anyone spot what I am doing wrong?
My strategy is to look for known-spammy recipient addresses (e.g.
addresses that will have been collected from Usenet, mailing list
archives, etc) in the acl_smtp_rcpt; if I find one I set a per-message
acl variable. Then, in the acl_smtp_data I accept if the variable is
unset, else invoke SpamAssassin.
What seems to happen is that the variable gets set in the right cases,
but SpamAssassin gets invoked even when it has not been set.
Here is an extract from my config file:
addresslist filter_recipients = /etc/sprout/filter_recipients
acl_smtp_rcpt = acl_check_rcpt
acl_smtp_data = acl_check_data
begin acl
acl_check_rcpt:
# Run for each recipient
warn set acl_m0 = 1
recipients = +filter_recipients
message = Spammy address, using filter
accept domains = +local_domains
endpass
verify = recipient
message = unknown user
accept hosts = 127.0.0.1
deny message = relay not permitted
acl_check_data:
# Run after message has been received
accept hosts = 127.0.0.1
accept condition = ${if eq{$acl_m0}{1}{0}{1}}
warn message = X-Spam-Score: $spam_score
spam = nobody:true
warn message = X-Spam-Report: $spam_report
spam = nobody:true
drop message = Rejected by SpamAssassin (score=$spam_score)
spam = nobody:true
condition = ${if >{$spam_score_int}{60}{1}{0}}
accept
I have simplified that a bit in the hope that it shows the important
stuff, but if no-one can see what's wrong I could post an unabridged
version.
What happens is that the "Spammy address, using filter" message is
inserted in the right messages; however, the SpamAssassin spam score and
report are inserted in all messages.
This is with the Debian "heavy" package of version 4.34.
Many thanks in advance for any help you can offer.
Cheers, Phil.