bypass amavisd after OK from policy daemon?

Rod K amavisd at
Wed Aug 7 17:26:41 CEST 2013

Sorry, I misspoke.  You don't need to set a policy bank for that.

In amavisd.conf you need to setup @lookup_sql_dns and $sql_select_policy 
(to retrieve the recipients userID) and that is used in 
$sql_select_white_black_list to select the single column "wb" using the 
userID and the sender email is in the list %k (sender email, sender 
domain and catchall).

For example:
$sql_select_policy = "select 'Y' as local, userID as id from users where 
\"user\" = %a";  (%a being the recipient email address)
$sql_select_white_black_list = "select 'W' as wb from whitelist where 
recipient = ? and sender in (%k)";

the ? is the place holder for the id retrieved in the first query and %k 
is the place holder for the various sender possibilities listed above.

Obviously, you could retrieve an actual whitelist/blacklist value ('W' 
or 'B') in the query to do blacklists, but since you are using a Postfix 
policy server I'd imagine you'd do blacklisting there and the email 
would never reach amavisd to being with, so isn't really necessary.

Good luck.

On 8/7/2013 11:00 AM, Rod K wrote:
> Franz,
> You can use Amavisd's built in SQL functionality to check your SQL 
> based whitelist as well and set the policy bank used for that email 
> which can be used to bypass any and all checks.
> Rod K
> On 8/7/2013 10:56 AM, Franz Schwartau wrote:
>> Hi Patrick!
>> On Wed, Aug 07, 2013 at 04:27:56PM +0200, Patrick Ben Koetter wrote:
>>> * Franz Schwartau <franz at>:
>>>>> Your only answer is to build
>>>>> your policy decision into amavisd-new.
>>>> Yes, but how? This is my question which is still unanswered. How 
>>>> can amavisd be configured to skip certain checks if some generic 
>>>> condition is met.
>>> You have to solve the problem in amavisd (and not outside). You will 
>>> have to
>>> write a custom class to have it trigger on various criteria, as you 
>>> pointed
>>> out.
>> I fancy myself to be an experienced perl programmer but I'm unfamiliar
>> with amavisd. Do you have a hint how to accomplish this? Have you
>> done something like this before?
>>     Best regards
>>         Franz

More information about the amavis-users mailing list