Hanns Mattes via dovecot <dovecot@dovecot.org> wrote
Sorry,
this was aimed to the german list.
I would have answered in English anyway ;-)
But feel free to answer - any hint appreciated :-)
Am 26.01.25 um 16:37 schrieb Hanns Mattes via dovecot:
Hei, mit 2.4 verschwindet ja, wenn ich das richtig verstanden habe, die Replication aus dem Werkzeugkasten von Dovecot. Obwohl ich nur ein recht kleines System mit etwa 500 Nutzern betreibe fand ich die Replication als ziemlich beruhigend :-) Meine Frage in die Runde: Wie wollt Ihr die Replikation ersetzen?
How to replace replication?
Yeah, that's what I am currently investigating, and I do have a crude proof of concept which needs more thorough testing, though.
BTW: I do have only 5 users ;-)
Concept:
every user needs a sieve script starting with:
require ["vnd.dovecot.execute"]; # add all your other requiries ... # replication with doveadm sync … execute "_REPLICATE" "test-replication";
dovecot.conf:
# home-brewn replication sieve_extensions = +vnd.dovecot.execute sieve_plugins = sieve_extprograms sieve_execute_bin_dir = /any/path/to/your/script sieve_extension_exec_timeout = 1s
script /any/path/to/your/script/_REPLICATION (sorry its csh)
#!/bin/csh
set LOGGER = "/usr/bin/logger -p mail.info -t replication"
if ( $#argv != 1 ) then echo "missing user in $0" | ${LOGGER} exit 1 endif
set USER = $argv[1] set DOVEADM = "/usr/local/bin/doveadm" set DELAY = "1" # this will give sieve time to finalise before synchronising set LOCK = "1" set TIMEOUT = "30" set PORT = "12345" # see doveadm service in dovecot.conf set DESTINATION = "my.destination.server"
# immediately spawn this script to let sieve continue ist work and store that mail accordingly # otherwise synchronisation will come before storage
( sleep ${DELAY} ; ${DOVEADM} sync -P -l ${LOCK} -T ${TIMEOUT} -u ${USER} tcp:${DESTINATION}:${PORT} ) |& ${LOGGER} & exit 0
This will replicate all incoming mails, even those incoming simultaneously at both servers. (But I haven't tested it with huge numbers of mails, yet)
- This doesn't trigger modified IMAP flags, deletions, and such. Thus I will add a crontab script similar to that above, that will synchronise both servers every minute or such.
Remarks:
#) This is FreeBSD. I am running postfix and dovecot in the same service jail
#) Both servers are connected via an ipsec tunnel. Thus I do not need to use ssh. But that should be easy to add.
#) I could live with 4) only, but I do now my users ;-)
#) my script needs to become much more bullet proof w.r.t. to locking, checking for runaway processes, and such.
#) v2.3 https://doc.dovecot.org/2.3/configuration_manual/sieve/plugins/extprograms/
#) v2.4 https://doc.dovecot.org/2.4.0/core/plugins/sieve_extprograms.html
I am testing this on both of my servers with active replication with dovecot 2.3.21.1. Thus needed to disable replication for test user "test-replication", though.
Again, this is just an initial concept that needs further testing and investigation [1]
HTH and regards, Michael
[1] how could one tell an listening daemon about modifications of IMAP flags ... ?