refpolicy: Setup virtual/refpolicy provider.

This allows us to provide a default policy through the
PREFERRED_PROVIDER mechanism for each of the example distro configs.
Consumers of meta-selinux will be able to override this at the config
level instead of having to depend on a specific policy package. We do
lose the ability install more than one policy package but this falls
in line with the embedded nature of the project.

Signed-off-by: Philip Tricca <flihp@twobit.us>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
This commit is contained in:
Philip Tricca 2016-04-04 00:21:33 +00:00 committed by Joe MacDonald
parent fc122bb653
commit 14c84b182b
5 changed files with 7 additions and 5 deletions

View File

@ -2,3 +2,4 @@ DISTRO = "oe-selinux"
DISTROOVERRIDES .= ":selinux"
DISTRO_FEATURES_append = " acl xattr pam selinux"
PREFERRED_PROVIDER_virtual/refpolicy ?= "refpolicy-mls"

View File

@ -26,7 +26,6 @@ RDEPENDS_${PN} = " \
selinux-autorelabel \
selinux-init \
selinux-labeldev \
refpolicy-standard \
refpolicy-mls \
virtual/refpolicy \
coreutils \
"

View File

@ -23,5 +23,5 @@ RDEPENDS_${PN} = "\
policycoreutils-setfiles \
selinux-config \
selinux-labeldev \
refpolicy-mls \
virtual/refpolicy \
"

View File

@ -3,6 +3,9 @@ LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=393a5ca445f6965873eca0259a17f833"
PROVIDES += "virtual/refpolicy"
RPROVIDES_${PN} += "virtual/refpolicy"
# Specific config files for Poky
SRC_URI += "file://customizable_types \
file://setrans-mls.conf \

View File

@ -1,4 +1,3 @@
DEFAULT_POLICY ??= "mls"
DEFAULT_ENFORCING ??= "enforcing"
SUMMARY = "SELinux configuration"
@ -30,7 +29,7 @@ SELINUX=${DEFAULT_ENFORCING}
# mls - Multi Level Security protection.
# targeted - Targeted processes are protected.
# mcs - Multi Category Security protection.
SELINUXTYPE=${DEFAULT_POLICY}
SELINUXTYPE=${@d.getVar("PREFERRED_PROVIDER_virtual/refpolicy", False)[len("refpolicy-"):]}
" > ${WORKDIR}/config
install -d ${D}/${sysconfdir}/selinux
install -m 0644 ${WORKDIR}/config ${D}/${sysconfdir}/selinux/