Commit graph

730 commits

Author SHA1 Message Date
Martin Weinelt fbc56958af
nixos/pfix-srsd: migrate postfix integration from postfix module
The postfix module is too big to host every individual integration option
and moving it here has no downside.
2025-07-15 22:04:28 +02:00
Martin Weinelt c915f104b0
nixos/postsrsd: add package option, migrate enable option 2025-07-15 20:29:35 +02:00
Martin Weinelt 9a9073fc89
nixos/postsrsd: integrate with postfix by default 2025-07-15 20:29:35 +02:00
Martin Weinelt 819c34cb7f
nixos/postsrsd: harden and modernize systemd unit
This replaces the previous confinement settings with a more complete and
context-sensitive hardening setup.

Also exposes the current config at /etc/postsrsd.conf, which makes it
easily inspectable.
2025-07-15 20:14:32 +02:00
Martin Weinelt 83af4a9aed
nixos/postsrsd: migrate to rfc42 settings
Allow a freeform configuration approach to satisfy different
configuration complexities.

Remove confinement options and make its hardening options more explicit
and removed the deprecated PermissionStartOnly= option.
2025-07-15 20:14:31 +02:00
Alyssa Ross 381be8e990 nixos/spamassassin: set home for spamd user
This should hopefully fix errors like the following:

	plugin: eval failed: bayes: (in learn) locker: safe_lock: cannot create tmp lockfile /var/empty/.spamassassin/bayes.lock.atuin.qyliss.net.398779 for /var/empty/.spamassassin/bayes.lock: No such file or directory
2025-07-15 09:01:21 +02:00
Alyssa Ross 96dab5ade3 nixos/spamassassin: add reload triggers
Previously, SpamAssassin did not pick up configuration changes
automatically.
2025-07-14 13:10:12 +02:00
Alyssa Ross e685fd6260 nixos/spamassassin: enable TextCat
Worked for me without requiring any additional Perl modules.  By
default it just adds an X-Language header.

Link: https://spamassassin.apache.org/full/4.0.x/doc/Mail_SpamAssassin_Plugin_TextCat.html
2025-07-14 13:10:06 +02:00
Quinn Flavel f2eda9a6a9
nixos/postfix: fix in secure systemd-nspawn containers 2025-07-12 21:28:15 +00:00
Martin Weinelt e6445e42fa
postfix-tlspol: adopt package and module 2025-07-11 03:20:39 +02:00
Martin Weinelt b201963951
nixos/postfix-tlspol: only preset dns resolver with useLocalResolver
This is the best indicator we have about whether to use a local resolver.

In the meantime I'm lobbying upstream to read /etc/resolv.conf.
2025-07-11 03:15:28 +02:00
Martin Weinelt e57363be15
nixos/postfix-tlspol: fix default settings and config reload
Reloading was insufficient for changing the dns resolver address, so we
make config changes a restart trigger instead.
2025-07-10 01:56:34 +02:00
Martin Weinelt fa949a7b18
nixos/dovecot: add marker to indicate new systemd unit name
This is a helper to escape infinite recursion when trying to check
whether the unit name is set before setting options on it.
2025-07-06 23:58:15 +02:00
Martin Weinelt 6403717045
Reapply "nixos/dovecot: improve and harden systemd unit"
This reverts commit a794031c59.

With the following additions:

Allow `CAP_KILL`, so the dovecot master process may interrupt its child
processes.

Allow new privileges, so dovecot and call the setuid sendmail executable.

Allow AF_NETLINK sockets, so dovecot sieve handling can use the
getifaddrs syscall.

Finally, we now asssert, that no options are set on the legacy dovecot2
systemd unit name, to make the user aware they need to update their
overrides.
2025-07-06 14:39:40 +02:00
Martin Weinelt a794031c59
Revert "nixos/dovecot: improve and harden systemd unit" 2025-07-06 02:13:07 +02:00
Martin Weinelt 88565a8620
nixos/dovecot: improve and harden systemd unit (#418722) 2025-07-03 23:44:45 +02:00
Martin Weinelt 1f92c7c42a
nixos/dovecot: improve and harden systemd unit
Remove the major version from the unit name and add an alias for the old
dovecot2 name.

Then restricts what the dovecot service can do, which is very interesting
given that the unit runs as root and spawns less-privileged processes
from there.
2025-07-02 04:45:22 +02:00
Martin Weinelt 7874cc6005
nixos/postfix-tlspol: fix config reload
Since we only pass a symlink to ExecStart we need to pass the backing
file as a reload trigger.
2025-06-28 23:44:37 +02:00
Martin Weinelt df0eb78b31
nixos/postfix-tlspol: migrate to static user/group
This fixes postfix' membership in the postfix-tlspol group, since
memberships in a dynamically allocated group don't seem to work out.

Additionally this fixes a typo in the systemd hardening and the test now
prints the results of systemd-analyze security.
2025-06-28 23:40:19 +02:00
Martin Weinelt 16ce859442
nixos/postfix-tlspol: fix postfix group membership (#418568) 2025-06-28 23:05:38 +02:00
Wolfgang Walther 41c5662cbe
nixos/postgresql: move postStart into separate unit
This avoids restarting the postgresql server, when only ensureDatabases
or ensureUsers have been changed. It will also allow to properly wait
for recovery to finish later.

To wait for "postgresql is ready" in other services, we now provide a
postgresql.target.

Resolves #400018

Co-authored-by: Marcel <me@m4rc3l.de>
2025-06-24 15:26:47 +02:00
Wolfgang Walther e780b064a8
nixos/roundcube: fix postgresql.package regression
`config.services.postgresql.package` is now only available when the
PostgreSQL module is actually enabled. If we're not using the local
database, we'll need to fallback to the latest postgresql version, since
we don't know about the remote version.
2025-06-22 14:24:58 +02:00
Martin Weinelt 64e7fad038
nixos/postfix-tlspol: fix postfix integration
Fixes the group membership for postfix processes in the postfix-tlspol
group.

Makes the postfix.service start up after postfix-tlspol.service, because
it depends on it for the TLS policy lookups.
2025-06-21 05:30:45 +02:00
Martin Weinelt 863d3a151d
nixos/tlsrpt: init 2025-06-16 06:02:10 +02:00
Martin Weinelt 3cb8d47c1a
nixos/postfix: replace sslCert and sslKey options
There exist multiple issues with these options, for example they are not
introspectable, since the values are configured in the config part of the
module.

Also the keypair is always configured for both server and client usage,
which is really surprising. The postfix docs even advise against setting
up client certificates, if they aren't required. [1]

The replacements are the `smtpd_tls_chain_files` for server usage and
`smtp_tls_chain_files` for client usage, which are the prefered way to
configure keys and certificates since Postfix 3.4.0. [2]

[1] https://www.postfix.org/postconf.5.html#smtp_tls_cert_file
[2] https://www.postfix.org/postconf.5.html#smtpd_tls_cert_file
2025-06-13 19:53:33 +02:00
Martin Weinelt 951a020ed4
nixos/postfix: make config freeform and drop null values
This is the basis for defining common options on
`services.postfix.config` while not rendering them, when they're set to
`null`.
2025-06-13 19:53:32 +02:00
Martin Weinelt 7c0f92f70b
nixos/postfix-tlspol: init
MTA-STS and DANE/TLSA resolver and TLS policy socketmap server for
Postfix.
2025-06-11 17:39:36 +02:00
Pol Dellaiera a22c7aad11
Revert "nixos/postfix: add slow domain" 2025-06-04 08:15:52 +02:00
Yt d699cfc3b4
stalwart-mail: 0.11.8 -> 0.12.2 (#409178) 2025-06-01 16:58:38 -04:00
Yt bd63862b59
nixos/stalwart-mail: fix incorrect config for webadmin and spam-filter (#412054) 2025-06-01 07:17:22 -04:00
TornaxO7 7f29ce73cb
nixos/stalwart-mail: fix description of openFirewall 2025-06-01 10:49:56 +02:00
Diogo Correia b7ab1fa981
nixos/stalwart-mail: fix incorrect config for webadmin and spam-filter
Stalwart 0.11.0 changed the `config.resource.spam-filter` and
`config.resource.webadmin` keys to be `spam-filter.resource` and
`webadmin.resource` respectively. The NixOS has been updated
accordingly, but unfortunately it has mistakenly used
`config.spam-filter.resource` and `config.webadmin.resource`, which are
incorrect and do not do anything.

This commit changes the default configuration to use the correct keys.

Note that due to infinite recursion, the `optionalAttrs` has been
replaced with `mkIf`.

Additionally, some tests were added to catch this regression in the
future.

Fixes #411351
2025-05-29 12:11:58 +01:00
oddlama 1069853a49
nixos/stalwart-mail: utilize lib.getExe 2025-05-27 20:42:06 +02:00
liberodark b9ecd30d81 nixos/postfix: add slow domain 2025-05-27 14:44:43 +02:00
Atemu 211d932302
clamsmtp: drop (#408043) 2025-05-18 16:11:16 +02:00
notehmry 871371a4cb
nixos/opensmtpd: explicit permissions for /var/spool/smtpd/queue (#406710) 2025-05-18 14:55:42 +02:00
Leona Maroni 99398273f3
nixos/clamsmtp: drop
drop as package is removed
2025-05-18 13:15:04 +02:00
Oliver Schmidt 047a804449 nixos/postsrsd: expose socketPath via module option
Services utilising postsrsd need to connect to it via a Unix socket.
While the path to that socket is static as of now, the discoverability
of that path suffers from the lack of module documentation and a
scattered definition of the individual path components over at least
three lines, even when reading the module source.

By exposing the socket path as a readOnly NixOS option, that value shows
up in the options overview and can be re-used in other parts of NixOS
config.
2025-05-12 09:51:17 +02:00
Alyssa Ross afdbf499ac nixos/mailman: hyperkitty needs mailman-web-setup
qcluster won't be happy if it's started before the database migrations
have been run.

	12:25:47 [Q] ERROR Failed to pull task from broker
	Traceback (most recent call last):
	  File "/nix/store/w5ndmidmkiy02vvgl7cxx1fkzc1pichg-python3-3.12.9-env/lib/python3.12/site-packages/django/db/backends/utils.py", line 89, in _execute
	    return self.cursor.execute(sql, params)
	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	  File "/nix/store/w5ndmidmkiy02vvgl7cxx1fkzc1pichg-python3-3.12.9-env/lib/python3.12/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
	    return super().execute(query, params)
	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	sqlite3.OperationalError: no such table: django_q_ormq
2025-05-05 20:06:00 +02:00
Jeremy Fleischman d1e920fc37
services/postsrsd: updates for postsrsd 2
postsrsd 2 expects a config file, and has some breaking changes that
make it incompatible with some of our old options.
2025-04-28 17:37:16 +02:00
Patrick Steinhardt feddb6a2bc opensmtpd-extras: drop in favor of standalone tables
Upstream has archived the OpenSMTPD-extras repository with 82c49af (add
deprecation notice, 2024-10-22). Instead, it has created a set of
repositories, each containing one of the tables. The old tables aren't
compatible anymore with recent OpenSMTPD versions due to changed
protocols. Other extras, like the queues, don't have an alternative to
the best of my knowledge.

Furthermore, opensmtpd-extras doesn't even build anymore, furthermore
indicating that there aren't any users of this package. Remove the
"opensmtpd-extras" package and raise errors pointing to the new
standalone tables.

Add a release note.
2025-04-28 13:26:53 +02:00
Patrick Steinhardt 132c73dd29 nixos/opensmtpd: adapt to changed filter location
The location of filters for OpenSMTPD has been changed to
"libexec/smtpd". Adapt the service accordingly.
2025-04-28 13:26:53 +02:00
Felix Bühler 7b3170d6b2
nixos/maddy: add package option (#396535) 2025-04-22 23:21:17 +02:00
Nick Cao 5051c4651e
nxios/cyrus-imap: fix cyrus-imap certs options (#392716) 2025-04-07 20:01:10 -04:00
Nguyễn Gia Phong baf2d3e27f
nixos/maddy: add package option 2025-04-06 20:20:18 +09:00
Silvan Mosberger 374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00
Moraxyc 128bdeb3c5
nxios/cyrus-imap: fix cyrus-imap certs options 2025-03-24 21:57:25 +08:00
h7x4 ab0564bd10
treewide: add documentation for nixos systemd units 2025-03-12 18:00:38 +01:00
Izorkin 6f9f983368 dovecot: remove option modules 2025-03-11 10:17:21 +03:00
Izorkin a6a9bb9725 dovecot: remove hard coding path to module dir 2025-03-06 19:47:04 +03:00