Skip to contentSkip to conversation

refpolicy: Add generic refpolicy recipe with configurable policy type.

RFC Superseded Philip Tricca 1 participant 2 messages Nov 13, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC 1/1 refpolicy: Add generic refpolicy recipe with configurable policy type.

This RFC is a significant departure from the way the policy packages are currently set up. The noteworthy differences are:
1) the POLICY_TYPE variable can be set as configuration outside the policy recipe
2) a single refpolicy recipe can be used to build all 3 policy types
3) DEFAULT_POLICY from selinux-config can be set outside the config recipe
4) refpolicy depends on the config and sets the DEFAULT_POLICY accordingly

This approach was taken to allow the use of a policy type beyond MLS. I've left the other refpolicy-* recipes in tact but if this approach is acceptable they could be removed if we're willing to accept the limitation that only one policy may be installed on a given image. If this limitation isn't \
acceptable then they can be left as is.

Comments and input would be appreciated.

Cheers,
- Philip

---
 .../packagegroups/packagegroup-selinux-minimal.bb   |    3 +--
 recipes-security/refpolicy/refpolicy_2.20130424.bb  |   19 +++++++++++++++++++
 recipes-security/selinux/selinux-config_0.1.bb      |    2 +-
 3 files changed, 21 insertions(+), 3 deletions(-)
 create mode 100644 recipes-security/refpolicy/refpolicy_2.20130424.bb
recipes-security/packagegroups/packagegroup-selinux-minimal.bb +1 -2
index 072320d..af29da1 100644
@@ -13,6 +13,5 @@ ALLOW_EMPTY_${PN} = "1"
 RDEPENDS_${PN} = "\
 	policycoreutils-semodule \
 	policycoreutils-sestatus \
-	selinux-config \
-	refpolicy-mls \
+	refpolicy \
 "
recipes-security/refpolicy/refpolicy_2.20130424.bb new file +19 -0
new file mode 100644
index 0000000..c00aca3
@@ -0,0 +1,19 @@
+SUMMARY = "The SELinux reference policy."
+DESCRIPTION = "\
+This is the reference policy for the SELinux mandatory access control \
+system. There are 3 supported policy types: standard, MCS and MLS. The \
+standard policy is the most simple of the three providing the standard \
+type enforcement policy. The MCS policy adds an additional element to the \
+SELinux label called a category. Finally the MLS variant allows giving data \
+labels such as \"Top Secret\" and preventing such data from leaking to \
+processes or files with lower classification. \
+"
+
+PR = "r0"
+
+POLICY_TYPE ??= "mls"
+DEFAULT_POLICY = "${POLICY_TYPE}"
+
+RDEPENDS_${PN} = "selinux-config"
+
+include refpolicy_${PV}.inc
recipes-security/selinux/selinux-config_0.1.bb +1 -1
index 27d9995..293218e 100644
@@ -1,4 +1,4 @@
-DEFAULT_POLICY = "mls"
+DEFAULT_POLICY ??= "mls"
 
 SUMMARY = "SELinux configuration"
 DESCRIPTION = "\
Signature · 1 line
1.7.10.4
#1 lore raw

This requires a few tweaks before it will work as advertised. I had a variable set in a distro.conf that interfered. I'll send out a v2 in a bit.

- Philip

Quoted 74 lines · Philip Tricca

This RFC is a significant departure from the way the policy packages are currently set up. The noteworthy differences are:
1) the POLICY_TYPE variable can be set as configuration outside the policy recipe
2) a single refpolicy recipe can be used to build all 3 policy types
3) DEFAULT_POLICY from selinux-config can be set outside the config recipe
4) refpolicy depends on the config and sets the DEFAULT_POLICY accordingly

This approach was taken to allow the use of a policy type beyond MLS. I've left the other refpolicy-* recipes in tact but if this approach is acceptable they could be removed if we're willing to accept the limitation that only one policy may be installed on a given image. If this limitation isn't \
acceptable then they can be left as is.

Comments and input would be appreciated.

Cheers,
- Philip

---
 .../packagegroups/packagegroup-selinux-minimal.bb   |    3 +--
 recipes-security/refpolicy/refpolicy_2.20130424.bb  |   19 +++++++++++++++++++
 recipes-security/selinux/selinux-config_0.1.bb      |    2 +-
 3 files changed, 21 insertions(+), 3 deletions(-)
 create mode 100644 recipes-security/refpolicy/refpolicy_2.20130424.bb
recipes-security/packagegroups/packagegroup-selinux-minimal.bb +1 -2
index 072320d..af29da1 100644
@@ -13,6 +13,5 @@ ALLOW_EMPTY_${PN} = "1"
 RDEPENDS_${PN} = "\
 	policycoreutils-semodule \
 	policycoreutils-sestatus \
-	selinux-config \
-	refpolicy-mls \
+	refpolicy \
 "
recipes-security/refpolicy/refpolicy_2.20130424.bb new file +19 -0
new file mode 100644
index 0000000..c00aca3
@@ -0,0 +1,19 @@
+SUMMARY = "The SELinux reference policy."
+DESCRIPTION = "\
+This is the reference policy for the SELinux mandatory access control \
+system. There are 3 supported policy types: standard, MCS and MLS. The \
+standard policy is the most simple of the three providing the standard \
+type enforcement policy. The MCS policy adds an additional element to the \
+SELinux label called a category. Finally the MLS variant allows giving data \
+labels such as \"Top Secret\" and preventing such data from leaking to \
+processes or files with lower classification. \
+"
+
+PR = "r0"
+
+POLICY_TYPE ??= "mls"
+DEFAULT_POLICY = "${POLICY_TYPE}"
+
+RDEPENDS_${PN} = "selinux-config"
+
+include refpolicy_${PV}.inc
recipes-security/selinux/selinux-config_0.1.bb +1 -1
index 27d9995..293218e 100644
@@ -1,4 +1,4 @@
-DEFAULT_POLICY = "mls"
+DEFAULT_POLICY ??= "mls"
 
 SUMMARY = "SELinux configuration"
 DESCRIPTION = "\