Re: mails not sent when using alias as recipient

2021-01-17 Thread Ryan Kavanagh
On Sun, Jan 17, 2021 at 09:07:41PM +0100, Yvan Masson wrote:
> I finally found it! There was no issue with the OpenSMTPD
> configuration, but I had a file, /etc/mailname, which contained only
> the string "debian".I don't know how it came on my system.

When you install the opensmtpd package for the first time, debconf
prompts you for your system mailname and writes it to /etc/mailname.
You can change it by:

sudo dpkg-reconfigure opensmtpd

Details:
https://salsa.debian.org/debian/opensmtpd/-/blob/debian/sid/debian/postinst#L96

See also Debian Policy §11.6:
https://www.debian.org/doc/debian-policy/ch-customized-programs.html#mail-transport-delivery-and-user-agents

Best,
Ryan

-- 
|)|/  Ryan Kavanagh  | GPG: 4E46 9519 ED67 7734 268F
|\|\  https://rak.ac |  BD95 8F7B F8FC 4A11 C97A



Re: mails not sent when using alias as recipient

2021-01-17 Thread Yvan Masson

Le 17/01/2021 à 19:04, Yvan Masson a écrit :

Le 17/01/2021 à 18:55, Edgar Pettijohn a écrit :

On Sun, Jan 17, 2021 at 06:33:29PM +0100, Yvan Masson wrote:

Hi list,

I have two Debian servers that need to be able to send notification 
emails

via a relay. Their configuration is identical, but only the first works
properly. On the second, sending to aliases does not work:


$ echo foo | mail -s test y...@masson-informatique.fr
-> works

