From 1ca7cb6585828312864eae6f5264e313be697bbf Mon Sep 17 00:00:00 2001 From: Sergey Orlov Date: Wed, 17 Feb 2021 12:23:33 +0100 Subject: [PATCH] ipatests: do not configure nameserver when installing client and replica When IPA master is installed without DNS, using it as nameserver creates invalid configuration. Related to https://pagure.io/freeipa/issue/8703 Reviewed-By: Florence Blanc-Renaud --- .../test_customized_ds_config_install.py | 1 + ipatests/test_integration/test_dnssec.py | 3 +- .../test_integration/test_installation.py | 73 +++++++++++++------ .../test_integration/test_ipahealthcheck.py | 2 +- ipatests/test_integration/test_ntp_options.py | 32 ++++---- .../test_replica_promotion.py | 3 +- .../test_integration/test_uninstallation.py | 5 +- 7 files changed, 78 insertions(+), 41 deletions(-) diff --git a/ipatests/test_integration/test_customized_ds_config_install.py b/ipatests/test_integration/test_customized_ds_config_install.py index 95195a014..4a9d8dbb8 100644 --- a/ipatests/test_integration/test_customized_ds_config_install.py +++ b/ipatests/test_integration/test_customized_ds_config_install.py @@ -69,4 +69,5 @@ class TestCustomDSConfigInstall(IntegrationTest): def test_customized_ds_install_replica(self): tasks.install_replica( self.master, self.replicas[0], setup_ca=False, + nameservers=None, extra_args=['--dirsrv-config-file', CONFIG_LDIF_PATH]) diff --git a/ipatests/test_integration/test_dnssec.py b/ipatests/test_integration/test_dnssec.py index b41ccd9e4..d80a77a81 100644 --- a/ipatests/test_integration/test_dnssec.py +++ b/ipatests/test_integration/test_dnssec.py @@ -304,7 +304,8 @@ class TestInstallDNSSECFirst(IntegrationTest): # support before Firewall(cls.master).enable_services(["dns"]) - tasks.install_replica(cls.master, cls.replicas[0], setup_dns=True) + tasks.install_replica(cls.master, cls.replicas[0], setup_dns=True, + nameservers=None) # backup trusted key tasks.backup_file(cls.master, paths.DNSSEC_TRUSTED_KEY) diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py index 673c6eb74..1aa283f54 100644 --- a/ipatests/test_integration/test_installation.py +++ b/ipatests/test_integration/test_installation.py @@ -62,13 +62,16 @@ class InstallTestBase1(IntegrationTest): num_replicas = 3 topology = 'star' + master_with_dns = False @classmethod def install(cls, mh): - tasks.install_master(cls.master, setup_dns=False) + tasks.install_master(cls.master, setup_dns=cls.master_with_dns) def test_replica0_ca_less_install(self): - tasks.install_replica(self.master, self.replicas[0], setup_ca=False) + tasks.install_replica( + self.master, self.replicas[0], setup_ca=False, + nameservers='master' if self.master_with_dns else None) def test_replica0_ipa_ca_install(self): tasks.install_ca(self.replicas[0]) @@ -80,7 +83,9 @@ class InstallTestBase1(IntegrationTest): tasks.install_dns(self.replicas[0]) def test_replica1_with_ca_install(self): - tasks.install_replica(self.master, self.replicas[1], setup_ca=True) + tasks.install_replica( + self.master, self.replicas[1], setup_ca=True, + nameservers='master' if self.master_with_dns else None) def test_replica1_ipa_kra_install(self): tasks.install_kra(self.replicas[1]) @@ -89,8 +94,9 @@ class InstallTestBase1(IntegrationTest): tasks.install_dns(self.replicas[1]) def test_replica2_with_ca_kra_install(self): - tasks.install_replica(self.master, self.replicas[2], setup_ca=True, - setup_kra=True) + tasks.install_replica( + self.master, self.replicas[2], setup_ca=True, setup_kra=True, + nameservers='master' if self.master_with_dns else None) def test_replica2_ipa_dns_install(self): tasks.install_dns(self.replicas[2]) @@ -100,21 +106,24 @@ class InstallTestBase2(IntegrationTest): num_replicas = 3 topology = 'star' + master_with_dns = False @classmethod def install(cls, mh): - tasks.install_master(cls.master, setup_dns=False) + tasks.install_master(cls.master, setup_dns=cls.master_with_dns) def test_replica1_with_ca_dns_install(self): - tasks.install_replica(self.master, self.replicas[1], setup_ca=True, - setup_dns=True) + tasks.install_replica( + self.master, self.replicas[1], setup_ca=True, setup_dns=True, + nameservers='master' if self.master_with_dns else None) def test_replica1_ipa_kra_install(self): tasks.install_kra(self.replicas[1]) def test_replica2_with_dns_install(self): - tasks.install_replica(self.master, self.replicas[2], setup_ca=False, - setup_dns=True) + tasks.install_replica( + self.master, self.replicas[2], setup_ca=False, setup_dns=True, + nameservers='master' if self.master_with_dns else None) def test_replica2_ipa_ca_install(self): tasks.install_ca(self.replicas[2]) @@ -130,20 +139,25 @@ class ADTrustInstallTestBase(IntegrationTest): """ num_replicas = 2 topology = 'star' + master_with_dns = False @classmethod def install(cls, mh): - tasks.install_master(cls.master, setup_dns=False) + tasks.install_master(cls.master, setup_dns=cls.master_with_dns) def install_replica(self, replica, **kwargs): tasks.install_replica(self.master, replica, setup_adtrust=True, **kwargs) def test_replica0_only_adtrust(self): - self.install_replica(self.replicas[0], setup_ca=False) + self.install_replica( + self.replicas[0], setup_ca=False, + nameservers='master' if self.master_with_dns else None) def test_replica1_all_components_adtrust(self): - self.install_replica(self.replicas[1], setup_ca=True) + self.install_replica( + self.replicas[1], setup_ca=True, + nameservers='master' if self.master_with_dns else None) ## @@ -151,10 +165,11 @@ class ADTrustInstallTestBase(IntegrationTest): ## class TestInstallWithCA1(InstallTestBase1): + master_with_dns = False @classmethod def install(cls, mh): - tasks.install_master(cls.master, setup_dns=False) + tasks.install_master(cls.master, setup_dns=cls.master_with_dns) @pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0, reason='does not work on DOMAIN_LEVEL_0 by design') @@ -200,10 +215,11 @@ class TestInstallWithCA1(InstallTestBase1): class TestInstallWithCA2(InstallTestBase2): + master_with_dns = False @classmethod def install(cls, mh): - tasks.install_master(cls.master, setup_dns=False) + tasks.install_master(cls.master, setup_dns=cls.master_with_dns) @pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0, reason='does not work on DOMAIN_LEVEL_0 by design') @@ -471,27 +487,32 @@ class TestInstallCA(IntegrationTest): class TestInstallWithCA_KRA1(InstallTestBase1): + master_with_dns = False @classmethod def install(cls, mh): - tasks.install_master(cls.master, setup_dns=False, setup_kra=True) + tasks.install_master(cls.master, setup_dns=cls.master_with_dns, + setup_kra=True) def test_replica0_ipa_kra_install(self): tasks.install_kra(self.replicas[0], first_instance=False) class TestInstallWithCA_KRA2(InstallTestBase2): + master_with_dns = False @classmethod def install(cls, mh): - tasks.install_master(cls.master, setup_dns=False, setup_kra=True) + tasks.install_master(cls.master, setup_dns=cls.master_with_dns, + setup_kra=True) class TestInstallWithCA_DNS1(InstallTestBase1): + master_with_dns = True @classmethod def install(cls, mh): - tasks.install_master(cls.master, setup_dns=True) + tasks.install_master(cls.master, setup_dns=cls.master_with_dns) @pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0, reason='does not work on DOMAIN_LEVEL_0 by design') @@ -510,10 +531,11 @@ class TestInstallWithCA_DNS1(InstallTestBase1): class TestInstallWithCA_DNS2(InstallTestBase2): + master_with_dns = True @classmethod def install(cls, mh): - tasks.install_master(cls.master, setup_dns=True) + tasks.install_master(cls.master, setup_dns=cls.master_with_dns) @pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0, reason='does not work on DOMAIN_LEVEL_0 by design') @@ -585,20 +607,24 @@ class TestInstallWithCA_DNS4(CALessBase): @pytest.mark.cs_acceptance class TestInstallWithCA_KRA_DNS1(InstallTestBase1): + master_with_dns = True @classmethod def install(cls, mh): - tasks.install_master(cls.master, setup_dns=True, setup_kra=True) + tasks.install_master(cls.master, setup_dns=cls.master_with_dns, + setup_kra=True) def test_replica0_ipa_kra_install(self): tasks.install_kra(self.replicas[0], first_instance=False) class TestInstallWithCA_KRA_DNS2(InstallTestBase2): + master_with_dns = True @classmethod def install(cls, mh): - tasks.install_master(cls.master, setup_dns=True, setup_kra=True) + tasks.install_master(cls.master, setup_dns=cls.master_with_dns, + setup_kra=True) class TestADTrustInstall(ADTrustInstallTestBase): @@ -616,11 +642,12 @@ class TestADTrustInstallWithDNS_KRA_ADTrust(ADTrustInstallTestBase): master. Additional two test cases were added to test interplay including KRA installer """ + master_with_dns = True @classmethod def install(cls, mh): - tasks.install_master(cls.master, setup_dns=True, setup_kra=True, - setup_adtrust=True) + tasks.install_master(cls.master, setup_dns=cls.master_with_dns, + setup_kra=True, setup_adtrust=True) def test_replica1_all_components_adtrust(self): self.install_replica(self.replicas[1], setup_ca=True, setup_kra=True) diff --git a/ipatests/test_integration/test_ipahealthcheck.py b/ipatests/test_integration/test_ipahealthcheck.py index 8836fbcd2..6aed449e0 100644 --- a/ipatests/test_integration/test_ipahealthcheck.py +++ b/ipatests/test_integration/test_ipahealthcheck.py @@ -2201,7 +2201,7 @@ class TestIpaHealthCheckWithExternalCA(IntegrationTest): tasks.kinit_admin(cls.master) tasks.install_packages(cls.master, HEALTHCHECK_PKG) tasks.install_packages(cls.replicas[0], HEALTHCHECK_PKG) - tasks.install_replica(cls.master, cls.replicas[0]) + tasks.install_replica(cls.master, cls.replicas[0], nameservers=None) def test_ipahealthcheck_crlmanagercheck(self): """ diff --git a/ipatests/test_integration/test_ntp_options.py b/ipatests/test_integration/test_ntp_options.py index 932c538fd..27d35043e 100644 --- a/ipatests/test_integration/test_ntp_options.py +++ b/ipatests/test_integration/test_ntp_options.py @@ -67,7 +67,8 @@ class TestNTPoptions(IntegrationTest): assert self.exp_records_msg in server_install.stderr_text assert self.exp_chrony_msg in server_install.stdout_text - client_install = tasks.install_client(self.master, self.client) + client_install = tasks.install_client(self.master, self.client, + nameservers=None) assert self.exp_records_msg in client_install.stderr_text assert self.exp_chrony_msg in client_install.stdout_text @@ -84,7 +85,8 @@ class TestNTPoptions(IntegrationTest): assert self.exp_default_msg not in server_install.stdout_text client_install = tasks.install_client(self.master, self.client, - extra_args=['--no-ntp']) + extra_args=['--no-ntp'], + nameservers=None) assert self.exp_default_msg not in client_install.stdout_text def test_server_client_install_with_multiple_ntp_srv(self): @@ -104,7 +106,7 @@ class TestNTPoptions(IntegrationTest): assert self.ntp_server2 in cmd.stdout_text client_install = tasks.install_client(self.master, self.client, - extra_args=args) + extra_args=args, nameservers=None) assert self.exp_change_msg in client_install.stderr_text cmd = self.client.run_command(['cat', paths.CHRONY_CONF]) assert self.ntp_server1 in cmd.stdout_text @@ -127,7 +129,7 @@ class TestNTPoptions(IntegrationTest): replica_install = tasks.install_replica(self.master, self.replica, extra_args=args, - promote=False) + promote=False, nameservers=None) assert self.exp_change_msg in replica_install.stderr_text cmd = self.replica.run_command(['cat', paths.CHRONY_CONF]) @@ -135,7 +137,7 @@ class TestNTPoptions(IntegrationTest): assert self.ntp_server1 in cmd.stdout_text client_install = tasks.install_client(self.master, self.client, - extra_args=args) + extra_args=args, nameservers=None) assert self.exp_change_msg in client_install.stderr_text cmd = self.client.run_command(['cat', paths.CHRONY_CONF]) assert self.ntp_pool in cmd.stdout_text @@ -156,7 +158,7 @@ class TestNTPoptions(IntegrationTest): replica_install = tasks.install_replica(self.master, self.replica, extra_args=args, - promote=True) + promote=True, nameservers=None) # while promoting with tasks expected_msg will not be in output assert self.exp_change_msg not in replica_install.stderr_text @@ -164,7 +166,7 @@ class TestNTPoptions(IntegrationTest): assert self.ntp_server1 in cmd.stdout_text client_install = tasks.install_client(self.master, self.client, - extra_args=args) + extra_args=args, nameservers=None) assert self.exp_change_msg in client_install.stderr_text cmd = self.client.run_command(['cat', paths.CHRONY_CONF]) assert self.ntp_server1 in cmd.stdout_text @@ -199,7 +201,7 @@ class TestNTPoptions(IntegrationTest): --ntp-pool and -N or --no-ntp option would fail """ tasks.install_master(self.master, setup_dns=False) - tasks.install_client(self.master, self.replica) + tasks.install_client(self.master, self.replica, nameservers=None) replica_install = self.replica.run_command( ['ipa-replica-install', '--no-ntp'], @@ -233,11 +235,12 @@ class TestNTPoptions(IntegrationTest): assert self.exp_change_msg in server_install.stderr_text client_install = tasks.install_client(self.master, self.replica, - extra_args=ntp_args) + extra_args=ntp_args, + nameservers=None) assert self.exp_change_msg in client_install.stderr_text replica_install = tasks.install_replica(self.master, self.replica, - promote=False) + promote=False, nameservers=None) assert "ipa-replica-install command was successful" in \ replica_install.stderr_text @@ -302,7 +305,8 @@ class TestNTPoptions(IntegrationTest): client_install = tasks.install_client(self.master, self.client, unattended=False, - stdin_text=client_input) + stdin_text=client_input, + nameservers=None) assert client_install.returncode == 0 @@ -349,7 +353,8 @@ class TestNTPoptions(IntegrationTest): client_install = tasks.install_client(self.master, self.client, unattended=False, - stdin_text=client_input) + stdin_text=client_input, + nameservers=None) assert client_install.returncode == 0 assert self.exp_records_msg in client_install.stderr_text @@ -389,7 +394,8 @@ class TestNTPoptions(IntegrationTest): client_install = tasks.install_client(self.master, self.client, unattended=False, - stdin_text=client_input) + stdin_text=client_input, + nameservers=None) assert client_install.returncode == 0 assert self.exp_records_msg in client_install.stderr_text diff --git a/ipatests/test_integration/test_replica_promotion.py b/ipatests/test_integration/test_replica_promotion.py index 381d3e497..846913c8a 100644 --- a/ipatests/test_integration/test_replica_promotion.py +++ b/ipatests/test_integration/test_replica_promotion.py @@ -705,7 +705,8 @@ class TestReplicaInstallCustodia(IntegrationTest): replica1.run_command(['ipactl', 'status'], raiseonerr=False) # Install Replica2 with CA with source as Replica1. - tasks.install_replica(replica1, replica2, setup_ca=True) + tasks.install_replica(replica1, replica2, setup_ca=True, + nameservers='master') result = replica2.run_command(['ipactl', 'status']) assert 'ipa-custodia Service: RUNNING' in result.stdout_text diff --git a/ipatests/test_integration/test_uninstallation.py b/ipatests/test_integration/test_uninstallation.py index d075d7fc8..3bdc25ad0 100644 --- a/ipatests/test_integration/test_uninstallation.py +++ b/ipatests/test_integration/test_uninstallation.py @@ -37,7 +37,8 @@ class TestUninstallBase(IntegrationTest): client = self.replicas[0] client_inv_hostname = '{}.nonexistent'.format(client.hostname) tasks.install_client(self.master, client, - extra_args=['--hostname', client_inv_hostname]) + extra_args=['--hostname', client_inv_hostname], + nameservers=None) client.run_command(['ipa-client-install', '--uninstall', '-U']) client_uninstall_log = client.get_file_contents( @@ -57,7 +58,7 @@ class TestUninstallBase(IntegrationTest): # Include /etc/httpd/conf.d/ipa-rewrite.conf # from ssl.conf on the replica tasks.install_replica(self.master, self.replicas[0], - extra_args=['--force-join']) + extra_args=['--force-join'], nameservers=None) tasks.uninstall_replica(self.master, self.replicas[0]) errline = b'Include /etc/httpd/conf.d/ipa-rewrite.conf' ssl_conf = self.replicas[0].get_file_contents(paths.HTTPD_SSL_CONF)