()
| 315 | |
| 316 | #check function |
| 317 | def check_selinux(): |
| 318 | if distro not in [Fedora,CentOS,RHEL6,SUSE]: return # no selinux outside of those |
| 319 | enforcing = False |
| 320 | config_enforcing = False |
| 321 | try: |
| 322 | output = getenforce().stdout.decode('utf-8').strip() |
| 323 | if "nforcing" in output: |
| 324 | enforcing = True |
| 325 | if any ( [ s.startswith("SELINUX=enforcing") for s in open("/etc/selinux/config").readlines() ] ): |
| 326 | config_enforcing = True |
| 327 | else: |
| 328 | config_enforcing = False |
| 329 | except (IOError,OSError) as e: |
| 330 | if e.errno == 2: pass |
| 331 | else: raise CheckFailed("An unknown error (%s) took place while checking for SELinux"%str(e)) |
| 332 | if enforcing: |
| 333 | raise CheckFailed('''SELinux is set to enforcing. There are two options: |
| 334 | 1> Set it permissive in /etc/selinux/config, then reboot the machine. |
| 335 | 2> Type 'setenforce Permissive' in commandline, after which you can run this program again. |
| 336 | |
| 337 | We strongly suggest you doing the option 1 that makes sure SELinux goes into permissive after system reboot.\n''') |
| 338 | |
| 339 | if config_enforcing: |
| 340 | print("WARNING: We detected that your SELinux is not configured in permissive. to make sure cloudstack won't block by \ |
| 341 | SELinux after system reboot, we strongly suggest you setting it in permissive in /etc/selinux/config, then reboot the machine.") |
| 342 | |
| 343 | |
| 344 | def preflight_checks(do_check_kvm=True): |
nothing calls this directly
no test coverage detected