From 040d48fa61eb4902f43dfe7fa10257de1e3818b6 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Tue, 8 Sep 2020 18:37:31 -0400 Subject: [PATCH] ipatests: test ipa_server_certinstall with an IPA-issued cert ipa-server-certinstall takes a slightly different code path if the replacement certificate is IPA-issued so exercise that path. This replaces the Apache cert with itself which is a bit of a no-op but it still goes through the motions. https://pagure.io/freeipa/issue/8204 Signed-off-by: Rob Crittenden Reviewed-By: Fraser Tweedale --- .../test_integration/test_installation.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py index 98bdc98ab..249e2bf89 100644 --- a/ipatests/test_integration/test_installation.py +++ b/ipatests/test_integration/test_installation.py @@ -358,6 +358,30 @@ class TestInstallCA(IntegrationTest): assert owner == "root" assert group == "root" + def test_cert_install_with_IPA_issued_cert(self): + """ + Test replacing an IPA-issued server cert + + ipa-server-certinstall can replace the web and LDAP certs. + A slightly different code path is taken when the replacement + certs are issued by IPA. Exercise that path by replacing the + web cert with itself. + """ + self.master.run_command(['cp', '-p', paths.HTTPD_CERT_FILE, '/tmp']) + self.master.run_command(['cp', '-p', paths.HTTPD_KEY_FILE, '/tmp']) + + passwd = self.master.get_file_contents( + paths.HTTPD_PASSWD_FILE_FMT.format(host=self.master.hostname) + ) + self.master.run_command([ + 'ipa-server-certinstall', + '-p', self.master.config.dirman_password, + '-w', + '--pin', passwd, + '/tmp/httpd.crt', + '/tmp/httpd.key', + ]) + def test_is_ipa_configured(self): """Verify that the old and new methods of is_ipa_installed works