Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

ignition: Enable SELinux relabeling #1784

Closed
wants to merge 2 commits into from

Conversation

JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Mar 31, 2022

ignition: Enable SELinux relabeling

This removes the LD Flag that disabled SELinux relabeling. It defaulted to true, thus enabling the feature.

Related Bug: flatcar/Flatcar#673

It was disabled.

Signed-off-by: Juan Antonio Osorio <[email protected]>
@@ -46,7 +46,7 @@ PATCHES=(

src_compile() {
export GO15VENDOREXPERIMENT="1"
GO_LDFLAGS="-X github.com/flatcar-linux/ignition/v2/internal/version.Raw=${PV} -X github.com/flatcar-linux/ignition/v2/internal/distro.selinuxRelabel=false -X github.com/flatcar-linux/ignition/v2/internal/distro.writeAuthorizedKeysFragment=false" || die
GO_LDFLAGS="-X github.com/flatcar-linux/ignition/v2/internal/version.Raw=${PV} -X github.com/flatcar-linux/ignition/v2/internal/distro.writeAuthorizedKeysFragment=false" || die
Copy link
Contributor

Choose a reason for hiding this comment

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

@tormath1 oh, I think writeAuthorizedKeysFragment should be true, right? Otherwise changes done by Ignition get lost when update-ssh-keys runs, or?

Copy link
Contributor

Choose a reason for hiding this comment

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

and we would need to trigger update-ssh-keys once because internal/authorized_keys_d/authorized_keys_d.go is gone

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll create a new issue for that

Copy link
Contributor

Choose a reason for hiding this comment

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

@tormath1
Copy link
Contributor

To verify it works as expected, we can run the following test:

sudo ./bin/kola run ... --remove=false --qemu-image ./flatcar_production_qemu_image.img cl.ignition.instantiated.enable-unit

This test will create the following service file:

/etc/systemd/system/[email protected]

which has the following label:

ls -aliZ /etc/systemd/system/[email protected]
29 -rw-r--r--. 1 root root system_u:object_r:unlabeled_t:s0 124 Mar 31 14:44 /etc/systemd/system/[email protected]

with this PR, result should be the following (obtained here after a restorecon command):

ls -aliZ /etc/systemd/system/[email protected]
29 -rw-r--r--. 1 root root system_u:object_r:etc_t:s0 124 Mar 31 14:44 /etc/systemd/system/[email protected]

One existing Mantle test could be updated consequently.

@tormath1
Copy link
Contributor

tormath1 commented Apr 1, 2022

CI failed for the following tests (94 tests, 82 ok, 11 not ok):

  • cl.disk.raid1.root
  • cl.ignition.oem.reuse
  • cl.disk.raid0.root
  • cl.ignition.oem.regular
  • cl.ignition.v1.btrfsroot
  • cl.ignition.v1.ext4root
  • cl.ignition.oem.wipe
  • cl.ignition.v2.ext4root
  • cl.ignition.v1.xfsroot
  • cl.ignition.v2.xfsroot
  • cl.ignition.v2.btrfsroot

Mainly for these two reasons:
https://gist.github.com/tormath1/f67ac94b4a035e7f6b17267a60de8726

@JAORMX
Copy link
Contributor Author

JAORMX commented Apr 4, 2022

Any ideas on how to fix this?

@pothos
Copy link
Contributor

pothos commented Apr 4, 2022

For the pwd.lock maybe a patch to Ignition, and for the readonly mount I'm not sure how to skip it best.

@JAORMX
Copy link
Contributor Author

JAORMX commented May 6, 2022

Unfortunately, I ran out of cycles for working on this.

@tormath1
Copy link
Contributor

tormath1 commented Mar 7, 2023

Superseded by #2500. Thanks for the initial work 💪

@tormath1 tormath1 closed this Mar 7, 2023
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.

3 participants