One can refine that to only do local delivery for a specified list of addresses 
in order to avoid risking in the long term to have local delivery to mailboxes 
that are never going to be read.


This is what I have (simplified a little bit to not have multiple interfaces 
etc.)

# more /etc/mail/mailname 
example.com

# more /etc/mail/recipients
[email protected]
[email protected]

# grep swa /etc/mail/aliases
root: swa
swa: [email protected]


Note here: the .com instead of the .ccTLD is what I would love to have there, 
but it’s not achievable with the current limitations of aliases and mailname in 
opensmtpd AFAIK.



# more /etc/mail/smtpd.conf 
listen on lo0

table aliases db:/etc/mail/aliases.db
table recipients file:/etc/mail/recipients

accept from local recipient <recipients> alias <aliases> deliver to mbox
accept for any relay via smtp://relay.isp.net:25 as “@example.com"


This gives you just 2 local email addresses for which aliases will be processed 
and risk local delivery, and both of those are aliased away fro the machine.
The second line allows to to email any other email address in any other domain, 
including exmaple.com itself, to be sent off to the relay.
(the as “@exmaple.com” is not stricly needed anymore I think)


It’s easier if you accept that locally originating email is sent from 
“@machine.example.com” than from “@example.com"



What I’d love to see is the ability to write something like:

accept from local alias <aliases> relay via smtp://relay.isp.net:25

But that just throws a syntax error …

webservers, firewalls, etc. all would benefit from it.

Swa


> On 07 Sep 2016, at 02:08, Edgar Pettijohn <[email protected]> wrote:
> 
> On 16-09-06 23:18:28, Mik J wrote:
> 
> If I'm reading correctly sounds like you are just trying to get
> your /etc/daily reports etc.  This is what I have on my laptop and 
> it works fine.  See notes inline.
> 
>> Hello Edgar,
>> 
>> Sorry
>> 
>> This is a very simple question but yet 
>> didn't find the answer.I have a machine m1 which is a webserver.
>> On 
>> openbsd there are daily reports and I want them to be sent to an 
>> external address.
>> 
>> 
>> # grep ^root /etc/mail/aliasesroot: [email protected]
>> 
>> 
>> After modifying the aliases files I run the command
>> 
>> # newaliases
>> 
>> My opensmtpd configuration is very simple
>> 
>> listen on lo0
>> table aliases file:/etc/mail/aliases
>> accept from local for any relay via smtp://192.168.1.1
> delete above line
> add following:
> 
> accept from local for any alias <aliases> deliver to mbox
> accept for any relay via smtp://192.168.1.1
> 
> You may need to look into table(5) under credentials in the event
> that you need to authenticate to relay through 192.168.1.1.
> 
>> As I'm writing this message I realise that the line "table aliases 
>> file:/etc/mail/aliases" is useless, but fair enough.
>> 
>> 
>> My problem is when I do:
>> 
>> # mail -s "Resolv" root < /etc/resolv.conf
>> 
>> it writes to [email protected] instead of [email protected]
>> 
>> So it looks like the aliases file is ignored. Do you know why ?
>> What's the right way to do it ?My web server should use my local mail server 
>> as a relay which is going to sign emails etc.
>> Thank you
>> 
>> 
>> 
>> Le Mercredi 7 septembre 2016 0h34, Edgar Pettijohn <[email protected]> 
>> a ??crit :
>> 
>> 
>>> 
>>> 
>>> On 16-09-06 21:53:14, Mik J wrote:
>>> 
>>>> Hello,
>>>> This is a very simple question but yet didn't find the answer.I have a 
>>>> machine m1 which is a webserver. On openbsd there are daily reports and I 
>>>> want them to be sent to an external address.
>>>> # grep ^root /etc/mail/aliasesroot: [email protected] 
>>>> modifying the aliases files I run the command newaliases
>>>> My opensmtpd configuration is very simplelisten on lo0table aliases 
>>>> file:/etc/mail/aliasesaccept from local for any relay via 
>>>> smtp://192.168.1.1
>>>> As I'm writing this message I realise that the line table aliases 
>>>> file:/etc/mail/aliases is useless, but fair enough
>>>> My problem is when I do: # mail -s "Resolv" root < /etc/resolv.conf it 
>>>> writes to [email protected] instead of [email protected] 
>>>> it looks like the aliases file is ignored. Do you know why ?
>>>> What's the right way to do it ?My web server should use my local mail 
>>>> server as a relay which is going to sign emails etc.
>>>> Thank you
>>> Your message is all globbed up.  Please resend with full smtpd.conf.  
>>> 
>>> Thanks,
>>> -- 
>>> Edgar Pettijohn
>>> 
>>> -- 
>>> You received this mail because you are subscribed to [email protected]
>>> To unsubscribe, send a mail to: [email protected]
>>> 
>>> 
>>> 
>>> 
>>> 
>> 
>> --
>> You received this mail because you are subscribed to [email protected]
>> To unsubscribe, send a mail to: [email protected]
> 
> -- 
> Edgar Pettijohn
> 
> -- 
> You received this mail because you are subscribed to [email protected]
> To unsubscribe, send a mail to: [email protected]
> 

Reply via email to