[exim] Spamassassin local.cf read

Top Page
Delete this message
Reply to this message
Author: Nikademus
Date:  
To: exim-users
Subject: [exim] Spamassassin local.cf read
Hello,

I am searching a good way to read the spamassassin local.cf file to be
able to reject mails over threshold at smtp time. I have to read it in
the local.cf file because the http administration page should only be
allowed to write in local.cf, not directly in the exim.conf.

So I have rule like that in the data acl to deny spam at smtp time

#Deny spam
drop
message         = Message rejected due to probable spam content.
log_message     = $sender_host_address has spam score: $spam_score
spam            = nobody:true
condition       = ${if >{$spam_score_int}{70}{1}{0}}


But I want to replace the hardcoded 70 by the value in local.cf file. So
I went to a rule like this to read the score (and to put it into headers for test purpose):

warn
set acl_m7 =
${lookup{required_hits}lsearch{/etc/spamassassin/local.cf}{$value}}
message = X-Spam-config:
${substr{-2}{2}{${extract{1}{\.}{$acl_m7}}}}${substr{0}{1}{${extract{2}
{\.}{$acl_m7}}}}

It works although, I'd like to hear from other people that would come with a less weird expression to do the conversion.