-
Notifications
You must be signed in to change notification settings - Fork 368
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
Set HOME_MODE to 0700 in Flatcar images #1400
Set HOME_MODE to 0700 in Flatcar images #1400
Conversation
Signed-off-by: Daniel Simionato <daniel.simionato@gmail.com>
Welcome @weseven! |
Hi @weseven. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
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.
@mboersma: GitHub didn't allow me to request PR reviews from the following users: jepio. Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
I wonder if this is something Flatcar upstream would be interested or what can be done using Ignition, since that would be probably more desirable than per-project hardening like in this case. |
I can give more context on that, since I made two PRs upstream:
In flatcar the file can be changed through ignition, true, but from my tests users created through the same ignition file will still have world readable home directories (that is, the useradd calls during ignition do not use the overridden value). I do believe setting This might also be useful to apply to other distros: RedHat based distributions already set it to 0700, Ubuntu sets it to 0750, but Debian for example leaves it commented as the upstream package. |
If this cannot be done via Ignition, I guess the change is fine, although it might be breaking for users which rely on that read access (I hit similar issue with Mariner recently). I always have a feeling that upstream image-builder should provide minimal viable images while hardening should be done for specific use-cases, similar to all other customizations, but I might be wrong, so I will let others decide :) |
My two cents (from someone, who in reality, knows zero about Flatcar). I'd be happy for this to go in because as a general rule because it hardens security and I would like to see a more security focused image coming out of the builder. Whilst we shouldn't be dictating the security posture of everyone, we should be providing as secure an image as is feasibly possible without hindering peoples development and deployments. That being said, I'd also like to see how it goes forward in the Flatcar repo because if it's fixed upstream, it seems a bit redundant to then have it set within image-builder too. |
FWIW: the way to do it through ignition would be like this:
(I couldn't get it to work for the default core user though).
I'd say it's probably a good idea - it's a better default and will be available faster if the change is done in image-builder. |
Co-authored-by: Jeremi Piotrowski <jeremi.piotrowski@gmail.com>
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.
/lgtm
Seems like we have a rough consensus that making this change here is worthwhile, although ideally it could be done upstream or in ignition.
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mboersma The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
This sets
HOME_MODE
to 0700 in /etc/login.defs.Currently it is unset in Flatcar (coming from Gentoo that keeps the upstream setting).
When
HOME_MODE
is unset, useradd uses the default umask of 022 when creating home directories for users.This causes home directories for all users created through ignition in Flatcar to be world readable.
Setting
HOME_MODE
to 0700 restrict home permissions to the owner, as is default in RHEL derived distros (Ubuntu uses 0750).