$ echo foo | mail -s test root
mail: cannot send message: Process exited with a non-zero status
-> does not work :-(


Unfortunately after two hours digging I still can't find where the issue
lies??? Any pointer would be greatly appreciated!

Best regards,
Yvan


# smtpd -d -T lookup
82908be87cc7fef7 smtp event=connected address=local host=debian
lookup: check "local" as NETADDR in table static: -> found
lookup: check "server.foo.fr" as DOMAIN in table static: 
-> 0

lookup: check "local" as NETADDR in table static: -> found
lookup: check "server.foo.fr" as DOMAIN in table static: -> 0
82908be87cc7fef7 smtp event=failed-command address=local host=debian
command="RCPT TO: " result="550 Invalid recipient"

82908be87cc7fef7 smtp event=closed address=local host=debian
reason=disconnect


$ cat /etc/smtpd.conf
listen on localhost
# If you edit the file, you have to run "smtpctl update table aliases"
table aliases file:/etc/aliases
table secrets file:/etc/smtpd.secrets
accept for local \
 alias  \
 deliver to mbox
accept for domain masson-informatique.fr \
 relay via secure+auth://y...@mail.infomaniak.com:587 \
 auth  \
 as y...@masson-informatique.fr


$ cat /etc/aliases
root: y...@masson-informatique.fr


r...@server.foo.fr:    y...@masson-informatique.fr


Thanks Edgar for the quick reply, but unfortunately I have the same result…



$ cat /etc/hostname
127.0.0.1   localhost
127.0.1.1   server.foo.fr serveur
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

I finally found it! There was no issue with the OpenSMTPD configuration, 
but I had
a file, /etc/mailname, which contained only the string "debian".I don't 
know how it came on my system. Anyway, it was sufficient to just move 
this file away to make it work properly.


Regards,
Yvan



OpenPGP_signature
Description: OpenPGP digital signature


Re: mails not sent when using alias as recipient

2021-01-17 Thread Yvan Masson

Le 17/01/2021 à 18:55, Edgar Pettijohn a écrit :

On Sun, Jan 17, 2021 at 06:33:29PM +0100, Yvan Masson wrote:

Hi list,

I have two Debian servers that need to be able to send notification emails
via a relay. Their configuration is identical, but only the first works
properly. On the second, sending to aliases does not work:


$ echo foo | mail -s test y...@masson-informatique.fr
-> works

$ echo foo | mail -s test root
mail: cannot send message: Process exited with a non-zero status
-> does not work :-(


Unfortunately after two hours digging I still can't find where the issue
lies??? Any pointer would be greatly appreciated!

Best regards,
Yvan


# smtpd -d -T lookup
82908be87cc7fef7 smtp event=connected address=local host=debian
lookup: check "local" as NETADDR in table static: -> found
lookup: check "server.foo.fr" as DOMAIN in table static: -> 0
lookup: check "local" as NETADDR in table static: -> found
lookup: check "server.foo.fr" as DOMAIN in table static: -> 0
82908be87cc7fef7 smtp event=failed-command address=local host=debian
command="RCPT TO: " result="550 Invalid recipient"

82908be87cc7fef7 smtp event=closed address=local host=debian
reason=disconnect


$ cat /etc/smtpd.conf
listen on localhost
# If you edit the file, you have to run "smtpctl update table aliases"
table aliases file:/etc/aliases
table secrets file:/etc/smtpd.secrets
accept for local \
 alias  \
 deliver to mbox
accept for domain masson-informatique.fr \
 relay via secure+auth://y...@mail.infomaniak.com:587 \
 auth  \
 as y...@masson-informatique.fr


$ cat /etc/aliases
root: y...@masson-informatique.fr


r...@server.foo.fr: y...@masson-informatique.fr


Thanks Edgar for the quick reply, but unfortunately I have the same result…



$ cat /etc/hostname
127.0.0.1   localhost
127.0.1.1   server.foo.fr serveur
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters










OpenPGP_signature
Description: OpenPGP digital signature


Re: mails not sent when using alias as recipient

2021-01-17 Thread Edgar Pettijohn
On Sun, Jan 17, 2021 at 06:33:29PM +0100, Yvan Masson wrote:
> Hi list,
> 
> I have two Debian servers that need to be able to send notification emails
> via a relay. Their configuration is identical, but only the first works
> properly. On the second, sending to aliases does not work:
> 
> 
> $ echo foo | mail -s test y...@masson-informatique.fr
> -> works
> 
> $ echo foo | mail -s test root
> mail: cannot send message: Process exited with a non-zero status
> -> does not work :-(
> 
> 
> Unfortunately after two hours digging I still can't find where the issue
> lies??? Any pointer would be greatly appreciated!
> 
> Best regards,
> Yvan
> 
> 
> # smtpd -d -T lookup
> 82908be87cc7fef7 smtp event=connected address=local host=debian
> lookup: check "local" as NETADDR in table static: -> found
> lookup: check "server.foo.fr" as DOMAIN in table static: -> 0
> lookup: check "local" as NETADDR in table static: -> found
> lookup: check "server.foo.fr" as DOMAIN in table static: -> 0
> 82908be87cc7fef7 smtp event=failed-command address=local host=debian
> command="RCPT TO: " result="550 Invalid recipient"
> 
> 82908be87cc7fef7 smtp event=closed address=local host=debian
> reason=disconnect
> 
> 
> $ cat /etc/smtpd.conf
> listen on localhost
> # If you edit the file, you have to run "smtpctl update table aliases"
> table aliases file:/etc/aliases
> table secrets file:/etc/smtpd.secrets
> accept for local \
> alias  \
> deliver to mbox
> accept for domain masson-informatique.fr \
> relay via secure+auth://y...@mail.infomaniak.com:587 \
> auth  \
> as y...@masson-informatique.fr
> 
> 
> $ cat /etc/aliases
> root: y...@masson-informatique.fr

r...@server.foo.fr: y...@masson-informatique.fr

> 
> 
> $ cat /etc/hostname
> 127.0.0.1   localhost
> 127.0.1.1   server.foo.fr serveur
> ::1 localhost ip6-localhost ip6-loopback
> ff02::1 ip6-allnodes
> ff02::2 ip6-allrouters
> 






mails not sent when using alias as recipient

2021-01-17 Thread Yvan Masson

Hi list,

I have two Debian servers that need to be able to send notification 
emails via a relay. Their configuration is identical, but only the first 
works properly. On the second, sending to aliases does not work:



$ echo foo | mail -s test y...@masson-informatique.fr
-> works

$ echo foo | mail -s test root
mail: cannot send message: Process exited with a non-zero status
-> does not work :-(


Unfortunately after two hours digging I still can't find where the issue 
lies… Any pointer would be greatly appreciated!


Best regards,
Yvan


# smtpd -d -T lookup
82908be87cc7fef7 smtp event=connected address=local host=debian
lookup: check "local" as NETADDR in table static: -> found
lookup: check "server.foo.fr" as DOMAIN in table static: -> 0
lookup: check "local" as NETADDR in table static: -> found
lookup: check "server.foo.fr" as DOMAIN in table static: -> 0
82908be87cc7fef7 smtp event=failed-command address=local host=debian 
command="RCPT TO: " result="550 Invalid recipient" 

82908be87cc7fef7 smtp event=closed address=local host=debian 
reason=disconnect



$ cat /etc/smtpd.conf
listen on localhost
# If you edit the file, you have to run "smtpctl update table aliases"
table aliases file:/etc/aliases
table secrets file:/etc/smtpd.secrets
accept for local \
alias  \
deliver to mbox
accept for domain masson-informatique.fr \
relay via secure+auth://y...@mail.infomaniak.com:587 \
auth  \
as y...@masson-informatique.fr


$ cat /etc/aliases
root: y...@masson-informatique.fr


$ cat /etc/hostname
127.0.0.1   localhost
127.0.1.1   server.foo.fr serveur
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters



OpenPGP_signature
Description: OpenPGP digital signature