1

Topic: Backup MX: forwarded message changes from and to address

==== Required information ====
- iRedMail version: latest with OpenLDAP
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Linux/BSD distribution name and version: CentOS 6.5
- Related log if you're reporting an issue: maillog
====

I installed iRed without any problems. I want to use it as backup MX, so I set the domain object with phpLDAPadmin, to 'domainBackupMX=yes'. And in main.cf I set the IP address of the primary host as relayhost.
When I sent an email on the backup server (telnet localhost 25), the mail is accepted, placed in the queue and forwarded to the primary MX.

But on the primary server, something weird is happening. The mail is accepted, but then directly sent to the from address given on the backup server.

To make it clear:
mail from: xyz@gmail.com
rcpti to: someone@example.com

On the primary, this is a (edited) part from the logfile:
Oct  9 12:47:11 HOST postfix/cleanup[16560]: A682C23DB6: hold: header Received: from HOST-backup.domain.me (HOST [IP ADDRESS])??by smtp.domain.nl (Postfix) with ESMTP id A682C23DB6??for <xyz@gmailcom>; Thu,  9 Oct 2014 12:47:11 +0200 (CEST) from HOST[IP ADDRESS]; from=<> to=<xyz@gmail.com> proto=ESMTP helo=<HOST-backup.domain.me>

So, the to address is gone/empty, and the mail is sent to the from address.

btw the primary is not an iRedserver. (will be done later, but that takes some time).

Any idea what goes wrong and where?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Backup MX: forwarded message changes from and to address

Sorry, cannot help if it's not a iRedMail server.
iRedMail doesn't have any rule to "hold" emails like mentioned in pasted log.

3

Re: Backup MX: forwarded message changes from and to address

I understand you reply with this answer, but the problem is located at the iredmail backup server, I forgot to past that part of the log.
In the log of the sending iredmail server, you see that the from address is already wrong there. So the problem is not located at the primary server.

So, the iRedmail server changes the from address into the TO address.

Oct  9 06:47:11 host-backup postfix/smtpd[4995]: connect from host-backup.domain.me[127.0.0.1]
Oct  9 06:47:11 host-backup postfix/smtpd[4995]: 17F2646E181A: client=host-backup.domain.me[127.0.0.1]
Oct  9 06:47:11 host-backup postfix/cleanup[4988]: 17F2646E181A: message-id=<20141009104659.E657E46E1818@host-backup.domain.me>
Oct  9 06:47:11 host-backup postfix/qmgr[3903]: 17F2646E181A: from=<xyz@gmail.nl>, size=841, nrcpt=1 (queue active)
Oct  9 06:47:11 host-backup amavis[886]: (00886-01) Passed CLEAN {RelayedInternal}, MYNETS/MYUSERS LOCAL [127.0.0.1]:50714 <xyz@gmail.nl> -> <someone@domain.me>, Queue-ID: E657E46E1818, Message-ID: <20141009104659.E657E46E1818@host-backup.domain.me>, mail_id: CWzXfBLtbsPt, Hits: -7.026, size: 347, queued_as: 17F2646E181A, 5240 ms
Oct  9 06:47:11 host-backup postfix/smtpd[4995]: disconnect from host-backup.domain.me[127.0.0.1]
Oct  9 06:47:11 host-backup postfix/smtp[4989]: E657E46E1818: to=<someone@domain.me>, relay=127.0.0.1[127.0.0.1]:10024, delay=20, delays=15/0.01/0/5.3, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 17F2646E181A)
Oct  9 06:47:11 host-backup postfix/qmgr[3903]: E657E46E1818: removed
Oct  9 06:47:11 host-backup postfix/pipe[4996]: 17F2646E181A: to=<someone@domain.me>, relay=dovecot, delay=0.14, delays=0.04/0.02/0/0.09, dsn=5.1.1, status=bounced (user unknown)
Oct  9 06:47:11 host-backup postfix/cleanup[4988]: 3B3D746E1818: message-id=<20141009104711.3B3D746E1818@host-backup.domain.me>
Oct  9 06:47:11 host-backup postfix/qmgr[3903]: 3B3D746E1818: from=<>, size=2769, nrcpt=1 (queue active)
Oct  9 06:47:11 host-backup postfix/bounce[4999]: 17F2646E181A: sender non-delivery notification: 3B3D746E1818
Oct  9 06:47:11 host-backup postfix/qmgr[3903]: 17F2646E181A: removed
Oct  9 06:47:11 host-backup postfix/smtp[5001]: 3B3D746E1818: to=<xyz@gmail.nl>, relay=smtp.domain.me[relay IP]:25, delay=0.48, delays=0.03/0.01/0.35/0.09, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as A682C23DB6)
Oct  9 06:47:11 host-backup postfix/qmgr[3903]: 3B3D746E1818: removed

4

Re: Backup MX: forwarded message changes from and to address

JeeGee wrote:

In the log of the sending iredmail server, you see that the from address is already wrong there. So the problem is not located at the primary server.

iRedMail doesn't have any script/rule/filter to modify mail headers by default, so i don't quite understand this situation.
How did you assure it's not modified by primary server?

5

Re: Backup MX: forwarded message changes from and to address

Because you can see that in the logs of de sending iredmail server. All I did was: set BackupMX in LDAP and set the parameter relayhost in main.cf. Nothing more, just a fresh installation.

This morning, I removed the relayhost option in main.cf to see what happens. Still the domain is backupMX. And then I get this:

