I have defined global whitelist in postfix using MYSQL with the following options:
smtpd_recipient_restrictions =
reject_invalid_hostname,
check_client_access mysql:/etc/postfix/client_whitelist
check_sender_access mysql:/etc/postfix/sender_whitelist
check_recipient_access mysql:/etc/postfix/recipient_whitelist
permit_mynetworks,reject
cat /etc/postfix/client_whitelist
host = localhost:3306
user = root
password = password
dbname = postfix
query = SELECT restriction FROM client_whitelist WHERE client = "%s" AND status = "1";
mysql table
+---------------+-------------+--------+
| client | restriction | status |
+---------------+-------------+--------+
| 192.168.66.18 | OK | 1 |
| 192.168.66.92 | OK | 1 |
| 192.168.66.93 | REJECT | 1 |
+---------------+-------------+--------+
And I have the same table for sender and recievers. My main problem is that I have multiple domains behind postfix and I would like to filter the clients/senders taking into account which is the receiver. For example:
Mail from 192.168.66.92 and sender "user1@test.com" IS ALLOW to "user2@domain1.com"
Mail from 192.168.66.92 and sender "user1@test.com" IS NOT ALLOW to "user2@domain2.com"
Mail from 192.168.66.18 IS ALLOW for recipient or domain "domain1.com"
Mail from 192.168.66.18 IS NOT ALLOW for recipient or domain "domain2.com"
Is there any way to implement this in postfix? I have been googleing but no luck.
On the other way I was thinking to put a "postfix proxy" to redirect to another postfix instances and each instance filter each domain. But I'm not sure about the performance of this environment, even if it is possible.
Sorry about my english, I'm not native :)
Thanks!