Skip to content
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

nixos/gdm: use provided PAM login configuration wherever possible #21860

Merged
merged 2 commits into from Apr 14, 2019

Conversation

outergod
Copy link
Contributor

Fixes #20608, fixes #21859

Motivation for this change

GDM's PAM modules in NixOS are a mess. pam.d/gdm is never used (gdm-password is used for logging in) and instead of re-using what's provided by pam.nix, there are half-broken custom modules written bei gdm.nix.
These changes substack/include the existing login PAM module akin to Fedora and fix two other issues mentioned above. Without this patch, SSSD authentication will also not work because only pam_unix.so is loaded.

This probably needs more thorough testing, any help appreciated.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@mention-bot
Copy link

@e-user, thanks for your PR! By analyzing the history of the files in this pull request, we identified @lethalman, @obadz and @spacefrogg to be potential reviewers.

@FRidh
Copy link
Member

FRidh commented Jan 13, 2017

Relevant discussion on unified PAM settings #17044

@FRidh FRidh added the 6.topic: GNOME GNOME desktop environment and its underlying platform label Jan 13, 2017
@outergod
Copy link
Contributor Author

Can we please follow up on this @lethalman @obadz @spacefrogg @FRidh?

@FRidh
Copy link
Member

FRidh commented Jan 4, 2019

It's a pity this did not get any further attention. I don't know much about PAM so I find it hard to review.

cc @jtojnar who works on Gnome package set.

@jtojnar
Copy link
Contributor

jtojnar commented Jan 4, 2019

Same here, do not know PAM well enough to review this.

@obadz
Copy link
Contributor

obadz commented Jan 4, 2019

Same here, sorry.

@worldofpeace
Copy link
Contributor

Looks like I'll be learning about PAM when I get some time 😄

@hedning
Copy link
Contributor

hedning commented Jan 13, 2019

Testing this now (the confilcts are pretty simple), and it works as advertised 👍

screenshot from 2019-01-13 12-01-08

@FRidh
Copy link
Member

FRidh commented Jan 13, 2019

@hedning care to open a new PR?

@hedning
Copy link
Contributor

hedning commented Jan 13, 2019

@FRidh sure, though I don't know much about pam either 😆

@e-user, it seems like you actually get pam, are you still interested in getting this merged?

@worldofpeace
Copy link
Contributor

So I'm slowly studying how PAM works, but it's unrealistic for me to just learn this so i can review the pr properly.

And I'm thinking having this couldn't possibly be much worse that what's already going on 😄
If I can check if they're aren't any holes in the implementation this should be fine to have.

I'd like to also open a pr for lightdm as gnome-keyring is broken there also.

If you disagree then we should move towards having #17044

@hedning
Copy link
Contributor

hedning commented Jan 19, 2019

And I'm thinking having this couldn't possibly be much worse that what's already going on

That is very true.

I'm guessing the only thing to look out for is the enableEcryptfs, we might need to add that back in. Though I don't know if it currently works, or if it's used a lot.

I'll try to get a PR going soon 🤞

@worldofpeace
Copy link
Contributor

And I'm thinking having this couldn't possibly be much worse that what's already going on

That is very true.

I'm guessing the only thing to look out for is the enableEcryptfs, we might need to add that back in. Though I don't know if it currently works, or if it's used a lot.

I'll try to get a PR going soon crossed_fingers

I agree, as the our experience has been degraded for a while and these pieces have remained relatively the same.

Also I think this probably should be adapted slightly since we have #30686

@hedning
Copy link
Contributor

hedning commented Jan 19, 2019

Also I think this probably should be adapted slightly since we have #30686

True, actually getting that to work might be ideal.

@outergod
Copy link
Contributor Author

Ugh, guys. After two years, there's finally interest in this.
I don't even have a NixOS installation right now, even though I'm using Nix on many systems.
Can't promise much, but if I get around to install a VM in the near future, I'm happy to pick this up a again, no promises.
What I can tell you however is that PAM is not difficult to grasp, after reading its manuals, esp. pam(8) and pam.d(5). In a nutshell, it works like this: Whenever a service authenticates against PAM, PAM looks up the matching service name in /etc/pam.d/$NAME, e.g. ssh, login or gdm. There are four "groups" in each such definition, account, auth(entication), password and session. These groups are made up of references to PAM "modules", i.e. plugins, with or without parameters, which are processed in the order defined, each within the respective group. For the authentication to succeed, all checks in accounts (which includes authorization aspects) have to pass, plus the checks in auth. password is only for updating passwords AFAIK and session for supplementary actions. Each module can implement functionalities in up to any four of those groups. Lastly, there are control keywords which define success and failure are being handled.

@turion
Copy link
Contributor

turion commented Apr 11, 2019

This looks like you're dropping ecryptfs support here. Would be a shame if that's missing in the end :/

Can you merge with master to get rid of the conflicts?

@outergod
Copy link
Contributor Author

I'm installing NixOS into a VM right now and will pick it up again, for real.

@outergod
Copy link
Contributor Author

Well, there you go. The ecryptfs stuff gets loaded through login, I double-checked that.

@GrahamcOfBorg GrahamcOfBorg added 10.rebuild-darwin: 0 10.rebuild-linux: 0 and removed 6.topic: GNOME GNOME desktop environment and its underlying platform labels Apr 13, 2019
@worldofpeace
Copy link
Contributor

Testing this now 💖

@worldofpeace
Copy link
Contributor

worldofpeace commented Apr 14, 2019

Ok so all the correct keyrings are created on login with GNOME.

I'm wondering if we can use use_authtok?
It's described as

the PAM module will use the provided new authentication token (new password) and will not request one from the user, even if none is available.

but that's not really in scope of this change.

Edit:
noticing you've done that already before syncing this change.

@outergod
Copy link
Contributor Author

@worldofpeace done, could you please test again with the new commit?

@worldofpeace
Copy link
Contributor

So here's what I've done to test again

  1. Logged in
    Saw the login keyring was unlocked ✔️
  2. Added some secrets to it (gnome-online-account, ssh, etc.)
    These should be unlocked when I login
  3. Logged out and logged in
    Keyring was unlocked and I can see my secrets ❇️

Copy link
Contributor

@worldofpeace worldofpeace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Thank you @e-user for continuing this.

Copy link
Contributor

@hedning hedning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking this up again ❤️ I've been using the previous version without issue for a while.

The changes looks good, nice getting rid of all the bloat.

gnome-keyring is now started when logging in to a console too. So I checked that it works logging in to a console before logging in to a gnome session, which it does 👍

Lets merge 🚀

@worldofpeace worldofpeace changed the title gdm: use provided PAM login configuration wherever possible nixos/gdm: use provided PAM login configuration wherever possible Apr 14, 2019
@worldofpeace
Copy link
Contributor

Just changed the commit messages slightly. Going for it.

@worldofpeace worldofpeace merged commit 4616b4e into NixOS:master Apr 14, 2019
GNOME automation moved this from To Do to Done Apr 14, 2019
@mat8913
Copy link
Contributor

mat8913 commented Apr 22, 2019

Can this please be in 19.03?

@alexeymuranov
Copy link
Contributor

I've created a quick PR (#61450) with these commits backported to 19.03.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
GNOME
  
Done
Development

Successfully merging this pull request may close these issues.

GDM doesn't unlock the GNOME keyring gdm doesn't respect security.pam.loginLimits