Hello, this is Dam
I'm in the process of freeing myself from Gmail and I'm trying to
configure my debian vm as a mailserver using OpenSMTPD.
Back in the days I was used to run my own mailserver with Postfix (then
I don't know what happened to me and I moved to 3rd party services) but
this is my first time with OpenSMTPD so I'm really trying to learn how
to configure it properly.
So far so good I've to say. Chess Griffin's guide has been of great help.
There is one thing that I've noticed: if the local user contains @ in
the name, OpenSTMD can't route an incoming email properly. I'm not sure
if this something expected or a bug or if I'm missing something.
So this is the scenario:
d...@venturin.net sends an email to u...@example.com (123.123.123.123)
which is is mapped on the server as user@example--com.
So this is what you see in my /etc/opensmtd/vuser:
u...@example.com: user@example--com
As you can see from the log below, the incoming email is accepted, goes
through clamsmtp filtering process (listening on 127.0.0.1:10025)
smtpd[2794]: b22a8aceadaec265 smtp event=connected
address=209.35.192.171 host=mail-pf1-f171.google.com
smtpd[2794]: b22a8aceadaec265 smtp event=message msgid=9c2da050
from= to= size=2847 ndest=1 proto=ESMTP
smtpd[2794]: b22a8aceadaec265 smtp event=closed reason=quit
smtpd[2794]: b22a8ad7d4f8e7b8 mta event=connecting
address=smtp://127.0.0.1:10025 host=localhost
smtpd[2794]: b22a8ad7d4f8e7b8 mta event=connected
smtpd[2794]: b22a8ad89531da2b smtp event=connected address=127.0.0.1
host=localhost
smtpd[2794]: b22a8ad89531da2b smtp event=message msgid=9a2845eb
from= to= size=3043 ndest=1 proto=ESMTP
I think that now OpenSMTPD tries to send back a receipt to the email
server which has sent the email. Am I right?
Accordingly to the configuration, the message is sent again to clamsmtp
which is listening on 127.0.0.1:10027
smtpd[2794]: b22a8ae0d78126ae mta event=connecting
address=smtp://127.0.0.1:10027 host=localhost
smtpd[2794]: b22a8ad7d4f8e7b8 mta event=delivery evpid=9c2da05070285532
from= to= rcpt=<-> source=127.0.0.1
relay=
127.0.0.1 (localhost) delay=11s result=Ok stat=250 2.0.0: 9a2845eb
Message accepted for delivery
smtpd[2794]: b22a8ae0d78126ae mta event=connected
But then something happens: all of the sudden the recipient is no more
u...@example.com but user@example--com (which is the name of the real
local user)
smtpd[2794]: b22a8ae11170b5b4 smtp event=connected address=127.0.0.1
host=localhost
smtpd[2794]: b22a8ae11170b5b4 smtp event=message msgid=f33aeeec
from= to= size=3243 ndest=1 proto=ESMTP
smtpd[2794]: b22a8ae0d78126ae mta event=delivery evpid=9a2845eb454ddf26
from= to=rcpt=
source=127.0.0.1 relay=127.0.0.1 (localhost) delay=5s result=Ok stat=250
2.0.0: f33aeeec Message accepted for delivery
smtpd[2794]: b22a8ad89531da2b smtp event=closed reason=quit
smtpd[2794]: b22a8ad7d4f8e7b8 mta event=closed reason=quit messages=1
smtpd[2794]: smtp-out: Failed to resolve MX for [relay:example--com]:
Domain does not exist
Of course the domain example--com is not found
smtpd[2794]: mta event=delivery evpid=f33aeeecc889f968
from= to= rcpt=<-> source=-
relay=example--
info delay=5s result=PermFail stat=Domain does not exist
smtpd[2794]: b22a8aeac0c27769 smtp event=connected address=local
host=localhost
smtpd[2794]: b22a8aeac0c27769 smtp event=message msgid=57f4cae9 from=<>
to= size=4459 ndest=1 proto=ESMTP
smtpd[2794]: b22a8aeac0c27769 smtp event=closed reason=quit
smtpd[2794]: b22a8ae11170b5b4 smtp event=message msgid=e121e32c from=<>
to= size=4660 ndest=1 proto=ESMTP
smtpd[2794]: b22a8ae0d78126ae mta event=delivery evpid=57f4cae9a970f282
from=<> to= rcpt=<-> source=127.0.0.1 relay=127.0.0.1 (loc
alhost) delay=1s result=Ok stat=250 2.0.0: e121e32c Message accepted for
delivery
smtpd[2794]: b22a8ae11170b5b4 smtp event=closed reason=quit
smtpd[2794]: b22a8ae0d78126ae mta event=closed reason=quit messages=2
smtpd[2794]: b22a8af88282d316 mta event=connecting
address=smtp+tls://66.102.1.27:25 host=wb-in-f27.1e100.net
smtpd[2794]: b22a8af88282d316 mta event=connected
smtpd[2794]: b22a8af88282d316 mta event=starttls
ciphers=version=TLSv1.2, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128
smtpd[2794]: smtp-out: Server certificate verification succeeded on
session b22a8af88282d316
smtpd[2794]: b22a8af88282d316 mta event=delivery evpid=e121e32cb085713e
from=<> to= rcpt=<-> source=123.123.123.123
relay=66.102.1.
27 (wb-in-f27.1e100.net) delay=20s result=Ok stat=250 2.0.0 OK
1526942107 a7-v6si5619866wrq.344 - gsmtp
Now, if I change the local username to, say, user-example--com or
user-example.com, rebuild the vuser.db everything works fine but the
presence of the "@" seems to mess up things. Is this an expected behavior?
P.S. 1
* I've tested the same thing but removing clamsmtp for the (outgoing)
relayed traffic and the result is absolutely the same
* I've tried removing clamsmtp entirely and the result is the same but
the log changes in this way
smtpd[543