summary refs log tree commit diff
path: root/nixos/modules/security
Commit message (Collapse)AuthorAge
* Merge pull request #156858: nixos/polkit: don't enable by defaultpiegames2022-03-05
|\
| * nixos/polkit: don't enable by defaultMartin Weinelt2022-01-27
| | | | | | | | | | | | | | | | | | SUID wrappers really shouldn't be enabled by default, unless a consumer relies on them. So in my opinion this falls upon the desktop environments if needed or a user to explicltly enable this if wanted. Most desktop environments and services like CUPS already enable polkit by default, that should really be sufficient.
* | Merge pull request #162496 from Baughn/masterPascal Bach2022-03-04
|\ \ | | | | | | pam: Fix google-authenticator reference
| * | pam: Fix google-authenticator referenceSvein Ove Aas2022-03-02
| | |
* | | nixos/systemd-confinement: Allow shipped unit fileaszlig2022-03-02
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In issue #157787 @martined wrote: Trying to use confinement on packages providing their systemd units with systemd.packages, for example mpd, fails with the following error: system-units> ln: failed to create symbolic link '/nix/store/...-system-units/mpd.service': File exists This is because systemd-confinement and mpd both provide a mpd.service file through systemd.packages. (mpd got updated that way recently to use upstream's service file) To address this, we now place the unit file containing the bind-mounted paths of the Nix closure into a drop-in directory instead of using the name of a unit file directly. This does come with the implication that the options set in the drop-in directory won't apply if the main unit file is missing. In practice however this should not happen for two reasons: * The systemd-confinement module already sets additional options via systemd.services and thus we should get a main unit file * In the unlikely event that we don't get a main unit file regardless of the previous point, the unit would be a no-op even if the options of the drop-in directory would apply Another thing to consider is the order in which those options are merged, since systemd loads the files from the drop-in directory in alphabetical order. So given that we have confinement.conf and overrides.conf, the confinement options are loaded before the NixOS overrides. Since we're only setting the BindReadOnlyPaths option, the order isn't that important since all those paths are merged anyway and we still don't lose the ability to reset the option since overrides.conf comes afterwards. Fixes: https://github.com/NixOS/nixpkgs/issues/157787 Signed-off-by: aszlig <aszlig@nix.build>
* | treewide: remove obsolete kernel version checksAlyssa Ross2022-02-19
| | | | | | | | We don't support Linux kernels older than 4.4 in Nixpkgs.
* | google-compute-config: update configNikolay Amiantov2022-02-05
| |
* | nixos/nix-daemon: use structural settingspolykernel2022-01-26
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Merge master into staging-nextgithub-actions[bot]2022-01-12
|\
| * Merge pull request #146937 from amarshall/pam-apparmor-fixpennae2022-01-12
| |\ | | | | | | nixos/pam: Fix apparmor syntax error
| | * nixos/pam: Fix apparmor syntax errorAndrew Marshall2022-01-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running e.g. `aa-genprof` get error: > ERROR: Syntax Error: Unknown line found in file /etc/apparmor.d/abstractions/pam line 26: > r /nix/store/XXXXX.pam,mr /nix/store/XXXXX-linux-pam-1.5.1/lib/security/pam_filter/*, So add an explicit newline as concatMapStringsSep only adds them between.
* | | Merge staging-next into staginggithub-actions[bot]2022-01-11
|\| |
| * | nixos/acme: ensure web servers using certs can access themWinter2022-01-08
| |/
* | Merge #153104: linux-pam: don't create dangling symlink during buildVladimír Čunát2022-01-09
|\ \ | |/ |/| | | ... into staging
| * linux-pam: don't create dangling symlink during buildWinter2022-01-01
|/
* Merge pull request #152594 from ju1m/apparmorMichele Guerini Rocco2021-12-31
|\ | | | | security/wrappers: remove C compiler from the nixos/security.wrappers…
| * security/wrappers: remove C compiler from the nixos/security.wrappers ↵Julien Moutinho2021-12-29
| | | | | | | | AppArmor profile
* | nixos/acme: Add test for lego's built-in web serverLucas Savva2021-12-26
| | | | | | | | | | | | In the process I also found that the CapabilityBoundingSet was restricting the service from listening on port 80, and the AmbientCapabilities was ineffective. Fixed appropriately.
* | nixos/acme: Clean up default handlingSilvan Mosberger2021-12-26
| |
* | nixos/acme: Add useRoot optionLucas Savva2021-12-26
| |
* | nixos/acme: Update documentationLucas Savva2021-12-26
| | | | | | | | | | | | | | | | - Added defaultText for all inheritable options. - Add docs on using new defaults option to configure DNS validation for all domains. - Update DNS docs to show using a service to configure rfc2136 instead of manual steps.
* | nixos/acme: Add defaults and inheritDefaults optionLucas Savva2021-12-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allows configuring many default settings for certificates, all of which can still be overridden on a per-cert basis. Some options have been moved into .defaults from security.acme, namely email, server, validMinDays and renewInterval. These changes will not break existing configurations thanks to mkChangedOptionModule. With this, it is also now possible to configure DNS-01 with web servers whose virtualHosts utilise enableACME. The only requirement is you set `acmeRoot = null` for each vhost. The test suite has been revamped to cover these additions and also to generally make it easier to maintain. Test config for apache and nginx has been fully standardised, and it is now much easier to add a new web server if it follows the same configuration patterns as those two. I have also optimised the use of switch-to-configuration which should speed up testing.
* | nixos/acme: Check for revoked certificatesLucas Savva2021-12-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #129838 It is possible for the CA to revoke a cert that has not yet expired. We must run lego to validate this before expiration, but we must still ignore failures on unexpired certs to retain compatibility with #85794 Also changed domainHash logic such that a renewal will only be attempted at all if domains are unchanged, and do a full run otherwises. Resolves #147540 but will be partially reverted when go-acme/lego#1532 is resolved + available.
* | nixos/acme: Add a human readable error on run failureLucas Savva2021-12-26
| | | | | | | | | | | | | | | | | | | | | | Closes NixOS/nixpkgs#108237 When a user first adds an ACME cert to their configuration, it's likely to fail to renew due to DNS misconfig. This is non-fatal for other services since selfsigned certs are (usually) put in place to let dependant services start. Tell the user about this in the logs, and exit 2 for differentiation purposes.
* | nixos/acme: Remove selfsignedDeps from finished targetsLucas Savva2021-12-26
|/ | | | | | | | selfsignedDeps is already appended to the after and wants of a cert's renewal service, making these redundant. You can see this if you run the following command: systemctl list-dependencies --all --reverse acme-selfsigned-mydomain.com.service
* Merge pull request #148785 from pennae/more-option-doc-staticizingGraham Christensen2021-12-17
|\ | | | | treewide: more defaultText for options
| * treewide: set defaultText for options using simple path defaultspennae2021-12-09
| | | | | | | | | | adds defaultText for all options that set their default to a path expression using the ubiquitous `cfg` shortcut bindings.
* | Merge pull request #125256 from deviant/acme-standaloneMartin Weinelt2021-12-11
|\ \
| * | nixos/acme: Allow using lego's built-in web serverV2021-06-05
| | | | | | | | | | | | | | | | | | | | | Currently, we hardcode the use of --http.webroot, even if no webroot is configured. This has the effect of disabling the built-in server. Co-authored-by: Chris Forno <jekor@jekor.com>
* | | nixos/pam: Type all limit optionsJanne Heß2021-12-09
| | |
* | | Merge pull request #146815 from ElvishJerricco/systemd-utils-expressionsajs1242021-12-08
|\ \ \ | | | | | | | | Move systemd-lib.nix and systemd-unit-options.nix into utils
| * | | Move systemd-lib.nix and systemd-unit-options.nix into utilsWill Fancher2021-11-20
| | | |
* | | | nixos/acme: Allow disabling bash tracingJanne Heß2021-12-07
| | | | | | | | | | | | | | | | | | | | | | | | This is horrible if you want to debug failures that happened during system switches but your 30-ish acme clients spam the log with the same messages over and over again.
* | | | nixos/*: add trivial defaultText for options with simple defaultspennae2021-12-02
| |_|/ |/| |
* | | nixos/acme: fix typo in docsRoman Frołow2021-11-30
| | |
* | | nixos/acme: Fix rate limiting of selfsigned servicesLucas Savva2021-11-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes NixOS/nixpkgs#147348 I was able to reproduce this intermittently in the test suite during the tests for HTTPd. Adding StartLimitIntervalSec=0 to disable rate limiting for these services works fine. I added it anywhere there was a ConditionPathExists.
* | | security/pam: Document test locationVictor Engmark2021-11-27
| | |
* | | nixos/acme: add an option for reloading systemd services after renewalPoscat2021-11-24
| | |
* | | nixos/pam: avoid extra lines in pam filesVictor Engmark2021-11-16
|/ /
* | Merge master into staging-nextgithub-actions[bot]2021-11-09
|\ \
| * | nixos/terminfo: inherit TERMINFO* env vars also for doassternenseemann2021-11-08
| | | | | | | | | | | | | | | | | | | | | This should mirror the behavior we implement for sudo: The TERMINFO and TERMINFO_DIRS variables are inherited from the normal user's environment, so terminfo files installed in the user's profile can be found by ncurses applications running as root.
* | | Merge master into staging-nextgithub-actions[bot]2021-11-06
|\| |
| * | nixos/pam: pam_mkhomedir umask to 0077Nico Berlee2021-11-06
| | | | | | | | | | | | | | | | | | pam_mkhomedir should create homedirs with the same umask as the rest of the system. Currently it creates homedirs with go+rx which makes it readable for other non-privileged users.
* | | Merge staging-next into staginggithub-actions[bot]2021-10-27
|\| |
| * | Merge master into staging-nextgithub-actions[bot]2021-10-27
| |\ \
| | * | pam_mount: do not re-prompt for passwordPeter Hoeg2021-10-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nixos-rebuild test causes pam_mount to prompt for a password when running with an encrypted home: building '/nix/store/p6bflh7n5zy2dql8l45mix9qnzq65hbk-nixos-system-mildred-18.09.git.98592c5da79M.drv'... activating the configuration... setting up /etc... reenter password for pam_mount: (mount.c:68): Messages from underlying mount program: (mount.c:72): crypt_activate_by_passphrase: File exists (pam_mount.c:522): mount of /dev/mapper/vg0-lv_home_peter failed kbuildsycoca5 running... This change makes pam_mount not prompt. It still tries to remount (and fails in the process) but that message can be ignored. Fixes: #44586
* | | | Merge staging-next into staginggithub-actions[bot]2021-10-26
|\| | |
| * | | Merge remote-tracking branch 'origin/master' into staging-nextMartin Weinelt2021-10-25
| |\| |
| | * | Merge pull request #139311 from NinjaTrappeur/nin-acme-fix-webrootMartin Weinelt2021-10-25
| | |\ \
| | | * | nixos/acme: add webroots to ReadWritePathsFélix Baylac-Jacqué2021-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 7a10478ea7b992ffa1f19f389e53df0fe2aa936d, all /var except /var/lib/acme gets mounted in a read-only fashion. This behavior breaks the existing acme deployments having a webroot set outside of /var/lib/acme. Collecting the webroots and adding them to the paths read/write mounted to the systemd service runtime tree. Fixes #139310