about summary refs log tree commit diff
path: root/nixos/modules/services/security
AgeCommit message (Collapse)AuthorFilesLines
2023-11-24nixos/clamav: add fangfrisch updaterhappysalada1-0/+90
2023-11-22nixos/clamav: run as clamav user not roothappysalada1-0/+4
2023-11-22nixos/clamav: use state and runtime directoryhappysalada1-9/+4
2023-11-13nixos/postgresql: drop ensurePermissions, fix ensureUsers for postgresql15Maximilian Bosch1-1/+1
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-10-31privacyidea: removeMaximilian Bosch1-458/+0
Related to #262907 (Django3 removal from nixpkgs). This package already required an unreasonable amount of maintenance regularly for a such small leaf-package. It has a few highly outdated dependencies (e.g. flask 1, jinja2 2.11, sqlalchemy 1.3). After at least each Python package-set update one had to fix up a lot of dependencies to fix the package itself, so it was only useful on stable branches. And having so much outdated software in a security-sensitive piece of software seems questionable. Finally, globin and I won't be available for maintaining this now that Mayflower is migrating to another solution (and we'll do that as well) and I'd expect this to bitrot extremely quick if we both bail out.
2023-10-21Merge pull request #260275 from thillux/jitterentropy-rngdnikstur1-0/+18
jitterentropy-rngd: init at 1.2.8
2023-10-21nixos/fail2ban: change bantime default to not be config breakingSandro Jäckel1-3/+3
2023-10-20jitterentropy-rngd: init at 1.2.8Markus Theil1-0/+18
Add jitterentropy-rngd, a tool similar to rng-tools. While not necessarily needed, it is useful for those who want to strengthen their kernel entropy input pool by periodic insertion of an independent source. The entropy source is a NIST SP800-90B compliant non-physical true RNG source on most systems. See the jitterentropy documentation for details (http://chronox.de/jent/doc/CPU-Jitter-NPTRNG.pdf). Signed-off-by: Markus Theil <theil.markus@gmail.com>
2023-10-17nixos/opensnitch: fix typo and enable new system rulesChristopher Crouse1-1/+1
Fixed typo to enable [new system rules](https://github.com/evilsocket/opensnitch/wiki/System-rules#upgrading-from-previous-versions) Fixes: https://github.com/NixOS/nixpkgs/issues/256290
2023-10-17nixos/fail2ban: also inherit bantime (#244688)Artturi1-1/+1
nixos/fail2ban: also inherit bantime
2023-10-16nixos/tang: create module for tang server (#247037)Jean-François Roche1-0/+95
This commit adds a module for the tang server and the related nixos test.
2023-09-27nixos/usbguard: don't use path literal for pure evaluationAndreas Wiese1-2/+2
PR#256295 reintroduced ruleFile option, but set the default as a path literal, which was a "string path" previously. This breaks evaluation for being impure: error: access to absolute path '/var/lib/usbguard/rules.conf' is forbidden in pure eval mode (use '--impure' to override)
2023-09-25Merge pull request #256295 from Janik-Haag/usbguard0x4A6F1-6/+15
nixos/usbguard: restore ruleFile option
2023-09-20nixos/usbguard: restore ruleFile optionJanik H.1-6/+15
2023-09-19nixos/vaultwarden: Fix doubly-nested `config` value. Fixes evaluationNiklas Hambüchen1-4/+2
2023-08-31nixos/kanidm: fix broken doc linksSagi Sarussi1-3/+3
2023-08-17Merge pull request #249521 from Kranzes/oauth2-proxyIlan Joselevich1-1/+1
nixos/oauth2_proxy: service after network.target -> network-online.target
2023-08-16nixos/oauth2_proxy: service after network.target -> network-online.targetIlan Joselevich1-1/+1
2023-08-15nixos/kanidm: add package optionh7x41-6/+8
Signed-off-by: h7x4 <h7x4@nani.wtf>
2023-08-13nixos/opensnitch: Add support for EPBF process monitorJonas Heinrich1-2/+12
Co-authored-by: Slime90
2023-08-01kanidm: 1.1.0-alpha.12 -> 1.1.0-beta.13Martin Weinelt1-3/+14
https://github.com/kanidm/kanidm/releases/tag/v1.1.0-beta.13 The kanidmd process now creates a unix socket, over which admin tasks can be done, without having to shut kanidm down first. The kanidm_unixd process now wants access to /etc/shadow and /etc/group, so it can rule out collisions with the host system.
2023-07-21also inherit bantimeTim1-1/+1
2023-07-17nixos/vaultwarden: Fix Markdown syntax of linkAndré Schröder1-1/+1
The typo was introduced in 1d41cff3dc4c8f37bb5841f51fcbff705e169178
2023-07-13esdm: init at 0.6.0Oliver Richter1-0/+102
Signed-off-by: Oliver Richter <richter-oliver@gmx.net>
2023-07-12Merge pull request #241927 from ether42/usbguardLassulus1-2/+3
nixos/usbguard: rename services.usbguard.implictPolicyTarget to services.usbguard.implicitPolicyTarget
2023-07-12treewide: use lib.optional instead of 'then []'Felix Buehler1-1/+1
2023-07-06nixos/usbguard: rename services.usbguard.implictPolicyTarget to ↵Kevin Boulain1-2/+3
services.usbguard.implicitPolicyTarget
2023-07-05Merge pull request #237477 from accelbread/usbguard-dbus-supportLassulus1-41/+84
nixos/usbguard: add USBGuard dbus daemon option
2023-07-02Merge pull request #201907 from Tom-Hubrecht/fail2banRyan Lahfa1-92/+133
2023-07-01nixos/vaultwarden: Bind to localhost by default. See #100192Niklas Hambüchen1-1/+6
2023-06-30nixos/fail2ban: use attrsets for settings instead of stringsTom Hubrecht1-92/+133
2023-06-25treewide: use optional instead of 'then []'Felix Buehler1-3/+2
2023-06-22vault: set coredump ulimit to 0Jelle Besseling1-0/+1
2023-06-12nixos/usbguard: add USBGuard dbus daemon optionArchit Gupta1-41/+84
The usbguard package includes the dbus daemon, but the NixOS config option does not provide a service file or its necessary polkit rules. Enabling the dbus daemon allows use of Gnome's USBGuard support.
2023-06-11nixos/kanidm: auto-restart kanidm-unixd-tasksMax1-0/+1
2023-05-21Merge pull request #233238 from emilylange/username-changepennae1-1/+1
maintainers: rename indeednotjames to emilylange
2023-05-21maintainers: rename indeednotjames to emilylangeemilylange1-1/+1
2023-05-19nixos: fix typosfigsoda2-2/+2
2023-05-03nixos/fail2ban: others small updateIzorkin1-1/+1
2023-05-03nixos/fail2ban: update bantime optionsIzorkin1-31/+38
2023-04-24nixos/{consul-template,vault-agent}: initThomas1-0/+128
2023-04-20nixos/authelia: Allow using Unix socketsTom Hubrecht1-1/+1
2023-04-20nixos/fail2ban: add extraSettings optiondatafoo1-0/+18
2023-04-20Merge pull request #222080 from Stunkymonkey/nixos-optionalStringArtturi1-3/+2
2023-04-20kanidm: BindMount certificate pathsFlakebi1-43/+59
Bind mount the base dirs of the tls key and chain into the service. Make sure to bind every directory just once. The test failed on ofborg when /nix/store and the certificate path in /nix/store/<some path> were bound.
2023-04-19nixos/fail2ban: add bantime optiondatafoo1-0/+10
2023-04-07treewide: use more lib.optionalStringFelix Buehler1-3/+2
2023-03-27authelia: move module under security and minor fixes06kellyjac1-0/+401
Fixed test access to lib Added nixos test to passthru
2023-02-15fail2ban: 0.11.2 -> 1.0.2Flakebi1-11/+1
Update to 1.0.2: https://github.com/fail2ban/fail2ban/blob/1.0.2/ChangeLog#ver-102-20221109---finally-war-game-test-tape-not-a-nuclear-alarm 1.0.1 contained a few breaking changes, but I think they have little impact. I changed the module to use the systemd service shipping with fail2ban (now added to the package).
2023-02-11nixos/yubikey-agent: Add dependency to pcsd.serviceMarin1-0/+3
Issue: after installing, running `yubikey-agent -setup` produces the following error: ``` nixOS: Failed to connect to the YubiKey: connecting to pscs: the Smart card resource manager is not running ``` More on this issue: https://github.com/FiloSottile/yubikey-agent/issues/137