1 (edited by tge 2013-05-17 04:15:39)

Topic: Backup MX & Relay setting

==== Required information ====
- iRedMail version: 0.8.4
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Linux/BSD distribution name and version: 5.8
- Related log if you're reporting an issue:
====
Hello Zhang
Can you show me step by step how to setting Backup MX & Relay email
I could not found any documents of iRedAdmin relating this 2 features

Thanks for answers !

2

Re: Backup MX & Relay setting

You can setup Backup MX and Relay in domain profile page:

- Backup MX: in domain profile page, under tab "General".
- Relay: in domain profile page, under tab "Relay".

3 (edited by tge 2013-05-17 10:40:13)

Re: Backup MX & Relay setting

Dear Zhang
Backup MX: I checked "Mark as Backup MX"
What's next step?

Thanks Zhang !

4

Re: Backup MX & Relay setting

You should update your DNS record of this domain, to point its MX record to your mail server.

5 (edited by tge 2013-05-17 13:18:37)

Re: Backup MX & Relay setting

Dear Zhang
I updated my domain name DNS record.
@  MX  main-mx.serverdomain.com 1
@  MX  backup-mx.serverdomain.com 5
And what's next step?

Thanks Zhang !

6

Re: Backup MX & Relay setting

Sorry, may i know why you need to mark this domain as Backup MX?

7 (edited by tge 2013-05-17 13:26:34)

Re: Backup MX & Relay setting

Dear Zhang

@  MX  main-mx.serverdomain.com 1
(IP: 1.1.1.1)
@  MX  backup-mx.serverdomain.com 5 -> This domain is marked as backup mx
(IP: 2.2.2.2)

--
Sorry Zhang, My plan is:
When main-mx is downing, email will not lost
And email sending and receiving will continue through backup-mx
--

Thanks Zhang !

8

Re: Backup MX & Relay setting

tge wrote:

Dear Zhang

@  MX  main-mx.serverdomain.com 1
(IP: 1.1.1.1)
@  MX  backup-mx.serverdomain.com 5 -> This domain is marked as backup mx
(IP: 2.2.2.2)

Thanks Zhang !

I use this setup myself. It's a bit more involved than just using the mark as backup MX feature because you will want to setup LDAP syncrep to keep the domains and users on both accounts in sync.

You will then need to edit the LDAP postfix config on the backup MX server to trick it into thinking all your domains are backup MX on this server.

The final step is to tell your main server to accept all mail from your backup MX by using the relay_domains setting in postfix.

Hope this helps!

9 (edited by tge 2013-05-17 13:54:17)

Re: Backup MX & Relay setting

orphans wrote:
tge wrote:

Dear Zhang

@  MX  main-mx.serverdomain.com 1
(IP: 1.1.1.1)
@  MX  backup-mx.serverdomain.com 5 -> This domain is marked as backup mx
(IP: 2.2.2.2)

Thanks Zhang !

I use this setup myself. It's a bit more involved than just using the mark as backup MX feature because you will want to setup LDAP syncrep to keep the domains and users on both accounts in sync.

You will then need to edit the LDAP postfix config on the backup MX server to trick it into thinking all your domains are backup MX on this server.

The final step is to tell your main server to accept all mail from your backup MX by using the relay_domains setting in postfix.

Hope this helps!

Hello orphans,
Could you please give me more details:
1. How to setup LDAP syncrep between 2 servers: main-mx & backup-mx?
2. How to trick?
3. Exactly where is it?

Thanks for answers !

10 (edited by orphans 2013-05-17 14:00:57)

Re: Backup MX & Relay setting

This is my setup on the backup MX, remember these configs might be a different location on your distro. I'm using CentOS 6.3.

/etc/openldap/slapd.conf - append this to bottom of file and change the settings to your own.

syncrepl   rid=001
           provider=ldap://primarymx.example.co.uk:389
           searchbase="dc=example,dc=co,dc=uk"
           bindmethod=simple
           binddn="cn=Manager,dc=example,dc=co,dc=uk"
           credentials=********
           schemachecking=on
           type=refreshOnly
           retry="60 +"
           scope=sub
           interval=00:00:01:00
           attrs="*,+"

/etc/postfix/ldap/relay_domains.conf

server_host     = 127.0.0.1
server_port     = 389
bind            = yes
start_tls       = no
version         = 3
bind_dn         = cn=vmail,dc=example,dc=co,dc=uk
bind_pw         = ********
search_base     = o=domains,dc=example,dc=co,dc=uk
scope           = one
#query_filter    = (&(objectClass=mailDomain)(|(domainName=%s)(&(enabledService=domainalias)(domainAliasName=%s)))(domainBackupMX=yes)(accountStatus=active)(enabledService=mail)) # this is the old line
query_filter    = (&(objectClass=mailDomain)(|(domainName=%s)(&(enabledService=domainalias)(domainAliasName=%s)))(accountStatus=active)(enabledService=mail)) # new config line with domainBackupMX=yes removed.
result_attribute= domainName
debuglevel      = 0

