-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[BUG] pam eauth fails with salt-master/salt-api running as user salt on 3006.x #64275
Comments
so, right now this might be more of a documentation issue. if you need pam, change the user back to root. which can be done in but i like the idea of a separate process for authentication, but that becomes more of a feature request for that part. |
It was a documentation issue for the 3006.0 release. Now, it's a breaking change that wasn't handled or communicated. I'm also going to disagree that users that need to use pam eauth are better off running the master as root rather than adding the salt user to the shadow group.. with the former, you've given the salt-master process the ability to do anything as root, with the latter you have only given it the ability to read I think requiring (rather than forcing) knowledge on to the user that pam needs shadow access is better than requiring them to have no understanding and just defaulting to running stuff as root. Asking through debconf if a user that runs a daemon should be given additional privilege to enable a feature is not unusual and is perfectly reasonable. I guess for the moment I'll work on some docs to cover this.
Yeah, I think that is probably the way to go longer term as will work across the various Linux distros. I'll have a think about how to do that. |
thank goodness I am using debian, otherwise the last 4 hours of my life would have been for naught! |
Why is salt trying to read the group file at all? Shouldn't it being going through the nss interface in the same way that getent group salt PAM+NSS is nice because it can transparently handle NIS/NIS+, LDAP, ActiveDirectory, etc such that all standard libc calls still work. Tools such as |
@major0 As far as I see it, Salt is already using PAM (and most likely, at least implicitly through libc, NSS). But that's not a silver bullet. If you run as a non-root user, If a process should be able to password-authenticate users without access to the password hashes (or even the raw passwords), this would have to be delegated to a trusted service (like SASL). I could imagine a salt-master root process taking care of authentication, while the more "salty" processes (Jobs, Highstate, etc.) runs as a non-root user. |
While I agree with all of your statements about the I must be missing something, because looking to see if someone is a member of a group does not use |
@major0 As far as I can read the conversation here, the issue is not about checking group membership, but about authenticating users, and for that, the salt master (or rather the chain salt-master -> libpam -> pam_unix) needs, at some point, read access to But digging deeper (see pam(7), pam_unix(8), and unix_chkpwd(8)), pam_unix seems to come prepared for usage as non-root, and giving xlock as a well-known example. This makes me wonder (for academic reasons*) if salt really uses libpam, or just calls the auth component "pam"? ( *) for practical reasons, I am fine running salt-master as root on a VM with no other purpose.) |
I was just curious: salt indeed loads the actual libpam library, and uses (by default) the pam "login" service: https://github.com/saltstack/salt/blob/master/salt/auth/pam.py#L229 and (at least here on Debian 12), my |
Found the cause, described here: linux-pam/linux-pam#112 (comment) tl;dr, as I understand it: Non-root-Users can only validate themselves. So if salt ran as user "salt", only the user "salt" could authenticate via PAM. What happens? Salt runs a subprocess calling libpam functions. libpam in turn runs its unix_chkpwd binary with that behaviour, which returns an authentication failure when it cannot read the shadow file. IMHO this is not a bug in Salt, but rather a result of various security design choices in libpam etc. |
@major0 - this isn't about getting group info, this is about being able to authenticate a user. Whilst not necessarily a "bug" in salt, it's a "breaking change" in the packaging for 3006.x when the default user that the I'd also like to actually resolve this issue in a way that isn't just "run the salt-master as root if you want to use pam eauth" - the most common use case I come across for using pam eauth is when using salt-api - that's essentially exposing the |
Hey guys this is still a problem in 3006.9 right ? I'm unable to login to Salt API on a master running as a non-root user |
Are these
|
eapi pam authentication started to work after we found this line in salt\pam.py
|
Hey @amalaguti, thanks for your response! However, I don't understand how this fixes the issue mentioned previously by @MartinEmrich here:
@amalaguti Do you use the same user to run the salt master and authenticate against the API? |
And about my comment on using |
Description
Running the salt-master process under the
salt
user breaks pam eauth as thesalt
user can't read/etc/shadow
and/etc/gshadow
This issue is documented in SEP19 and Issue 7762
Setup
Steps to Reproduce the behavior
Configure the salt master to use pam eauth -
Expected behavior
Versions Report
Additional context
This was a known issue with running with the salt-master as a non-root user - documented in SEP19, issue 61770 and has been called out in the eauth documentation for a long time...
There's a simple fix for Debian derived distributions - adding the
salt
user to theshadow
group allows thesalt-master
process to read/etc/shadow
and resolvesthe issue. This doesn't work for RH derived distros.
I'd suggest that for Debian derivatives whether to add
salt
to theshadow
group should be asked through debconf - that way folk that need to use eauth/pam can do so but those who don't, don't expose the content of/etc/shadow
to thesalt
user.I'm not sure how to easily handle this to RPM packages as I'm less familiar with the options there.
Best long term solution would be to have a small separate privileged process for pam eauth that the salt master queries for authentication.
The text was updated successfully, but these errors were encountered: