Postal cluster. Replication mail server

NethServer Version: 8
Module: mail

Hello. How to configure the replication of mail servers in the new version? I do not understand. Do you need to do this through Relay?

I have configured Relay but on the slave server I get the following text:

2024-10-29T17:50:15+03:00 [1:mail15:dovecot] imap-login: Login: user=, method=PLAIN, rip=10.5.4.1, lip=10.5.4.1, mpid=6042, secured, session=
2024-10-29T17:50:15+03:00 [1:mail15:dovecot] imap(test1)<6042>: Disconnected: Logged out in=90 out=994 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
2024-10-29T17:50:19+03:00 [1:mail15:dovecot] imap-login: Login: user=, method=PLAIN, rip=10.5.4.1, lip=10.5.4.1, mpid=6048, secured, session=
2024-10-29T17:50:19+03:00 [1:mail15:dovecot] imap(test1)<6048>: Disconnected: Logged out in=90 out=994 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
2024-10-29T17:51:15+03:00 [1:mail15:dovecot] imap-login: Login: user=, method=PLAIN, rip=10.5.4.1, lip=10.5.4.1, mpid=6054, secured, session=
2024-10-29T17:51:15+03:00 [1:mail15:dovecot] imap(test1)<6054>: Disconnected: Logged out in=90 out=994 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
2024-10-29T17:51:20+03:00 [1:mail15:dovecot] imap-login: Login: user=, method=PLAIN, rip=10.5.4.1, lip=10.5.4.1, mpid=6060, secured, session=
2024-10-29T17:51:20+03:00 [1:mail15:dovecot] imap(test1)<6060>: Disconnected: Logged out in=90 out=994 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
2024-10-29T17:51:31+03:00 [1:mail15:clamav] SelfCheck: Database status OK.

Whatā€™s wrong?
The mail2 server is the main server,
server mail1 is the slave.
Relay is configured on both

I donā€™t know if I understood correctly but if itā€™s about using failover servers for sending then you just need the right MX records in DNS for your servers, see also Mail ā€” NS8 documentation and MX record - Wikipedia

1 Like

Iā€™d like to make two mail servers that will replicated between them. That is, if the first mail server goes down, the second one will have a complete or nearly complete copy of the messages.

I realized that dovecot needs to be configured.

I ran the command:
podman exec -ti dovecot doveconf -n
It didnā€™t work. I need to run the command:
runagent -m mail1

But it doesnā€™t work either!
What could be the reason?
Iā€™m getting an error:
No such file or directory: '/home/user/.config/state/agent.env'

Hereā€™s how to customize dovecot:

Enter the app environment:

runagent -m mail1

Show the dovecot config:

podman exec -ti dovecot doveconf -n

Edit the configuration:

podman exec -ti postfix vi /etc/postfix/main.cf.d/myoverride.cf

Restart the service:

systemctl --user reload postfix

It should be something like /home/<app_instance_name>/.config/state/...

I have an error:
bash: runagent: command not found

I just donā€™t understand how to get this up and running! I looked it up in the manuals. Thereā€™s no such thing. What kind of magic is this?

I couldnā€™t find instructions on the nethserver command line logic. I realized that nethserver works in podman I found the containers and logged into them, but nothing works there either. Maybe this is beyond the scope of nethserver but really not clear.

More or lessā€¦ runagent is a wrapper command located at /usr/local/bin/runagent, IIRC it requires to be root (executed on CLI without needing to access podman container beforehand). Used to access, inspect and modify rootless containers.

2 Likes

Thank you very much for your reply. It is not in any manual. If it wasnā€™t for you, I wouldnā€™t have figured out how to do it! Now I have found the entry point from which there are manuals!

P.s. In the end, the entry point looks like this:
/usr/local/bin/runagent -m mail1
Where the number may not be 1. The digit must be viewed in the web console. I have uninstalled and reinstalled the mail application many times, so I have it as mail15.

one way to edit files inside container:

Was able to start synchronization via Dovecont. The settings are shown below.
The code in the second message is not correct. You need to configure everything in Dovecont, not PostFix!
Then this is the correct way to do it:

For login we use:

/usr/local/bin/runagent -m mail1

Further documentation:

# print the config values that differ from Dovecot defaults
# WARNING! changing one of them may be dangerous!
podman exec -ti dovecot doveconf -n
# start the editor
podman exec -ti dovecot vi /etc/dovecot/local.conf.d/myoverride.conf
systemctl --user reload dovecot

And at the end the config. Taken from here and finalized with a file.
Also the port must be opened on the firewall in the actual machine! I donā€™t know which protocol is needed, so I opened both. The instructions require port 4092.

firewall-cmd --add-port=4092/tcp
firewall-cmd --add-port=4092/udp

It is necessary to specify IP address for synchronization!!!

mail_replica = tcp:195.888.888.888:4092
# cat conf.d/10-replicator.conf 
mail_plugins = $mail_plugins notify replication

# Replicator process should be started at startup, so it can start replicating users immediately
service replicator {
  process_min_avail = 1
  # Enable doveadm replicator commands
  unix_listener replicator-doveadm {
    user = vmail
    group = vmail
    mode = 0660
  }
}

service aggregator {
  fifo_listener replication-notify-fifo {
    user = vmail
  }
  
  unix_listener replication-notify {
    user = vmail
  }

  process_min_avail = 1 
}


service doveadm {
  inet_listener {
    port = 4092
  }

  process_min_avail = 1
}

service config {
  unix_listener config {
    mode = 0600
    user = vmail
  }
}

doveadm_password = 6yLuFVJb0wceKOdNXQVHD8go8Lwtvarzmygr

dsync_remote_cmd = doveadm dsync-server -u%u

plugin {
    mail_replica = tcp:195.888.888.888:4092

    replication_full_sync_interval = 1 hours
}
1 Like