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

This commit is contained in:
h7x4
2025-10-17 06:06:47 +00:00
committed by GitHub
+29 -1
View File
@@ -1,6 +1,27 @@
{ 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 ${