On Sun, Dec 08, 2013 at 12:04:44PM +0000, John Cox wrote:
> Hi
>

Hi,


> I want to migrate from sendmail but I'm a bit confused by the
> documentation and as I don't have a dummy system to play on I thought
> I'd ask first rather than thowing (too much) legit mail down the
> plughole.
> 
> I have an vanilla OpenBSD 5.4 system with whichever version of
> OpenSMTPD comes with that.
> 

You should definitely install yesterday's release 5.4.1 on top of
your OpenBSD 5.4 system, it has *many* improvements ... including
some new features that makes your use-case easier ;-)


> I have a smarthost: smart.example.net to which I wish to send all
> outgoing mail
> 
> I am running on: server.internal.example.net
> 
> I want to deal with messages for example.net and fakedomain.co.uk
> 
> I want to relay & deliver messages sent to me from my local net. I
> want to deliver messages sent from the smart host.  No messages should
> arrive from the "outside world" except from the smart host.
>

Ok, this is simply a matter of:

    accept from source yoursmarthost for domain <yourdomains> ... deliver [...]
    accept from source <yourtrustednetworks> for domain <yourdomains> ... 
deliver [...]
    accept from source <yourtrustednetworks> for any relay via 
tls://yoursmarthost
    accept from local for any relay via tls://yoursmarthost

keep in mind that we do first match, the order is important and you want that 
last
line so that mails generated from localhost (when an alias is a forward for 
example)
can actually leave.

 
> I have some local users: [email protected], [email protected],
> [email protected]
> 
> I have some virtual users: [email protected], [email protected],
> [email protected] + all the usual system ones.
>
> I have some dead users that I would like to bounce, preferably with
> custom error messages for some of them: [email protected],
> [email protected] (like you can in the sendmail access db)
>

Since you want to use a wildcard later on, you will want a virtual
table, not an aliases table, it will look like:

    [email protected]     alice
    [email protected]      bob
    [email protected]     clara

    [email protected]    whatever
    [email protected]      whatever
    [email protected]    whatever

    [email protected]   system1
    [email protected]   system2

    [email protected]   error:530 this user is disabled
    [email protected]   error:530 this user is also disabled

    [...]

    and you can complete with what's coming next ;-)



> Mail sent to fakedomain.co.uk should be delivered to clara
>

in a virtual mapping, "@domain" can be used as a catchall:

   @fakedomain.co.uk  clara

 
> Some virtual users want to be delivered to local mailboxes and some
> want to be forwarded to external addresses
> 
> xavier -> [email protected]
> yola -> bob
> zander -> [email protected]
> 

This works like you'd expect:

     [email protected] [email protected]
     [email protected]   bob
     [email protected] [email protected]


> clara would like all mail to local domains that is otherwise
> unrecognised to be delivered to her.  (Actually, ideally, she would
> like anything matching clara-*@example.net to be delivered to her, but
> I suspect that wildcarding in aliases is a bit hopeful and I don't get
> it in sendmail without more effort than I'm prepared to put in)
>

Same as for the fakedomain.co.uk catchall, if you declare:

     @example.net                clara

all mail for @example.net that isn't matched by another entry will
be delivered to clara.


> All the local delivery stuff seems obvious enough, id rejection seems
> obvious though the custom error stuff is missing I think (I thought
> I'd seen mention of it but it isn't obvious in the man file now I
> look).  I'm much less sure about the forwarding - in sendmail simply
> adding the line
> 
> xavier: [email protected]
> 
> to the aliases file does the trick, but
>

Works the same with us


> accept from any for domain example.net\
>   alias <aliases>\
>   deliver to maildir %(user.directory)/Maildir
> 
> seems clearly wrong as we don't want to deliver there.  So we have to
> split the forwarding rules from the alias rules?
>

The "deliver" part is the default action, it will only be matched for
aliases entries that map to local users, if a user has an alias that
has an email address as a target, mail will match that action first
so the deliver part will be discarded.


> accept from any for domain example.net\
>   virtual <forward> relay via tls://smart.example.net verify
> accept from any for domain example.net\
>   alias <aliases>\
>   deliver to maildir %(user.directory)/Maildir
> 
> This looks like it should work as long as a lack of match in <forward>
> causes the rule to fail - this isn't obvious one way or the other from
> the man page.  Otherwise I guess I need a "recipient" filter - if so
> can this be the same <forward> table I use for the "virtual" mapping
> or is that illegal because it has values too?
>

maybe you don't need the recipient filter after all


> I like the look of opensmtpd a lot, but a few more examples in the man
> pages or elsewhere with some of the alias & virtual tables populated
> might make understanding exactly what it can do a lot clearer.
> 

Problem is man power, the more we spend on writing examples, the less
we spend on writing code. I encourage all users to fill the wiki on
Github so that we can then incorporate the examples into a FAQ, but
for now we only document the individual features in the man pages and
show small examples.


-- 
Gilles Chehade

https://www.poolp.org                                          @poolpOrg

-- 
You received this mail because you are subscribed to [email protected]
To unsubscribe, send a mail to: [email protected]

Reply via email to