sec-policy/selinux-base: Add unknown-perms policy capability
authorJason Zaman <perfinion@gentoo.org>
Mon, 16 Dec 2019 12:23:23 +0000 (20:23 +0800)
committerJason Zaman <perfinion@gentoo.org>
Sat, 21 Dec 2019 14:00:44 +0000 (22:00 +0800)
Package-Manager: Portage-2.3.79, Repoman-2.3.16
Signed-off-by: Jason Zaman <perfinion@gentoo.org>
sec-policy/selinux-base/metadata.xml
sec-policy/selinux-base/selinux-base-9999.ebuild

index 16f3d9c00e6676fc29e3889405af7f75993c5a16..cf565be6f0442547e45841b35cc2db21755fe9bc 100644 (file)
@@ -14,5 +14,6 @@
                <flag name="open_perms">Enable the open permissions for file object classes (SELinux policy capability).</flag>
                <flag name="ubac">Enable User Based Access Control (UBAC) in the SELinux policy</flag>
                <flag name="unconfined">Enable support for the unconfined SELinux module</flag>
+               <flag name="unknown-perms">Default allow unknown classes in kernels newer than the policy (SELinux policy capability).</flag>
        </use>
 </pkgmetadata>
index 16ee9f2b2abbe106614df21241b8edaf7b87dd94..5342853efec55673754973fd0f1bd6ccc0c0f22d 100644 (file)
@@ -16,7 +16,7 @@ else
        KEYWORDS="~amd64 -arm ~arm64 ~mips ~x86"
 fi
 
-IUSE="doc +open_perms +peer_perms systemd +ubac +unconfined"
+IUSE="doc +unknown-perms systemd +ubac +unconfined"
 
 DESCRIPTION="Gentoo base policy for SELinux"
 HOMEPAGE="https://wiki.gentoo.org/wiki/Project:SELinux"
@@ -48,14 +48,11 @@ src_configure() {
 
        # Update the SELinux refpolicy capabilities based on the users' USE flags.
 
-       if ! use peer_perms; then
-               sed -i -e '/network_peer_controls/d' \
-                       "${S}/refpolicy/policy/policy_capabilities" || die
-       fi
-
-       if ! use open_perms; then
-               sed -i -e '/open_perms/d' \
-                       "${S}/refpolicy/policy/policy_capabilities" || die
+       if use unknown-perms; then
+               sed -i -e '/^UNK_PERMS/s/deny/allow/' "${S}/refpolicy/build.conf" \
+                       || die "Failed to allow Unknown Permissions Handling"
+               sed -i -e '/^UNK_PERMS/s/deny/allow/' "${S}/refpolicy/Makefile" \
+                       || die "Failed to allow Unknown Permissions Handling"
        fi
 
        if ! use ubac; then