stalwartlabs / mail-server

Secure & Modern All-in-One Mail Server (IMAP, JMAP, POP3, SMTP)
https://stalw.art
3.53k stars 135 forks source link

[bug]: Incorrect Gmail SPF source IP #511

Closed robogao-net closed 3 weeks ago

robogao-net commented 3 weeks ago

What happened?

Any emails from Gmail are being marked as spam.

ss

How can we reproduce the problem?

I can reproduce the problem by doing the following steps:

Version

v0.8.x

What database are you using?

RocksDB

What blob storage are you using?

S3-compatible

Where is your directory located?

Internal

What operating system are you using?

Docker

Relevant log output

Mon, 03 Jun 2024 20:52:40   
INFO    
smtp::outbound::delivery: Delivery completed. context="queue" event="completed"
Mon, 03 Jun 2024 20:52:40   
INFO    
smtp::outbound::local: context="deliver_local" event="delivered" rcpt="kai@***.email"
Mon, 03 Jun 2024 20:52:40   
INFO    
smtp::queue::spool: Message queued for delivery. context="queue" event="scheduled" id=178549754109935616 from="***@gmail.com" nrcpts=1 size=5699
Mon, 03 Jun 2024 20:52:37   
INFO    
common::listener::listen: context="tls" event="handshake" version=TLSv1_3 cipher=TLS13_AES_256_GCM_SHA384

Code of Conduct

mdecimus commented 3 weeks ago

This a configuration issue on your side, not a bug.

robogao-net commented 3 weeks ago

Reproducing the issue:

Set up DNS AAAA records

Gmail prioritizes using IPv6 to deliver emails. These hosts don't have IPv4, causing reverse lookup to fail and resulting in unknown [172.17.0.1].

For example: mail-wr1-x430.google.com mail-pg1-x535.google.com

mdecimus commented 3 weeks ago

Is your server behind a reverse proxy or NAT? The source IP is obtained from the TCP connection, not from the DNS.