Skip to content
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

shadow: Adjust all deployments #4913

Merged
merged 1 commit into from
Apr 12, 2024
Merged

Conversation

cgwalters
Copy link
Member

It was pointed out that in the previous change here we missed the fact that the previous deployments were accessible.

  • Move the logic into Rust, adding unit tests
  • Change the code to iterate over all deployments
  • Add an integration test too

Note: A likely future enhancement here will be to finally deny unprivileged access to non-default roots; cc
ostreedev/ostree#3211

tests/kolainst/destructive/shadow Dismissed Show dismissed Hide dismissed
tests/kolainst/destructive/shadow Dismissed Show dismissed Hide dismissed
Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Some minor comments (and I think a bug in the unit test), but LGTM overall.

rust/src/passwd.rs Outdated Show resolved Hide resolved
rust/src/passwd.rs Outdated Show resolved Hide resolved
rust/src/passwd.rs Outdated Show resolved Hide resolved
src/daemon/rpm-ostree-fix-shadow-mode.service Show resolved Hide resolved
It was pointed out that in the previous change here we missed
the fact that the previous deployments were accessible.

- Move the logic into Rust, adding unit tests
- Change the code to iterate over all deployments
- Add an integration test too

Note: A likely future enhancement here will be to finally
deny unprivileged access to non-default roots; cc
ostreedev/ostree#3211
@cgwalters cgwalters enabled auto-merge April 12, 2024 19:59
@cgwalters cgwalters merged commit b18433b into coreos:main Apr 12, 2024
16 of 17 checks passed
pub(crate) fn fix_shadow_perms_in_root(root: &Dir) -> Result<bool> {
let zero_perms = Permissions::from_mode(0);
let mut changed = false;
for path in ["etc/shadow", "etc/shadow-", "etc/gshadow", "etc/gshadow-"] {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HuijingHei found that we are not fixing /usr/etc/shadow and /usr/etc/gshadow. I think this means we need another patch right @cgwalters ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conceptually those files are part of the immutable base image defaults, so we "can't"¹ change them per instance.

They need to get fixed on the build server.

Note also, that because we don't have any hardcoded passwords in our base images, it doesn't actually matter if /usr/etc/shadow is world readable because there's nothing there.

¹ Of course, we could mask them or something but I don't think it matters, we can just explain the above

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess since useradd does not really work in layering yet is not an issue either? and if people are adding layered hardcoded credentials manually to shadow... they just need to fix it "downstream".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants