CpVES Postfix recipient classes

If you want to use the postfix recipient restriction classes with CpVES you need some additional postfix configuration.

The mysql postmap file for the lookup to the MySQL VIEW:

file: /etc/postfix/mysql-recipient_classes.cf

user = mail
password = 
dbname = mail_system
hosts = 127.0.0.1
query = SELECT CONCAT(polw, " ", grey) FROM smtpd_recipient_classes WHERE email='%s'



In the main configuration file of postfix, you have to define the available checks for the postmap lookup:

file: /etc/postfix/main.cf

smtpd_restriction_classes = check_polw, check_grey
check_polw = check_policy_service inet:127.0.0.1:12525
check_grey =  check_policy_service inet:127.0.0.1:60000



than you have to add the check to the smtpd_recipient_restrictions paramenter. file: /etc/postfix/main.cf

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/mysql-recipient_classes.cf

Please note, you have to add the check_recipient_access mysql:/etc/postfix/mysql-recipient_classes.cf after the reject_unauth_destination, statement!

Now you have to enable the new configuration method in the config.inc.php for the webinterface:

file: includes/config.inc.php

// use the postfix per recipient classes with policyd-weight
$config['recipient_classes_polw']=1;

// use the postfix per recipient classes with greylisting
$config['recipient_classes_grey']=1;