-
-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update sssd integration with pam as documented by RedHat #31969
Conversation
@GrahamcOfBorg eval |
Looks good to me. (But I'm no PAM expert.) You may be interested in #22789. |
I can give this a try on my SSSD installation. |
@dezgeg Any results to share ? |
@grahamc Can you Please check this, its small and strait forward. |
@grahamc btw when looking at the PR again, this doesn't seem to change anything in the pam config unless the new option is set to true (which is false by default). So I guess it should be fine to merge ? |
Setting pam_unix set to sufficient means early-succeeding account management group, as soon as pam_unix.so is succeeding. This is not sufficient. For example, modules might install nss modules for user lookup, so pam_unix.so succeeds, and we end the stack successfully, even though other pam modules might want to do more extensive checks. Other distros set pam_unix.so to 'required', so if there are other pam modules in that management group, they get a chance to do some validation too. This broke SSSD, for which @PsyanticY added a workaround knob in NixOS#31969. This also breaks parts of Google OS Login, as the pam_oslogin_admin.so module doesn't get a chance to add a sudoers file for admins (while the NSS module fixes the lookup done in pam_unix.so) This changes the default of pam_unix.so to 'required' We don't drop the `security.pam.services.<name?>.sssdStrictAccess` option, as it's used some lines below to tweak error behaviour inside the pam sssd module.
Having pam_unix set to "sufficient" means early-succeeding account management group, as soon as pam_unix.so is succeeding. This is not sufficient. For example, nixos modules might install nss modules for user lookup, so pam_unix.so succeeds, and we end the stack successfully, even though other pam account modules might want to do more extensive checks. Other distros seem to set pam_unix.so to 'required', so if there are other pam modules in that management group, they get a chance to do some validation too. For SSSD, @PsyanticY already added a workaround knob in NixOS#31969, while stating this should be the default anyway. I did some thinking in what could break - after this commit, we require pam_unix to succeed, means we require `getent passwd $username` to return something. This is the case for all local users due to the passwd nss module, and also the case for all modules installing their nss module to nsswitch.conf - true for ldap (if not explicitly disabled) and sssd. I'm not so sure about krb5, cc @eqyiel for opinions. Is there some nss module loaded? Should the pam account module be placed before pam_unix? We don't drop the `security.pam.services.<name?>.sssdStrictAccess` option, as it's also used some lines below to tweak error behaviour inside the pam sssd module itself (by changing it's 'control' field). This is also required to get admin login for Google OS Login working (NixOS#51566), as their pam_oslogin_admin accounts module takes care of sudo configuration.
Motivation for this change
I was working on setting up an integration for NixOS instances with FreeIPA using SSSD.
In the SSSD config file i specify the groups/users that are allowed to access the server.
When setting up SSSD some changes on the pam services occurs. these changes do not allow the required behavior the way it is now as when i allow just a certain ldap user to access the server, he will just be able to access. So i needed to re-declare the pam.sshd module and add SSSD modules to the PAM configuration as specified in RedHat documentation (Check 4. ).
re-declaring the module is obviously not good practice so the option I am asking you to include will allows to include SSSD module in pam the way as Redhat specified if set to true or keep it as it is if it is false (the default state).
Please let me know if you need any further explanation or if i can improve my pull request as it is my first time contributing to an open source project :) .
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)