1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

security.pki: add test for ca-certificates.crt

This commit is contained in:
Daiderd Jordan 2019-01-15 22:14:56 +01:00
parent 2e525a93da
commit c50ba6a354
No known key found for this signature in database
GPG key ID: D02435D05B810C96
2 changed files with 25 additions and 0 deletions

View file

@ -98,6 +98,7 @@ let
tests.nixpkgs-overlays = makeTest ./tests/nixpkgs-overlays.nix;
tests.programs-ssh = makeTest ./tests/programs-ssh.nix;
tests.programs-zsh = makeTest ./tests/programs-zsh.nix;
tests.security-pki = makeTest ./tests/security-pki.nix;
tests.services-activate-system = makeTest ./tests/services-activate-system.nix;
tests.services-buildkite-agent = makeTest ./tests/services-buildkite-agent.nix;
tests.services-nix-daemon = makeTest ./tests/services-nix-daemon.nix;

24
tests/security-pki.nix Normal file
View file

@ -0,0 +1,24 @@
{ config, pkgs, ... }:
{
security.pki.certificates = [
''
Fake Root CA
------------
''
];
test = ''
echo "checking for ca-certificates.crt in /etc" >&2
test -e ${config.out}/etc/ssl/certs/ca-certificates.crt
echo "checking NIX_SSL_CERT_FILE in set-environment" >&2
grep 'NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"' ${config.system.build.setEnvironment}
echo "checking for certificates in ca-certificates.crt" >&2
grep -q 'BEGIN CERTIFICATE' ${config.out}/etc/ssl/certs/ca-certificates.crt
echo "checking for extra certificate in ca-certificates.crt" >&2
grep 'Fake Root CA' ${config.out}/etc/ssl/certs/ca-certificates.crt
'';
}