Skip to content

Commit

Permalink
Skip the ACME mod_md test when the client is in enforcing mode
Browse files Browse the repository at this point in the history
mod_md requires its own SELinux policy which is only available
in the upstream github. It is beyond the scope of this test to
maintain SELinux policy only for the scenario so skip it
if the client is in enforcing.

Note that no check needs to be done on OS because that is
already handled by the outer skipif for skip_mod_md_tests.

https://pagure.io/freeipa/issue/8514

Signed-off-by: Rob Crittenden <[email protected]>
Reviewed-By: Mohammad Rizwan <[email protected]>
Reviewed-By: Florence Blanc-Renaud <[email protected]>
Reviewed-By: Alexander Bokovoy <[email protected]>
  • Loading branch information
rcritten committed Dec 4, 2020
1 parent d460f02 commit df4380c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ipatests/test_integration/test_acme.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@ def check_acme_status(host, exp_status, timeout=60):
return status


def get_selinux_status(host):
"""
Return the SELinux enforcing status.
Return True if enabled and enforcing, otherwise False
"""
result = host.run_command(['/usr/sbin/selinuxenabled'], raiseonerr=False)
if result.returncode != 0:
return False

result = host.run_command(['/usr/sbin/getenforce'], raiseonerr=False)
if 'Enforcing' in result.stdout_text:
return True

return False


def server_install_teardown(func):
def wrapped(*args):
master = args[0].master
Expand Down Expand Up @@ -290,6 +307,10 @@ def test_certbot_dns(self):

@pytest.mark.skipif(skip_mod_md_tests, reason='mod_md not available')
def test_mod_md(self):
if get_selinux_status(self.clients[0]):
# mod_md requires its own SELinux policy to grant perms to
# maintaining ACME registration and cert state.
raise pytest.skip("SELinux is enabled, this will fail")
# write config
self.clients[0].run_command(['mkdir', '-p', '/etc/httpd/conf.d'])
self.clients[0].run_command(['mkdir', '-p', '/etc/httpd/md'])
Expand Down

0 comments on commit df4380c

Please sign in to comment.