Archived
fix(ipa): suppress Kerberos NFS services in LXC containers
Check NixOS configurations / eval-hosts (pull_request) Successful in 10m30s
Check NixOS configurations / eval-hosts (pull_request) Successful in 10m30s
The NixOS IPA module adds ConditionPathExists=/etc/krb5.keytab drop-ins for auth-rpcgss-module.service and rpc-gssd.service via systemd.units. In LXC containers with keytabs those conditions pass, the services start, and then fail because auth_rpcgss can't be loaded and rpc_pipefs doesn't exist in the container namespace. Use lib.mkForce on our systemd.units text to win the conflict with NixOS's existing definitions, and include ConditionVirtualization=!container alongside the ConditionPathExists conditions so the services are skipped (inactive, not failed) in containers that have a keytab. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+36
-2
@@ -41,10 +41,10 @@ lib.mkIf enabled {
|
|||||||
security.ipa = {
|
security.ipa = {
|
||||||
enable = true;
|
enable = true;
|
||||||
domain = vars.homeDomain;
|
domain = vars.homeDomain;
|
||||||
realm = realm;
|
inherit realm;
|
||||||
server = vars.ipaServer;
|
server = vars.ipaServer;
|
||||||
certificate = caCertPkg;
|
certificate = caCertPkg;
|
||||||
basedn = basedn;
|
inherit basedn;
|
||||||
ipaHostname = fqdn;
|
ipaHostname = fqdn;
|
||||||
offlinePasswords = true;
|
offlinePasswords = true;
|
||||||
cacheCredentials = true;
|
cacheCredentials = true;
|
||||||
@@ -86,4 +86,38 @@ lib.mkIf enabled {
|
|||||||
mode = "0600";
|
mode = "0600";
|
||||||
restartUnits = [ "sssd.service" ];
|
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
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user