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

composepost: Add SELinux equivalency rule for /usr/lib/opt → /opt #4819

Merged
merged 3 commits into from Feb 7, 2024

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Feb 6, 2024

When /opt packages get moved to /usr/lib/opt, they're not being labeled properly; they get the lib_t label instead of usr_t (or e.g. bin_t for /opt/bin).

This apparently works for e.g. Google Chrome (for which the /usr/lib/opt translation was added). But with state overlays, the goal is to support all /opt packages and things will break without proper labeling.

Add an equivalency rule so that /usr/lib/opt is labeled like `/opt. This fixes the SELinux issues that occur when layering Puppet in #233 (comment).

This should probably be upstreamed to SELinux (along with the /usr/etc equivalency rule just above).

Side note: in the status quo model where /opt is a symlink to /var/opt, everything is also mislabeled (it gets var_t). To be conservative, we don't fix this since presumably this works right now for people writing files there via e.g. Ignition/cloud-init and anyway all that would go away if we move over to state overlays by default in the future.

When `/opt` packages get moved to `/usr/lib/opt`, they're not being
labeled properly; they get the `lib_t` label instead of `usr_t` (or e.g.
`bin_t` for `/opt/bin`).

This apparently works for e.g. Google Chrome (for which the
`/usr/lib/opt` translation was added). But with state overlays, the goal
is to support all `/opt` packages and things will break without proper
labeling.

Add an equivalency rule so that `/usr/lib/opt` is labeled like `/opt.
This fixes the SELinux issues that occur when layering Puppet in
coreos#233 (comment).

This should probably be upstreamed to SELinux (along with the `/usr/etc`
equivalency rule just above).

Side note: in the status quo model where `/opt` is a symlink to
`/var/opt`, everything is *also* mislabeled (it gets `var_t`). To be
conservative, we don't fix this since presumably this works right now
for people writing files there via e.g. Ignition/cloud-init and anyway
all that would go away if we move over to state overlays by default in
the future.
@jlebon
Copy link
Member Author

jlebon commented Feb 6, 2024

Prow failing with

Feb 06 16:28:17 qemu0 kola-runext-state-overlays[1330]: # system_u:object_r:lib_t:s0
Feb 06 16:28:17 qemu0 kola-runext-state-overlays[1316]: error: File '/tmp/out.txt' doesn't match regexp ':bin_t:'

Some other kind of "off by one rpm-ostree release" thing going on possibly there. Will investigate.

Let's match CoreOS CI and also build RPMs here to not fall into issues
relating to supermin relying on the rpmdb:

coreos#4763 (comment)

This implicitly reverts 1451675.
The Prow CI build job we have doesn't seem to keep the git remote
around.
@jlebon jlebon merged commit 9f7cc77 into coreos:main Feb 7, 2024
17 checks passed
@jlebon jlebon deleted the pr/opt-relabel branch February 7, 2024 12:22
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.

None yet

2 participants