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

selinux: update eclass, libsepol to 3.1 and semodule-utils #172

Merged
merged 6 commits into from
Jul 16, 2021

Conversation

tormath1
Copy link
Contributor

@tormath1 tormath1 commented Jun 4, 2021

(this PR superseeds #66)

  • add a new package semodule-utils with temporary patch to avoid conflict with policycoreutils-2.4: this packages provide the same files
  • upgrade libsepol to 3.1 as it's required to upgrade libselinux
  • upgrade selinux-policy-2 eclass and patch it (https://bugs.gentoo.org/794682)

basically we can provide patches to a SELinux policies in the ebuild using the POLICY_PATCH variable but it was failing with:
[[ ${#files[@]} -eq 0 ]] && die "No *.{patch,diff} files in directory ${f}

Digging into the eclass, we have the following:
[[ -n ${POLICY_PATCH[*]} ]] && eapply -d "${S}/refpolicy/policy/modules" "${POLICY_PATCH[@]}"
so it seems the -d "${S}/refpolicy/policy/modules" is interpreted as "apply any patches you find in this repository" not sure why... if the it's confirmed by the gentoo-hardened let's push the patch upstream if not, let's move this eclass to ::coreos-overlay.

How to use

emerge-amd64-usr libsepol semodule-utils

Testing done

@tormath1 tormath1 self-assigned this Jun 4, 2021
@tormath1 tormath1 force-pushed the tormath1/selinux branch 2 times, most recently from 008c82d to f1df039 Compare June 11, 2021 09:27
@tormath1 tormath1 changed the title [wip] selinux: update eclass and libsepol to 3.1 selinux: update eclass, libsepol to 3.1 and semodule-utils Jun 11, 2021
@tormath1 tormath1 marked this pull request as ready for review June 11, 2021 09:47
@tormath1 tormath1 requested a review from a team June 11, 2021 09:48
tormath1 and others added 6 commits July 6, 2021 15:55
Signed-off-by: Mathieu Tortuyaux <mathieu@kinvolk.io>
Signed-off-by: Mathieu Tortuyaux <mathieu@kinvolk.io>
need to open a bug upstream - current discussions on IRC
Signed-off-by: Mathieu Tortuyaux <mathieu@kinvolk.io>
Signed-off-by: Mathieu Tortuyaux <mathieu@kinvolk.io>
Signed-off-by: Sayan Chowdhury <sayan@kinvolk.io>
Copy link
Contributor

@dongsupark dongsupark left a comment

Choose a reason for hiding this comment

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

Looks good in general.

Nits:

# policycoreutils-2.4 and semodule-utils provide the same files
RDEPEND="${DEPEND}
!=sys-apps/policycoreutils-2.4-r2
"
Copy link
Contributor

Choose a reason for hiding this comment

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

If semodule-utils requires Flatcar changes, then why don't we move it to coreos-overlay?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's right - it's an edge case actually: starting from policycoreutils-2.7, semodule-utils becomes a single entity; see this commit: SELinuxProject/selinux@c9c97d6.

In the current way we upgrade the things, semodule-utils needs to be installed after the policycoreutils upgrade - otherwise semodule-utils-3.1 will collide with some files provided by policycoreutils-2.4.

This blocker allows portage to first upgrade policycoreutils then install semodule-utils.

We can certainly move semodule-utils to ::coreos-overlay but we would need to move it back in ::portage-stable once the upgrade done. :)

@tormath1 tormath1 merged commit ab79908 into main Jul 16, 2021
@tormath1 tormath1 deleted the tormath1/selinux branch July 16, 2021 09:25
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