Oct 10 03:43:28 host-backup postfix/smtpd[21836]: 68F5B46E1819: client=host.backup.domain.me[127.0.0.1]
Oct 10 03:43:37 host-backup postfix/cleanup[21863]: 68F5B46E1819: message-id=<20141010074328.68F5B46E1819@host.backup.domain.me>
Oct 10 03:43:37 host-backup postfix/qmgr[21702]: 68F5B46E1819: from=<someone@yahoo.com>, size=347, nrcpt=1 (queue active)
Oct 10 03:43:42 host-backup postfix/smtpd[21870]: connect from host.backup.domain.me[127.0.0.1]
Oct 10 03:43:42 host-backup postfix/smtpd[21870]: 6960446E181C: client=host.backup.domain.me[127.0.0.1]
Oct 10 03:43:42 host-backup postfix/cleanup[21863]: 6960446E181C: message-id=<20141010074328.68F5B46E1819@host.backup.domain.me>
Oct 10 03:43:42 host-backup postfix/qmgr[21702]: 6960446E181C: from=<someone@yahoo.com>, size=842, nrcpt=1 (queue active)
Oct 10 03:43:42 host-backup amavis[892]: (00892-01) Passed CLEAN {RelayedInternal}, MYNETS/MYUSERS LOCAL [127.0.0.1]:57640 <someone@yahoo.com> -> <name@domain.me>, Queue-ID: 68F5B46E1819, Message-ID: <20141010074328.68F5B46E1819@host.backup.domain.me>, mail_id: Y_S-v4IzMgqs, Hits: -4.792, size: 347, queued_as: 6960446E181C, 5515 ms
Oct 10 03:43:42 host-backup postfix/smtpd[21870]: disconnect from host.backup.domain.me[127.0.0.1]
Oct 10 03:43:42 host-backup postfix/smtp[21864]: 68F5B46E1819: to=<name@domain.me>, relay=127.0.0.1[127.0.0.1]:10024, delay=25, delays=20/0.01/0.02/5.6, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 6960446E181C)
Oct 10 03:43:42 host-backup postfix/qmgr[21702]: 68F5B46E1819: removed
Oct 10 03:43:42 host-backup postfix/pipe[21871]: 6960446E181C: to=<name@domain.me>, relay=dovecot, delay=0.35, delays=0.26/0.02/0/0.07, dsn=5.1.1, status=bounced (user unknown)
Oct 10 03:43:42 host-backup postfix/cleanup[21863]: BFDCC46E1819: message-id=<20141010074342.BFDCC46E1819@host.backup.domain.me>
Oct 10 03:43:42 host-backup postfix/qmgr[21702]: BFDCC46E1819: from=<>, size=2770, nrcpt=1 (queue active)
Oct 10 03:43:42 host-backup postfix/bounce[21874]: 6960446E181C: sender non-delivery notification: BFDCC46E1819
Oct 10 03:43:42 host-backup postfix/qmgr[21702]: 6960446E181C: removed
Oct 10 03:43:47 host-backup postfix/smtp[21876]: BFDCC46E1819: to=<someone@yahoo.com>, relay=mta6.am0.yahoodns.net[98.136.216.25]:25, delay=4.5, delays=0.19/0.01/1.2/3.2, dsn=2.0.0, status=sent (250 ok dirdel)
Oct 10 03:43:47 host-backup postfix/qmgr[21702]: BFDCC46E1819: removed
Oct 10 03:44:21 host-backup postfix/smtpd[21836]: lost connection after UNKNOWN from host.backup.domain.me[127.0.0.1]
Oct 10 03:44:21 host-backup postfix/smtpd[21836]: disconnect from host.backup.domain.me[127.0.0.1]


So after removing the relayhost, iredmail doesn't swap the TO and FROM anymore, but then I get a bounced. Which is strange as it should act as backup MX.

Maybe I am doing something wrong. What should be done to setup a domain act as backup?

What I want is: Primary down, mail is sent to backup. There it is placed in the queue, waiting for the primary to be online again, and so the mail is delivered after all to the right person.

6

Re: Backup MX: forwarded message changes from and to address

Did you try to set per-domain transport to primary server?

By the way, seems there's bug if configure iRedMail to act as backup mx.

7

Re: Backup MX: forwarded message changes from and to address

ZhangHuangbin wrote:

Did you try to set per-domain transport to primary server?

By the way, seems there's bug if configure iRedMail to act as backup mx.

No, didn't do that. How can I do that?

Ah so it's 100% me then ;-)

8

Re: Backup MX: forwarded message changes from and to address

JeeGee wrote:

No, didn't do that. How can I do that?

If you have iRedAdmin-Pro, please go to domain profile page, add custom relay/transport under tab "Relay".
if you don't have iRedAdmin-Pro, please login to phpLDAPadmin (or other LDAP management tool), modify attribute "mtaTransport" in domain object to custom relay/transport. e.g. 'smtp:[primary_server]:25'.

9

Re: Backup MX: forwarded message changes from and to address

Thanks. Will try that this evening and let you know.

What should I do with the setting: domainBackupMX?

10

Re: Backup MX: forwarded message changes from and to address

Set 'domainBackupMX=yes' to mark this domain as a backup mx, or remove this attribute in domain object as a primary mx.

11

Re: Backup MX: forwarded message changes from and to address

Great! Thank you. Now it seems to work.

'domainBackupMX=yes'
and
'mtaTransport=smtp:[primary_server]:25'

Made it work. Sending an email to the backup server, forwards it to the primary mailserver.

12 (edited by JeeGee 2014-10-11 17:26:43)

Re: Backup MX: forwarded message changes from and to address

Topic can be closed.