about summary refs log tree commit diff
path: root/nixos/modules/security
Commit message (Collapse)AuthorAge
* Merge pull request #87016 from flokli/nsswitch-cleanupFlorian Klink2020-05-14
|\ | | | | nixos/nsswitch cleanup nss modules
| * nixos/google-oslogin: add to system.nssDatabases.group tooFlorian Klink2020-05-11
| | | | | | | | | | | | | | nixos/modules/config/nsswitch.nix uses `passwdArray` for both `passwd` and `group`, but when moving this into the google-oslogin module in 4b71b6f8fa5f7b06ea5d0dd37d44a73757c7f142, it didn't get split appropriately.
* | pam: fix spelling mistake in configurationTimmy Xiao2020-05-12
| |
* | Merge pull request #87581 from cole-h/doasadisbladis2020-05-12
|\ \ | |/ |/| nixos/doas: default rule should be first
| * nixos/doas: default rule should be firstCole Helbling2020-05-10
| | | | | | | | | | | | | | In /etc/doas.conf, the last-matched rule will override all previously-matched rules. Thus, make the default rule show up first (but still allow some wiggle room for a user to `mkBefore` it), before any user-defined rules.
* | nixos/confinement: add conflict for ProtectSystem service optionDominique Martinet2020-05-10
|/ | | | | | | | Systemd ProtectSystem is incompatible with the chroot we make for confinement. The options is redundant with what we do anyway so warn if it had been set and advise to disable it. Merges: https://github.com/NixOS/nixpkgs/pull/87420
* nixos/doas: initCole Helbling2020-05-04
| | | | | | | | | `doas` is a lighter alternative to `sudo` that "provide[s] 95% of the features of `sudo` with a fraction of the codebase" [1]. I prefer it to `sudo`, so I figured I would add a NixOS module in order for it to be easier to use. The module is based off of the existing `sudo` module. [1] https://github.com/Duncaen/OpenDoas
* Merge pull request #86347 from m1cr0man/dnsdocsFlorian Klink2020-05-04
|\ | | | | nixos/acme: update documentation
| * nixos/acme: fix incorrect exampleLucas Savva2020-05-02
| |
| * nixos/acme: indicate support for other providersLucas Savva2020-05-01
| |
| * nixos/acme: update documentationLucas Savva2020-04-29
| |
* | Merge pull request #83121 from emilazy/acme-use-ec256Yegor Timoshenko2020-05-03
|\ \ | | | | | | nixos/acme: change default keyType to ec256
| * | nixos/acme: change default keyType to ec256Emily2020-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the NixOS ACME module defaulted to using P-384 for TLS certificates. I believe that this is a mistake, and that we should use P-256 instead, despite it being theoretically cryptographically weaker. The security margin of a 256-bit elliptic curve cipher is substantial; beyond a certain level, more bits in the key serve more to slow things down than add meaningful protection. It's much more likely that ECDSA will be broken entirely, or some fatal flaw will be found in the NIST curves that makes them all insecure, than that the security margin will be reduced enough to put P-256 at risk but not P-384. It's also inconsistent to target a curve with a 192-bit security margin when our recommended nginx TLS configuration allows 128-bit AES. [This Stack Exchange answer][pornin] by cryptographer Thomas Pornin conveys the general attitude among experts: > Use P-256 to minimize trouble. If you feel that your manhood is > threatened by using a 256-bit curve where a 384-bit curve is > available, then use P-384: it will increases your computational and > network costs (a factor of about 3 for CPU, a few extra dozen bytes > on the network) but this is likely to be negligible in practice (in a > SSL-powered Web server, the heavy cost is in "Web", not "SSL"). [pornin]: https://security.stackexchange.com/a/78624 While the NIST curves have many flaws (see [SafeCurves][safecurves]), P-256 and P-384 are no different in this respect; SafeCurves gives them the same rating. The only NIST curve Bernstein [thinks better of, P-521][bernstein] (see "Other standard primes"), isn't usable for Web PKI (it's [not supported by BoringSSL by default][boringssl] and hence [doesn't work in Chromium/Chrome][chromium], and Let's Encrypt [don't support it either][letsencrypt]). [safecurves]: https://safecurves.cr.yp.to/ [bernstein]: https://blog.cr.yp.to/20140323-ecdsa.html [boringssl]: https://boringssl.googlesource.com/boringssl/+/e9fc3e547e557492316932b62881c3386973ceb2 [chromium]: https://bugs.chromium.org/p/chromium/issues/detail?id=478225 [letsencrypt]: https://letsencrypt.org/docs/integration-guide/#supported-key-algorithms So there's no real benefit to using P-384; what's the cost? In the Stack Exchange answer I linked, Pornin estimates a factor of 3× CPU usage, which wouldn't be so bad; unfortunately, this is wildly optimistic in practice, as P-256 is much more common and therefore much better optimized. [This GitHub comment][openssl] measures the performance differential for raw Diffie-Hellman operations with OpenSSL 1.1.1 at a whopping 14× (even P-521 fares better!); [Caddy disables P-384 by default][caddy] due to Go's [lack of accelerated assembly implementations][crypto/elliptic] for it, and the difference there seems even more extreme: [this golang-nuts post][golang-nuts] measures the key generation performance differential at 275×. It's unlikely to be the bottleneck for anyone, but I still feel kind of bad for anyone having lego generate hundreds of certificates and sign challenges with them with performance like that... [openssl]: https://github.com/mozilla/server-side-tls/issues/190#issuecomment-421831599 [caddy]: https://github.com/caddyserver/caddy/blob/2cab475ba516fa725d012f53ca417c3e039607de/modules/caddytls/values.go#L113-L124 [crypto/elliptic]: https://github.com/golang/go/tree/2910c5b4a01a573ebc97744890a07c1a3122c67a/src/crypto/elliptic [golang-nuts]: https://groups.google.com/forum/#!topic/golang-nuts/nlnJkBMMyzk In conclusion, there's no real reason to use P-384 in general: if you don't care about Web PKI compatibility and want to use a nicer curve, then Ed25519 or P-521 are better options; if you're a NIST-fearing paranoiac, you should use good old RSA; but if you're a normal person running a web server, then you're best served by just using P-256. Right now, NixOS makes an arbitrary decision between two equally-mediocre curves that just so happens to slow down ECDH key agreement for every TLS connection by over an order of magnitude; this commit fixes that. Unfortunately, it seems like existing P-384 certificates won't get migrated automatically on renewal without manual intervention, but that's a more general problem with the existing ACME module (see #81634; I know @yegortimoshenko is working on this). To migrate your certificates manually, run: $ sudo find /var/lib/acme/.lego/certificates -type f -delete $ sudo find /var/lib/acme -name '*.pem' -delete $ sudo systemctl restart 'acme-*.service' nginx.service (No warranty. If it breaks, you get to keep both pieces. But it worked for me.)
* | | nixos/google-oslogin: Move nsswitch config into the moduleFlorian Klink2020-04-30
| | | | | | | | | | | | Motivation: #86350
* | | Merge pull request #85589 from emilazy/add-acme-maintainers-teamworldofpeace2020-04-28
|\ \ \ | | | | | | | | Add ACME maintainers team
| * | | nixos/acme: set maintainers to acme teamEmily2020-04-20
| | | |
* | | | Merge pull request #80896 from clkamp/pam-unix-add-nodelayworldofpeace2020-04-28
|\ \ \ \ | | | | | | | | | | nixos/security/pam: Add nodelay option
| * | | | nixos/security/pam: Add nodelay optionChristian Lütke-Stetzkamp2020-02-24
| | | | | | | | | | | | | | | | | | | | Closes #65551
* | | | | prey-bash-client: removeJörg Thalheim2020-04-28
| |_|_|/ |/| | | | | | | | | | | prey-bash-client is deprecated since 2018
* | | | treewide: add types to boolean / enable options or make use of mkEnableOptionDominik Xaver Hörl2020-04-27
| |/ / |/| |
* | | Merge pull request #85365 from immae/fix_acme_postrunworldofpeace2020-04-18
|\ \ \ | | | | | | | | nixos/acme: Fix postRun in acme certificate being ran at every run
| * | | nixos/acme: Fix postRun in acme certificate being ran at every runIsmaël Bouya2020-04-17
| | | |
* | | | Revert "nixos/acme: Fix allowKeysForGroup not applying immediately"Arian van Putten2020-04-16
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 5532065d0690645f0a813fed6e68163b0f4774d4. As far as I can tell setting RemainAfterExit=true here completely breaks certificate renewal, which is really bad! the sytemd timer will activate the service unit every OnCalendar=, however with RemainAfterExit=true the service is already active! So the timer doesn't rerun the service! The commit also broke the actual tests, (As it broke activation too) but this was fixed later in https://github.com/NixOS/nixpkgs/pull/76052 I wrongly assumed that PR fixed renewal too, which it didn't! testing renewals is hard, as we need to sleep in tests.
* | | acme: share accounts between certificatesLucas Savva2020-04-14
| | | | | | | | | | | | | | | There are strict rate limits on account creation for Let's Encrypt certificates. It is important to reuse credentails when possible.
* | | acme: create certificates in subdirectoryJörg Thalheim2020-04-09
| | | | | | | | | | | | | | | | | | | | | This allows to have multiple certificates with the same common name. Lego uses in its internal directory the common name to name the certificate. fixes #84409
* | | nixos/acme: don't depend on multi-user.target inside a containerMaximilian Bosch2020-03-29
| | | | | | | | | | | | | | | | | | | | | On boot, a container doesn't have an uplink and would run into a timeout while waiting for cert renewal[1]. [1] https://github.com/NixOS/nixpkgs/pull/81371#issuecomment-605526099
* | | nixos/duosec: rename ikey option to integrationKeyAaron Andersen2020-03-22
| | |
* | | nixos/duosec: replace insecure skey option with secure secretKeyFile optionAaron Andersen2020-03-22
| | |
* | | nixos/duosec: fix indentationAaron Andersen2020-03-21
| |/ |/|
* | Merge pull request #72029 from lschuermann/tpm2-moduleSilvan Mosberger2020-03-15
|\ \ | | | | | | nixos/tpm2: init
| * | nixos/tpm2: initLeon Schuermann2020-03-15
| |/ | | | | | | | | This commit adds udev rules, the userspace resource manager and PKCS#11 module support.
* | nixos/sshd: add authorizedKeysCommand and authorizedKeysCommandUser optionsAaron Andersen2020-03-12
| |
* | Merge pull request #81369 from mweinelt/pr/acme-chmodSilvan Mosberger2020-03-07
|\ \ | | | | | | nixos/acme: apply chmod and ownership unconditionally
| * | nixos/acme: apply chmod and ownership unconditionallyMartin Weinelt2020-02-29
| | | | | | | | | | | | | | | | | | | | | Also separate directory and file permissions so the certificate files don't end up with the executable bit. Fixes #81335
* | | nixos/acme: force symlink from fullchain.pem to cert.pemYegor Timoshenko2020-03-04
| | | | | | | | | | | | Co-authored-by: emily <vcs@emily.moe>
* | | Merge pull request #80900 from emilazy/acme-must-stapleYegor Timoshenko2020-03-03
|\ \ \ | | | | | | | | nixos/acme: Must-Staple and extra flags
| * | | nixos/acme: add extraLegoRenewFlags optionEmily2020-02-29
| | | |
| * | | nixos/acme: add ocspMustStaple optionEmily2020-02-29
| | |/ | |/|
* | | Merge pull request #80856 from emilazy/adjust-acmeYegor Timoshenko2020-03-03
|\ \ \ | | | | | | | | nixos/acme: adjust renewal timer options
| * | | nixos/acme: adjust renewal timer optionsEmily2020-02-29
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current weekly setting causes every NixOS server to try to renew its certificate at midnight on the dot on Monday. This contributes to the general problem of periodic load spikes for Let's Encrypt; NixOS is probably not a major contributor to that problem, but we can lead by example by picking good defaults here. The values here were chosen after consulting with @yuriks, an SRE at Let's Encrypt: * Randomize the time certificates are renewed within a 24 hour period. * Check for renewal every 24 hours, to ensure the certificate is always renewed before an expiry notice is sent out. * Increase the AccuracySec (thus lowering the accuracy(!)), so that systemd can coalesce the renewal with other timers being run. (You might be worried that this would defeat the purpose of the time skewing, but systemd is documented as avoiding this by picking a random time.)
* | | Merge pull request #81371 from mweinelt/pr/acme-autostartYegor Timoshenko2020-03-01
|\ \ \ | | | | | | | | nixos/acme: renew after rebuild and on boot
| * | | nixos/acme: renew after rebuild and on bootMartin Weinelt2020-02-29
| | |/ | |/| | | | | | | Fixes #81069
* | | Merge pull request #80920 from worldofpeace/rngd-cleanup-shutdownworldofpeace2020-03-01
|\ \ \ | |/ / |/| | nixos/rngd: fix clean shutdown
| * | nixos/rngd: fix clean shutdownworldofpeace2020-02-23
| |/ | | | | | | | | | | | | | | | | | | It seems disabling DefaultDependencies removes these implicit dependencies [0] that we needed for shutdown to happen cleanly. Fixes #80871 [0]: https://www.freedesktop.org/software/systemd/man/systemd.service.html#Default%20Dependencies
* / nixos/acme: move the crt to fullchain.pemEmily2020-02-23
|/ | | | | | | | | | | lego already bundles the chain with the certificate,[1] so the current code, designed for simp_le, was resulting in duplicate certificate chains, manifesting as "Chain issues: Incorrect order, Extra certs" on the Qualys SSL Server Test. cert.pem stays around as a symlink for backwards compatibility. [1] https://github.com/go-acme/lego/blob/5cdc0002e9abb2463fffc962dadc3479f72d7486/acme/api/certificate.go#L40-L44
* Merge pull request #71302 from tokudan/encrypted-swap-entropy-fixMichele Guerini Rocco2020-02-12
|\ | | | | rngd: Start early during boot and encrypted swap entropy fix
| * security.rngd: start rngd during early boot to reduce entropy starvation due ↵Daniel Frank2020-02-08
| | | | | | | | to encrypted swap and remove PrivateTmp to avoid a circular dependency
* | Merge pull request #77578 from m1cr0man/masterFlorian Klink2020-02-10
|\ \ | | | | | | Replace simp-le with lego and support DNS-01 challenge
| * | nixos/acme: Update release note, remove redundant requiresLucas Savva2020-02-09
| |\| | | | | | | | | | Merge remote-tracking branch 'remotes/upstream/master'
| * | nixos/acme: Fix b.example.com testLucas Savva2020-02-09
| | |