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

Add an allowlist test for non-root owned files and ensure their UID/GID are statically allocated #1826

Open
travier opened this issue Jul 7, 2022 · 9 comments
Labels
good first issue Good for newcomers jira For syncing to Jira. Only works for issues (i.e. not PRs)

Comments

@travier
Copy link
Member

travier commented Jul 7, 2022

Most of the files that are shipped as part of the ostree commit are root:root owned but a very small subset is not.

To make sure that those files end up using the same user and group in the final system, we need to make sure that their user -> UID and group -> GID associations are static.

Let's make a test that verify that for our current set of files.

See:

@travier travier added the good first issue Good for newcomers label Jul 7, 2022
@lucab
Copy link
Contributor

lucab commented Jul 7, 2022

I did an analysis pass on the OS content of current next, and these are the entries that need some tweaking:

# ostree ls <REV> -R / | grep -v ' 0 0'

-00640 0 992    540 /usr/etc/chrony.keys
-00644 0 985  27981 /usr/etc/dnsmasq.conf
d00755 0 985      0 /usr/etc/dnsmasq.d
d00750 0 998      0 /usr/etc/polkit-1/localauthority
d00700 999 0      0 /usr/etc/polkit-1/rules.d
-02555 0 999 334248 /usr/libexec/openssh/ssh-keysign
d00700 999 0      0 /usr/share/polkit-1/rules.d

These are the packages and bugzilla tickets for each of those:

@lucab
Copy link
Contributor

lucab commented Jul 11, 2022

The dnsmasq entries have been moved to root:root ownership in dnsmasq-2.86-10.fc36.

@cgwalters
Copy link
Member

It'd be good to socialize this on e.g. fedora-devel@ - this work conceptually isn't specific to FCOS and needs to be something that other OS developers/packagers understand. @lucab mind doing that?

@cgwalters
Copy link
Member

May even be Change worthy. Or perhaps packaging guidelines. And/or ensure that any tests for this are e.g. executed also for other editions.

@lucab
Copy link
Contributor

lucab commented Jul 14, 2022

Yes, that would help for packages that aren't directly used for base FCOS images. I'll try to put something together for fedora-devel after this initial small round of packages for our scenario is fixed.

@miabbott miabbott added the jira For syncing to Jira. Only works for issues (i.e. not PRs) label Jul 18, 2022
@lucab
Copy link
Contributor

lucab commented Aug 8, 2022

The ssh_keys group got moved to a static GID in openssh-8.8p1-3 (F37).

@cgwalters
Copy link
Member

I think this should actually be an rpm-ostree builtin feature.

@lucab
Copy link
Contributor

lucab commented Sep 2, 2022

@cgwalters mind detailing what is the this above? I was thinking of moving the ownership details of /etc content to systemd-tpmfiles, which would work better with dynamic users/groups. But /usr content is still a build-time problem open for brainstorming.
Right now we are already doing workarounds in rpm-ostree (pinning the dynamic IDs to static ones via manifest entries).

@cgwalters
Copy link
Member

I think rpm-ostree should traverse the target root (it has to anyways) and warn if there are any non-root owned files in /usr with dynamic ids.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers jira For syncing to Jira. Only works for issues (i.e. not PRs)
Projects
None yet
Development

No branches or pull requests

4 participants