depot/third_party/nixpkgs/nixos/tests/kerberos/heimdal.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

47 lines
1.3 KiB
Nix

import ../make-test-python.nix ({pkgs, ...}: {
name = "kerberos_server-heimdal";
nodes.machine = { config, libs, pkgs, ...}:
{ services.kerberos_server =
{ enable = true;
settings.realms = {
"FOO.BAR".acl = [{principal = "admin"; access = ["add" "cpw"];}];
};
};
security.krb5 = {
enable = true;
package = pkgs.heimdal;
settings = {
libdefaults = {
default_realm = "FOO.BAR";
};
realms = {
"FOO.BAR" = {
admin_server = "machine";
kdc = "machine";
};
};
};
};
};
testScript = ''
machine.succeed(
"kadmin -l init --realm-max-ticket-life='8 day' --realm-max-renewable-life='10 day' FOO.BAR",
"systemctl restart kadmind.service kdc.service",
)
for unit in ["kadmind", "kdc", "kpasswdd"]:
machine.wait_for_unit(f"{unit}.service")
machine.succeed(
"kadmin -l add --password=admin_pw --use-defaults admin",
"kadmin -l ext_keytab --keytab=admin.keytab admin",
"kadmin -p admin -K admin.keytab add --password=alice_pw --use-defaults alice",
"kadmin -l ext_keytab --keytab=alice.keytab alice",
"kinit -kt alice.keytab alice",
)
'';
meta.maintainers = [ pkgs.lib.maintainers.dblsaiko ];
})