2013-05-14 00:03:24 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-03-29 03:28:22 +00:00
|
|
|
set -eux
|
|
|
|
set -o pipefail
|
2013-05-16 02:33:24 +00:00
|
|
|
|
2014-07-21 13:31:55 +00:00
|
|
|
if [ -d /sys/fs/selinux -a /etc/selinux/targeted/contexts/files/file_context\
|
|
|
|
s -a -x /usr/sbin/setfiles ]; then
|
2014-01-23 12:21:58 +00:00
|
|
|
# Without fixing selinux file labels, sshd will run in the kernel_t domain
|
|
|
|
# instead of the sshd_t domain, making ssh connections fail with
|
|
|
|
# "Unable to get valid context for <user>" error message
|
|
|
|
setfiles /etc/selinux/targeted/contexts/files/file_contexts /
|
|
|
|
else
|
2014-07-21 13:31:55 +00:00
|
|
|
echo "Skipping SELinux relabel, since setfiles is not available."
|
|
|
|
echo "Touching /.autorelabel to schedule a relabel when the image boots."
|
|
|
|
touch /.autorelabel
|
2014-01-23 12:21:58 +00:00
|
|
|
fi
|