From 14e0eaaa35e1c3bba4680ca0c06b8fa9bafcdbc9 Mon Sep 17 00:00:00 2001 From: Javier Pena Date: Tue, 23 May 2017 17:37:18 +0200 Subject: [PATCH] Make SELinux enforcing/permisssive configurable for tests When running tests using run_tests.sh, we want to have the option to select if we want to run SELinux in enforcing (default) or permissive mode. Change-Id: I76776ff975a251c62f70c826913cd329b57c20c3 --- run_tests.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/run_tests.sh b/run_tests.sh index f40bd5e05..d1bfdc2d7 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -24,6 +24,7 @@ DELOREAN=${DELOREAN:-https://trunk.rdoproject.org/centos7-master/current-passed- DELOREAN_DEPS=${DELOREAN_DEPS:-https://trunk.rdoproject.org/centos7-master/delorean-deps.repo} GIT_BASE_URL=${GIT_BASE_URL:-git://git.openstack.org} ADDITIONAL_ARGS=${ADDITIONAL_ARGS:-} +SELINUX_ENFORCING=${SELINUX_ENFORCING:-true} # If logs should be retrieved automatically COPY_LOGS=${COPY_LOGS:-true} @@ -134,6 +135,13 @@ echo "${USER} hard nofile 65536" | $SUDO tee -a /etc/security/limits.conf echo "root soft nofile 65536" | $SUDO tee -a /etc/security/limits.conf echo "root hard nofile 65536" | $SUDO tee -a /etc/security/limits.conf +# Set SELinux to enforcing/permissive as needed +if [ "${SELINUX_ENFORCING}" = true ]; then + $SUDO setenforce 1 +else + $SUDO setenforce 0 +fi + # Setup repositories if [ "${MANAGE_REPOS}" = true ]; then $SUDO curl -L ${DELOREAN} -o /etc/yum.repos.d/delorean.repo