Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/security/ca: enable support for compatibility bundles #286857

Merged
merged 2 commits into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion nixos/modules/security/ca.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ let
extraCertificateFiles = cfg.certificateFiles;
extraCertificateStrings = cfg.certificates;
};
caBundle = "${cacertPackage}/etc/ssl/certs/ca-bundle.crt";
caBundleName = if cfg.useCompatibleBundle then "ca-no-trust-rules-bundle.crt" else "ca-bundle.crt";
caBundle = "${cacertPackage}/etc/ssl/certs/${caBundleName}";

in

Expand All @@ -23,6 +24,17 @@ in
internal = true;
};

security.pki.useCompatibleBundle = mkEnableOption ''usage of a compatibility bundle.

Such a bundle consist exclusively of `BEGIN CERTIFICATE` and no `BEGIN TRUSTED CERTIFICATE`,
which is a OpenSSL specific PEM format.

It is known to be incompatible with certain software stacks.

Nevertheless, enabling this will strip all additional trust rules provided by the
certificates themselves, this can have security consequences depending on your usecases.
'';

security.pki.certificateFiles = mkOption {
type = types.listOf types.path;
default = [];
Expand Down
4 changes: 4 additions & 0 deletions pkgs/data/misc/cacert/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,17 @@ stdenv.mkDerivation rec {
--ca_bundle_input "${extraCertificatesBundle}" ${lib.escapeShellArgs (map (arg: "${arg}") extraCertificateFiles)} \
--blocklist "${blocklist}" \
--ca_bundle_output ca-bundle.crt \
--ca_standard_bundle_output ca-no-trust-rules-bundle.crt \
--ca_unpacked_output unbundled \
--p11kit_output ca-bundle.trust.p11-kit
'';

installPhase = ''
install -D -t "$out/etc/ssl/certs" ca-bundle.crt

# install standard PEM compatible bundle
install -D -t "$out/etc/ssl/certs" ca-no-trust-rules-bundle.crt

# install p11-kit specific output to p11kit output
install -D -t "$p11kit/etc/ssl/trust-source" ca-bundle.trust.p11-kit

Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/python-modules/buildcatrust/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

buildPythonPackage rec {
pname = "buildcatrust";
version = "0.1.3";
version = "0.2.1";
pyproject = true;

src = fetchPypi {
inherit pname version;
hash = "sha256:0s0m0fy943dakw9cbd40h46qmrhhgrcp292kppyb34m6y27sbagy";
hash = "sha256-mjX+T5xo6cD1GxJ49Tx7zthPbGPFPYaf2qcNKVHEzJA=";
};

nativeBuildInputs = [
Expand Down
Loading