diff options
author | Philip Tricca <flihp@twobit.us> | 2013-09-26 20:49:39 +0000 |
---|---|---|
committer | Joe MacDonald <joe@deserted.net> | 2013-09-27 13:56:46 -0400 |
commit | 04044aa4e1269e9949b0d23daf30010fa0fff278 (patch) | |
tree | b24d97ae9286eac895c8b9fcc91f772f726d2656 | |
parent | c531a7a859762d510dfadf487efd9d283038205c (diff) | |
download | meta-selinux-04044aa4e1269e9949b0d23daf30010fa0fff278.tar.gz |
Check for the availability of 'secon' and 'setenforce' in the selinux-init.sh script.
This is for consistency and to aid in debugging.
Signed-off-by: Philip Tricca <flihp@twobit.us>
Signed-off-by: Joe MacDonald <joe@deserted.net>
-rw-r--r-- | recipes-security/selinux/selinux-config/selinux-init.sh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/recipes-security/selinux/selinux-config/selinux-init.sh b/recipes-security/selinux/selinux-config/selinux-init.sh index 1cdc3dd..8f3efac 100644 --- a/recipes-security/selinux/selinux-config/selinux-init.sh +++ b/recipes-security/selinux/selinux-config/selinux-init.sh | |||
@@ -6,8 +6,10 @@ CHCON=/usr/bin/chcon | |||
6 | MATCHPATHCON=/usr/sbin/matchpathcon | 6 | MATCHPATHCON=/usr/sbin/matchpathcon |
7 | FIXFILES=/sbin/fixfiles | 7 | FIXFILES=/sbin/fixfiles |
8 | RESTORECON=/sbin/restorecon | 8 | RESTORECON=/sbin/restorecon |
9 | SECON=/usr/bin/secon | ||
10 | SETENFORCE=/usr/sbin/setenforce | ||
9 | 11 | ||
10 | for i in ${CHCON} ${MATCHPATHCON} ${FIXFILES} ${RESTORECON} ; do | 12 | for i in ${CHCON} ${MATCHPATHCON} ${FIXFILES} ${RESTORECON} ${SECON} ${SETENFORCE}; do |
11 | test -x $i && continue | 13 | test -x $i && continue |
12 | echo "$i is missing in the system." | 14 | echo "$i is missing in the system." |
13 | echo "Please add \"selinux=0\" in the kernel command line to disable SELinux." | 15 | echo "Please add \"selinux=0\" in the kernel command line to disable SELinux." |
@@ -51,12 +53,12 @@ fi | |||
51 | 53 | ||
52 | # If first booting, the security context type of init would be | 54 | # If first booting, the security context type of init would be |
53 | # "kernel_t", and the whole file system should be relabeled. | 55 | # "kernel_t", and the whole file system should be relabeled. |
54 | if [ "`/usr/bin/secon -t --pid 1`" = "kernel_t" ]; then | 56 | if [ "`${SECON} -t --pid 1`" = "kernel_t" ]; then |
55 | echo "Checking SELinux security contexts:" | 57 | echo "Checking SELinux security contexts:" |
56 | check_rootfs | 58 | check_rootfs |
57 | echo " * First booting, filesystem will be relabeled..." | 59 | echo " * First booting, filesystem will be relabeled..." |
58 | test -x /etc/init.d/auditd && /etc/init.d/auditd start | 60 | test -x /etc/init.d/auditd && /etc/init.d/auditd start |
59 | /usr/sbin/setenforce 0 | 61 | ${SETENFORCE} 0 |
60 | ${RESTORECON} -R / | 62 | ${RESTORECON} -R / |
61 | ${RESTORECON} / | 63 | ${RESTORECON} / |
62 | echo " * Relabel done, rebooting the system." | 64 | echo " * Relabel done, rebooting the system." |