11 (edited by tge 2013-05-17 14:09:09)

Re: Backup MX & Relay setting

#query_filter    = (&(objectClass=mailDomain)(|(domainName=%s)(&(enabledService=domainalias)(domainAliasName=%s)))(domainBackupMX=yes)(accountStatus=active)(enabledService=mail)) # this is the old line
query_filter    = (&(objectClass=mailDomain)(|(domainName=%s)(&(enabledService=domainalias)(domainAliasName=%s)))(accountStatus=active)(enabledService=mail)) # new config line with domainBackupMX=yes removed.

Dear orphans
Why need to remove domainBackupMX=yes?
After do that:
1. Does i need un-check "Mark as Backup MX" setting ?
2. mydomain.com stored in main-mx, does i need to add mydomain.com domain name to backup-mx? Or it will auto-sync?

Thanks orphans !

12

Re: Backup MX & Relay setting

You need to remove the domainBackupMX=yes in order to trick the backup MX server that ALL domains are to be used as backup MX.

Yes you then un-check "Mark as Backup MX" setting, as this will be synced across from the main MX server, which will need to be marked as the main MX server, and not a backup MX.

Settings will autosync from the main server, however I think you will first need to do an ldiff export/import to get the two servers initially in sync.

13 (edited by tge 2013-05-17 14:44:56)

Re: Backup MX & Relay setting

Hello orphans,
After appended and did as your guide, i do restart ldap service, error occured:

---
[root@iredtest ~]# service ldap restart
Stopping slapd:                                            [  OK  ]
Checking configuration files for slapd:                    [FAILED]
/etc/openldap/slapd.conf: line 236: Base DN "dc=xxxx,dc=xxxxxx,dc=xxx" is not within the database naming context.
failed to add syncinfo
slaptest: bad configuration file!
---

(xxxx cencored are real value)
Waiting your answers and waiting Zhang answers too

Thanks all !

14 (edited by orphans 2013-05-17 15:22:15)

Re: Backup MX & Relay setting

Sorry you may also need something like this in the main MX slapd.conf

moduleload syncprov
overlay syncprov
syncprov-checkpoint 100 10
syncprov-sessionlog 200

15

Re: Backup MX & Relay setting

Are you sure?

16

Re: Backup MX & Relay setting

Hi @tge,

Personally, i suggest you make sure Backup MX works first, then try to sync mail accounts between two servers with OpenLDAP replication. Simply the process, step-by-step.

17 (edited by tge 2013-05-17 21:30:54)

Re: Backup MX & Relay setting

Hello Zhang,

Backup MX still not work.

Domain mydomain.com i added on 2 servers main-mx & backup-mx server.

And pointing to 2 servers MX:

@  MX  main-mx.serverdomain.com 1
(IP: 1.1.1.1)
@  MX  backup-mx.serverdomain.com 5 -> This is marked as backup mx
(IP: 2.2.2.2)

My purpose is:

- When main-mx is downing, email will not lost
- And email sending and receiving will continue through backup-mx

On backup-mx server, i checked on "Mark as Backup MX"

1. Does i need manually add mailbox account on both servers? (Or i do auto-sync when Backup MX work)

2. After that i shutdown main-mx server, and use my @gmail.com mailbox send to @mydomain.com, then i boot up main-mx server, it is not recived any mail from backup-mx server. I checked backup-mx server log, it said rejected. and @gmail.com failed email message, it said could not delivery.

I tried many days and many times, could not get it work.

Error messages 1:

The error that the other server returned was:
554 5.7.1 <test@mydomain.com>: Relay access denied

Error message 2:

<test@mydomain.com>: user unknown

Final-Recipient: rfc822; test@mydomain.com
Original-Recipient: rfc822;test@mydomain.com
Action: failed
Status: 5.1.1
Diagnostic-Code: x-unix; user unknown

Zhang, could you please step-by-step write a tutorial to guide how to setup Backup MX, Relay domain, and how to use disclaimer.
That features very useful, but no clearly documents.

Thanks Zhang !

18 (edited by tge 2013-05-17 22:33:38)

Re: Backup MX & Relay setting

Setting Backup MX work like a charm!
Close this section
Thanks all
---
I testing relay mail setting
Hope it work like Backup MX