OOB issues: stuck in loop and not-recognized DSN

Hi again,

I was currently testing OOB, but appear to have trouble understanding why they’re not logged to the webhook.

For example:

User A sets cname for bounces.user.com to bounces.esp.net, this has an MX pointing the the incoming Kumo SMTP listener:

        listen = "0.0.0.0:2510", -- proxied to 25
        hostname = "bounces.esp.net", ... ommitted tls and banner property```

Message arrives, showing these logs with `kcli trace-smtp-server`:
```[10.2.11.0:25876->10.2.1.55:2510]    1s  -> ------33D00BEF02924490820158550AD524A1
[10.2.11.0:25876->10.2.1.55:2510]    1s  -> Content-Type: message/delivery-status
[10.2.11.0:25876->10.2.1.55:2510]    1s  -> Content-Description: Delivery report
[10.2.11.0:25876->10.2.1.55:2510]    1s  -> 
[10.2.11.0:25876->10.2.1.55:2510]    1s  -> Reporting-MTA: smtp; service.socketlabs.com
[10.2.11.0:25876->10.2.1.55:2510]    1s  -> Original-Recipient: rfc822; bounce-test@service.socketlabs.com
[10.2.11.0:25876->10.2.1.55:2510]    1s  -> Action: failed
[10.2.11.0:25876->10.2.1.55:2510]    1s  -> Status: 5.1.1
[10.2.11.0:25876->10.2.1.55:2510]    1s  -> Diagnostic-Code: SMTP; 550 No such recipient
[10.2.11.0:25876->10.2.1.55:2510]    1s  -> 
[10.2.11.0:25876->10.2.1.55:2510]    1s  -> ------33D00BEF02924490820158550AD524A1--
[10.2.11.0:25876->10.2.1.55:2510]    1s  -> 
[10.2.11.0:25876->10.2.1.55:2510]    1s  -> .
[10.2.11.0:25876->10.2.1.55:2510]    1s === smtp_server_message_received: Ok
[10.2.11.0:25876->10.2.1.55:2510]    1s === get_listener_domain domain=bounces.esp.net: Ok: Object {"log_arf": String("LogThenRelay"), "log_oob": String("LogThenRelay"), "relay_from": Array [], "relay_to": Bool(false), "ttl": String("1m")}
[10.2.11.0:25876->10.2.1.55:2510]    1s === Message from=<3e8.10.feedback=bounces.user.com@tracking.socketlabs.com> to=<feedback@bounces.esp.net> id=370482d0539711f0a6d0c2c86979c17c
[10.2.11.0:25876->10.2.1.55:2510]    1s === Message queue=default@bounces.esp.net relay=false log_arf="LogThenRelay" log_oob="LogThenRelay" was_arf_or_oob=Some(false) will_enqueue=Some(false)
[10.2.11.0:25876->10.2.1.55:2510]    1s === Message meta: ehlo_domain="s1-be0f.socketlabs.email-od.com"
[10.2.11.0:25876->10.2.1.55:2510]    1s === Message meta: hostname="bounces.esp.net"
[10.2.11.0:25876->10.2.1.55:2510]    1s === Message meta: received_from="10.2.11.0:25876"
[10.2.11.0:25876->10.2.1.55:2510]    1s === Message meta: received_via="10.2.1.55:2510"
[10.2.11.0:25876->10.2.1.55:2510]    1s === Message meta: reception_protocol="ESMTP"
[10.2.11.0:25876->10.2.1.55:2510]    1s === Message meta: tenant="default"
[10.2.11.0:25876->10.2.1.55:2510]    1s <-  550 5.7.1 relaying not permitted
[10.2.11.0:25876->10.2.1.55:2510]    1s  -> QUIT
[10.2.11.0:25876->10.2.1.55:2510]    1s <-  221 So long, and thanks for all the fish!
[10.2.11.0:25876->10.2.1.55:2510]    1s === Closed```

When using the socketlabs.com bounce test address, it shows log_oob "LogThenRelay" but doesn't call the webhook and it returns `relaying not permitted`.

Since the return path can be anything, we have this to rewrite the recipient:
```kumo.on('get_listener_domain', function(domain, listener, conn_meta)
    local is_bounce_listener = string.match(listener, ":2510$") ~= nil
    if is_bounce_listener then
        return kumo.make_listener_domain {
          log_oob = true,
          log_arf = true,
        }
    end
end)```

When using my own test address that generates an ARF, it is marked as was_arf_or_oob=Some(true) but still never calling the webhook:

[10.2.6.0:36431->10.2.1.65:2510]  49ms === get_listener_domain domain=bounces.esp.net: Ok: Object {"log_arf": String("LogThenRelay"), "log_oob": String("LogThenRelay"), "relay_from": Array [], "relay_to": Bool(false), "ttl": String("1m")}
[10.2.6.0:36431->10.2.1.65:2510]  50ms === Message from=<nobody@test.com> to=<feedback@bounces.esp.net> id=a36fe45d53a411f08da6d6327330ef62
[10.2.6.0:36431->10.2.1.65:2510]  50ms === Message queue=sandbox@bounces.esp.net![10.3.175.53] relay=false log_arf="LogThenRelay" log_oob="LogThenRelay" was_arf_or_oob=Some(true) will_enqueue=Some(true)```

I'm not sure what I am missing here. Appreciate the help! Webhook works fine for other events.

Ah - I found out what happened. Even though I have relay_to and relay_from disabled on this listener, it loops. I and up with a DSN message with hundreds of Received headers :sweat_smile: But because of hundreds of calls to the webhook (which contained Reception + Delivery) I looked over the OOB

          log_oob = true,
          log_arf = true,
          relay_to = false,
          relay_from = {}
        }```

With this disabled, I don't need the routing_domain overwrite right? Why would it still relay to itself?

and fwiw, this DSN is not recognized as OOB, resulting in the relaying not permitted error which is correct in that case.
message.txt (6.43 KB)

OOB issues: stuck in loop and not-recognized DSN

Sadly have not been able to fix it over the weekend. I can’t seem to figure out why it still tries to relay and why the socketlabs DSN is not recognized as one.

Pls submit a copy of the DSN as an issue on Github.

Will do! Currently moving to a new home so will take some time :sweat_smile: