Is it possible to setup automatic mail sync between two Hestia servers?
I have 2 Debian 12 Hestia 1.9.3 installs.
Tried to setup Dovecot sync with official guides.
adding 20-dsync.conf
doveadm_password = superuserpassword
replication_max_conns = 10
service aggregator {
fifo_listener replication-notify-fifo {
group = mail
user = admin
mode = 0660
}
unix_listener replication-notify {
group = mail
user = admin
mode = 0660
}
}
service replicator {
process_min_avail = 1
unix_listener replicator-doveadm {
mode = 0660
user = admin
group = mail
}
}
service doveadm {
user = admin
group = mail
inet_listener {
port = 12345
ssl = yes
}
}
plugin {
mail_replica = tcps:mail2.server.com:12345
replication_sync_timeout = 2
}
It works when I run command from root
doveadm -v sync -u [email protected] tcps:mail2.server.com:12345
using script
#!/bin/bash
# getting list of domains
DOMAINS=$(ls /etc/exim4/domains/)
SERVER=mail2.server.com
PORT=12345
for domain in $DOMAINS; do
# getting users from passwd file
USERS=$(cut -d: -f1 /etc/exim4/domains/$domain/passwd)
for user in $USERS; do
doveadm -v sync -u $user@$domain tcps:$SERVER:$PORT
done
done
But it doesn’t work as it should - automatically without any scripts in cron.
When I send or receive letters from to server1 nothing happens.
After start dovecot writes errors in syslog:
May 15 05:33:56 auth-worker(300404): Error: conn unix:auth-worker (pid=300403,uid=107): auth-worker<1>: passwd-file(*): passwd-file: User iteration isn't currently supported with %variable paths
May 15 05:33:56 replicator: Error: auth-master: userdb list: User listing returned failure
May 15 05:33:56 replicator: Error: listing users failed, can't replicate existing data
As far as i see it can’t get users list because config uses %v variable in path of passwd files for domains.
I’ve added all users to doveadm replicator using same script as above
for domain in $DOMAINS; do
USERS=$(cut -d: -f1 /etc/exim4/domains/$domain/passwd)
for user in $USERS; do
doveadm replicator add $user@$domain
done
done
dovecot/replicator is running
doveadm replicator status
Queued 'sync' requests 0
Queued 'high' requests 0
Queued 'low' requests 0
Queued 'failed' requests 0
Queued 'full resync' requests 451
Waiting 'failed' requests 7
Total number of known users 458
Another problem that is HOME set to /home/admin and doveadm trying to use this folder for creating lock files while syncing and that give an error:
May 15 06:01:58 doveadm([email protected])<304589><dZERLCNnJWjNpQQA8knpeQ>: Error: Couldn't lock /home/admin/.dovecot-sync.lock: fcntl(/home/admin/.dovecot-sync.lock, write-lock, F_SETLKW) locking failed: Interrupted system call
Cause this file is trying to lock for several sync processes at a time.
But it should be created at each users folder separatly.