Modoboa
The Modoboa connector reads a server in three ways. Mail and Sieve scripts come over IMAP and ManageSieve through a Dovecot master user. Domains, mailboxes, aliases and forwards come from the Modoboa database, which Vandelay queries with the psql or mysql client on the server through host access. DKIM keys, Radicale calendars and address books, and the Maildirs of disabled mailboxes come from files on the server.
Modoboa runs Dovecot and Postfix on a server the operator controls, so both cutover strategies apply: a zero-downtime migration with the Stalwart proxy in front of the server, or a one-shot migration per domain. Detection recognises Modoboa from its API schema.
Migrated data
Section titled “Migrated data”Mail is copied over IMAP with the folder tree, and Sieve scripts over ManageSieve when its URL is set. On Modoboa 2.4 and later, automatic replies live in the Sieve scripts and are copied with them; Vandelay tells the version from the database’s migration history. A mailbox forward becomes a redirect rule when the mailbox has exactly one. When Vandelay runs on the Modoboa host, calendars and address books are read from the Radicale files, and the mail of disabled mailboxes from their Maildirs. Modoboa has no files or sender identities for Vandelay to read.
From the database, read with SELECT statements on admin_domain, admin_domainalias, core_user, admin_mailbox, admin_quota, admin_alias, modoboa_admin_aliasrecipient, admin_senderaddress, django_migrations and, on Modoboa 2.3 or older, postfix_autoreply_armessage:
- An active domain is migrated with its alias domains and its catch-all address.
- A mailbox keeps its password hash, its display name and its quota. A hash is carried when Stalwart supports its scheme, as described in Password hashes.
- A mailbox that is disabled, or that belongs to a disabled domain, is created disabled on Stalwart. Dovecot refuses it even to the master user, so its mail is copied from its Maildir when Vandelay runs on the host.
- An alias with one mailbox as its recipient becomes an alias of that account, and an alias with several recipients becomes a mailing list.
- The DKIM key of each domain, from the key file that
admin_domainnames, is carried when “DKIM keys” imports it.
Source preparation
Section titled “Source preparation”-
Choose the master user: an active Modoboa account flagged as master user (
core_user.master_user), which Modoboa’s Dovecot lets sign in to every mailbox. Dovecot matches the master user by its email address, not by its username, and so does Vandelay; any other name is refused. -
Give Vandelay host access to the server, normally as root. Calendars, address books and the Maildirs of disabled mailboxes are read only when Vandelay runs on the Modoboa host itself (local host access); over SSH, each account that has them records a loss instead. Vandelay reads the Radicale configuration in
/etc/radicale/configand the Maildirs under Dovecot’smail_location. -
When the host access user is not root, give it read access to the DKIM key files that
admin_domainnames, for example/var/lib/dkim/<domain>.pem, with a read-only ACL:Terminal window setfacl -m u:vandelay:r /var/lib/dkim/example.org.pemDiscovery checks that each key can be read. A key that cannot be read is not carried, and the report names a loss for its domain; in a server-scope project, Stalwart then generates a new key, whose DNS record must be published before mail is switched. An account-scope project carries no DKIM keys at all.
-
Give the database client read access. A read-only role is enough, because Vandelay only runs
SELECT. On PostgreSQL, the role’s password goes into root’s~/.pgpass, never into the plan. On MariaDB, the client signs in with/root/.my.cnf.
The same steps are printed by vandelay migrate guide modoboa and shown on the Source: access step of the web UI and the TUI.
Proxy mode settings
Section titled “Proxy mode settings”The settings that a Dovecot and Postfix source needs behind the Stalwart proxy are described in Proxy mode settings and apply to Modoboa, with these differences:
- Persistence. The Modoboa installer writes the Dovecot and Postfix configuration from its templates on every run, including
--upgrade, and keeps the previous file as a copy with a timestamped.oldsuffix. Dovecot settings such aslogin_trusted_networkstherefore go into/etc/dovecot/local.conf, which Modoboa’sdovecot.confincludes. Postfix has no such file: settings made withpostconf -eare lost at the next installer run and are made again afterwards. - Spam filtering. Stalwart’s address is exempted in the filter the installation uses: rspamd, through a file of its own under
/etc/rspamd/local.d/, or Amavis and SpamAssassin. When postscreen is enabled, its access list permitsmynetworks, so adding Stalwart there also lets it pass postscreen.
Plan settings
Section titled “Plan settings”The endpoints are “IMAP URL” (source.imap, --imap-url), the IMAPS address of the server on port 993, and “ManageSieve URL” (source.sieve, --sieve-url), which also carries the automatic replies of Modoboa 2.4 and later. The master user is “Master user” (source.master.name, --master-user), the email address of the flagged account, and “Master, admin or service account password” (source.master.password, --master-password), a secret reference to its password.
Host access is required. The database is set by two fields:
- “Database server” (
source.sql.engine,--sql-engine):postgres, Modoboa’s default, ormysqlfor MariaDB. - “Database” (
source.sql.database,--sql-database): for PostgreSQL, a connection string such asdbname=modoboa user=vdread host=127.0.0.1, with only the keysdbname,user,host,port,sslmodeandconnect_timeout; a password in the string is refused. For MariaDB, the database name.
The following excerpt reads a Modoboa server from the server itself, with a read-only PostgreSQL role:
[source]system = "modoboa"imap = "imaps://mail.example.org"sieve = "sieve://mail.example.org:4190"cleartext = "forbid"
[source.master]password = "env:MODOBOA_MASTER_PASSWORD"form = "*"
[source.host]kind = "local"root = "/"
[source.sql]engine = "postgres"database = "dbname=modoboa user=vdread host=127.0.0.1"The following command sets the same source:
vandelay migrate source \ --system=modoboa \ --imap-url=imaps://mail.example.org \ --sieve-url=sieve://mail.example.org:4190 \ --master-password=env:MODOBOA_MASTER_PASSWORD \ --host-access=local \ --host-root=/ \ --sql-engine=postgres \ '--sql-database=dbname=modoboa user=vdread host=127.0.0.1'Items not migrated
Section titled “Items not migrated”Pre-flight lists the following as losses:
- Automatic replies of Modoboa 2.3 or older, which are kept outside Sieve:
an automatic reply set in Modoboa 2.3 or older, which keeps it outside Sieve; it is not migrated, so set it up again on the target. Whenpostfix_autoreply_armessagecannot be read on such a server, the replies are not known at all, and one loss says so:postfix_autoreply_armessage could not be read, so the automatic replies of this Modoboa 2.3 or older are not known; they are not migrated, so set them up again on the target. - Mailboxes nothing can sign in to. A mailbox whose account signs in under another email address is not migrated, because Dovecot finds a mailbox only under the address it signs in with:
<mailbox>: its account signs in as "<email>", and Dovecot finds a mailbox only under the address it signs in with, so nothing can sign in to it; not migrated. - Alias expiry. An alias that expires on Modoboa is migrated without its expiry:
<alias> expires on the source; the target keeps it until it is removed there. - Send-only mailboxes. Dovecot refuses them IMAP even to the master user, so their mail is not read; their Sieve scripts are copied, and pre-flight tests the next account.
- Limits and permissions: domain quotas (mailbox quotas are carried), daily sending limits, and sender permissions.
- Relay domains, and the aliases, forwards and catch-all of a disabled domain.
- Shared calendars of a whole domain (
collection-root/<domain>/in Radicale), which are not read. - Sieve scripts of disabled mailboxes, which Dovecot refuses even to the master user, with local host access too.
- Calendars, contacts and the Maildirs of disabled mailboxes when host access is over SSH. Discovery records
the calendars and contacts are Radicale files on the Modoboa host (<root>), which vandelay reads only when it runs on that host (local host access); with SSH host access none are copied, so run vandelay on the Modoboa host to copy them, and pre-flight and the Losses table list it. Run Vandelay on the Modoboa host to copy them. - Catch-alls on alias domains.
- Mailboxes listed twice, of which Dovecot signs in only one.
- Forwarding of a mailbox with several forwards, reported as a loss to recreate as a redirect rule.
- Refused spellings. A domain, alias domain or mailbox with a final dot, with upper-case letters outside ASCII, or on PostgreSQL with any upper case, or that points at no domain Vandelay reads. The loss names the table, row and value.
Troubleshooting
Section titled “Troubleshooting”Master user refused
Section titled “Master user refused”the master user "<name>" is not the email of an active Modoboa account flagged master_user; Dovecot matches the master user by core_user.email, not by username means that “Master user” holds a username, or names an account that is inactive or not flagged. Set it to the email address of the flagged account.
Automatic replies not known
Section titled “Automatic replies not known”django_migrations could not be read, so the Modoboa version is not known; this migration assumes 2.4 or later, where automatic replies live in the Sieve scripts it copies; on 2.3 or older, automatic replies are not migrated means that the database role cannot read django_migrations. Grant it read access when the server runs Modoboa 2.3 or older, whose automatic replies are otherwise not migrated.
Send-only mailbox in pre-flight
Section titled “Send-only mailbox in pre-flight”<address> cannot be read over IMAP: it is a send-only mailbox, which the source refuses IMAP even to the master user; its mail is not copied is expected for send-only mailboxes; pre-flight tests the next account instead.