Hi, Short version: Is there a way to apply recipient canonical mappings (or any other mappings that rewrite the envelope recipient) for specific SMTP client machines in a null client/central mailhub environment?
Background: In our development infrastructure we have a few mail hubs which accept and relay mail from various development machines. These development machines are configured as null clients [1]. Services on the development machines use "localhost" as mailserver, which in turn uses $mydomain as relay host. The mail hubs accept mail and apply various mappings, such as smtp_generic_maps (rewrite the sender address from f...@dev01.dev.example.com to hosts+foo=dev01....@example.com) and virtual_alias_maps ("@dev01.dev.example.com" maps to the mailhub's root account, which is itself an alias to a real account), and relay mail through our upstream company mailserver. I want to add the possibility to "catch all" mails originating from specific development machines and redirect/rewrite them to a specific address. This would be useful for developing and testing services that send out mail where we want to make sure these messages don't go anywhere, except to one specific address. I have implemented this using recipient_canonical_maps on the specific dev machines/null clients in question: /etc/postfix/main.cf: recipient_canonical_classes = envelope_recipient recipient_canonical_maps = regexp:/etc/postfix/recipient_canonical_maps /etc/postfix/recipient_canonical_maps: # Mail to root is not rewritten to the catchall address /^root(.*)/ root /.+@.+/ dev-catch...@example.com All mail (except for root) is rewritten to go the catchall address. This has been working well enough so far. However, I'd like to keep the configuration on the null clients as thin as possible so I'd rather find a way to apply such a mapping on the mailhub itself, instead of the null client. What I'm looking for, essentially, is a way to identify that mail is coming from a specific null client and rewrite at least the recipient envelope address for messages from this null client. Can this be done? Thanks, Andreas [1] http://www.postfix.org/STANDARD_CONFIGURATION_README.html#null_client
signature.asc
Description: OpenPGP digital signature