[Mimedefang] Slightly OT Sendmail virtusertable/mailertable Q.

Kris Deugau kdeugau at webhart.net
Mon Feb 23 15:02:49 EST 2004


Rolf wrote:
> The idea is that there are few users on this mail server, the
> mailertable sending everything onwards. But I would like msgs to
> postmaster at ... and a couple of others to be delivered to a local
> user. Virtusertable entry of postmaster at ...  localusername
> doesn't seem to be working. And I would like that localusername in
> one instance to actually be an alias to several users elsewhere, and
> setting that up is not clear.

I don't redirect postmaster to multiple accounts, nor do I redirect it
off of the local machine, but I do redirect all postmaster/abuse mail
to postmaster at FQDN on the domain hosting box here.

In filter_sender, I make sure to accept postmaster/abuse/etc mails
(because I do other checks which would otherwise reject them):

# All domains MUST accept hostmaster/postmaster/abuse mail, which
# goes to postmaster at zeus, which goes to root
  $recip =~ tr/<>//d;
  $recip =~ tr/A-Z/a-z/;
  if ($recip =~ /^(postmaster|hostmaster|abuse)\@/) {
    return ('CONTINUE',"Postmaster/hostmaster/abuse mail OK");
  }

Then in filter_end I delete the "postmaster at domain" recipients, and
replace them with postmaster at FQDN:   (Watch for line wraps)

    if (exists $hosteddomains{$Domain}) {
        # Make sure postmaster and hostmaster email goes to our admin
        # accounts
        # Let's do abuse@ as well.
        foreach $recip (@Recipients) {
            $recip =~ tr/<>//d;
            $recip =~ tr/A-Z/a-z/;
            if ($recip =~ /^postmaster\@/) {
                add_recipient('postmaster at zeus.webhart.net');
                delete_recipient($recip);
md_syslog('info',"Redirecting postmaster\@$Domain to local postmaster");
            }
            if ($recip =~ /^hostmaster\@/) {
                add_recipient('hostmaster at zeus.webhart.net');
                delete_recipient($recip);
md_syslog('info',"Redirecting hostmaster\@$Domain to local postmaster");
            }
            if ($recip =~ /^abuse\@/) {
                add_recipient('abuse at zeus.webhart.net');
                delete_recipient($recip);
md_syslog('info',"Redirecting abuse\@$Domain to local postmaster");
            }
        }
    } # if (exists($hosteddomains{$Domain}))

%hosteddomains is a tied hash which contains information about the
domains allowed to relay through the server;  I needed it here to make
sure that *outbound* mail to postmasters elsewhere didn't get redirected
locally.  :/  A global variable, or simple direct check against a list
of domains should work OK as well, or checking based on the relay IP
should work.

-kgd
-- 
"Sendmail administration is not black magic.  There are legitimate
technical reasons why it requires the sacrificing of a live chicken."
   - Unknown



More information about the MIMEDefang mailing list