Skip to content

All mail is received from the local 127.0.0.1 IP address and therefore always whitelisted #701

@gesture1968

Description

@gesture1968

** Bug description**
After installing the latest EFA spamscanner (v5) all mail received appears to come from the localhost IP address in stead of the public IP addres of the sender. Therefore MailScanner always treats the mail as internal and the mail is always whitelisted without is being checked. The EFA uses postfix as its mailserver.

After digging into the code, I found that the /usr/share/MailScanner/perl/MailScanner/postfix.pm has a function called ReadQf. In this function, the $InReceived is set to 0 in line 395, but it is never changed in that function, so the check in line 651 is never processed. This leaves the $rcvdip to always point to 127.0.0.1, resulting in the MailScanner always seeing the sender as the localhost.

Expected behavior
The Mailscanner uses the public IP address of the sender to process the mails

Server (please complete the following information):

  • OS: CentOS
  • Mandatory Access Control Enforcement: none
  • MailScanner Version: 5.5.1]
  • OS Version: 9
  • Installation method: Using EFA install process
  • Installation: New
  • Containerized: No

Additional context
By setting the $InReceived according to the received header's public IP address before line 651, and also setting the $UnfoldBuffer to the value of the $recdata, the mail is now received from the public IP address:

if ($recdata =~ /^Received:/i) { $InReceived = 1; }

if ($InReceived) { if ($recdata =~ /^\s/) { $recdata =~ s/^\s//; $UnfoldBuffer .= ' ' . $recdata; next; } else { $UnfoldBuffer = $recdata; ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions