summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Tricca <flihp@twobit.us>2016-04-04 00:21:34 +0000
committerJoe MacDonald <joe_macdonald@mentor.com>2016-04-04 12:55:56 -0400
commit8094407fd77e9df1993be6ac266b159eca58df5e (patch)
tree4bdff9a8bd4572b2335ddc9a4f0f6c46798a3766
parent14c84b182b1a5c8f2be057c9066ea809db9f9ba6 (diff)
downloadmeta-selinux-8094407fd77e9df1993be6ac266b159eca58df5e.tar.gz
Integrate selinux-config into refpolicy_common.
With the virutal package there's no need for a separate recipe to build the config. This can be generated and included as part of the policy package. Signed-off-by: Philip Tricca <flihp@twobit.us> Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
-rw-r--r--recipes-security/packagegroups/packagegroup-core-selinux.bb1
-rw-r--r--recipes-security/packagegroups/packagegroup-selinux-minimal.bb1
-rw-r--r--recipes-security/refpolicy/refpolicy_common.inc30
-rw-r--r--recipes-security/selinux/selinux-config_0.1.bb40
4 files changed, 28 insertions, 44 deletions
diff --git a/recipes-security/packagegroups/packagegroup-core-selinux.bb b/recipes-security/packagegroups/packagegroup-core-selinux.bb
index 62c5a76..c6d22b7 100644
--- a/recipes-security/packagegroups/packagegroup-core-selinux.bb
+++ b/recipes-security/packagegroups/packagegroup-core-selinux.bb
@@ -22,7 +22,6 @@ RDEPENDS_${PN} = " \
22 packagegroup-selinux-policycoreutils \ 22 packagegroup-selinux-policycoreutils \
23 setools \ 23 setools \
24 setools-console \ 24 setools-console \
25 selinux-config \
26 selinux-autorelabel \ 25 selinux-autorelabel \
27 selinux-init \ 26 selinux-init \
28 selinux-labeldev \ 27 selinux-labeldev \
diff --git a/recipes-security/packagegroups/packagegroup-selinux-minimal.bb b/recipes-security/packagegroups/packagegroup-selinux-minimal.bb
index 87ae686..451ae8b 100644
--- a/recipes-security/packagegroups/packagegroup-selinux-minimal.bb
+++ b/recipes-security/packagegroups/packagegroup-selinux-minimal.bb
@@ -21,7 +21,6 @@ RDEPENDS_${PN} = "\
21 policycoreutils-semodule \ 21 policycoreutils-semodule \
22 policycoreutils-sestatus \ 22 policycoreutils-sestatus \
23 policycoreutils-setfiles \ 23 policycoreutils-setfiles \
24 selinux-config \
25 selinux-labeldev \ 24 selinux-labeldev \
26 virtual/refpolicy \ 25 virtual/refpolicy \
27" 26"
diff --git a/recipes-security/refpolicy/refpolicy_common.inc b/recipes-security/refpolicy/refpolicy_common.inc
index ba887e4..305675f 100644
--- a/recipes-security/refpolicy/refpolicy_common.inc
+++ b/recipes-security/refpolicy/refpolicy_common.inc
@@ -1,3 +1,5 @@
1DEFAULT_ENFORCING ??= "enforcing"
2
1SECTION = "base" 3SECTION = "base"
2LICENSE = "GPLv2" 4LICENSE = "GPLv2"
3 5
@@ -14,7 +16,8 @@ SRC_URI += "file://customizable_types \
14 16
15S = "${WORKDIR}/refpolicy" 17S = "${WORKDIR}/refpolicy"
16 18
17FILES_${PN} = " \ 19CONFFILES_${PN} += "${sysconfdir}/selinux/config"
20FILES_${PN} += " \
18 ${sysconfdir}/selinux/${POLICY_NAME}/ \ 21 ${sysconfdir}/selinux/${POLICY_NAME}/ \
19 ${datadir}/selinux/${POLICY_NAME}/*.pp \ 22 ${datadir}/selinux/${POLICY_NAME}/*.pp \
20 ${localstatedir}/lib/selinux/${POLICY_NAME}/ \ 23 ${localstatedir}/lib/selinux/${POLICY_NAME}/ \
@@ -25,7 +28,6 @@ FILES_${PN}-dev =+ " \
25" 28"
26 29
27DEPENDS += "checkpolicy-native policycoreutils-native m4-native" 30DEPENDS += "checkpolicy-native policycoreutils-native m4-native"
28RDEPENDS_${PN} += "selinux-config"
29 31
30PACKAGE_ARCH = "${MACHINE_ARCH}" 32PACKAGE_ARCH = "${MACHINE_ARCH}"
31 33
@@ -137,13 +139,37 @@ install_misc_files () {
137 oe_runmake 'DESTDIR=${D}' 'prefix=${D}${prefix}' install-headers 139 oe_runmake 'DESTDIR=${D}' 'prefix=${D}${prefix}' install-headers
138} 140}
139 141
142install_config () {
143 echo "\
144# This file controls the state of SELinux on the system.
145# SELINUX= can take one of these three values:
146# enforcing - SELinux security policy is enforced.
147# permissive - SELinux prints warnings instead of enforcing.
148# disabled - No SELinux policy is loaded.
149SELINUX=${DEFAULT_ENFORCING}
150# SELINUXTYPE= can take one of these values:
151# standard - Standard Security protection.
152# mls - Multi Level Security protection.
153# targeted - Targeted processes are protected.
154# mcs - Multi Category Security protection.
155SELINUXTYPE=${POLICY_TYPE}
156" > ${WORKDIR}/config
157 install -d ${D}/${sysconfdir}/selinux
158 install -m 0644 ${WORKDIR}/config ${D}/${sysconfdir}/selinux/
159}
160
140do_install () { 161do_install () {
141 prepare_policy_store 162 prepare_policy_store
142 rebuild_policy 163 rebuild_policy
143 install_misc_files 164 install_misc_files
165 install_config
144} 166}
145 167
146do_install_append(){ 168do_install_append(){
147 # While building policies on target, Makefile will be searched from SELINUX_DEVEL_PATH 169 # While building policies on target, Makefile will be searched from SELINUX_DEVEL_PATH
148 echo "SELINUX_DEVEL_PATH=${datadir}/selinux/${POLICY_NAME}/include" > ${D}${sysconfdir}/selinux/sepolgen.conf 170 echo "SELINUX_DEVEL_PATH=${datadir}/selinux/${POLICY_NAME}/include" > ${D}${sysconfdir}/selinux/sepolgen.conf
149} 171}
172
173sysroot_stage_all_append () {
174 sysroot_stage_dir ${D}${sysconfdir} ${SYSROOT_DESTDIR}${sysconfdir}
175}
diff --git a/recipes-security/selinux/selinux-config_0.1.bb b/recipes-security/selinux/selinux-config_0.1.bb
deleted file mode 100644
index e902e98..0000000
--- a/recipes-security/selinux/selinux-config_0.1.bb
+++ /dev/null
@@ -1,40 +0,0 @@
1DEFAULT_ENFORCING ??= "enforcing"
2
3SUMMARY = "SELinux configuration"
4DESCRIPTION = "\
5SELinux configuration files for Yocto. \
6"
7
8SECTION = "base"
9LICENSE = "MIT"
10LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
11PR = "r4"
12
13S = "${WORKDIR}"
14
15CONFFILES_${PN} += "${sysconfdir}/selinux/config"
16
17PACKAGE_ARCH = "${MACHINE_ARCH}"
18
19do_install () {
20 echo "\
21# This file controls the state of SELinux on the system.
22# SELINUX= can take one of these three values:
23# enforcing - SELinux security policy is enforced.
24# permissive - SELinux prints warnings instead of enforcing.
25# disabled - No SELinux policy is loaded.
26SELINUX=${DEFAULT_ENFORCING}
27# SELINUXTYPE= can take one of these values:
28# standard - Standard Security protection.
29# mls - Multi Level Security protection.
30# targeted - Targeted processes are protected.
31# mcs - Multi Category Security protection.
32SELINUXTYPE=${@d.getVar("PREFERRED_PROVIDER_virtual/refpolicy", False)[len("refpolicy-"):]}
33" > ${WORKDIR}/config
34 install -d ${D}/${sysconfdir}/selinux
35 install -m 0644 ${WORKDIR}/config ${D}/${sysconfdir}/selinux/
36}
37
38sysroot_stage_all_append () {
39 sysroot_stage_dir ${D}${sysconfdir} ${SYSROOT_DESTDIR}${sysconfdir}
40}