-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mail provider adds a few Received From lines with 127.0.0.1 making MailScanner into thinking the Sending IP is 127.0.0.1 #585
Comments
Thank you for submitting your first issue to MailScanner! We will respond to you soon! |
In MSMail.pm:
Which basically says that if The regex to match the IP in the received header is:
It turns out the Fetchmail doesn't get matched because the IP in brackets is not in parenthesis, so the subsequent Received header is used. So, this is just a consequence of Fetchmail not formatting the Received header properly with comments in parenthesis. According to https://datatracker.ietf.org/doc/html/rfc2822:
[Corrected] ...and...
|
@RobinR1 The enhancement you suggest would require new logic to detect fetchmail. I'll need to ponder this some more. |
Ok, so it is actually a coincidence that it works most af the time when fetchmail is used due to the fetchmail formatting 😅. I assumed it was already actively detected as it is (according the the docs) with BarricadeMX. But yes, the logic I proposed needs fetchmail detection. |
I've set up MailScanner and MailWatch (with fetchmail - postfix - dovecot). And from docs on MailWatch I had to add 127.0.0.1 to the Whitelist to be able to release quarantined mails. I have several mail addresses from different providers, but I noticed that now all mails directed to one specific provider are always whitelisted because MailScanner thinks those are always sent from 127.0.0.1.
An example header of a mail from the problematic provider (real email addresses obfuscated):
An example header from another provider without this problem:
In MailScanner.conf
Read IP Address From Received Header
is still set tono
since it didn't seem to be a problem using fetchmail in combination with the other mail providers. I assume MailScanner detects that Fetchmail is used and first tries to read the IP from the secondReceived:
header despite that setting is set tono
; And this works correctly for most mails from the other providers. So I can't useRead IP Address From Received Header = 4
as that does work for this specific provider but won't work for the others anymore as those, most of the time, only contain 2Received:
headers with IP addresses in, making MailScanner to use 127.0.0.1 again (I assume as fallback it takes the actual IP of the SMTP client which is fetchmail here).I now worked around this by using postfix header_checks to strip out the localhost entries from that provider, so that the 2nd
Received:
header also on this provider would be the actual sending IP. Except when the provider itself sends me mail; since then there is only 1Received
header and MailScanner uses 127.0.0.1 again. But that is not that much of a problem as I trust that provider.I assume this is not really a "bug" as such and more of an "enhancement request" as in a Fetchmail system it is probably always a bit of guessing which IP is the actual sending IP. But I think this could be solved if the logic when fetchmail is detected would be:
Received
header, as it does now,Received
headers are found: use the IP from the firstReceived
header (the one Fetchmail added) which contains the IP of the mail provider itself;Or would that introduce other problems ?
Server :
The text was updated successfully, but these errors were encountered: