I have succesfully set up my postfix to lookup sql tables for servicing virtual domains. What I would like to do is REJECT and IMMEDIATELY DISCONNECT any client that:
MAIL FROM: with a domain matching any of my virtual domains
2.is not a local client (connection comes from my_networks).
(Legit users of my domains that want to send mail, use 587 submission service with other rules)
Point 2 is done by beginning
permit_mynetworks. Then I want to append
check_sender_access = ????
I dont know what I should put in ???? to consult an sql query. I know how to do it with an access hash table.I dont want to use the hash , because the valid domains are already in SQL and anytime I add a domain, I dont want to have to update the access hash table.
The problem is that I should either
REJECT the mail sender if the sql query returns any value, or
OK the mail sender if the query returns no rows. I dont know how to express that pattern - action using sql.