diff options
author | Philip Tricca <flihp@twobit.us> | 2016-04-04 00:21:34 +0000 |
---|---|---|
committer | Joe MacDonald <joe_macdonald@mentor.com> | 2016-04-04 12:55:56 -0400 |
commit | 8094407fd77e9df1993be6ac266b159eca58df5e (patch) | |
tree | 4bdff9a8bd4572b2335ddc9a4f0f6c46798a3766 | |
parent | 14c84b182b1a5c8f2be057c9066ea809db9f9ba6 (diff) | |
download | meta-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>
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 @@ | |||
1 | DEFAULT_ENFORCING ??= "enforcing" | ||
2 | |||
1 | SECTION = "base" | 3 | SECTION = "base" |
2 | LICENSE = "GPLv2" | 4 | LICENSE = "GPLv2" |
3 | 5 | ||
@@ -14,7 +16,8 @@ SRC_URI += "file://customizable_types \ | |||
14 | 16 | ||
15 | S = "${WORKDIR}/refpolicy" | 17 | S = "${WORKDIR}/refpolicy" |
16 | 18 | ||
17 | FILES_${PN} = " \ | 19 | CONFFILES_${PN} += "${sysconfdir}/selinux/config" |
20 | FILES_${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 | ||
27 | DEPENDS += "checkpolicy-native policycoreutils-native m4-native" | 30 | DEPENDS += "checkpolicy-native policycoreutils-native m4-native" |
28 | RDEPENDS_${PN} += "selinux-config" | ||
29 | 31 | ||
30 | PACKAGE_ARCH = "${MACHINE_ARCH}" | 32 | PACKAGE_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 | ||
142 | install_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. | ||
149 | SELINUX=${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. | ||
155 | SELINUXTYPE=${POLICY_TYPE} | ||
156 | " > ${WORKDIR}/config | ||
157 | install -d ${D}/${sysconfdir}/selinux | ||
158 | install -m 0644 ${WORKDIR}/config ${D}/${sysconfdir}/selinux/ | ||
159 | } | ||
160 | |||
140 | do_install () { | 161 | do_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 | ||
146 | do_install_append(){ | 168 | do_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 | |||
173 | sysroot_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 @@ | |||
1 | DEFAULT_ENFORCING ??= "enforcing" | ||
2 | |||
3 | SUMMARY = "SELinux configuration" | ||
4 | DESCRIPTION = "\ | ||
5 | SELinux configuration files for Yocto. \ | ||
6 | " | ||
7 | |||
8 | SECTION = "base" | ||
9 | LICENSE = "MIT" | ||
10 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | ||
11 | PR = "r4" | ||
12 | |||
13 | S = "${WORKDIR}" | ||
14 | |||
15 | CONFFILES_${PN} += "${sysconfdir}/selinux/config" | ||
16 | |||
17 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
18 | |||
19 | do_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. | ||
26 | SELINUX=${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. | ||
32 | SELINUXTYPE=${@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 | |||
38 | sysroot_stage_all_append () { | ||
39 | sysroot_stage_dir ${D}${sysconfdir} ${SYSROOT_DESTDIR}${sysconfdir} | ||
40 | } | ||