Check if selinux is enabled before getting the mode

This commit is contained in:
Martin Gracik 2012-06-05 16:25:53 +02:00
parent f73545471b
commit 0123377d9b

View File

@ -181,7 +181,7 @@ class Lorax(BaseLoraxClass):
# tools need to access (/etc/group, /etc/passwd, /etc/shadow etc.), # tools need to access (/etc/group, /etc/passwd, /etc/shadow etc.),
# is wrong and selinux therefore disallows access to these files. # is wrong and selinux therefore disallows access to these files.
logger.info("checking the selinux mode") logger.info("checking the selinux mode")
if selinux.security_getenforce(): if selinux.is_selinux_enabled() and selinux.security_getenforce():
logger.critical("selinux must be disabled or in Permissive mode") logger.critical("selinux must be disabled or in Permissive mode")
sys.exit(1) sys.exit(1)