Skip to content
This repository has been archived by the owner on Sep 18, 2020. It is now read-only.

initrd-setup-root: Process all tmpfile configs #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

initrd-setup-root: Process all tmpfile configs #143

wants to merge 1 commit into from

Conversation

glevand
Copy link

@glevand glevand commented Mar 29, 2018

Needed by the other Update selinux support PRs: coreos/portage-stable#654 and coreos/coreos-overlay#3155.

@@ -32,3 +31,7 @@ fi
if [ -d /usr/share/oem ] && mountpoint --quiet /sysroot/usr/share/oem; then
cp -Ra /usr/share/oem/. /sysroot/usr/share/oem
fi

# Add SELinux labels to files.
setfiles -F /sysroot/usr/lib/selinux/mcs/contexts/files/file_contexts /sysroot/
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this safe to do unconditionally? Won't this change labels that users have manually set?

Copy link
Author

Choose a reason for hiding this comment

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

I'm still looking into this, but yes, I think you are correct. We need to somehow arrange for all files created in the initramfs to have the proper SELinux labels, and this was to handle that. Some related info is here: coreos/bugs#2417

Copy link
Author

Choose a reason for hiding this comment

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

@dm0- I put this relabeling in to cover the Root on Raid case. Initially there were AVC dened messages without this relabeling, and the kola Root on Raid test was failing. After some recent investigation though I found that things work without it. Maybe due to the update of systemd.

With Root on Raid the rootfs is created above by running systemd-tmpfiles. At that time in the boot it seems the SELinux policy is not available, so systemd-tmpfiles does not make the correct labels, but later in the boot systemd runs systemd-tmpfiles again, and at that time the SELinux policy is available. Since these tmpfile configs are in a 'standard' location they are re-processed and the correct labels get created.

@@ -12,7 +12,6 @@ systemd-tmpfiles --root=/sysroot --create \
baselayout-home.conf etc.conf etc-shadow.conf

# Not all images provide these files so check before using them.
# Note: selinux-base.conf must run before libsemanage.conf
for config in baselayout-ldso.conf selinux-base.conf libsemanage.conf; do
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these still need to be conditional after SELinux is enabled for arm64? (I don't see any baselayout-ldso.conf file, so maybe that can just be removed.)

Copy link
Author

Choose a reason for hiding this comment

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

I'll remove baselayout-ldso.conf and change it to just run them all unconditionally.

All build targets should now have the same tmpfile configs, so
remove the conditional processing.  libsemanage.conf now creates
the directory it needs, so remove the comment here regarding a
dependency on selinux-base.conf.

Signed-off-by: Geoff Levand <geoff@infradead.org>
@glevand
Copy link
Author

glevand commented May 8, 2018

Rebased to latest, removed setting any SEL labels, changed to run systemd-tmpfiles on all tmpfile configs.

@glevand glevand changed the title initrd-setup-root: Add SELinux labels to files initrd-setup-root: Process all tmpfile configs May 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants