2019-11-23 13:25:27 +01:00
|
|
|
import ../make-test-python.nix ({pkgs, ...}: {
|
2017-11-06 18:41:34 +01:00
|
|
|
name = "kerberos_server-mit";
|
2022-03-21 00:15:30 +01:00
|
|
|
nodes.machine = { config, libs, pkgs, ...}:
|
2017-11-06 18:41:34 +01:00
|
|
|
{ services.kerberos_server =
|
|
|
|
{ enable = true;
|
|
|
|
realms = {
|
|
|
|
"FOO.BAR".acl = [{principal = "admin"; access = ["add" "cpw"];}];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
krb5 = {
|
|
|
|
enable = true;
|
|
|
|
kerberos = pkgs.krb5Full;
|
|
|
|
libdefaults = {
|
|
|
|
default_realm = "FOO.BAR";
|
|
|
|
};
|
|
|
|
realms = {
|
|
|
|
"FOO.BAR" = {
|
|
|
|
admin_server = "machine";
|
|
|
|
kdc = "machine";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
users.extraUsers.alice = { isNormalUser = true; };
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
2019-11-23 13:25:27 +01:00
|
|
|
machine.succeed(
|
|
|
|
"kdb5_util create -s -r FOO.BAR -P master_key",
|
|
|
|
"systemctl restart kadmind.service kdc.service",
|
|
|
|
)
|
2017-11-06 18:41:34 +01:00
|
|
|
|
2019-11-23 13:25:27 +01:00
|
|
|
for unit in ["kadmind", "kdc"]:
|
|
|
|
machine.wait_for_unit(f"{unit}.service")
|
2017-11-06 18:41:34 +01:00
|
|
|
|
2019-11-23 13:25:27 +01:00
|
|
|
machine.succeed(
|
|
|
|
"kadmin.local add_principal -pw admin_pw admin",
|
|
|
|
"kadmin -p admin -w admin_pw addprinc -pw alice_pw alice",
|
|
|
|
"echo alice_pw | sudo -u alice kinit",
|
|
|
|
)
|
2017-11-06 18:41:34 +01:00
|
|
|
'';
|
|
|
|
})
|