1 import ./make-test-python.nix ({ pkgs, ... }:
3 test-certificates = pkgs.runCommandLocal "test-certificates" { } ''
5 echo insecure-root-password > $out/root-password-file
6 echo insecure-intermediate-password > $out/intermediate-password-file
7 ${pkgs.step-cli}/bin/step certificate create "Example Root CA" $out/root_ca.crt $out/root_ca.key --password-file=$out/root-password-file --profile root-ca
8 ${pkgs.step-cli}/bin/step certificate create "Example Intermediate CA 1" $out/intermediate_ca.crt $out/intermediate_ca.key --password-file=$out/intermediate-password-file --ca-password-file=$out/root-password-file --profile intermediate-ca --ca $out/root_ca.crt --ca-key $out/root_ca.key
16 { config, pkgs, ... }: {
22 intermediatePasswordFile = "${test-certificates}/intermediate-password-file";
24 dnsNames = [ "caserver" ];
25 root = "${test-certificates}/root_ca.crt";
26 crt = "${test-certificates}/intermediate_ca.crt";
27 key = "${test-certificates}/intermediate_ca.key";
30 dataSource = "/var/lib/step-ca/db";
45 { config, pkgs, ... }: {
46 security.acme.defaults.server = "https://caserver:8443/acme/acme/directory";
47 security.acme.defaults.email = "root@example.org";
48 security.acme.acceptTerms = true;
50 security.pki.certificateFiles = [ "${test-certificates}/root_ca.crt" ];
52 networking.firewall.allowedTCPPorts = [ 80 443 ];
65 catester = { config, pkgs, ... }: {
66 security.pki.certificateFiles = [ "${test-certificates}/root_ca.crt" ];
73 caserver.wait_for_unit("step-ca.service")
74 caclient.wait_for_unit("acme-finished-caclient.target")
75 catester.succeed("curl https://caclient/ | grep \"Welcome to nginx!\"")