Dovecot on Jammy with FIPS

Dovecot is a widely used open-source IMAP and POP3 email server that provides the capability to encrypt mailboxes. The mail crypt plugin is used to secure email messages stored in a Dovecot system. Messages are encrypted before being written to storage, and decrypted after reading from storage. Both operations are transparent to the user. The mailcrypt plugin uses the PBKDF2 algorithm to encrypt the private key that is used to decrypt mail that is stored on the system.

Ubuntu 20.04 (Focal) was certified using FIPS 140-2 requirements. FIPS 140-2 allowed PBKDF2 keys to have 8 bytes of salt. However, Ubuntu 22.04 (Jammy) was required to be certified according to the newer FIPS 140-3 standard, and FIPS 140-3 requires PBKDF2 keys to use 16 bytes of salt.

A bug (#2107773) was reported against Dovecot on Jammy regarding its use of 8 bytes of salt. This was fixed in Dovecot version 1:2.3.16+dfsg1-3ubuntu2.6 on Jammy and now Dovecot requires 16 bytes of salt.

This means that an upgrade of a Dovecot server from a Focal system to a Jammy system with FIPS enabled is not possible since a Jammy based dovecot installation cannot decrypt mailboxes encrypted on a Focal based Dovecot system.

The recommended solution is to separately create a Jammy based FIPS system running Dovecot with encryption enabled and then use the “doveadm backup” or “doveadm sync” tool to migrate Dovecot mailboxes from Focal to Jammy.

2 Likes