On Tue, Jul 19, 2011 at 06:45:46PM -0500, Jay G. Scott wrote:

> Management wants email to
>       user@ <a non-existent machine> .arlut.utexas.edu
> will be treated as though it had been addressed to
>       u...@arlut.utexas.edu

Regardless of the MTA, this requires at the very least a wild-card MX
record, do you have that?

If a wildcard MX is in place, and mail to:

        mana...@pointy-haired-bosses.arlut.utexas.edu

needs to be delivered, the next question is whether the delivery is
local (system accounts and local aliases(5)) or to a virtual mailbox,
or is relayed further for delivery, or is aliased to a real address.

> relay_recipient_maps = regexp:/etc/postfix/pfrecipient_canonical

This is used when the recipient domain is listed "relay_domains":

        relay_domains = .arlut.utexas.edu

>       This file looks like this for the user schumi
>       /^schumi@.*\.arlut\.utexas\.edu$/       sch...@arlut.utexas.edu

With Postfix 2.8 or later, you can solve the problem upstream:

    main.cf:
        pcre = pcre:${config_directory}/

        # Last resort. Edit remote SMTP commands
        #
        smtpd_command_filter = ${pcre}smtpd_cmd.pcre

    smtpd_cmd.pcre:
        # Sweet smell of Sendmail:
        /^(RCPT TO:<\S+@).*?\.(\Qarlut.utexas.edu\E>.*)$/ ${1}${2}

The above can also be be done with regexp, but I prefer PCRE, so
you'll have to craft your own regexps if that's what works for you.

With this, there is no mail to sub-domains of "arlut", all mail
appears to have been addressed correctly, but recipient validation
is not defeated, despite the wild-card rewrite, since the rewrite
happens upstream in the SMTP I/O routines.

This of course requires that there be no real sub-domains that
you want handled without truncation.

-- 
        Viktor.

Reply via email to