Skip to content

use buildcatrust to generate trust stores - #136777

Merged
lukegb merged 6 commits into
NixOS:stagingfrom
lukegb:buildcatrust
Oct 9, 2021
Merged

lukegb merged 6 commits into
NixOS:stagingfrom
lukegb:buildcatrust

Conversation

@lukegb

@lukegb lukegb commented Sep 5, 2021

Copy link
Copy Markdown
Contributor
Motivation for this change
  • Generate three types of trust store
  • Support more methods of passing extra CAs to trust in a NixOS system
  • Reenable p11-kit support in Firefox
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@github-actions github-actions Bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: python Python is a high-level, general-purpose programming language. 8.has: module (update) This PR changes an existing module in `nixos/` labels Sep 5, 2021
Comment thread nixos/modules/security/ca.nix Resolved
@github-actions github-actions Bot added 6.topic: bsd Running or building packages on BSD 6.topic: emacs Text editor 6.topic: erlang General-purpose, concurrent, functional high-level programming language 6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: haskell General-purpose, statically typed, purely functional programming language 6.topic: kernel The Linux kernel labels Sep 7, 2021
@lukegb lukegb removed 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: haskell General-purpose, statically typed, purely functional programming language 6.topic: kernel The Linux kernel 8.has: documentation This PR adds or changes documentation 8.has: changelog This PR adds or changes release notes 2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: emacs Text editor 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 6.topic: policy discussion Discuss policies to work in and around Nixpkgs labels Sep 7, 2021

@sternenseemann sternenseemann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial impression, will have a more thorough look later hopefully.

Comment thread pkgs/data/misc/cacert/default.nix Resolved
Comment thread pkgs/data/misc/cacert/default.nix Resolved
Comment thread pkgs/data/misc/cacert/default.nix Resolved
Comment thread pkgs/data/misc/cacert/default.nix Resolved
@lukegb

lukegb commented Sep 17, 2021

Copy link
Copy Markdown
Contributor Author

nixos/tests/custom-ca.nix passes! (or well, it did before my most recent rebase on top of staging)

Comment thread pkgs/data/misc/cacert/default.nix Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
install -D ca-bundle.trust.p11-kit $p11kit/etc/ssl/trust-source/ca-bundle.trust.p11-kit
install -D ca-bundle.trust.p11-kit -t $p11kit/etc/ssl/trust-source

Comment thread pkgs/data/misc/cacert/default.nix Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
install -D ca-bundle.crt $out/etc/ssl/certs/ca-bundle.crt
install -D ca-bundle.crt -t $out/etc/ssl/certs

@sternenseemann

Copy link
Copy Markdown
Member

@ofborg build cacert
@ofborg test custom-ca

@rnhmjoj rnhmjoj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this!
I left some comments and suggestions, mostly about shell scripting.

Comment thread pkgs/data/misc/cacert/default.nix Resolved
Comment thread pkgs/data/misc/cacert/default.nix Resolved
Comment thread pkgs/data/misc/cacert/default.nix Resolved
Comment thread pkgs/data/misc/cacert/default.nix Resolved
Comment thread pkgs/data/misc/cacert/default.nix Resolved
Comment thread nixos/tests/custom-ca.nix Resolved
Comment thread nixos/tests/custom-ca.nix Resolved
@rnhmjoj rnhmjoj mentioned this pull request Oct 2, 2021
@rnhmjoj

rnhmjoj commented Oct 3, 2021

Copy link
Copy Markdown
Contributor

I'd like to have this in the 21.11 release, before the feature freeze.
@lukegb do you think you have time to finish it? Otherwise I'll try to pick up the work and open another PR.

@sternenseemann sternenseemann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing else stood out to me on this pass.

Comment thread pkgs/data/misc/cacert/default.nix Resolved
lukegb added 5 commits October 8, 2021 00:56
This introduces the ability to have additional certificates in the trust
store using an override, similar to how the blacklist is done. If the
certificates are provided in OpenSSL TRUSTED CERTIFICATE form, then
those trust bits will be respected.

It also adds a p11-kit compatible trust store output.
This allows users to specify custom CAs without needing to download the
entirety of the NSS source code - just certdata.txt, which should end up
in cache.nixos.org.
The cacert package can now generate p11-kit-compatible output itself,
as well as generating the correct set of outputs for fully-joined
and unbundled "traditional" outputs (in standard PEM and
OpenSSL-compatible formats).

@mweinelt mweinelt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and Firefox looks good.

@rnhmjoj

rnhmjoj commented Oct 14, 2021

Copy link
Copy Markdown
Contributor

Sorry for the late reply but it took me an age to build all the dependencies. The changes look good, for what I'm qualified to review, at least. Also, the basic custom-ca test is passing and re-enabling p11kit didn't bring back #126065, so far so good.

However, I noticed that MITMing Firefox with a system root CA doesn't work anymore, but I don't know for sure if this PR is related or it's due to some change upstream. Firefox should detect this and automatically enable security.enterprise_roots.enabled, but it doesn't and If I do that manually I still get SEC_ERROR_UNKNOWN_ISSUER.

@evrim

evrim commented Oct 20, 2021

Copy link
Copy Markdown
Contributor

@rnhmjoj

rnhmjoj commented Oct 20, 2021

Copy link
Copy Markdown
Contributor

@evrim That option should be enabled by default (it has been for a while), but it doesn't matter because setting enterpise_roots.enabled manually doesn't work either.

@jonringer

Copy link
Copy Markdown
Contributor

feel like there should also be a release note that this occurred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: python Python is a high-level, general-purpose programming language. 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants