mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
ipatests: add too-restritive mask tests
If the mask used during the installation is "too restrictive", ie.0027, installing FreeIPA results in a broken server or replica. Add two tests that expect an error message at install time to catch too restrictive masks. Related to: https://pagure.io/freeipa/issue/7193 Signed-off-by: François Cami <fcami@redhat.com> Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
This commit is contained in:
@@ -567,3 +567,49 @@ class TestKRAinstallAfterCertRenew(IntegrationTest):
|
||||
self.master.run_command(['kinit', 'admin'], stdin_text=passwd)
|
||||
cmd = self.master.run_command(['ipa-kra-install', '-p', dm_pass, '-U'])
|
||||
self.master.run_command(['systemctl', 'start', 'chronyd'])
|
||||
|
||||
|
||||
class TestMaskInstall(IntegrationTest):
|
||||
""" Test master and replica installation with wrong mask
|
||||
|
||||
This test checks that master/replica installation fails (expectedly) if
|
||||
mask > 022.
|
||||
|
||||
related ticket: https://pagure.io/freeipa/issue/7193
|
||||
"""
|
||||
|
||||
num_replicas = 0
|
||||
|
||||
@classmethod
|
||||
def install(cls, mh):
|
||||
super(TestMaskInstall, cls).install(mh)
|
||||
cls.bashrc_file = cls.master.get_file_contents('/root/.bashrc')
|
||||
|
||||
def test_install_master(self):
|
||||
self.master.run_command('echo "umask 0027" >> /root/.bashrc')
|
||||
result = self.master.run_command(['umask'])
|
||||
assert '0027' in result.stdout_text
|
||||
|
||||
cmd = tasks.install_master(
|
||||
self.master, setup_dns=False, raiseonerr=False
|
||||
)
|
||||
exp_str = ("Unexpected system mask")
|
||||
assert (exp_str in cmd.stderr_text and cmd.returncode != 0)
|
||||
|
||||
def test_install_replica(self):
|
||||
result = self.master.run_command(['umask'])
|
||||
assert '0027' in result.stdout_text
|
||||
|
||||
cmd = self.master.run_command([
|
||||
'ipa-replica-install', '-w', self.master.config.admin_password,
|
||||
'-n', self.master.domain.name, '-r', self.master.domain.realm,
|
||||
'--server', 'dummy_master.%s' % self.master.domain.name,
|
||||
'-U'], raiseonerr=False
|
||||
)
|
||||
exp_str = ("Unexpected system mask")
|
||||
assert (exp_str in cmd.stderr_text and cmd.returncode != 0)
|
||||
|
||||
def test_files_ownership_and_permission_teardown(self):
|
||||
""" Method to restore the default bashrc contents"""
|
||||
if self.bashrc_file is not None:
|
||||
self.master.put_file_contents('/root/.bashrc', self.bashrc_file)
|
||||
|
Reference in New Issue
Block a user