Add selinux check to lorax-composer

anaconda needs to have SELinux set to disabled or permissive in order to
run correctly. Check at startup and exit with an error.
This commit is contained in:
Brian C. Lane 2018-05-03 16:49:34 -07:00
parent 5c25f98db7
commit 5e0246d4a9

View File

@ -28,6 +28,7 @@ import argparse
import grp import grp
import os import os
import pwd import pwd
import selinux
import sys import sys
import subprocess import subprocess
from threading import Lock from threading import Lock
@ -178,6 +179,9 @@ if __name__ == '__main__':
except KeyError: except KeyError:
errors.append("Missing group '%s'" % opts.group) errors.append("Missing group '%s'" % opts.group)
if selinux.is_selinux_enabled() and selinux.security_getenforce():
errors.append("selinux must be disabled or in Permissive mode.")
# No point in continuing if there are uid or gid errors # No point in continuing if there are uid or gid errors
if errors: if errors:
for e in errors: for e in errors: