Commit Graph

533 Commits

Author SHA1 Message Date
Emily Trau
7edd128431
Merge pull request #266746 from serpent213/patch-2
nixos/roundcube: Ignore newline at end of password file
2023-12-01 15:50:05 +11:00
h7x4
79d3d59f58
treewide: replace mkPackageOptionMD with mkPackageOption 2023-11-30 19:03:14 +01:00
h7x4
0a37316d6c
treewide: use mkPackageOption
This commit replaces a lot of usages of `mkOption` with the package
type, to be `mkPackageOption`, in order to reduce the amount of code.
2023-11-27 01:28:36 +01:00
Ryan Lahfa
ccfe07c316
Merge pull request #266270 from Ma27/postgresql-ownership-15 2023-11-17 18:02:17 +01:00
Maximilian Bosch
48459567ae nixos/postgresql: drop ensurePermissions, fix ensureUsers for postgresql15
Closes #216989

First of all, a bit of context: in PostgreSQL, newly created users don't
have the CREATE privilege on the public schema of a database even with
`ALL PRIVILEGES` granted via `ensurePermissions` which is how most of
the DB users are currently set up "declaratively"[1]. This means e.g. a
freshly deployed Nextcloud service will break early because Nextcloud
itself cannot CREATE any tables in the public schema anymore.

The other issue here is that `ensurePermissions` is a mere hack. It's
effectively a mixture of SQL code (e.g. `DATABASE foo` is relying on how
a value is substituted in a query. You'd have to parse a subset of SQL
to actually know which object are permissions granted to for a user).

After analyzing the existing modules I realized that in every case with
a single exception[2] the UNIX system user is equal to the db user is
equal to the db name and I don't see a compelling reason why people
would change that in 99% of the cases. In fact, some modules would even
break if you'd change that because the declarations of the system user &
the db user are mixed up[3].

So I decided to go with something new which restricts the ways to use
`ensure*` options rather than expanding those[4]. Effectively this means
that

* The DB user _must_ be equal to the DB name.
* Permissions are granted via `ensureDBOwnerhip` for an attribute-set in
  `ensureUsers`. That way, the user is actually the owner and can
  perform `CREATE`.
* For such a postgres user, a database must be declared in
  `ensureDatabases`.

For anything else, a custom state management should be implemented. This
can either be `initialScript`, doing it manual, outside of the module or
by implementing proper state management for postgresql[5], but the
current state of `ensure*` isn't even declarative, but a convergent tool
which is what Nix actually claims to _not_ do.

Regarding existing setups: there are effectively two options:

* Leave everything as-is (assuming that system user == db user == db
  name): then the DB user will automatically become the DB owner and
  everything else stays the same.

* Drop the `createDatabase = true;` declarations: nothing will change
  because a removal of `ensure*` statements is ignored, so it doesn't
  matter at all whether this option is kept after the first deploy (and
  later on you'd usually restore from backups anyways).

  The DB user isn't the owner of the DB then, but for an existing setup
  this is irrelevant because CREATE on the public schema isn't revoked
  from existing users (only not granted for new users).

[1] not really declarative though because removals of these statements
    are simply ignored for instance: https://github.com/NixOS/nixpkgs/issues/206467
[2] `services.invidious`: I removed the `ensure*` part temporarily
    because it IMHO falls into the category "manage the state on your
    own" (see the commit message). See also
    https://github.com/NixOS/nixpkgs/pull/265857
[3] e.g. roundcube had `"DATABASE ${cfg.database.username}" = "ALL PRIVILEGES";`
[4] As opposed to other changes that are considered a potential fix, but
    also add more things like collation for DBs or passwords that are
    _never_ touched again when changing those.
[5] As suggested in e.g. https://github.com/NixOS/nixpkgs/issues/206467
2023-11-13 17:16:25 +01:00
Molly Miller
9cec5c807a nixos/mailman: restart services on failure and increase mailman timeouts 2023-11-13 16:10:55 +01:00
Steffen Beyer
ae5fe741ba
nixos/roundcube: Ignore newline at end of password file 2023-11-11 00:17:53 +01:00
Linus Heckemann
8670794565
Merge pull request #263203 from nikstur/replace-activation
Replace simple activationScripts
2023-10-28 10:17:15 +02:00
nikstur
f18ff2ec0b nixos/mlmmj: replace activationScript 2023-10-26 01:44:21 +02:00
github-actions[bot]
cfc75eec46
Merge master into staging-next 2023-10-20 18:00:54 +00:00
Vladimír Čunát
9320d9e7bc
Merge #260527: Mailman fixes
...into staging-next
2023-10-20 18:56:03 +02:00
Bjørn Forsman
142074c2a8 nixos: fix bad mkEnableOption descriptions
Fix descriptions that don't account for (1) the "Whether to enable"
prefix or (2) the automatically added trailing dot.
2023-10-20 16:22:40 +01:00
Maximilian Bosch
2ee12a93de treewide: remove myself (ma27) from a few packages
It's time again, I guess :>

Main motivation is to stop being pinged about software that I maintained
for work now that I'm about to switch jobs. There's no point in pinging
me to review/test updates or to debug issues in e.g. the Atlassian stack
or on mailman since I use neither personally.

But there's also a bunch of other stuff that I stopped using personally. While
at it I realized that I'm still maintainer of a few tests & modules related to
packages I stopped maintaining in the past already.
2023-10-18 15:47:20 -03:00
Molly Miller
1a794a3e4b nixos/mailman: store locks in ephemeral runtime directory
nixosTests.mailman: test mailman master lock handling
2023-10-12 10:39:18 +00:00
Alyssa Ross
21e3908ea3
nixos/mailman: ensure uwsgi uses mailman's python
If they differ, uwsgi will fail to start, because it won't be able to
find the appropriate libraries.
2023-10-11 20:20:12 +00:00
revol-xut
6f50091de7 nixos/listmonk: fixing datatype of options 2023-09-09 15:21:32 +02:00
BruNeu
c729c9746e nixos/stalwart-mail: fixed broken link 2023-09-08 23:59:03 +02:00
pacien
f6961de637 nixos/stalwart-mail: add module 2023-09-03 22:18:50 -04:00
Lin Jian
74fadae942
treewide: stop using types.string
It is an error[1] now.

[1]: https://github.com/NixOS/nixpkgs/pull/247848
2023-08-08 21:31:21 +08:00
Sandro Jäckel
b2c1b176d9
nixos/nullmailer: allow users in the nullmailer group to send mails
In combination with https://github.com/NixOS/nixpkgs/pull/231673 this
allows hardened services to use nullmailer's sendmail.
2023-07-13 17:02:19 +02:00
Luke Granger-Brown
cba7cd9b6d
Merge pull request #233282 from pkern/spamassassin
spamassassin: 3.4.6 → 4.0.0
2023-06-25 23:55:34 +01:00
Luke Granger-Brown
58b48cd720 nixos/spamassassin: add DMARC module to default config 2023-06-25 17:35:16 +00:00
pennae
32deda9ec0
Merge pull request #238222 from mads256h/harden-davmail
davmail: enable sandboxing options
2023-06-25 14:57:19 +02:00
Philipp Kern
0ce6a09235 spamassassin: 3.4.6 → 4.0.0
The HashCash module has been removed, so this change also drops it from
the default config for spamassassin.
2023-06-25 09:38:10 +00:00
Alyssa Ross
eafa1fd10d nixos/public-inbox: set ProtectHome=tmpfs
This fixes using coderepos in /home, by allowing the coderepo paths to
be bind mounted into an otherwise empty /home tmpfs.  Since this was
the usecase for making ProtectHome= overrideable, we don't need the
mkDefault any more.
2023-06-20 17:19:09 +00:00
Alyssa Ross
03216e705c nixos/public-inbox: make coderepo paths accessible 2023-06-20 17:19:09 +00:00
Alyssa Ross
68c68f39db nixos/public-inbox: remove unused indexing code
This was never run, because public-inbox-init now always initializes
Xapian.
2023-06-20 17:11:23 +00:00
Mads Mogensen
40c923aa13
davmail: enable sandboxing options
The output from `systemd-analyze security davmail`:
Before: `Overall exposure level for davmail.service: 8.2 EXPOSED 🙁`
After: `Overall exposure level for davmail.service: 1.3 OK 🙂`
2023-06-17 11:32:42 +02:00
Alyssa Ross
18f2be2e56 nixos/public-inbox: require that URL be non-empty
public-inbox-init doesn't work if passed an empty URL.
2023-06-17 07:57:27 +00:00
Pol Dellaiera
7907dd9d6b
Merge pull request #235924 from Stunkymonkey/remove-then-{}
treewide: use lib.optionalAttrs instead of 'then {}'
2023-06-13 20:14:58 +02:00
Felix Buehler
ed3b102d1e treewide: use use lib.optionalAttrs instead of 'then {}' 2023-06-06 22:54:31 +02:00
pacien
54be076ae7 nixos/exim: apply privilege restrictions
Since 816614bd62, the service is set to use the exim user so that
systemd takes care of the credentials ownership. The executable is
still required to run as root, to then drop privileges. The prefix '+'
that was used however interfers with the use of privilege restrictions
and other sandboxing options. Since we only want to escape the "User"
setting, we can use the '!' prefix instead.
2023-06-05 20:04:48 +02:00
Julien Moutinho
b6ed3b8f40 nixos/public-inbox: explicit a few more freeform settings 2023-06-04 13:09:28 +00:00
Jonas Heinrich
63f73b3295
nixos/maddy: change secrets option to accept a list of paths 2023-05-30 12:41:07 +08:00
figsoda
701bcdbead nixos: fix typos 2023-05-19 22:31:04 -04:00
Alyssa Ross
7ddca49451 nixos/mailman: set RemainAfterExit for settings
This seems to be required to have the unit re-run if
services.mailman.restApiPassFile gets set.
2023-05-19 12:03:41 +02:00
Alyssa Ross
43465c94d4 nixos/mailman: randomly generate REST API token 2023-05-19 12:03:41 +02:00
Jonas Heinrich
8a4f016281 nixos/maddy: tls.loader add acme support, add secrets option 2023-05-15 15:00:16 -04:00
Jonas Heinrich
d932d6929b
Merge pull request #227401 from onny/maddytls2
nixos/maddy: Add tls option
2023-05-02 07:32:56 +02:00
Jonas Heinrich
616ba4ae5c nixos/maddy: Add tls option 2023-05-01 19:12:26 +02:00
Andreas Brinner
9d5dba7170 nixos/roundcube: read only first line of password file
Only read the first line of the password file, if has multiple lines.
Mention that behaviour in options documentation.
2023-04-23 21:05:48 +02:00
Andreas Brinner
78fb35ce39 nixos/roundcube: extend documentation for passwordFile
The passwordFile must be formatted correctly. Added some information
about how the file content should look like.
2023-04-23 14:05:40 +02:00
Andreas Brinner
279eeae178 nixos/roundcube: fix roundcube-setup start
When using Roundcube with a non local PostgreSQL database wait for
network start before running roundcube-setup.service
Otherwise the database is not reachable and the service fails.
2023-04-23 13:11:28 +02:00
Andreas Brinner
2af4a9bc09 nixos/roundcube: fix PostgreSQL password
Extract PostgreSQL database password for Roundcube from .pgpass file.
The password file is used in two locations:

  1. in the Roundcube config.php
  2. in the systemd setup service that initializes the roundcube
     database

These two services need the password in different formats.

Keep the password file in PostgreSQL standard format and extract the
password for the Roundcube config (see #215986).
2023-04-23 13:11:28 +02:00
Artturi
b83db86a9e
Merge pull request #222080 from Stunkymonkey/nixos-optionalString 2023-04-20 16:07:30 +03:00
Ryan Lahfa
b914dffe7e
Merge pull request #224494 from LeSuisse/roundcube-php81
nixos/roundcube: use PHP 8.1
2023-04-15 22:12:31 +02:00
Jonas Heinrich
86a685ceb1 nixos/maddy: Add option ensureCredentials 2023-04-13 09:36:54 -04:00
Felix Buehler
327b0cff7a treewide: use more lib.optionalString 2023-04-07 13:38:33 +02:00
Thomas Gerbet
188573bf93 nixos/roundcube: use PHP 8.1
Roundcube has announced support of PHP 8.1 in the 1.6.0

https://github.com/roundcube/roundcubemail/releases/tag/1.6.0
2023-04-03 18:21:35 +02:00
ettom
a375b000a6 nixos/zeyple: init 2023-03-21 00:14:03 +02:00