summary refs log tree commit diff
path: root/nixos/tests/hardened.nix
AgeCommit message (Collapse)AuthorFilesLines
2022-07-08nixosTests.hardened: fix for recent NixAlyssa Ross1-2/+2
As far as I know, there's no stable equivalent of nix ping-store.
2022-07-08nixosTests.hardened: disable dhcpcd privsepAlyssa Ross1-0/+5
Since 831024e2b93 ("nixos/dhcpcd: assert if privSep && alternative malloc"), this test has an assertion failure because dhcpcd (with privsep enabled) is not compatible with the allocator used by the hardened profile. Since it's unclear[1] what to do about this for the hardened profile, I propose doing the simplest thing possible to make the test eval, which is to just disable dhcpcd privsep. It's very inconvenient when trying to refactor the NixOS test infrastructure to have a test that doesn't evaluate. Once the correct solution is found for using dhcpcd with privsep with the hardened profile, this patch can be reverted. [1]: https://github.com/NixOS/nixpkgs/pull/157430
2022-03-28treewide: machine -> nodes.machineRobert Hensing1-1/+1
2022-01-26nixos/nix-daemon: use structural settingspolykernel1-1/+1
The `nix.*` options, apart from options for setting up the daemon itself, currently provide a lot of setting mappings for the Nix daemon configuration. The scope of the mapping yields convience, but the line where an option is considered essential is blurry. For instance, the `extra-sandbox-paths` mapping is provided without its primary consumer, and the corresponding `sandbox-paths` option is also not mapped. The current system increases the maintenance burden as maintainers have to closely follow upstream changes. In this case, there are two state versions of Nix which have to be maintained collectively, with different options avaliable. This commit aims to following the standard outlined in RFC 42[1] to implement a structural setting pattern. The Nix configuration is encoded at its core as key-value pairs which maps nicely to attribute sets, making it feasible to express in the Nix language itself. Some existing options are kept such as `buildMachines` and `registry` which present a simplified interface to managing the respective settings. The interface is exposed as `nix.settings`. Legacy configurations are mapped to their corresponding options under `nix.settings` for backwards compatibility. Various options settings in other nixos modules and relevant tests have been updated to use structural setting for consistency. The generation and validation of the configration file has been modified to use `writeTextFile` instead of `runCommand` for clarity. Note that validation is now mandatory as strict checking of options has been pushed down to the derivation level due to freeformType consuming unmatched options. Furthermore, validation can not occur when cross-compiling due to current limitations. A new option `publicHostKey` was added to the `buildMachines` submodule corresponding to the base64 encoded public host key settings exposed in the builder syntax. The build machine generation was subsequently rewritten to use `concatStringsSep` for better performance by grouping concatenations. [1] - https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md
2021-09-22nixos/tests: drop latestKernel.hardenedrnhmjoj1-3/+1
The latest kernel does not guarantee a hardened version anymore, see ga5341beb for the motivation.
2021-09-19nixos/lock-kernel-modules: reorder before/afterrnhmjoj1-0/+1
Moving the service before multi-user.target (so the `hardened` test continue to work the way it did before) can result in locking the kernel too early. It's better to lock it a bit later and changing the test to wait specifically for the disable-kernel-module-loading.service.
2021-08-14graphene-hardened-malloc: 2 -> 8Robert Scott1-26/+2
significantly overhaul tests to cover build-time-linking and LD_PRELOAD use, simplifying the hardened nixos test to allow it to reuse this test setup.
2021-02-21nixos/hidepid: drop the module as the hidepid mount option is brokenDominik Xaver Hörl1-11/+0
This has been in an unusable state since the switch to cgroups-v2. See https://github.com/NixOS/nixpkgs/issues/73800 for details.
2021-02-14nixosTests.*: update to use virtualisation.fileSystemsMaciej Krüger1-1/+1
2021-01-10treewide: simplify pkgs.stdenv.lib -> pkgs.libDominik Xaver Hörl1-1/+1
The library does not depend on stdenv, that `stdenv` exposes `lib` is an artifact of the ancient origins of nixpkgs.
2020-10-05tests/hardened: Fix usage with 5.8Tim Steinbach1-1/+4
Linux >= 5.8 improved /proc mount options. `hidepid=2` is now displayed as `hidepid=invisible`
2020-08-21nixos/hardened: Port test to Python and fix itJanne Heß1-55/+59
Related to #72828 Replaces and closes #76708 Looks like `nix ping-store` does not output anything anymore but still fails when the connection does not work.
2020-04-17nixos/tests/hardened: add latestKernel argumentEmily1-2/+6
2020-04-17nixos/hardened: enable user namespaces for rootEmily1-1/+2
linux-hardened sets kernel.unprivileged_userns_clone=0 by default; see anthraxx/linux-hardened@104f44058f058a395502192c4939645df6f52ecb. This allows the Nix sandbox to function while reducing the attack surface posed by user namespaces, which allow unprivileged code to exercise lots of root-only code paths and have lead to privilege escalation vulnerabilities in the past. We can safely leave user namespaces on for privileged users, as root already has root privileges, but if you're not running builds on your machine and really want to minimize the kernel attack surface then you can set security.allowUserNamespaces to false. Note that Chrome's sandbox requires either unprivileged CLONE_NEWUSER or setuid, and Firefox's silently reduces the security level if it isn't allowed (see about:support), so desktop users may want to set: boot.kernel.sysctl."kernel.unprivileged_userns_clone" = true;
2019-09-18tests/hardened: fix buildJoachim Fasting1-0/+1
Bug introduced by 4ead3d2ec3d4fac9ee22da47bbe3bc9defb62c49 For ZHF https://github.com/NixOS/nixpkgs/issues/68361
2019-08-28treewide: remove redundant recvolth1-1/+1
2019-05-12Merge pull request #60187 from joachifm/feat/configurable-mallocJoachim F1-0/+27
nixos: configurable system-wide malloc
2019-05-11nixos/tests/hardened: check that apparmor is properly loadedJoachim Fasting1-0/+10
2019-05-07nixos/tests/hardened: test hardened mallocJoachim Fasting1-0/+27
2019-01-06nixos/tests/hardened: test loading out-of-tree-modulesJoachim Fasting1-1/+8
2018-12-27nixos/security/misc: factor out protectKernelImageJoachim Fasting1-0/+6
Introduces the option security.protectKernelImage that is intended to control various mitigations to protect the integrity of the running kernel image (i.e., prevent replacing it without rebooting). This makes sense as a dedicated module as it is otherwise somewhat difficult to override for hardened profile users who want e.g., hibernation to work.
2018-11-24nixos/hardened: restrict access to nix daemonJoachim Fasting1-0/+6
2018-11-24nixos/tests/hardened: fix build by disabling nix.useSandboxJoachim Fasting1-0/+1
2018-07-20[bot] nixos/*: remove unused arguments in lambdasvolth1-1/+1
2018-05-19nixos/tests/hardened: fix test (#40745)xeji1-3/+5
failed because `pgrep -u` segfaults when accesss to proc info is denied on a hardened system.
2017-09-22nixos/hardened test: add failing test-case for deferred mountsJoachim Fasting1-0/+19
2017-09-16nixos/tests: expand hardened testsJoachim Fasting1-0/+10
2017-04-30nixos/hardened profile: disable user namespaces at runtimeJoachim Fasting1-0/+5
2017-04-30nixos/tests: add tests for exercising various hardening featuresJoachim Fasting1-0/+31
This test exercises the linux_hardened kernel along with the various hardening features (enabled via the hardened profile). Move hidepid test from misc, so that misc can go back to testing a vanilla configuration.