Topic: Clean up header
======== Required information ====
- iRedMail version: 0.8.7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: Ubuntu 14.04 LTS
- Related log if you're reporting an issue:
====
Recently I've set my iredmail server as primary MX. While test period (as secondary mx) I checked it on http://mxtoolbox.com/ and http://mail-tester.com services - everything gonna be ok.
But as my server become primary it has been got to DNSBL by Spamhaus ZEN. The reason on its site was bad HELO - localhost [127.0.0.1], but all test show it is right fqdn - mail.mydomain.com.
For investigation I've looked into header of my email, here it is (for short view only 'received' fields):
Header of the eml sent with roundcube:
Received: by 10.27.178.10 with SMTP id b10csp267363wlf;
Wed, 18 Feb 2015 22:52:49 -0800 (PST)
Received: from mail.mydomain.com (mail.mydomain.com. [xxx.xxx.xxx.xxx])
by mx.google.com with ESMTPS id z2si4177050lal.19.2015.02.18.22.52.47
for <xxxxx@gmail.com>
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 18 Feb 2015 22:52:47 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
by mail.mydomain.com (Postfix) with ESMTP id 6E4D2814A5
for <xxxxx@gmail.com>; Thu, 19 Feb 2015 09:52:22 +0300 (MSK)
Received: from mail.mydomain.com ([127.0.0.1])
by mail.mydomain.com (localhost [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id F-WRYjAfrm40 for <xxxxx@gmail.com>;
Thu, 19 Feb 2015 09:52:22 +0300 (MSK)
Received: from mail.mydomain.com (localhost [127.0.0.1])
by mail.mydomain.com (Postfix) with ESMTPSA id F0D7381461
for <xxxxx@gmail.com>; Thu, 19 Feb 2015 09:52:20 +0300 (MSK)
For Thunderbird client last 'Recieved' looks like below:
Received: from [192.168.xxx.xxx] (comp.mydomain.local [192.168.xxx.xxx])
by mail.mydomain.com (Postfix) with ESMTPSA id 8043E81461
for <xxxxx@gmail.com>; Thu, 19 Feb 2015 09:53:11 +0300 (MSK)
First and second 'recieved' are ok , but I need to get rid of unwanted received fields (localhost and some inner IP informations). Looking for some information and get:
Getting rid of 'received':
/etc/postfix/main.cf
header_checks = regexp:/etc/postfix/header_checks
/etc/postfix/header_checks:
/^Received: from .*by mail\.mydomain\.com \(Postfix\) with ESMTPSA/ IGNORE #inner info
/^Received: from .*\[127\.0\.0\.1\].*by mail\.mydomain\.com.*/ IGNORE #all fields by my server containing [127.0.0.1]
Turn off adding 'recieved' fields by amavis:
/etc/amavis/conf.d/50-user:
$allowed_added_header_fields{lc('Received')} = 0;
Check new header:
Received: by 10.27.178.10 with SMTP id b10csp1120450wlf;
Fri, 20 Feb 2015 04:56:55 -0800 (PST)
Received: from mail.mydomain.com (mail.mydomain.com. [xxx.xxx.xxx.xxx])
by mx.google.com with ESMTPS id wo5si15188206lbb.15.2015.02.20.04.56.54
for <xxxxx@gmail.com>
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Fri, 20 Feb 2015 04:56:54 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
by mail.mydomain.com (Postfix) with ESMTP id 813AE81467
for <xxxxx@gmail.com>; Fri, 20 Feb 2015 15:56:28 +0300 (MSK)
Still 1 more unwanted recieved But how it could be? Check our recieved field:
postmap -q "Received: from localhost (localhost [127.0.0.1]) by mail.mydomain.com (Postfix) with ESMTP " regexp:/etc/postfix/header_checks
IGNORE
So i believe this Recieved is added after header_checks. Any idea how to remove it?
My temporary solution to not get in BL is editing
/etc/amavis/conf.d/05-node_id
chomp($localhost_name = `localhost`); #before
chomp($localhost_name = `hostname --fqdn`); #after
This changes affect to header:
Received: from mail.mydomain.com (localhost [127.0.0.1])
by mail.mydomain.com (Postfix) with ESMTP id 813AE81467
for <xxxxx@gmail.com>; Fri, 20 Feb 2015 15:56:28 +0300 (MSK)
Only after this my server stops to get to the Spamhaus BL.
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.