Method to drop unknown user messages to black hole

Andrew Morgan morgan at orst.edu
Mon Jul 16 16:00:35 EDT 2007


On Fri, 13 Jul 2007, Bob Bob wrote:

> Postfix & Cyrus
>
> Have been finishing off the server ready for accepting external smtp
> connections. No more fetchmail...
>
> I note that in todays spam environment more and more administrators are
> choosing to black hole any messages with invalid recipients. In a
> standard postfix setup this is pretty easy with luser_relay. When
> however you use lmtp, local delivery really only looks at /etc/aliases
> until it passes through to cyrus.
>
> My first question is a general one. Do you all choose to send
> reject/nonexistent user messages or just black hole them? Rejecting is
> obviously the simplest solution but I am concerned about being
> blacklisted from sending garbage back out. There are ways of course to
> stop backscatter happening but I am also concerned that there are valid
> bounces being created that the (real) sender needs to know about. I'd
> like to hear what your solutions have been.
>
> My second question is how to you accomplish a black hole with cyrus? I
> had thought that a "global" sieve script would do it but note that this
> is user specific. I see nothing specific in lmtp that points to that either.
>
> I note this has been discussed previously but I didn't find an actual
> resolution beyond allowing auto mailbox creation!
>
> Thoughts appreciated

I generate a list of all valid email addresses from my Cyrus servers 
using a perl script.  Here is the code doing the real work:

# Fetch all top-level mailboxes
foreach $mailbox ($imap->list("user.%")) {
         if ($mailbox =~ /^user\.(\w+)$/) {
                 $username = $1;
                 print OUT "$username\@onid.orst.edu OK\n";
                 print OUT "$username\@onid.oregonstate.edu OK\n";
         }
         else {
                 print "Could not match input mailbox: $mailbox\n";
         }
}


This file is the then copied to all our SMTP frontends and used to build a 
Postfix relay recipients map.  Here is the relevant Postfix config from 
main.cf:

relay_recipient_maps =
         hash:/etc/postfix/relay-recipient-maps


Postfix is configured to use a transport map to deliver mail to Cyrus 
from main.cf:

transport_maps = hash:/etc/postfix/transport

And /etc/postfix/transport contains:

onid.oregonstate.edu            lmtp:cyrus-vs.onid.oregonstate.edu
onid.orst.edu                   lmtp:cyrus-vs.onid.oregonstate.edu


I think that covers all the pieces needed...

 	Andy


More information about the Info-cyrus mailing list