-
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
user.present group regression in 2017.7.5+ if gid_from_name is True #48640
Comments
In practise with my current state layout with I guess this could be forced by manually setting an |
ping @meaksh can you comment here since this was your change. |
Looking over #45365 some more, and looking over @meaksh's profile, I now have a better understanding of the problem. I rolled back to 2017.7.4 and ran the example state from that PR that is supposed to have problems (which I called
This is what I got:
As you can see, this was already working perfectly - no changes required. However now with the PR merged, Salt checks for the return value of Then I looked at meaksh's GitHub profile and noticed he's running SuSE. As we probably all know, RPM-based distros like RedHat and SuSE do things a bit differently with regards to user management. These distributions don't create one group per user by default as is the norm elsewhere, but instead create a How does this happen? It basically comes down to I've given the Salt code and changes a quick skim just now, and I didn't notice anywhere where a group is explicitly created by Salt, or anywhere where the This begs the question; what did
Here is the result on Debian Stretch with Salt 2017.7.4:
So the answer: absolutely nothing! So what the PR should have done is fix that by making it use the I'm actually confused now about what
? AFAIC the PR makes Even this bit in the |
My team recently upgraded from 2017.7.0 to 2018.3.2 and this behavior also exists. |
@boltronics thanks for all your work on this. we really appreciate it. @c4t3l looks like there is a proposed PR for this issue in #48704 |
Since the resolution involved adding a new feature, I don't expect the PR to be merged into a stable release until Fluorine, which I guess we will see sometime later this year. I don't know if there are any plans to revert to the original 2017.7.4 behaviour in the next point release. |
saltstack/salt#48640 explains how `gid_from_name` is broken/redundant
saltstack/salt#48640 explains how `gid_from_name` is broken/redundant
saltstack/salt#48640 explains how `gid_from_name` is broken/redundant
saltstack/salt#48640 explains how `gid_from_name` is broken/redundant
saltstack/salt#48640 explains how `gid_from_name` is broken/redundant
saltstack/salt#48640 explains how `gid_from_name` is broken/redundant
# [1.1.0](v1.0.6...v1.1.0) (2019-07-10) ### Bug Fixes * **package:** explicitly require package providing setcap ([d476700](d476700)) * **user:** handle removal of `gid_from_name` in Salt develop branch ([dee3748](dee3748)), closes [saltstack/salt#48640](saltstack/salt#48640) ### Code Refactoring * **defaults:** place common values in defaults.yaml ([3656e31](3656e31)) ### Continuous Integration * **kitchen+travis:** bring into line with `template-formula` ([34f05bd](34f05bd)) ### Features * add support for openSUSE ([76b8ac3](76b8ac3)) ### Tests * **user+group:** test for vault user/group existence ([ff5cdf9](ff5cdf9))
Description of Issue/Question
There is a regression when upgrading from 2017.7.4 to 2017.7.5+ which results in a change in behaviour to the
user.present
functionality. My understanding is that this should never happen in a bugfix release unless it cannot be avoided due to a security issue.I was building a new host with the following state applied (as rendered via
state.show_sls users
):Note I have replaced the id, fullname and gid arguments in all these examples to protect the innocent. I am focusing on just one specific user here for clarity.
This has worked for many years, and results in the following successful output on <=2017.7.4:
The
gid_from_name
argument has historically functioned in more or less the same way as useradd's-U
argument, which naturally makes sense given the module name is calleduseradd
.The original documentation for this option in Salt said:
If True, the default group id will be set to the id of the group with the same name as the user, Default is False.
To me, this implies that it will create the user for the group - which has always been how useradd has functioned, and is the most logical behaviour since the user has already indicated they want the group.
Well, despite all of this, it appears this behaviour changed in this PR - including the documentation!
I don't understand why this change in functionality was permitted in a point release since those are supposed to be stable. A request to update documentation to reflect new behaviour in a point release should be a red flag! Instead we are left with being unable to log into a new system until we change all affected configurations.
I tried manually correcting this:
I then re-ran my
users
state responsible for the above state sls data, and this still didn't work correctly! That left me with this situation:How is that even possible? Well let's look at the updated docs for
gid_from_name
:If True, the default group id will be set to the id of the group with the same name as the user. If the group does not exist the state will fail.
Well yes it's technically working as documented... but the user id now doesn't match up with the group id!
There must be a way to fix that... looking at the
uid
argument documentation:The user id to assign. If not specified, and the user does not exist, then the next available uid will be assigned.
So now there's no way to just say "match the group name". We can't embed some jinja to look it up, because that will be rendered before the group is created and it won't find anything!
This is all turning out to be quite a mess, and I'm at a loss as to how this was never picked up over the last few months by anyone. The way I see it I now have two options - write a custom state module, or replace the
user.present
sls blocks withcmd.run
blocks. If I'm missing a more elegant solution here, please let me know.Obviously nobody likes bugs and I've reported quite a few over the years, but this one makes me especially sad to see this broken so badly, in a point release, after it's been running for years without issue, in such a core piece of functionality that affects every host I manage.
Setup
This will probably suffice to trigger the main problem.
Steps to Reproduce Issue
sudo salt 'host-in-question' user.delete myuser1 remove=True
Note this command also removes the user group! I believe managing the user group is the more convenient behaviour here too - although this really should be documented since in some cases the user might not want or expect the group to be deleted.
sudo salt 'host-in-question' state.sls users
Versions Report
The text was updated successfully, but these errors were encountered: