Unverified Commit cc3cb66a authored by h7x4's avatar h7x4 Committed by GitHub
Browse files

nixosTests.certmgr.{command,systemd}: fix tests (#435141)

parents 669c42b4 f5f0b6ad
Loading
Loading
Loading
Loading
+29 −1
Original line number Diff line number Diff line
{ runTest, pkgs, ... }:

let
  authKey = pkgs.writeText "auth-key" "1234ABCD";
  cfsslConfig = pkgs.writeText "config.json" (
    builtins.toJSON {
      # also see `cfssl print-defaults config`
      auth_keys = {
        my_key = {
          type = "standard";
          key = "file:${authKey}";
        };
      };
      signing = {
        default = {
          expiry = "168h";
          auth_key = "my_key";
          usages = [
            "digital signature"
          ];
        };
      };
    }
  );
  mkSpec =
    {
      host,
@@ -18,6 +39,7 @@ let
        label = "www_ca";
        profile = "three-month";
        remote = "localhost:8888";
        auth_key_file = toString authKey;
      };
      certificate = {
        group = "nginx";
@@ -75,7 +97,10 @@ let
            ];
            networking.extraHosts = "127.0.0.1 imp.example.org decl.example.org";

            services.cfssl.enable = true;
            services.cfssl = {
              enable = true;
              configFile = toString cfsslConfig;
            };
            systemd.services.cfssl.after = [
              "cfssl-init.service"
              "networking.target"
@@ -90,6 +115,9 @@ let
                User = "cfssl";
                Type = "oneshot";
                WorkingDirectory = config.services.cfssl.dataDir;
                # matches systemd.services.cfssl to run setup transparently
                StateDirectory = baseNameOf config.services.cfssl.dataDir;
                StateDirectoryMode = 700;
              };
              script = ''
                ${pkgs.cfssl}/bin/cfssl genkey -initca ${