dear all, i'm going to setup a backup-MX, and although i've now a working solution, I'd like to ask, if this is the correct solution ...
PART 1 (working): Backup for domain.com with a list of valid recipients in a database. my main.cf looks like: --------------------------- relay_domains = domain.com relay_recipient_maps = mysql:/etc/postfix/mysql_relay.cf # contains query = SELECT 'OK' FROM recipients WHERE email='%s' smtpd_recipient_restrictions = ..., check_recipient_access mysql:/etc/postfix/mysql_relay.cf, ... --------------------------- a) if postfix receives mail for o...@domain.com, then postfix answers immediatly with OK, since this address is listed in the table b) if postfix receives mail for t...@domain.com, then postfix answers "User unknown in relay recipient table". but since my database-list is updated only once per week, i'd like check the primary MX in situation b), if in the meantime user TWO has been added. PART 2 (working): i changed main.cf as follows: --------------------------- relay_domains = domain.com relay_recipient_maps = mysql:/etc/postfix/mysql_relay.cf # contains query = SELECT 'OK' FROM recipients WHERE email='%s' smtpd_recipient_restrictions = ..., check_recipient_access mysql:/etc/postfix/mysql_relay.cf, check_recipient_access hash:/etc/postfix/domains # contains: domain.com reject_unverified_recipient ... --------------------------- a) immediate OK for o...@domain.com, since this address is within the table b) postfix queryies the primary MX, since t...@domain.com is not within the table so far, so good .. PART 3 (problem): domain.at is an alias for domain.com. so i added the following: --------------------------- virtual_alias_maps = pcre:/etc/postfix/virtual.pcre # contains /^([a-z\.]+)@domain.at$/ $1...@domain.com --------------------------- what happens: in that case both emails are accepted (o...@domain.at as well as t...@domain.at), without querying the primary MX PART 4 (problem): so i added to /etc/postfix/domains: --------------------------- domain.at reject_unverified_recipient --------------------------- if postfix receives mail for o...@domain.at, then the address is rewritten to o...@domain.com, but then the primary MX is immediately queried! why is postfix not checking the mysql-database after rewriting?????????? MY CURRENT SOLUTION (working): extend smtpd_recipient_restrictions in main.cf: --------------------------- # contains query = SELECT 'OK' FROM recipients WHERE email='%s' smtpd_recipient_restrictions = ..., check_recipient_access mysql:/etc/postfix/mysql_relay.cf, check_recipient_access mysql:/etc/postfix/mysql_relay_at.cf, # contains query = SELECT 'OK' FROM recipients WHERE email=REPLACE('% s','.at','.com') check_recipient_access hash:/etc/postfix/domains --------------------------- this is working, so if postfix receives mail for o...@domain.at it answers with OK, since the second table lookup returns a record, and if postfix receives t...@domain.at, the mails queryies the primary MX if t...@domain.com exists ... but is this the correct solution? is there a more easy way to solve this? ciao H.