Hi!

I'm trying to setup a simple backup mx on OpenBSD 5.8-stable, but so far
it seems more of a burden than a "simple" task :)

smtpd.conf:
------------------------8<------------------------
pki hostname certificate "/etc/ssl/smtpd_cert.pem"
pki hostname key "/etc/ssl/private/smtpd_key.pem"

listen on pppoe0 tls pki hostname

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

accept for local alias <aliases> deliver to mbox

accept from any for domain "example.com" relay backup tls verify expire 30d

accept from local for any relay
------------------------8<------------------------

The MX records are set for example.com correctly, with the priority set
to 10 for the primary MX, and 20 for this, the secondary.
The $(hostname) is the same as in the MX record.

So what this configuration does currently, is it loops the mail back to
itself [1], like it had never done an actual MX lookup for example.com,
and determined that there are MX servers with higher priority to relay
the mail to.

I thought it would work like this:
-> accepting the mail from outside of the box, if the rcpt is the domain
   @example.com
-> DNS lookup for MX record, check if there are higher priority servers
-> relay mail to MX server with higher priority ...
-> ... otherwise if it cannot do it, queue it for 30 days.

Clearly I am missing something, but what?

Daniel

[1]:
Oct 31 09:09:13 host smtpd[1612]: smtp-in: New session f7f7a554f37e98c7 from 
host client [client_ip]
Oct 31 09:09:13 host smtpd[1612]: smtp-in: Started TLS on session 
f7f7a554f37e98c7: version=TLSv1/SSLv3, cipher=ECDHE-RSA-AES256-GCM-SHA384, 
bits=256
Oct 31 09:09:26 host smtpd[1612]: smtp-in: Accepted message 99f80132 on session 
f7f7a554f37e98c7: from=<l...@example.com>, to=<l...@example.com>, size=66, 
ndest=1, proto=ESMTP
Oct 31 09:09:26 host smtpd[1612]: smtp-out: Connecting to tls://ip:25 
(hostname) on session f7f7a55764209204...
Oct 31 09:09:26 host smtpd[1612]: smtp-out: Connected on session 
f7f7a55764209204
Oct 31 09:09:26 host smtpd[1612]: smtp-in: New session f7f7a558578d8e10 from 
host hostname [ip]
Oct 31 09:09:26 host smtpd[1612]: smtp-in: Started TLS on session 
f7f7a558578d8e10: version=TLSv1/SSLv3, cipher=ECDHE-RSA-CHACHA20-POLY1305, 
bits=256
Oct 31 09:09:26 host smtpd[1612]: smtp-out: Started TLS on session 
f7f7a55764209204: version=TLSv1/SSLv3, cipher=ECDHE-RSA-CHACHA20-POLY1305, 
bits=256
Oct 31 09:09:26 host smtpd[1612]: smtp-in: Client certificate verification 
succeeded on session f7f7a558578d8e10
Oct 31 09:09:26 host smtpd[1612]: smtp-out: Server certificate verification 
succeeded on session f7f7a55764209204
Oct 31 09:09:26 host smtpd[1612]: smtp-in: Accepted message 31901619 on session 
f7f7a558578d8e10: from=<l...@example.com>, to=<l...@example.com>, size=346, 
ndest=1, proto=ESMTP
Oct 31 09:09:26 host smtpd[1612]: relay: Ok for 99f80132578a8c22: 
session=f7f7a55764209204, from=<l...@example.com>, to=<l...@example.com>, 
rcpt=<->, source=ip, relay=ip (hostname), delay=6s, stat=250 2.0.0: 31901619 
Message accepted for delivery
Oct 31 09:09:27 host smtpd[1612]: smtp-in: Accepted message 1d0aeed4 on session 
f7f7a558578d8e10: from=<l...@example.com>, to=<l...@example.com>, size=632, 
ndest=1, proto=ESMTP
Oct 31 09:09:27 host smtpd[1612]: relay: Ok for 31901619061e4baf: 
session=f7f7a55764209204, from=<l...@example.com>, to=<l...@example.com>, 
rcpt=<->, source=ip, relay=ip (hostname), delay=1s, stat=250 2.0.0: 1d0aeed4 
Message accepted for delivery
Oct 31 09:09:28 host smtpd[1612]: smtp-in: Accepted message 7263a1e6 on session 
f7f7a558578d8e10: from=<l...@example.com>, to=<l...@example.com>, size=918, 
ndest=1, proto=ESMTP
Oct 31 09:09:28 host smtpd[1612]: relay: Ok for 1d0aeed4f9fac231: 
session=f7f7a55764209204, from=<l...@example.com>, to=<l...@example.com>, 
rcpt=<->, source=ip, relay=ip (hostname), delay=1s, stat=250 2.0.0: 7263a1e6 
Message accepted for delivery
Oct 31 09:09:29 host smtpd[1612]: smtp-in: Accepted message d74d740a on session 
f7f7a558578d8e10: from=<l...@example.com>, to=<l...@example.com>, size=1204, 
ndest=1, proto=ESMTP
Oct 31 09:09:29 host smtpd[1612]: relay: Ok for 7263a1e6c37169f7: 
session=f7f7a55764209204, from=<l...@example.com>, to=<l...@example.com>, 
rcpt=<->, source=ip, relay=ip (hostname), delay=1s, stat=250 2.0.0: d74d740a 
Message accepted for delivery
Oct 31 09:09:30 host smtpd[1612]: smtp-in: Accepted message 72bce114 on session 
f7f7a558578d8e10: from=<l...@example.com>, to=<l...@example.com>, size=1490, 
ndest=1, proto=ESMTP
Oct 31 09:09:30 host smtpd[1612]: relay: Ok for d74d740acfc489b0: 
session=f7f7a55764209204, from=<l...@example.com>, to=<l...@example.com>, 
rcpt=<->, source=ip, relay=ip (hostname), delay=1s, stat=250 2.0.0: 72bce114 
Message accepted for delivery
Oct 31 09:09:31 host smtpd[1612]: smtp-in: Accepted message 86d4de5a on session 
f7f7a558578d8e10: from=<l...@example.com>, to=<l...@example.com>, size=1776, 
ndest=1, proto=ESMTP
Oct 31 09:09:31 host smtpd[1612]: relay: Ok for 72bce114deb2a617: 
session=f7f7a55764209204, from=<l...@example.com>, to=<l...@example.com>, 
rcpt=<->, source=ip, relay=ip (hostname), delay=1s, stat=250 2.0.0: 86d4de5a 
Message accepted for delivery
Oct 31 09:09:32 host smtpd[1612]: smtp-in: Accepted message b676ae8e on session 
f7f7a558578d8e10: from=<l...@example.com>, to=<l...@example.com>, size=2062, 
ndest=1, proto=ESMTP
Oct 31 09:09:32 host smtpd[1612]: relay: Ok for 86d4de5a4eb3651a: 
session=f7f7a55764209204, from=<l...@example.com>, to=<l...@example.com>, 
rcpt=<->, source=ip, relay=ip (hostname), delay=1s, stat=250 2.0.0: b676ae8e 
Message accepted for delivery
[...] many more of these [...]
Oct 31 09:11:06 host smtpd[1612]: warn: loop detected
Oct 31 09:11:06 host smtpd[1612]: smtp-in: Failed command on session 
f7f7a558578d8e10: "DATA" => 500 5.4.6 Routing loop detected: Loop detected
Oct 31 09:11:06 host smtpd[1612]: relay: PermFail for 1c7e2c42fadc367e: 
session=f7f7a55764209204, from=<l...@example.com>, to=<l...@example.com>, 
rcpt=<->, source=ip, relay=ip (hostname), delay=1s, stat =500 5.4.6 Routing 
loop detected: Loop detected



-- 
LÉVAI Dániel
PGP key ID = 0x83B63A8F
Key fingerprint = DBEC C66B A47A DFA2 792D  650C C69B BE4C 83B6 3A8F

-- 
You received this mail because you are subscribed to misc@opensmtpd.org
To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org

Reply via email to