Different Postfix Access Policy Delegation

Today I got some hints how to use different Access Policy Delegation with postfix. This it opens the possibility to use different check_policy_service in dependency on sender address, client ip ... and so on.

Create aliases for groups of access restrictions in /etc/postfix/main.cf:

smtpd_restriction_classes = policy1,
policy1 = check_policy_service inet:
policy2 = check_policy_service inet:

Create "/etc/postfix/ip_rules.cidr":

# echo " policy1" > /etc/postfix/ip_rules.cidr
# echo " policy1" >> /etc/postfix/ip_rules.cidr
# echo " policy2" >> /etc/postfix/ip_rules.cidr

Add check_client_access cidr:/etc/postfix/ip_rules.cidr at the end of smtpd_recipient_restrictions in /etc/postfix/main.cf

In this scenario you can have different access policies based on the client ip. It is also possible to base it on client reverse dns with help of pcre maps and recipient/sender address and hash maps