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

Handle SELinux policy recompilation #1026

Closed
cgwalters opened this issue Jul 21, 2017 · 3 comments
Closed

Handle SELinux policy recompilation #1026

cgwalters opened this issue Jul 21, 2017 · 3 comments
Labels

Comments

@cgwalters
Copy link
Member

Migrating from https://bugzilla.gnome.org/show_bug.cgi?id=761620

OSTree basically encourages systems to move away from %post for systems management tasks. However, SELinux policy is very special as it gets loaded in the initramfs.
We need to recompile the policy after creating a new deployment. This will actually need to involve using e.g. systemd-nspawn -D /path/to/new-deployment semodule.
Need to work out:

  • Can we detect "is the policy changed"? Probably cmp /{usr/,}etc/selinux/targeted/policy/policy.29 - but is there an API for that?
  • Can we efficiently detect the case where on upgrade, the base policy version didn't change, so we don't need to recompile, and just propagate forward our modified policy from /etc?

Basically we need to use bwrap or so to rebuild policy in the new root right after we do the /etc merge.

More details in: http://marc.info/?l=selinux&m=145677940526857&w=2

@cgwalters cgwalters added the bug label Jul 21, 2017
@miabbott
Copy link
Collaborator

@jlebon
Copy link
Member

jlebon commented Feb 27, 2020

Totally missed this ticket before. But definitely worth cross-linking to coreos/rpm-ostree#27 and coreos/fedora-coreos-tracker#368.

I think we're on the same wavelength re. recompiling the policy though: coreos/fedora-coreos-tracker#368 (comment). (The suggestion I have is to make it an explicit opt-in instead of dynamically doing this -- that would require moving the binary policy under /usr, though I guess it already is, just /usr/etc :) ).

One note re.

However, SELinux policy is very special as it gets loaded in the initramfs.

This is not true today at least for Fedora and RHEL (and IIUC most other distros).

@jlebon
Copy link
Member

jlebon commented Apr 21, 2022

This is fixed by #2569. 🎉

@jlebon jlebon closed this as completed Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants