Commit graph

1150 commits

Author SHA1 Message Date
Tristan Ross 22f2e258af
nixos/security: add landlock, yama, and bpf defaults 2025-05-16 20:56:19 -07:00
C0D3 M4513R 754412b4ae
acme: Add csr option
Signed-off-by: C0D3 M4513R <28912031+C0D3-M4513R@users.noreply.github.com>
2025-05-16 11:45:54 +02:00
nixpkgs-ci[bot] c376a565f9
Merge staging-next into staging 2025-04-24 18:04:57 +00:00
arthsmn 2c88eb3331
sudo-rs: refactor module 2025-04-23 21:31:50 -03:00
Martin Weinelt 65f179f903
apparmor: 4.0.3 -> 4.1.0, rewrite (#400430) 2025-04-23 22:34:10 +02:00
Grimmauld 5467162f9a
nixos/apparmor: transfer maintenance to team 2025-04-22 23:56:45 +02:00
Grimmauld f8a3ea075a
nixos/apparmor: don't hardcode glibc for logprof 2025-04-22 23:48:12 +02:00
Ryan Hendrickson 317c972e8a
nixos/pam: conditional enabling of services (#399051) 2025-04-20 13:23:01 -04:00
Nico Felbinger e0d1b49a46
chore: move meta option to top level in many modules 2025-04-19 18:27:48 +02:00
Tristan Ross b2f0ccb56b
nixos/security: init lsm option (#395855) 2025-04-18 07:12:07 -07:00
Ryan Hendrickson 2ef165538a nixos/pam: conditional enabling of services 2025-04-15 23:19:42 -04:00
Tristan Ross 6fb5b22821
nixos/apparmor: use security.lsm option 2025-04-14 23:06:54 -07:00
Tristan Ross b8402295a4
nixos/security: init lsm option 2025-04-14 23:06:51 -07:00
Arne Keller 0bd982a343
agnos: init at 0.1.0, nixos/agnos: init (#351678) 2025-04-07 16:21:00 +02:00
Justinas Stankevicius 7757648f82 nixos/agnos: init 2025-04-06 19:53:26 +03:00
azahi 5f25aceff5
treewide: remove azahi from maintainers 2025-04-06 15:09:19 +03: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
h7x4 ab0564bd10
treewide: add documentation for nixos systemd units 2025-03-12 18:00:38 +01:00
h7x4 405054ead6
nixos/kerberos_server: add the "get-keys" ACL permission (#337306) 2025-03-11 14:51:02 +01:00
Sandro 74ee058fc3
nixos/sudo-rs: align sudo and sudo-rs config (#386423) 2025-03-10 16:51:43 +01:00
shelvacu 1a4575f9db
nixos/modules: Add security.pki.caBundle option and make all services use it for CA bundles (#352244)
Previously some modules used `config.environment.etc."ssl/certs/ca-certificates.crt".source`, some used `"/etc/ssl/certs/ca-certificates.crt"`, and some used `"${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"`. These were all bad in one way or another:

- `config.environment.etc."ssl/certs/ca-certificates.crt".source` relies on `source` being set; if `text` is set instead this breaks, introducing a weird undocumented requirement
- `"/etc/ssl/certs/ca-certificates.crt"` is probably okay but very un-nix. It's a magic string, and the path doesn't change when the file changes (and so you can't trigger service reloads, for example, when the contents change in a new system activation)
- `"${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"` silently doesn't include the options from `security.pki`

Co-authored-by: Shelvacu <git@shelvacu.com>
2025-03-08 08:41:08 +00:00
r-vdp 4e17c9546f
nixos/sudo-rs: align sudo and sudo-rs config
Since the latest release, sudo-rs supports all what we need
2025-03-02 17:42:18 +01:00
K900 b157c03c40
nixos/tests/acme: Refactor test suite (#378705) 2025-02-26 10:29:20 +03:00
K900 62b5275700
nixos/acme: Refactor setup process (#355087) 2025-02-26 10:29:09 +03:00
Lucas Savva 229640ed3a nixos/tests/acme: Refactor test suite
Split tests up based on certain use cases:

- http01-builtin: Tests most functionality of the core module, such
 as the systemd and hashing components, whilst utilising lego's built
 in http01 resolution mechanis.
- dns01: Tests only that DNS01 renewal works as expected.
- nginx: Tests nginx compatability
- httpd: Tests httpd compatability
- caddy: Tests caddy compatability
2025-02-22 23:58:29 +00:00
Lucas Savva 84af416af6 nixos/acme: Refactor setup process
Over time, we added a lot of setup services to the ACME module, namely:

- acme-selfsigned-ca.service: Creates the selfsigned CA certificates
 used to generate selfsigned certs for each configured cert.
- acme-fixperms.service: Ensures permissions correctness on certs after
 system configuration changes.
- acme-lockfiles.service: Create lockfiles used to implement
 maxConcurrentRenewals.

These numerous setup services complicated the dependency chain for any
cert renewal, and also made it difficult to track responsibility for
specific setup steps, for example, creating /var/lib/acme or setting
permissions of shared folders.

This change proposes a new acme-setup.service which encapsulates the
functionality of the previous 3 services into one. The service is still
defined in 3 separate chunks (using lib.mkMerge) which allows us to
keep a logical separation between each step and preserve some
optionality in the features.

The result is a generally simplified definition of systemd unit
dependencies and an obvious entrypoint for future setup extensions.
2025-02-22 21:14:56 +00:00
Maximilian Bosch dda82d9eef
Merge: nixos/acme: fix account creation service ordering (#355054) 2025-02-19 21:17:41 +01:00
Nessdoor f500ae084a nixos/kerberos_server: disallow combining "all" with policies != "get-keys" 2025-02-14 19:47:14 +01:00
Nessdoor 00a8c125b0 nixos/kerberos_server: add the "get-keys" ACL permission 2025-02-13 02:18:18 +01:00
Aleksana ece0ac9a7f
nixos/wrappers: add per-wrapper enable option (#376196) 2025-02-12 20:02:52 +08:00
Aleksana 9f741786ca
docs: removed internal security.wrapperDir (#376606) 2025-02-12 11:06:39 +08:00
Peder Bergebakken Sundt 953f72e76e nixos/*: tag manpage references 2025-01-27 02:47:01 +01:00
Andrew Voynov d62ea22c2b
docs: removed internal security.wrapperDir 2025-01-25 10:30:16 +03:00
Patrick Steinhardt d267ea8717 nixos/wrappers: add per-wrapper enable option
While it is possible to globally enable or disable security wrappers, it
isn't possible to disable only a subset of them. Consequently, users
will have to overwrite the security wrappers completely and re-add the
desired subset in case they want to disable a subset of those set up by
the NixOS modules.

Address this usecase by adding a new per-wrapper enable option.
2025-01-23 19:56:06 +01:00
Nick Cao 885e9e8474
nixos/pam: update u2f authfile description (#371381) 2025-01-15 09:45:25 -05:00
Aaron Andersen b6fe803517
nixos/pam: fixup refactor 2025-01-08 17:51:22 -05:00
oluceps 03b400b595
nixos/pam: update u2f authfile description 2025-01-06 17:57:51 +08:00
K900 764be63348
nixos/acme: fix cert ownership assert message (#362271) 2024-12-18 10:49:58 +03:00
Grimmauld e87b9b1f3e
nixos/apparmor: profile activation tristate and profile path support 2024-12-16 15:32:42 +01:00
Grimmauld 4d07e306ad
nixos/apparmor: Format 2024-12-16 15:31:30 +01:00
nicoo f6c5531461
nixos: Don't set !allowSubstitutes (#314664)
It is set by `runCommandLocal` and prevents fetching the build output
from `cache.nixos.org` or another trusted substituter.
2024-12-12 18:26:24 +00:00
Arne Keller 1a0bc2c68d
nixos/rtkit: Add option for rtkit-daemon command-line args (#299696) 2024-12-11 23:00:50 +01:00
Bjørn Forsman 886de305c8 nixos/rtkit: mention pipewire in docstring
I don't know the reason for rtkit only getting enabled by
hardware.pulseaudio.enable and not services.pipewire.enable, as they
both use it to get real-time priority, but we can at least help users by
mentioning pipewire in the rtkit option.
2024-12-11 20:52:13 +01:00
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
Felix Buehler 5c7e172a28 nixos/security.sudo: remove with lib; 2024-12-08 13:21:49 +01:00
Felix Buehler 430f4e9c5e nixos/security.pam: remove with lib; 2024-12-08 13:21:49 +01:00
Felix Buehler 97b9c7bfcc nixos/security.lockKernelModules: remove with lib; 2024-12-08 13:21:49 +01:00
Felix Buehler 264f1b4941 nixos/security.googleOsLogin: remove with lib; 2024-12-08 13:21:48 +01:00
Felix Buehler 89f9d95e02 nixos/security.duosec: remove with lib; 2024-12-08 13:21:48 +01:00
Felix Buehler 6f58cc224f nixos/security.doas: remove with lib; 2024-12-08 13:21:48 +01:00
Felix Buehler 011b094cdd nixos/security.chromiumSuidSandbox: remove with lib; 2024-12-08 13:21:48 +01:00
Felix Buehler 8d0fd73946 nixos/security.pki: remove with lib; 2024-12-08 13:21:48 +01:00
Masum Reza c584da6436
Apparmor: Adopt package, nixos module and nixos tests (#359817) 2024-12-08 09:56:55 +05:30
Thomas Gerbet 6dadace420
nixos/wrapper: pass trusted argv[0] to the privileged executable (#285588) 2024-12-07 11:54:27 +01:00
Rodney Lorrimar e2139b903b
nixos/rtkit: Add option for rtkit-daemon command-line args 2024-12-06 12:43:54 +08:00
ThinkChaos 1e8e314fdb
nixos/acme: fix cert ownership assert message
Handle the case where a service has no `User` defined in the message
in addition to the assertion itself.
2024-12-05 20:38:45 -05:00
Colin ca5f6df0c2
nixos/pam: replace apparmor warnings with assertions (#332119) 2024-12-04 19:06:22 +00:00
misuzu f608d1b3bc
nixos/acme: fix cert ownership assert for string SupplementaryGroups (#356064) 2024-12-01 16:31:01 +02:00
Grimmauld ceaeeb47cb
nixos/apparmor: adopt 2024-11-29 19:38:20 +01:00
Felix Buehler 3c80b14a81 nixos/security.please: remove with lib; 2024-11-27 22:26:57 +01:00
Felix Buehler a62e66394b nixos/security.audit: remove with lib; 2024-11-27 22:26:57 +01:00
Felix Buehler 236ed7869d nixos/security.apparmor: remove with lib; 2024-11-27 22:26:57 +01:00
Franz Pletz 6473ecdc08
nixos/acme: Set /var/lib/acme permissions to 755 (#353659) 2024-11-27 14:51:32 +01:00
Malte Voos d9bf91700e nixos/acme: make address families in systemd service less restrictive
This change is to support LEGO's capability to spawn an external process that
solves the DNS-01 challenge. In particular, this enables a setup where LEGO
runs a shell script that uses nsd-control to add an appropriate zone to a
local NSD instance.
2024-11-19 01:40:59 +01:00
ThinkChaos b2e7be76ba
nixos/acme: fix cert ownership assert for string SupplementaryGroups 2024-11-14 19:19:46 -05:00
John Titor 53712fa4a1
nixos/soteria: init module 2024-11-14 23:23:20 +05:30
K900 871087c18d
nixos/acme: do not limit credentials functionality to DNS/S3 config (#348344) 2024-11-11 01:43:53 +03:00
ThinkChaos b69074099e
Merge branch 'NixOS:master' into fix/acme-account-ordering 2024-11-10 15:13:31 -05:00
ThinkChaos 2f52ab637c
nixos/acme: fix account creation service ordering
If the chosen leader was an HTTP service, then the web server would be
both before and after the server.
2024-11-09 14:29:05 -05:00
K900 0453fe2395
{apache,caddy,nginx}: not "before" ACME certs using DNS validation (#336412) 2024-11-08 18:50:28 +03:00
ThinkChaos 1bd7f1374d
nixos/acme: use non deprecated CLI flag for dnsPropagationCheck 2024-11-07 20:19:12 -05:00
ThinkChaos 3c2e82337d
nixos/web-servers: assert ACME cert access via service user and groups
Allows giving access using SupplementaryGroups.
2024-11-07 20:19:12 -05:00
Yuriy Taraday 64a6e8292a nixos/acme: Set /var/lib/acme permissions to 755
It was being created with the default home permissions of 700, and then
set to 755 at runtime by something either some script or systemd as
part of service startup.

It worked fine without sysusers, but when it's enabed with:

    systemd.sysusers.enable = true;

systemd-tmpfiles is resetting permissions on each activation, which
breaks, for example, nginx reload, because it cannot load certificates
anymore, because it doesn't have any access to `/var/lib/acme`.

Fix this by setting `homeMode = "755";` explicitely so that it's set to
the final value from the beginning.
2024-11-04 16:04:56 +01:00
github-actions[bot] a0e96c5d1c
Merge master into staging-next 2024-10-29 06:05:06 +00:00
Sandro Jäckel 1a6638aeb1
nixos/ca: fix description formatting
Right now most of the text is treated as a code block
2024-10-28 15:03:11 +01:00
Fabián Heredia Montiel 34b62f7c47 Merge remote-tracking branch 'origin/master' into staging-next 2024-10-27 16:10:56 -06:00
Aleksana a56b4f3e50
nixos/wrappers: add enable switch (#350233) 2024-10-27 18:34:01 +08:00
nikstur 7fad2c2e39 nixos/wrappers: add enable switch
Add enable switch to make it possible to disable all wrappers but then
also re-enable all at once by forcing the option to be true.

By default the wrappers are enabled and thus the default behaviour
doesn't change.
2024-10-21 14:41:17 +02:00
github-actions[bot] 8164a7aa6d
Merge master into staging-next 2024-10-21 00:14:52 +00:00
Piotr Dobrowolski 6e6fc7ca26
nixos/acme: do not limit credentials functionality to DNS/S3 config 2024-10-13 22:48:14 +02:00
github-actions[bot] 144082b47e
Merge staging-next into staging 2024-10-10 18:05:19 +00:00
Mikael Voss 7b3261b5a6
nixos/pam: Strip config in documentation and messages
config can be assumed as the options root and is therefore redundant.
2024-10-10 16:07:36 +02:00
Franz Pletz 262f0e36d5
nixos/pam: add pam_rssh support (#336609) 2024-10-10 15:11:28 +02:00
github-actions[bot] 483deb3a04
Merge staging-next into staging 2024-10-04 12:06:05 +00:00
h7x4 d783411040
nixos: improve systemd slice names (#345990) 2024-10-04 12:08:36 +02:00
github-actions[bot] ae87c79207
Merge staging-next into staging 2024-10-03 18:05:09 +00:00
Bjørn Forsman 48908e5b86 nixos: improve systemd slice names
Following
https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#Description=,
update slice names to be short, descriptive and capitalized.
2024-10-02 20:24:13 +02:00
Peder Bergebakken Sundt 3100acba08 treewide: \xc2\xa0 ->
I have no idea what this escape sequence even is, but it breaks the nix parser with cryptic errors if not used in a comment.
A friend let me know MacOS is prone to input weird spaces, not sure if that is the source.

Candidates were located and created with:

    chr="$(echo -e '\xc2\xa0')"; rg -F "$chr" -l | xe sd -F "$chr" " "

There are some examples left, most being example output from `tree` in various markdown documents, some patches which we can't really touch, and `pkgs/tools/nix/nixos-render-docs/src/tests/test_commonmark.py` which I'm not sure if should be addressed
2024-10-02 15:33:06 +02:00
oxalica f534f74249
nixos/security/wrappers: fix fuse path 2024-09-30 15:26:51 -04:00
Felix Buehler b0d554537c nixos/security.pam: remove with lib; 2024-09-15 10:43:46 +02:00
Felix Buehler c99cbe65c4 nixos/security: remove with lib; 2024-09-15 10:43:46 +02:00
Mikael Voss 972976d903
nixos/pam: add pam_rssh support 2024-09-13 13:04:39 +02:00
Peder Bergebakken Sundt c3dabc54aa
security/dhparams: shellcheck fixes (#340492) 2024-09-13 02:52:09 +02:00
phaer 37cf9cbb22
security/dhparams: shellcheck fixes 2024-09-08 12:31:15 +02:00
phaer 22794b93e0
security/acme: shellcheck fixes 2024-09-08 12:29:58 +02:00
Felix Bühler d7a108054a
nixos/security.acme: remove with lib; (#339101) 2024-09-06 00:08:41 +02:00
r-vdp 38d73e0c07
auditd: add a dependency on systemd-tmpfiles-setup
This is needed so that:
- users have been created (when using systemd-sysusers or userborn)
- /run and /var/run exist
2024-09-05 10:05:18 +02:00
Felix Buehler 03a0f9debe nixos/security.acme: remove with lib; 2024-09-05 00:28:18 +02:00
r-vdp 544c97226d
auditd: remove with lib 2024-09-04 10:00:07 +02:00
r-vdp 0cb37347c6
auditd: format with nixfmt 2024-09-04 10:00:07 +02:00