Mailserver synchronisieren (Ubuntu 18.04)

Aus Tutorials
Zur Navigation springen Zur Suche springen

Konfiguration

/etc/dovecot/dovecot-sql.conf.ext

In der Datei

sudo vi /etc/dovecot/dovecot-sql.conf.ext

den Parameter iterate_query einkommentieren und anpassen:

iterate_query = SELECT username AS user FROM mailbox

/etc/dovecot/conf.d/10-mail.conf

Die Datei

sudo vi /etc/dovecot/conf.d/10-mail.conf

bearbeiten und bei den mail_plugins die Plugins replication und notify hinzufügen:

mail_plugins = $mail_plugins notify replication

/etc/dovecot/conf.d/90-replication.conf

sudo vi /etc/dovecot/conf.d/90-replication.conf

Die Platzhalter <password> und <ip of the server> müssen angepasst werden.

# Replicator process should be started at startup, so it can start 
# replicating users immediately:
service replicator {
  process_min_avail = 1
}

# The mail processes need to have access to the replication-notify 
# fifo and socket. If you have a single vmail UID, you can do:
service aggregator {
  fifo_listener replication-notify-fifo {
    mode = 0666
    user = vmail
  }

  unix_listener replication-notify {
    mode = 0666
    user = vmail
  }
}

# The replication-notify only notifies the replicator processes that 
# there is work to be done, so it's not terribly insecure either to 
# just set mode=0666. Enable doveadm replicator commands by setting:
service replicator {
  unix_listener replicator-doveadm {
    mode = 0600
    user = vmail 
  }
}

# You can configure how many dsyncs can be run in parallel (10 by default):
replication_max_conns = 10

# Normally all replication is asynchronous. You can also optionally 
# configure new mail saving to be synchronous, with a timeout to avoid 
# waiting too long. This can be configured with:
plugin {
  # When saving a new mail via IMAP or delivering a mail via LDA/LMTP,
  # wait for the mail to be synced to the remote site. If it doesn't finish
  # in 2 seconds, return success anyway.
#  replication_sync_timeout = 2s
  replication_full_sync_interval = 1 hours
  mail_replica = tcp:<ip of the server>:47111
}

# Both the client and the server need to have a shared secret
doveadm_password = <password>

# And tell doveadm client to use this port by default:
doveadm_port = 47111

service doveadm {
  user = vmail
  inet_listener {
    port = 47111
  }
}

Einzelne Konten nicht synchsonisieren

Noch in Bearbeitung

https://www.mail-archive.com/dovecot@dovecot.org/msg79724.html

Firewall

Der Port 47111 muss dann noch in der Firewall geöffnet werden, siehe dazu Nftables

Neustart

sudo systemctl restart dovecot.service

Testen

doveadm replicator status '*'

Probleme

Fatal: Couldn't load required plugin /usr/lib/dovecot/modules/lib20_replication_plugin.so: Plugin notify must be loaded also

In /etc/dovecot/conf.d/10-mail.conf hat bei den Plugins notify gefehlt.

Links

https://wiki.dovecot.org/Replication

https://wiki.dovecot.org/Tools/Doveadm/Sync

https://www.silvesterlangen.de/?Linux___Dovecot_Mail_Replikation

https://loteks.de/email-konten-mit-doveadm-syncronisieren-sichern/


Zurück zu Mailserver einrichten