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

coreos-boot-edit: relabel rdcore files #3155

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ karg() {

# Mount /boot. Note that we mount /boot but we don't unmount it because we
# are run in a systemd unit with MountFlags=slave so it is unmounted for us.
bootmnt=/mnt/boot_partition
mkdir -p ${bootmnt}
bootmnt=/sysroot/boot
bootdev=/dev/disk/by-label/boot
mount -o rw ${bootdev} ${bootmnt}

Expand All @@ -44,3 +43,9 @@ fi
# 4. it adds GRUB bootuuid.cfg dropins so that GRUB selects the boot filesystem
# by UUID
rdcore bind-boot /sysroot ${bootmnt}
Copy link
Member

Choose a reason for hiding this comment

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

is this running before the policy is loaded and that's why the created files don't have labels?

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct.


# relabel files rdcore created; ideally in the future rdcore does this itself
coreos-relabel /boot/.root_uuid
if [ -e /sysroot/boot/grub2/bootuuid.cfg ]; then
coreos-relabel /boot/grub2/bootuuid.cfg
fi
Comment on lines +47 to +51
Copy link
Member

Choose a reason for hiding this comment

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

if the files that rdcore created are pretty static and we know the context the files should have I wonder if we should just hardcode it in rdcore. i.e. rather than have rdcore call coreos-relabel or some other command that consults the policy we just set the context directly when creating the files?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, in general I don't think it's a good idea to hardcode specific labels.

Copy link
Member

Choose a reason for hiding this comment

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

I would typically agree, just wondering if in this specific instance (a few files in a known location) if it would be advantageous (i.e. to avoid the layering violations and also the complexity of an alternative more comprehensive solution in rdcore).

Copy link
Member

@dustymabe dustymabe Sep 10, 2024

Choose a reason for hiding this comment

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

one other option here could be to have the package that delivers rdcore deliver a tmpfiles.d entry to request a relabel.

this assumes that there aren't selinux denials that happen between when this is run and tmpfiles that would invalidate this as an option (maybe it does).

Loading