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

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Sep 10, 2024

The rdcore bind-boot command write files to the bootfs but currently doesn't relabel them. Let's just relabel it from this side for now. In the future we could look at having rdcore call setfiles like Ignition does, or better, make coreos-relabel a more public API.

This fixes coreos/fedora-coreos-tracker#1770 for new installs.

Refrained from adding tests for this. I think instead what we need is once all these relabeling issues are fixed, a test that verifies that everything is labeled.

The `rdcore bind-boot` command write files to the bootfs but currently
doesn't relabel them. Let's just relabel it from this side for now.
In the future we could look at having `rdcore` call `setfiles` like
Ignition does, or better, make `coreos-relabel` a more public API.

This fixes coreos/fedora-coreos-tracker#1770
for new installs.

Refrained from adding tests for this. I think instead what we need is
once all these relabeling issues are fixed, a test that verifies that
*everything* is labeled.
@@ -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.

Comment on lines +47 to +51
# 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
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).

Copy link
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for digging in to this

@jlebon jlebon merged commit e183044 into coreos:testing-devel Sep 10, 2024
3 checks passed
@jlebon jlebon deleted the pr/boot-edit-relabel branch September 10, 2024 18:19
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.

coreos-boot-edit.sh creates /boot/.root_uuid as unlabeled_t
2 participants