fix(ipa): suppress Kerberos NFS services in LXC containers #84

Merged
beatzaplenty merged 1 commits from worktree-ipa-lxc-kerberos-fix into main 2026-07-28 02:13:48 +00:00
Showing only changes of commit 0b60d3ff2d - Show all commits
+36 -2
View File
@@ -41,10 +41,10 @@ lib.mkIf enabled {
security.ipa = {
enable = true;
domain = vars.homeDomain;
realm = realm;
inherit realm;
server = vars.ipaServer;
certificate = caCertPkg;
basedn = basedn;
inherit basedn;
ipaHostname = fqdn;
offlinePasswords = true;
cacheCredentials = true;
@@ -86,4 +86,38 @@ lib.mkIf enabled {
mode = "0600";
restartUnits = [ "sssd.service" ];
};
# security.ipa enables Kerberos (security.krb5) which causes systemd to
# start auth-rpcgss-module.service and rpc-gssd.service for Kerberos NFS
# authentication. LXC containers can't load the auth_rpcgss kernel module
# and don't have /var/lib/nfs/rpc_pipefs, so both services fail.
#
# The NixOS IPA module already adds a drop-in for auth-rpcgss-module.service
# with ConditionPathExists=/etc/krb5.keytab. We use lib.mkForce to win the
# text conflict and add ConditionVirtualization=!container alongside it so
# the service is skipped (not failed) in containers that do have a keytab.
# Same fix for rpc-gssd.service which also fails in containers.
systemd.units = lib.mkIf config.boot.isContainer {
"auth-rpcgss-module.service" = {
overrideStrategy = "asDropinIfExists";
text = lib.mkForce ''
[Unit]
ConditionPathExists=
ConditionPathExists=/etc/krb5.keytab
ConditionVirtualization=!container
'';
};
# rpc-gssd also has ConditionPathExists from the NixOS IPA module (and an
# X-Restart-Triggers store path from systemd.nix). Use mkForce to win;
# omit X-Restart-Triggers since this service is skipped in containers anyway.
"rpc-gssd.service" = {
overrideStrategy = "asDropinIfExists";
text = lib.mkForce ''
[Unit]
ConditionPathExists=
ConditionPathExists=/etc/krb5.keytab
ConditionVirtualization=!container
'';
};
};
}