IPREV check failed: reverseIp showing as internal Docker IP

Your question

Hi,

I’m running Stalwart v0.16.27 in the latest Docker and am having a problem with some legitimate messaged being classified as spam, and I think a big part of this is the “IPREV check failed” messages I’m getting.

The weird thing is that this doesn’t happen for all connections, only certain ones. It seems to happen mostly for connections from google.com (see example below), but I don’t currently have enough log data to be 100% sure.

Here’s an example:

stalwart  | 2026-10-25T09:30:00Z INFO IPREV check failed (smtp.iprev-fail) listenerId = "smtp", localPort = 25, remoteIp = 172.18.0.1, remotePort = 48414, domain = "mail-qt1-x849.google.com", result = IPREV permanent error (iprev.perm-error) { causedBy = DNS record not found (mail-auth.dns-record-not-found) { code = "Non-Existent Domain" } }, elapsed = 0ms

And an example of a check that passes (from Amazon):

stalwart  | 2026-10-24T10:33:39Z INFO IPREV check passed (smtp.iprev-pass) listenerId = "smtp", localPort = 25, remoteIp = 54.240.7.4, remotePort = 38217, domain = "a7-4.smtp-out.eu-west-1.amazonses.com", result = IPREV check passed (iprev.pass) { details = ["a7-4.smtp-out.eu-west-1.amazonses.com."] }, elapsed = 4016ms

This seems to happen on all listeners, but it’s obviously a biggest issue on smtp and submissions as the revip checks are failing.

Has anyone been seeing this same issue? I’ve looked around the forum and I can see similar issues, but they’re all on the http listener, which doesn’t seem to be affecting me.

Host OS is Debian 13 (up to date), with the latest docker-ce from the docker repos.

UPDATE: I’m relatively confident it’s just google.com that’s the only legit domain it’s failing on, other than bots and script kiddies that are scanning me (e.g. fake domain ‘win-7n1fiecl6ic.domain’).

I wonder if this is a DNS filtering/adblock issue…

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

This confirms the cause: the remote IP in your logs (172.18.0.1) is Docker’s internal bridge gateway, which means Stalwart is actually seeing a proxy (likely Docker’s own NAT/port mapping, or something in front of the container) rather than the real client IP. That’s why IPREV is doing a reverse lookup on an address that obviously has no PTR record, while real connections that arrive without any intermediary (like your Amazon example) pass fine.

The fix is to get Docker to preserve the real client IP, or if you’re actually running a reverse proxy container (e.g. nginx/traefik/haproxy) in front of Stalwart, to enable and trust the PROXY protocol between that proxy and Stalwart, so Stalwart records the genuine remote IP instead of the Docker gateway address:

  • Configure your reverse proxy to emit the PROXY protocol (or, for HTTP, X-Forwarded-For).
  • Mark the proxy’s address (here, the Docker bridge network, e.g. 172.18.0.0/16) as a trusted network so Stalwart honours the forwarded IP instead of treating the connection as originating from 172.18.0.1 itself. This is proxyTrustedNetworks on the SystemSettings singleton, or overrideProxyTrustedNetworks on the specific NetworkListener (smtp, submissions, etc).
  • Only one mechanism (PROXY protocol or X-Forwarded-For) should be enabled per listener, and it must match what the thing in front of Stalwart actually sends.

If there is no reverse proxy and Stalwart is published directly via Docker port mapping, then seeing 172.18.0.1 as the remote IP indicates something (e.g. Docker’s userland proxy, a host firewall/NAT rule, or another container) is relaying the connection through the bridge network rather than passing it straight through; check your docker-compose/docker run networking mode (e.g. consider network_mode: host or verifying -p port publishing is direct) so that the real internet client IP reaches the Stalwart container, not the gateway address.

Reference: https://support.stalw.art/… see docs at /docs/server/reverse-proxy and /docs/server/reverse-proxy/proxy-protocol

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

Also having this issue for domain ‘bendel.debian.org’.

The failing connections are the ones arriving over IPv6. mail-qt1-x849.google.com is one of Google’s IPv6 sending hosts, and bendel.debian.org has IPv6 too, while Amazon SES only sends over IPv4, which is why that one shows its real address.

Your container only has an IPv4 address on the bridge network, so when a sender connects to the host over IPv6, Docker’s userland proxy accepts it and opens a fresh IPv4 connection to the container from the bridge gateway. Stalwart only ever sees 172.18.0.1, the PTR lookup for that fails, and IPREV (and anything else keyed on the client IP, like SPF and DNSBLs) is evaluated against the wrong address.

Any of these fixes it:

  1. Run the container with network_mode: host, so Stalwart sees the real client addresses on both families.
  2. Enable IPv6 on the Docker network (enable_ipv6: true plus an IPv6 subnet in your compose network definition) so the container gets its own IPv6 address and Docker forwards IPv6 traffic straight to it.
  3. Remove the AAAA record for your MX hostname, so everyone delivers over IPv4.

Host networking is the least moving parts for a mail server. Once it’s in place, the IPREV entries for Google should show a 2607:f8b0:... address and pass.