-
Notifications
You must be signed in to change notification settings - Fork 133
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
Adduser consistency #73
Conversation
@dupuy Great work. I really like your approach and it is worth the effort to harmonize the user UID/GID across tools. I need to think further, if we should extract this part from hardening or leave it as a part. I will discuss this topic with @arlimus and @atomic111 |
uid_min: node['auth']['uid_min'], | ||
gid_min: node['auth']['gid_min'] | ||
) | ||
end | ||
|
||
adduser_conf = '/etc/adduser.conf' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this to attributes?
No problem. Just to be perfectly clear (line numbers of comments are not always unambiguous references), you are recommending that
That's reasonable too, although the second new template (for I'll try to get to this over the weekend. |
@dupuy Yeah, i think that nails it. The additional split makes sense for me. This keeps components small and manageable. Since this useradd vs adduser can be confusing for newcomers, I also think we should properly document what is for what. Do you need help for that? |
I can certainly add documentation if you can suggest the most appropriate place. There is another issue where I could use help, which is that to avoid feature slip between Chef and Puppet versions of the hardening, all of this (probably including Bernhard's original change as well), probably ought to be implemented there as well, and I know no more about Puppet than I did about Chef four months ago... |
@dupuy Of course. Lets first finish the chef implementation. Afterwards I can migrate it to puppet. |
@dupuy Anything I can do to bring this forward? |
Okay, I revised this PR to reflect the changes (I had a transatlantic flight without internet so I couldn't work on the other stuff that has kept this on the back burner) and added some basic tests and even documentation (just in the README). I rebased it all on the latest master, so should be a clean merge. There might be a problem with the tests in that the adduser recipe doesn't create the |
@dupuy great work. Let's rebase this PR to the latest master to ensure we pass all tests. |
OK, rebased, will see how Travis goes... |
OK, fixed up some more things revealed by the tests (a Pythonism in the actual code, and a bunch of problems with the Chefspec tests themselves), and I think that it should really go through this time. I did run the kitchen tests (or thought I did) before pushing these (and earlier) changes out for Travis, but maybe there's a problem with that, since there's no output from that stage of the kitchen run:
|
Looks like you havn't used |
Thanks for those pointers, I had thought the vagrant kitchen VM would run things directly (this is how Bernhard set up Chef cookbooks that we're using). Running |
One other note, the Rakefile seems not to properly detect failures in the 1.9.3 environment, as Job #153.1 shows:
|
we have to pull in the tests, because we share the same tests across all implementations: Chef, Puppet ansible. Therefore it's not possible to ship it directly with this repository. This is not required if you have just one DevOps tool. |
@dupuy amazing work, I need to add some fixes to os-hardening to meet the latest serverspec implementation before I am able to merge. Additionally I need to ensure this PR works great on RHEL-based systems. Maybe we need to restrict |
I haven't explicitly tested on RHEL/Fedora, but the adduser command can be absent on Debian/Ubuntu as well (admittedly much more likely to be absent on RHEL/Fedora) - to handle this regardless of platform the creation (update) of No other actions (apart from configuration file modifications) relative to adduser (or useradd) is taken by these recipes, so I think this should be sufficient restriction. |
including description of ['env']['umask'] and its new homedir aspect, and also ['auth']['root_ttys'] list, which was previously overlooked
bugfix: adjust travis to work with chef12/ruby2
I'm closing this PR, as its not mergeable in the current state. Sorry for that, please ping me if you thing its still needed, I'll try to pick it up and to get it to the mergeable state |
This is just a preliminary PR to get some feedback on scope (i.e. please don't merge!). If there is interest or you have other suggestions, I will add tests and docs and everything else per the guidelines.
Although Bernhard's UID_MIN/GID_MIN PR#62 prevents problems when you have some range of fixed UIDs or GIDs that you need to keep away from, it only does so when using the
useradd
command. Debian/Ubuntu systems (maybe some others?) also have a "friendlier" front-end calledadduser
that uses a separate configuration file for some reason. To really change the minimum UID/GID on a system where adduser is not just a symlink to useradd, you also need to update that separate configuration file.This PR does that, in two commits - the first only updates fields in
/etc/adduser.conf
that correspond to fields in/etc/login.defs
that is being modified per hardening. The second commit goes a bit further in trying to enforce consistency between adduser and useradd, and also updates another configuration file used by useradd:/etc/default/useradd
. There is a bit of diminishing returns here - the extra configuration fields are not really security-related, and bringing these files under Chef control makes it harder to configure them manually or in other cookbooks/recipes. The default values for all these fields are the same between the two tools.Anyhow, interested to know whether you think the second commit (or even the first one) are something you would want to merge, and I will polish them up if you give the green light.