Commit Graph

376 Commits

Author SHA1 Message Date
Martin Weinelt ecbe707330 postfix/dovecot: support SecP256r1MLKME768 key exchange
Added support means we allow it, but for now we don't prefer it, since it
has not seen much use yet. For Postfix that means it lands below the two
groups that already send a key share and save us a roundtrip.

https://www.ietf.org/archive/id/draft-kwiatkowski-tls-ecdhe-mlkem-02.html
2026-04-26 01:04:33 +02:00
Martin Weinelt 7909eabac2 postfix: require AEAD & ECDHE cipher suites
This drops ARIA, Camellia and AES-CBC support from TLSv1.2 cipher suites.

When we explicitly restrict the cipherlist in Postfix, then we need to
define TLSv1.3 cipher suites in our OpenSSL config file.
2026-04-26 01:04:33 +02:00
Martin Weinelt 8d6b14c82c postfix: restrict TLS signing algorithms
Prunes the list preset and removes SHA-1 to restore compatibility with
NCSC TLS security guidelines.
2026-04-26 01:04:32 +02:00
Charlotte Van Petegem 6e9a4420b3 Only prepend {CRYPT} scheme if there is no scheme present 2026-04-23 14:45:22 +02:00
Martin Weinelt f9d1435378 dovecot: migrate to dovecot 2.4 2026-04-20 15:39:36 +02:00
Martin Weinelt fdb1be9b50 Merge branch 'update-dovecot-hostname' into 'main'
dovecot: fix hostname to fqdn

See merge request simple-nixos-mailserver/nixos-mailserver!510
2026-04-19 00:12:04 +00:00
Lafiel 903d0cc8ad rspamd: add authentication-results header 2026-04-18 18:10:00 +03:00
isabel 10b577c650 dovecot: fix quota users assertion 2026-04-16 01:04:07 +01:00
Lafiel c67cc808ce dovecot: fix hostname to fqdn 2026-04-15 19:30:27 +03:00
Martin Weinelt bb1728f27c dovecot: restore hierarchy separator setting
The application of this setting got lost in the structured settings
migration.

Ref: 44149c5
2026-04-14 14:33:29 +02:00
Martin Weinelt f1e4af7184 dovecot: run lmtp service under storage owner user
Previously it ran as root, which is not required since we use a single
uid/gid for all mail storage.
2026-04-13 01:19:14 +02:00
Martin Weinelt 0da8e2b197 quota: expose global quota settings
With the options in the upstream dovecot module gone the quota support
and its option now live in our downstream module.

The only behavior change this introduces is not setting a global per
user default instead of the previous 100G per user.

Diabling quota support and setting per user quotas now raises an
assertion:

````
Failed assertions:
- Without quota support enabled, per-user quotas cannot be applied to the following accounts:

  - lowquota@example.com

  Either remove per user quota settings or re-enable `mailserver.quota.enable`.
````
2026-04-13 01:19:14 +02:00
Martin Weinelt 44149c527e dovecot: migrate to settings option 2026-04-13 01:19:14 +02:00
Martin Weinelt 42650aad4d dovecot: drop redundant uuid mapping in user_attrs
This was redundant at best and crashing Dovecot at worst, due to multiple
requests for the uuid field name.

Closes: #352
2026-03-31 23:17:08 +02:00
Martin Weinelt 20f0e767cb users: remove unused common import 2026-03-24 01:58:37 +01:00
Martin Weinelt e13736db67 Group storage and vmail user options at mailserver.storage
Create a nicer option structure that deals with the mail storage and its
owner, uid, group and gid. Also includes the directory layout as a
property of how mails are stored..
2026-03-24 01:57:31 +01:00
Martin Weinelt 6826d11c58 users: remove global with config.mailserver 2026-03-24 01:35:48 +01:00
Martin Weinelt e9337b346f Rename mailserver.loginAccounts to mailserver.accounts
The "login" prefix makes this option more confusing rather than clearer,
because what other account types are there? LDAP ones for example, but
you can login with those too, so the prefix is pointless.
2026-03-24 01:35:48 +01:00
Martin Weinelt 4f3d21f386 dovecot: fix storage basedir regression in ldap home
During the rewrite of the LDAP userdb field lookups the default path for
the mail storage directory accidentally leaked into the home directory
path.
2026-03-24 01:11:09 +01:00
Martin Weinelt 31c7607ef4 Rename extraVirtualAliases to aliases and update description
The extra and virtual parts are redundant and Postfix specific and not
at all required. Compare forwards for example.
2026-03-23 16:26:32 +01:00
Martin Weinelt 23364b04e8 ldap: allow local accounts and aliases with ldap enabled
In conflicts between local addresses and LDAP addresses the local one
will always take priority in mail routing.

This is something we now document and guarantee through tests.
2026-03-23 16:25:50 +01:00
Martin Weinelt 86d256870b postfix: prune virtual delivery agent settings
We exclusively rely on delivery via dovecot-lmtp, so these are redundant.
2026-03-23 13:23:01 +01:00
Martin Weinelt 5d715c4ce8 assertions: adjust docs url for migration #4 2026-03-22 15:03:18 +01:00
Martin Weinelt 98acd76bbf Add migration story for LDAP UUID home directories 2026-03-21 22:34:50 +01:00
Martin Weinelt 63365fb1a8 postfix: document ldap map purposes 2026-03-21 01:38:04 +01:00
Martin Weinelt 762f553643 ldap: make uid the default account name
I fail to understand how mail became the uidAttribute way back when LDAP
support was introduced, but it was unintentional and clearly a mistake.

The uid attribute is the standard system login name per RFC4519 2.39 and
what we default to going forward.
2026-03-21 01:38:04 +01:00
Martin Weinelt a87d01ea79 ldap: reorganize and regroup options
Now that we have more experience with how we use the LDAP module options
we can make smarter decisions in how to organize them. We can also
explain much better what these options imply, which results in more
extensive option documentation.
2026-03-21 01:38:04 +01:00
Martin Weinelt 609fd80936 dovecot: make sure vid/gid are not overridable
The only storage scheme we support is a single declarative user with
fixed uid/gid. The default_fields are overridable if these fields leak
in from LDAP, so promote them to override_fields instead.
2026-03-21 00:47:59 +01:00
Martin Weinelt af480dba87 ldap: replace pass_attrs option with password attr option
The passdb only checks password access, so instead of customizing the
whole pass_attrs setting we now allow customization of the password field
used.
2026-03-21 00:47:59 +01:00
Martin Weinelt 091eda1ed2 ldap: migrate to UUID based Dovecot home directories
The LDAP support was not in a good shape when it was merged. This is a
breaking change and course correction to apply best practices going
forward.

This fixes various issues experienced with the Dovecot LDAP home
directory.

The gravest issue is that the `homeDirectory` attribute from
the `posixAccount` schema would overwrite the Dovecot home directory and
cause permission errors. This was possible because we defined the home
variable in `default_fields` that is inherently mutable and just a preset
if no other value gets transmitted from LDAP. This did not surface in
tests, because our LDAP schema was too minimal compared to a common
production dataset.

The most annoying issue and the actual breaking change is that we now
default to UUID based home directories. Every entry in an IDM that
supports LDAP comes with a unique identifier that does not change upon
account name changes. We want those to enable simple account name
migrations that don't require any manual data migration.

To migrate existing dovecot home directories a migration script is
included, which will be backported to the 25.11 release, so the migration
can already be started from the previous release version.
2026-03-21 00:47:59 +01:00
lennart 5544b0fa70 Add rejectSenderMessage option 2026-03-20 10:16:09 +00:00
Martin Weinelt 3da442701a dovecot: restore compat for RSA key material
In TLS1.2 available cipher suites depend on the available key material,
so the last round of cipher suites updates broke TLS1.2 support with RSA
key pairs.

The NixOS ACME module has been defaulting to EC256 (and earlier EC384)
key material, so I assume this did not affect many setups in practice.
2026-03-18 14:06:10 +01:00
Martin Weinelt 33b8946c87 Deprecate borgbackup, rsnapshot, monit integrations
The plan is to start warning now with the intent to remove these
integrations before the 26.11 release.
2026-03-14 04:30:39 +01:00
Martin Weinelt 271e6e54fd Reorganize imports
With the growing number of option refactors centralize the module import
within the mail-server directory.

Also group deprecations by release, so we can eventually yank them in
bulk after a while.
2026-03-12 13:21:51 +01:00
Martin Weinelt 06cc71c76e treewide: add language annotations for inline code
Instruct editors to correctly highlight and evaluate inline code blocks.
2026-03-12 12:59:03 +01:00
Martin Weinelt 6ff4a50f02 Add support for DKIM key management
After bumping the generation of new DKIM keys to RSA 2048 in NixOS 25.11
key rotation for existing users could not be done safely.

To resolve this situation we now support multiple generations of
selectors per domain to enable proper DKIM key transitions as described
in RFC6376 3.1. The added documentation introduces and motivates DKIM
and guides the user through a DKIM key rotation.

Additionally, DKIM key material can now also be treated as a managed
secrets when autogenerated state on the mail server host is undesirable.

This change is fully backwards compatible in behavior and will continue
to use the previously generated DKIM key without any additional
configuration up until the point when DKIM selectors are configured
explicitly.
2026-03-11 22:37:49 +01:00
Martin Weinelt 1c57aab586 treewide: fix typos and other minor issues 2026-03-11 01:50:14 +01:00
Ryan Gibb 12ae5dd89b support unhashed password files 2026-03-05 11:06:01 +00:00
teutat3s 9b90a9837a rspamd: fix duplicate systemd dependencies
These are also declared in mail-server/systemd.nix.
2025-12-28 20:40:33 +01:00
Martin Weinelt 3579eb0001 dovecot: restrict TLS cipher suites 2025-12-19 04:00:47 +01:00
Martin Weinelt 1415623586 dovecot: support X25519MLKEM768 hybrid kex 2025-12-19 03:13:47 +01:00
Martin Weinelt e437760341 treewide: replace/remove dovecot2 service name
The unit name is now dovecot.service.
2025-12-19 02:52:55 +01:00
Martin Weinelt 33ba1ff52b Switch to NixOS ACME module for certificate management
Drop most of the existing certificate handling, because we're effectively
duplicating functionality that NixOS offers for free with better
design, testing and maintainance than what we could provide downstream.

The remaining two options are to reference an
existing `security.acme.certs` configuration through
`mailserver.x509.useACMEHost` or to provide existing key material via
`mailserver.x509.certificateFile` and `mailserver.x509.privateKeyFile`.

Support for automatic creation of self-signed certificates has been
removed, because it is undesirable in public mail setups.

The updated setup guide now displays the recommended configuration that
relies on the NixOS ACME module, but requires further customization to
select a suitable challenge.

Co-Authored-By: Emily <git@emilylange.de>
2025-12-19 02:36:28 +01:00
Martin Weinelt e04e5b7ea6 assertions: bump mailserver version for release check 2025-11-29 02:43:16 +01:00
Martin Weinelt cbdf90f639 rspamd: fix DKIM signing for subdomains
With the eSLD normalization feature in rspamd subdomains actually use the
DKIM key for their parent domain, which simplifies the setup if you serve
multiple subdomains.

We however currently create DKIM key pairs for every given domain
name, no matter if it is a second-level domain or subdomain for one, so
disabling eSLD normalization aligns with the current intent behind our
configuration.

In the future it would be nice if we could reuse the parent domain DKIM
key for all its subdomains, but that requires some thought on how to
achieve that normalization in nixos-mailserver first.

Reapplies 1a3a618a30 to the correct
configuration file.
2025-11-16 19:29:16 +01:00
Martin Weinelt b88e6182f0 Revert "rspamd: fix DKIM signing for subdomains"
This reverts commit 1a3a618a30.

This went into the wrong configuration file unfortunately
2025-11-16 19:26:22 +01:00
Martin Weinelt b946f74261 mail-server/common: fix eval
CI has a shitty failure mode where jobs that don't eval get removed and
hydra-cli will still exit cleanly.
2025-11-16 18:41:47 +01:00
Martin Weinelt 1cb4295b74 Remove dovecot service name compat code 2025-11-16 18:18:22 +01:00
Martin Weinelt db66559815 Merge branch 'srs' into 'master'
Add support for sender rewriting for forwards using postsrsd

See merge request simple-nixos-mailserver/nixos-mailserver!431
2025-11-16 14:00:07 +00:00
Martin Weinelt 1a3a618a30 rspamd: fix DKIM signing for subdomains
With the eSLD normalization feature in rspamd subdomains actually use the
DKIM key for their parent domain, which simplifies the setup if you serve
multiple subdomains.

We however currently create DKIM key pairs for every given domain
name, no matter if it is a second-level domain or subdomain for one, so
disabling eSLD normalization aligns with the current intent behind our
configuration.

In the future it would be nice if we could reuse the parent domain DKIM
key for all its subdomains, but that requires some thought on how to
achieve that normalization in nixos-mailserver first.
2025-11-16 14:55:41 +01:00