summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Tricca <flihp@twobit.us>2015-11-08 19:00:39 +0000
committerJoe MacDonald <joe_macdonald@mentor.com>2015-11-27 09:18:14 -0500
commitac8450482dcbca2944c158f8b53ce295dc3cbb04 (patch)
treea751c450584cd4e58e351f70ba8a7ba11def2fcf
parent766bed8304ae123646232e0799c865d3af6db22c (diff)
downloadmeta-selinux-ac8450482dcbca2944c158f8b53ce295dc3cbb04.tar.gz
selinux-init: Break labeling of /dev out into separate script.
Remove selinux-init package from packagegroup-selinux-minimal. 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.bb2
-rw-r--r--recipes-security/selinux/selinux-init/selinux-init.sh9
-rw-r--r--recipes-security/selinux/selinux-init_0.1.bb2
-rw-r--r--recipes-security/selinux/selinux-labeldev/selinux-labeldev.sh24
-rw-r--r--recipes-security/selinux/selinux-labeldev_0.1.bb16
6 files changed, 43 insertions, 11 deletions
diff --git a/recipes-security/packagegroups/packagegroup-core-selinux.bb b/recipes-security/packagegroups/packagegroup-core-selinux.bb
index 472bf55..e46cda7 100644
--- a/recipes-security/packagegroups/packagegroup-core-selinux.bb
+++ b/recipes-security/packagegroups/packagegroup-core-selinux.bb
@@ -24,6 +24,7 @@ RDEPENDS_${PN} = " \
24 setools-console \ 24 setools-console \
25 selinux-config \ 25 selinux-config \
26 selinux-init \ 26 selinux-init \
27 selinux-labeldev \
27 refpolicy-standard \ 28 refpolicy-standard \
28 refpolicy-mls \ 29 refpolicy-mls \
29 coreutils \ 30 coreutils \
diff --git a/recipes-security/packagegroups/packagegroup-selinux-minimal.bb b/recipes-security/packagegroups/packagegroup-selinux-minimal.bb
index 42fb82d..34c5f7c 100644
--- a/recipes-security/packagegroups/packagegroup-selinux-minimal.bb
+++ b/recipes-security/packagegroups/packagegroup-selinux-minimal.bb
@@ -22,6 +22,6 @@ RDEPENDS_${PN} = "\
22 policycoreutils-sestatus \ 22 policycoreutils-sestatus \
23 policycoreutils-setfiles \ 23 policycoreutils-setfiles \
24 selinux-config \ 24 selinux-config \
25 selinux-init \ 25 selinux-labeldev \
26 refpolicy-mls \ 26 refpolicy-mls \
27" 27"
diff --git a/recipes-security/selinux/selinux-init/selinux-init.sh b/recipes-security/selinux/selinux-init/selinux-init.sh
index f9f0914..32c4de1 100644
--- a/recipes-security/selinux/selinux-init/selinux-init.sh
+++ b/recipes-security/selinux/selinux-init/selinux-init.sh
@@ -34,12 +34,6 @@ check_rootfs()
34 /sbin/shutdown -f -h now 34 /sbin/shutdown -f -h now
35} 35}
36 36
37# Because /dev/console is not relabeled by kernel, many commands
38# would can not use it, including restorecon.
39${CHCON} -t `${MATCHPATHCON} -n /dev/null | cut -d: -f3` /dev/null
40${CHCON} -t `${MATCHPATHCON} -n /dev/console | cut -d: -f3` /dev/console
41
42
43# If /.autorelabel placed, the whole file system should be relabeled 37# If /.autorelabel placed, the whole file system should be relabeled
44if [ -f /.autorelabel ]; then 38if [ -f /.autorelabel ]; then
45 echo "Checking SELinux security contexts:" 39 echo "Checking SELinux security contexts:"
@@ -65,7 +59,4 @@ if [ "`${SECON} -t --pid 1`" = "kernel_t" ]; then
65 /sbin/reboot 59 /sbin/reboot
66fi 60fi
67 61
68# Now, we should relabel /dev for most services.
69${RESTORECON} -RF /dev
70
71exit 0 62exit 0
diff --git a/recipes-security/selinux/selinux-init_0.1.bb b/recipes-security/selinux/selinux-init_0.1.bb
index cde142d..87f8dad 100644
--- a/recipes-security/selinux/selinux-init_0.1.bb
+++ b/recipes-security/selinux/selinux-init_0.1.bb
@@ -14,6 +14,6 @@ ${PN}_RDEPENDS = " \
14" 14"
15 15
16SRC_URI = "file://${BPN}.sh" 16SRC_URI = "file://${BPN}.sh"
17SELINUX_SCRIPT_DST = "0${BPN}" 17INITSCRIPT_PARAMS = "start 01 S ."
18 18
19require selinux-initsh.inc 19require selinux-initsh.inc
diff --git a/recipes-security/selinux/selinux-labeldev/selinux-labeldev.sh b/recipes-security/selinux/selinux-labeldev/selinux-labeldev.sh
new file mode 100644
index 0000000..62e7a42
--- /dev/null
+++ b/recipes-security/selinux/selinux-labeldev/selinux-labeldev.sh
@@ -0,0 +1,24 @@
1#!/bin/sh
2
3/usr/sbin/selinuxenabled 2>/dev/null || exit 0
4
5CHCON=/usr/bin/chcon
6MATCHPATHCON=/usr/sbin/matchpathcon
7RESTORECON=/sbin/restorecon
8
9for i in ${CHCON} ${MATCHPATHCON} ${RESTORECON}; do
10 test -x $i && continue
11 echo "$i is missing in the system."
12 echo "Please add \"selinux=0\" in the kernel command line to disable SELinux."
13 exit 1
14done
15
16# Because /dev/console is not relabeled by kernel, many commands
17# would can not use it, including restorecon.
18${CHCON} -t `${MATCHPATHCON} -n /dev/null | cut -d: -f3` /dev/null
19${CHCON} -t `${MATCHPATHCON} -n /dev/console | cut -d: -f3` /dev/console
20
21# Now, we should relabel /dev for most services.
22${RESTORECON} -RF /dev
23
24exit 0
diff --git a/recipes-security/selinux/selinux-labeldev_0.1.bb b/recipes-security/selinux/selinux-labeldev_0.1.bb
new file mode 100644
index 0000000..b692bb2
--- /dev/null
+++ b/recipes-security/selinux/selinux-labeldev_0.1.bb
@@ -0,0 +1,16 @@
1SUMMARY = "SELinux init script"
2DESCRIPTION = "Set SELinux labels for /dev."
3
4LICENSE = "MIT"
5LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
6
7${PN}_RDEPENDS = " \
8 coreutils \
9 libselinux-bin \
10 policycoreutils-setfiles \
11"
12
13SRC_URI = "file://${BPN}.sh"
14SELINUX_SCRIPT_DST = "0${BPN}"
15
16require selinux-initsh.inc