-
Notifications
You must be signed in to change notification settings - Fork 207
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
Support for other pam modules #3
Comments
You can write whatever you want in /etc/pam.d/swaylock, it is standard pam so should do anything you ask it to (defaults to the 'login' ones so your setup might work out of the box if you have configured it globally; if you haven't it's just a file to change) |
Here is my
This exactly the same I have for my
What happens is that swaylock doesn't support any of those, as I described:
In details, it fails with that pam setting, either if I have the yubikey plugged in (which would suffice since it is The thing is, it seems none of the following modules are called and it fails with the password. If I was mistyping my password, it'd fail after prompting me for the TOTP code, which is not happening. |
Ah, right, totp requires displaying something so that'll need extra support, I didn't pay attention to the last bit. |
If you think this should be a priority, implement it and send a patch. |
Ok, so I figured out what happens with the yubikey. The challenge-response file is stored under
This means that only a process being run as root can check if the attached yubikey is the one that generated that response for that challenge. Swaylock is installed as root, but is run as the user which calls it. It should have Now, for TOTP, I'm not sure how that prompt would need to be implemented. |
Running swaylock as root is an incredibly stupid idea. |
How else would you get |
I'm not adding yubico-specific code to swaylock. |
I'm not asking that. That is done by its pam module. The thing is, having pam to manage privilege access is a way to ensure setuid is secure. They're related on that end, otherwise The thing, in the end, is that if swaylock isn't run by root, it can't block that, so I can easily change the tty and |
Don't leave yourself logged in on other ttys, then? You still have to enter a password at getty unless you configure it to accept no password, in which case I can just reboot your computer and get in anyway. Even so, swaylock doesn't have to be root to prevent tty switching. Sway can already do that. |
You could also just kill sway directly. |
If that is the case, then it's buggy, because I've being swapping back and forth between a sway session to test this. Even so, you're relying on 'swaylock users will have their ttys secure' to make sure swaylock is secure. But we're diverging from the topic. It'd be totally fine if you otherwise state that you don't support pam, but most pam modules require to actually be run as root. If you're breaking that invariant, then you're making most of pam security useless, thus not entirely supporting it. |
Sway can do this, not that it does do it. PAM works fine now without root. I'm not making it root. |
You can do whatever you want, and I can also not use sway or swaylock. It is disappointing that the
|
Ahh, I almost forgot. You still have issues with google-authenticator though. But I'll leave that to anyone else interested in it. |
I'll give sway another shot. I do believe in its potential, so the issue still remains - mfa support is missing from swaylock. Even though there may be other ways to deal with dealing with challenge-response as in the yubikey - and I'll not discuss this for now - , there are other forms of mfa which might require another password to be typed and that is not supported by swaylock, which fails right after the password was correctly typed. |
Patches welcome, but I haven't changed my mind about swaylock running as a normal user. |
I'm not questioning the user running swaylock - though I'd appreciate a debate over the theme. Still, I think there should be a way to deal with MFA, which doesn't need to be a challenge-response to a third-party hardware. I'll see what - and if - I can do. |
How else are you gonna authenticate against the system password on FreeBSD? There you must be root to do that, even with PAM. To solve this problem in xsecurelock, I had to factor out the talking to PAM into a separate process (called |
swaylock can fork, drop root on the parent, and use the child to call I don't want to complicate the root code here by introducing PAM to the equation. Right now it's small, isolated, and only has root for a short period of time. It's easily reasoned about and easily verified. |
Yeah, that is the non PAM way though, and PAM is pretty important e.g. for
2FA stuff.
Of course, if you asked me this is a bug in PAM - shouldn't there be a way
I make PAM open all file handles it needs, then drop privs? But there is
none.
…On Wed, Dec 12, 2018, 07:46 Drew DeVault ***@***.*** wrote:
swaylock can fork, drop root on the parent, and use the child to call
getspnam, which works on FreeBSD. It then drops root and validates
passwords over a pipe.
I don't want to complicate the root code here by introducing PAM to the
equation. Right now it's small, isolated, and only has root for a short
period of time. It's easily reasoned about and easily verified.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://github.com/swaywm/sway/issues/1832#issuecomment-446575951>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAPWsBd4gXh9u8jypX3uYUSCgKYOogfGks5u4PqjgaJpZM4TdU9q>
.
|
AFAIK under Linux pam_unix uses a suid helper /usr/bin/unix_chkpwd to check the password against /etc/shadow (which is user unreadable). So pam_yubico should either implement something similar, or use files in $HOME. OTOH, pam_google_authenticator uses $HOME/.google_authenticator, so that should just work, but swaylock needs to support the full pam conversation. |
Just to mention that the pam-u2f module seems to work fine with swaylock, which is another option for mfa with yubikey. |
@hughwilliams94 How are you using this to interact with swaylock? I have a Librem Key on the way and my understanding is it supports pam-u2f. |
I have two Yubikeys (4 and 5). I have installed pam-u2f from the Arch Linux community repo (this package is developed by Yubico so may not be compatible with the Librem Key). I then have my
(Note the gnome_keyring details are unrelated to U2F so may not be relevant to your use-case.) and my
I am not sure why the change to The Most of the details are explained pretty clearly here (although these details are Yubikey specific so the Librem Key may have a different setup utility). |
Yup it does not work under FreeBSD... so you cannot unlock on FreeBSD even with correct pam settings and correct password. You can verify with pamtester that pam_unix.so only is working when pamtester is running as root |
I followed this guide Universal 2nd Factor
and it works. |
Can confirm that swaylock works with solokey!
auth sufficient pam_u2f.so authfile=/etc/u2f_mappings cue
auth include login I've also added the following line to auth sufficient pam_u2f.so authfile=/etc/u2f_mappings cue
FWIW, on Fedora 33, as of |
I have a fingerprint reader using pam_fprint and also noticed the weird "need to first enter a dummy password and hit enter, and only then the fingerprint reader will let me in" behavior with swaylock.
EDIT: #61 is about that oddity. |
This can probably be closed as not planed if the developers don't want to add extra code to support something like specific input fields. A yubikey for example works as auth method as long as you don't need to enter a pin and use the u2f pam module. |
Also note that swaylock is not and will never be the end-all, be-all lock screen. Any ext-session-lock-v1 client will do. |
Hi! I know this is low priority compared to the amazing work you're doing on moving sway to wlroots, but one of the things that'd hold me back from moving to sway is the lack of support for MFA on Swaylock.
I use a yubikey as a second factor of authencication and TOTP (google auth) as a fallback in case I lose the yubikey. For some reason, it seems that neither scenarios are covered or supported by swaylock.
Anyway, thanks for the good work.
Cheers,
Henry John Kupty
The text was updated successfully, but these errors were encountered: