|
|
e0e1b7 |
From 0edf915efbb39fac45c784171dd715ec6b28861a Mon Sep 17 00:00:00 2001
|
|
|
e0e1b7 |
From: Sumedh Sidhaye <ssidhaye@redhat.com>
|
|
|
e0e1b7 |
Date: Fri, 14 Jan 2022 19:55:13 +0530
|
|
|
e0e1b7 |
Subject: [PATCH] Added test automation for SHA384withRSA CSR support
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Scenario 1:
|
|
|
e0e1b7 |
Setup master with --ca-signing-algorithm=SHA384withRSA
|
|
|
e0e1b7 |
Run certutil and check Signing Algorithm
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Scenario 2:
|
|
|
e0e1b7 |
Setup a master
|
|
|
e0e1b7 |
Stop services
|
|
|
e0e1b7 |
Modify default.params.signingAlg in CS.cfg
|
|
|
e0e1b7 |
Restart services
|
|
|
e0e1b7 |
Resubmit cert (Resubmitted cert should have new Algorithm)
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Pagure Link: https://pagure.io/freeipa/issue/8906
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Signed-off-by: Sumedh Sidhaye <ssidhaye@redhat.com>
|
|
|
e0e1b7 |
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
|
|
|
e0e1b7 |
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
|
|
|
e0e1b7 |
Reviewed-By: Antonio Torres <antorres@redhat.com>
|
|
|
e0e1b7 |
---
|
|
|
e0e1b7 |
.../test_integration/test_installation.py | 63 +++++++++++++++++++
|
|
|
e0e1b7 |
1 file changed, 63 insertions(+)
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py
|
|
|
e0e1b7 |
index 0947241ae..f2d372c0c 100644
|
|
|
e0e1b7 |
--- a/ipatests/test_integration/test_installation.py
|
|
|
e0e1b7 |
+++ b/ipatests/test_integration/test_installation.py
|
|
|
e0e1b7 |
@@ -34,6 +34,7 @@ from ipatests.pytest_ipa.integration import tasks
|
|
|
e0e1b7 |
from ipatests.pytest_ipa.integration.env_config import get_global_config
|
|
|
e0e1b7 |
from ipatests.test_integration.base import IntegrationTest
|
|
|
e0e1b7 |
from ipatests.test_integration.test_caless import CALessBase, ipa_certs_cleanup
|
|
|
e0e1b7 |
+from ipatests.test_integration.test_cert import get_certmonger_fs_id
|
|
|
e0e1b7 |
from ipaplatform import services
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
@@ -1916,3 +1917,65 @@ class TestInstallWithoutNamed(IntegrationTest):
|
|
|
e0e1b7 |
tasks.install_replica(
|
|
|
e0e1b7 |
self.master, self.replicas[0], setup_ca=False, setup_dns=False
|
|
|
e0e1b7 |
)
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+class TestInstallwithSHA384withRSA(IntegrationTest):
|
|
|
e0e1b7 |
+ num_replicas = 0
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ def test_install_master_withalgo_sha384withrsa(self, server_cleanup):
|
|
|
e0e1b7 |
+ tasks.install_master(
|
|
|
e0e1b7 |
+ self.master,
|
|
|
e0e1b7 |
+ extra_args=['--ca-signing-algorithm=SHA384withRSA'],
|
|
|
e0e1b7 |
+ )
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ # check Signing Algorithm post installation
|
|
|
e0e1b7 |
+ dashed_domain = self.master.domain.realm.replace(".", '-')
|
|
|
e0e1b7 |
+ cmd_args = ['certutil', '-L', '-d',
|
|
|
e0e1b7 |
+ '/etc/dirsrv/slapd-{}/'.format(dashed_domain),
|
|
|
e0e1b7 |
+ '-n', 'Server-Cert']
|
|
|
e0e1b7 |
+ result = self.master.run_command(cmd_args)
|
|
|
e0e1b7 |
+ assert 'SHA-384 With RSA Encryption' in result.stdout_text
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ def test_install_master_modify_existing(self, server_cleanup):
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ Setup a master
|
|
|
e0e1b7 |
+ Stop services
|
|
|
e0e1b7 |
+ Modify default.params.signingAlg in CS.cfg
|
|
|
e0e1b7 |
+ Restart services
|
|
|
e0e1b7 |
+ Resubmit cert (Resubmitted cert should have new Algorithm)
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ tasks.install_master(self.master)
|
|
|
e0e1b7 |
+ self.master.run_command(['ipactl', 'stop'])
|
|
|
e0e1b7 |
+ cs_cfg_content = self.master.get_file_contents(paths.CA_CS_CFG_PATH,
|
|
|
e0e1b7 |
+ encoding='utf-8')
|
|
|
e0e1b7 |
+ new_lines = []
|
|
|
e0e1b7 |
+ replace_str = "ca.signing.defaultSigningAlgorithm=SHA384withRSA"
|
|
|
e0e1b7 |
+ ocsp_rep_str = "ca.ocsp_signing.defaultSigningAlgorithm=SHA384withRSA"
|
|
|
e0e1b7 |
+ for line in cs_cfg_content.split('\n'):
|
|
|
e0e1b7 |
+ if line.startswith('ca.signing.defaultSigningAlgorithm'):
|
|
|
e0e1b7 |
+ new_lines.append(replace_str)
|
|
|
e0e1b7 |
+ elif line.startswith('ca.ocsp_signing.defaultSigningAlgorithm'):
|
|
|
e0e1b7 |
+ new_lines.append(ocsp_rep_str)
|
|
|
e0e1b7 |
+ else:
|
|
|
e0e1b7 |
+ new_lines.append(line)
|
|
|
e0e1b7 |
+ self.master.put_file_contents(paths.CA_CS_CFG_PATH,
|
|
|
e0e1b7 |
+ '\n'.join(new_lines))
|
|
|
e0e1b7 |
+ self.master.run_command(['ipactl', 'start'])
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ cmd = ['getcert', 'list', '-f', paths.RA_AGENT_PEM]
|
|
|
e0e1b7 |
+ result = self.master.run_command(cmd)
|
|
|
e0e1b7 |
+ request_id = get_certmonger_fs_id(result.stdout_text)
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ # resubmit RA Agent cert
|
|
|
e0e1b7 |
+ cmd = ['getcert', 'resubmit', '-f', paths.RA_AGENT_PEM]
|
|
|
e0e1b7 |
+ self.master.run_command(cmd)
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ tasks.wait_for_certmonger_status(self.master,
|
|
|
e0e1b7 |
+ ('CA_WORKING', 'MONITORING'),
|
|
|
e0e1b7 |
+ request_id)
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ cmd_args = ['openssl', 'x509', '-in',
|
|
|
e0e1b7 |
+ paths.RA_AGENT_PEM, '-noout', '-text']
|
|
|
e0e1b7 |
+ result = self.master.run_command(cmd_args)
|
|
|
e0e1b7 |
+ assert_str = 'Signature Algorithm: sha384WithRSAEncryption'
|
|
|
e0e1b7 |
+ assert assert_str in result.stdout_text
|
|
|
e0e1b7 |
--
|
|
|
e0e1b7 |
2.34.1
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
From 8b22ee018c3bb7f58a1b6694a7fd611688f8e74f Mon Sep 17 00:00:00 2001
|
|
|
e0e1b7 |
From: Sumedh Sidhaye <ssidhaye@redhat.com>
|
|
|
e0e1b7 |
Date: Thu, 25 Nov 2021 17:48:20 +0530
|
|
|
e0e1b7 |
Subject: [PATCH] Extend test to see if replica is not shown when running
|
|
|
e0e1b7 |
`ipa-replica-manage list -v <FQDN>`
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Related: https://pagure.io/freeipa/issue/8605
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Signed-off-by: Sumedh Sidhaye <ssidhaye@redhat.com>
|
|
|
e0e1b7 |
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
|
|
|
e0e1b7 |
---
|
|
|
e0e1b7 |
ipatests/test_integration/test_simple_replication.py | 3 ++-
|
|
|
e0e1b7 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
diff --git a/ipatests/test_integration/test_simple_replication.py b/ipatests/test_integration/test_simple_replication.py
|
|
|
e0e1b7 |
index 8de385144..17092a499 100644
|
|
|
e0e1b7 |
--- a/ipatests/test_integration/test_simple_replication.py
|
|
|
e0e1b7 |
+++ b/ipatests/test_integration/test_simple_replication.py
|
|
|
e0e1b7 |
@@ -111,5 +111,6 @@ class TestSimpleReplication(IntegrationTest):
|
|
|
e0e1b7 |
# has to be run with --force, there is no --unattended
|
|
|
e0e1b7 |
self.master.run_command(['ipa-replica-manage', 'del',
|
|
|
e0e1b7 |
self.replicas[0].hostname, '--force'])
|
|
|
e0e1b7 |
- result = self.master.run_command(['ipa-replica-manage', 'list'])
|
|
|
e0e1b7 |
+ result = self.master.run_command(
|
|
|
e0e1b7 |
+ ['ipa-replica-manage', 'list', '-v', self.master.hostname])
|
|
|
e0e1b7 |
assert self.replicas[0].hostname not in result.stdout_text
|
|
|
e0e1b7 |
--
|
|
|
e0e1b7 |
2.34.1
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
From ba7ec71ba96280da3841ebe47df2a6dc1cd6341e Mon Sep 17 00:00:00 2001
|
|
|
e0e1b7 |
From: Mohammad Rizwan <myusuf@redhat.com>
|
|
|
e0e1b7 |
Date: Fri, 26 Nov 2021 12:11:21 +0530
|
|
|
e0e1b7 |
Subject: [PATCH] ipatests: Fix test_ipa_cert_fix.py::TestCertFixReplica
|
|
|
e0e1b7 |
teardown
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Fixture `expire_certs` moves date back after renewing the certs.
|
|
|
e0e1b7 |
This is causing the ipa-replica to fail. This fix first uninstalls
|
|
|
e0e1b7 |
the server then moves back the date.
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Fixes: https://pagure.io/freeipa/issue/9052
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Signed-off-by: Mohammad Rizwan <myusuf@redhat.com>
|
|
|
e0e1b7 |
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
|
|
|
e0e1b7 |
---
|
|
|
e0e1b7 |
ipatests/test_integration/test_ipa_cert_fix.py | 9 ++++++++-
|
|
|
e0e1b7 |
1 file changed, 8 insertions(+), 1 deletion(-)
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
diff --git a/ipatests/test_integration/test_ipa_cert_fix.py b/ipatests/test_integration/test_ipa_cert_fix.py
|
|
|
e0e1b7 |
index 39904d5de..5b56054b4 100644
|
|
|
e0e1b7 |
--- a/ipatests/test_integration/test_ipa_cert_fix.py
|
|
|
e0e1b7 |
+++ b/ipatests/test_integration/test_ipa_cert_fix.py
|
|
|
e0e1b7 |
@@ -389,6 +389,12 @@ class TestCertFixReplica(IntegrationTest):
|
|
|
e0e1b7 |
setup_dns=False, extra_args=['--no-ntp']
|
|
|
e0e1b7 |
)
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
+ @classmethod
|
|
|
e0e1b7 |
+ def uninstall(cls, mh):
|
|
|
e0e1b7 |
+ # Uninstall method is empty as the uninstallation is done in
|
|
|
e0e1b7 |
+ # the fixture
|
|
|
e0e1b7 |
+ pass
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
@pytest.fixture
|
|
|
e0e1b7 |
def expire_certs(self):
|
|
|
e0e1b7 |
# move system date to expire certs
|
|
|
e0e1b7 |
@@ -398,7 +404,8 @@ class TestCertFixReplica(IntegrationTest):
|
|
|
e0e1b7 |
yield
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
# move date back on replica and master
|
|
|
e0e1b7 |
- for host in self.master, self.replicas[0]:
|
|
|
e0e1b7 |
+ for host in self.replicas[0], self.master:
|
|
|
e0e1b7 |
+ tasks.uninstall_master(host)
|
|
|
e0e1b7 |
tasks.move_date(host, 'start', '-3years-1days')
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
def test_renew_expired_cert_replica(self, expire_certs):
|
|
|
e0e1b7 |
--
|
|
|
e0e1b7 |
2.34.1
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
From 465f1669a6c5abc72da1ecaf9aefa8488f80806c Mon Sep 17 00:00:00 2001
|
|
|
e0e1b7 |
From: Anuja More <amore@redhat.com>
|
|
|
e0e1b7 |
Date: Mon, 13 Dec 2021 17:37:05 +0530
|
|
|
e0e1b7 |
Subject: [PATCH] ipatests: Test default value of nsslapd-sizelimit.
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
related : https://pagure.io/freeipa/issue/8962
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Signed-off-by: Anuja More <amore@redhat.com>
|
|
|
e0e1b7 |
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
|
|
|
e0e1b7 |
---
|
|
|
e0e1b7 |
ipatests/test_integration/test_installation.py | 13 +++++++++++++
|
|
|
e0e1b7 |
1 file changed, 13 insertions(+)
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py
|
|
|
e0e1b7 |
index 95cfaad54..0947241ae 100644
|
|
|
e0e1b7 |
--- a/ipatests/test_integration/test_installation.py
|
|
|
e0e1b7 |
+++ b/ipatests/test_integration/test_installation.py
|
|
|
e0e1b7 |
@@ -1067,6 +1067,19 @@ class TestInstallMaster(IntegrationTest):
|
|
|
e0e1b7 |
)
|
|
|
e0e1b7 |
assert "nsslapd-db-locks" not in result.stdout_text
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
+ def test_nsslapd_sizelimit(self):
|
|
|
e0e1b7 |
+ """ Test for default value of nsslapd-sizelimit.
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ Related : https://pagure.io/freeipa/issue/8962
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ result = tasks.ldapsearch_dm(
|
|
|
e0e1b7 |
+ self.master,
|
|
|
e0e1b7 |
+ "cn=config",
|
|
|
e0e1b7 |
+ ["nsslapd-sizelimit"],
|
|
|
e0e1b7 |
+ scope="base"
|
|
|
e0e1b7 |
+ )
|
|
|
e0e1b7 |
+ assert "nsslapd-sizelimit: 100000" in result.stdout_text
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
def test_admin_root_alias_CVE_2020_10747(self):
|
|
|
e0e1b7 |
# Test for CVE-2020-10747 fix
|
|
|
e0e1b7 |
# https://bugzilla.redhat.com/show_bug.cgi?id=1810160
|
|
|
e0e1b7 |
--
|
|
|
e0e1b7 |
2.34.1
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
From cbd9ac6ab07dfb60f67da762fdd70856ad35c230 Mon Sep 17 00:00:00 2001
|
|
|
e0e1b7 |
From: Mohammad Rizwan <myusuf@redhat.com>
|
|
|
e0e1b7 |
Date: Thu, 25 Nov 2021 13:10:05 +0530
|
|
|
e0e1b7 |
Subject: [PATCH] ipatests: Test empty cert request doesn't force certmonger to
|
|
|
e0e1b7 |
segfault
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
When empty cert request is submitted to certmonger, it goes to
|
|
|
e0e1b7 |
segfault. This fix test that if something like this happens,
|
|
|
e0e1b7 |
certmonger should gracefuly handle it
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
and some PEP8 fixes
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
related: https://pagure.io/certmonger/issue/191
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Signed-off-by: Mohammad Rizwan <myusuf@redhat.com>
|
|
|
e0e1b7 |
---
|
|
|
e0e1b7 |
ipatests/test_integration/test_cert.py | 79 +++++++++++++++++++++++++-
|
|
|
e0e1b7 |
1 file changed, 78 insertions(+), 1 deletion(-)
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
diff --git a/ipatests/test_integration/test_cert.py b/ipatests/test_integration/test_cert.py
|
|
|
e0e1b7 |
index 5ffb8c608..0518d7954 100644
|
|
|
e0e1b7 |
--- a/ipatests/test_integration/test_cert.py
|
|
|
e0e1b7 |
+++ b/ipatests/test_integration/test_cert.py
|
|
|
e0e1b7 |
@@ -14,6 +14,7 @@ import random
|
|
|
e0e1b7 |
import re
|
|
|
e0e1b7 |
import string
|
|
|
e0e1b7 |
import time
|
|
|
e0e1b7 |
+import textwrap
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
from ipaplatform.paths import paths
|
|
|
e0e1b7 |
from ipapython.dn import DN
|
|
|
e0e1b7 |
@@ -193,7 +194,7 @@ class TestInstallMasterClient(IntegrationTest):
|
|
|
e0e1b7 |
tasks.kinit_admin(self.master)
|
|
|
e0e1b7 |
tasks.user_add(self.master, user)
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
- for id in (0,1):
|
|
|
e0e1b7 |
+ for id in (0, 1):
|
|
|
e0e1b7 |
csr_file = f'{id}.csr'
|
|
|
e0e1b7 |
key_file = f'{id}.key'
|
|
|
e0e1b7 |
cert_file = f'{id}.crt'
|
|
|
e0e1b7 |
@@ -584,3 +585,79 @@ class TestCAShowErrorHandling(IntegrationTest):
|
|
|
e0e1b7 |
error_msg = 'ipa: ERROR: The certificate for ' \
|
|
|
e0e1b7 |
'{} is not available on this server.'.format(lwca)
|
|
|
e0e1b7 |
assert error_msg in result.stderr_text
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ def test_certmonger_empty_cert_not_segfault(self):
|
|
|
e0e1b7 |
+ """Test empty cert request doesn't force certmonger to segfault
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ Test scenario:
|
|
|
e0e1b7 |
+ create a cert request file in /var/lib/certmonger/requests which is
|
|
|
e0e1b7 |
+ missing most of the required information, and ask request a new
|
|
|
e0e1b7 |
+ certificate to certmonger. The wrong request file should not make
|
|
|
e0e1b7 |
+ certmonger crash.
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ related: https://pagure.io/certmonger/issue/191
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ empty_cert_req_content = textwrap.dedent("""
|
|
|
e0e1b7 |
+ id=dogtag-ipa-renew-agent
|
|
|
e0e1b7 |
+ key_type=UNSPECIFIED
|
|
|
e0e1b7 |
+ key_gen_type=UNSPECIFIED
|
|
|
e0e1b7 |
+ key_size=0
|
|
|
e0e1b7 |
+ key_gen_size=0
|
|
|
e0e1b7 |
+ key_next_type=UNSPECIFIED
|
|
|
e0e1b7 |
+ key_next_gen_type=UNSPECIFIED
|
|
|
e0e1b7 |
+ key_next_size=0
|
|
|
e0e1b7 |
+ key_next_gen_size=0
|
|
|
e0e1b7 |
+ key_preserve=0
|
|
|
e0e1b7 |
+ key_storage_type=NONE
|
|
|
e0e1b7 |
+ key_perms=0
|
|
|
e0e1b7 |
+ key_requested_count=0
|
|
|
e0e1b7 |
+ key_issued_count=0
|
|
|
e0e1b7 |
+ cert_storage_type=FILE
|
|
|
e0e1b7 |
+ cert_perms=0
|
|
|
e0e1b7 |
+ cert_is_ca=0
|
|
|
e0e1b7 |
+ cert_ca_path_length=0
|
|
|
e0e1b7 |
+ cert_no_ocsp_check=0
|
|
|
e0e1b7 |
+ last_need_notify_check=19700101000000
|
|
|
e0e1b7 |
+ last_need_enroll_check=19700101000000
|
|
|
e0e1b7 |
+ template_is_ca=0
|
|
|
e0e1b7 |
+ template_ca_path_length=-1
|
|
|
e0e1b7 |
+ template_no_ocsp_check=0
|
|
|
e0e1b7 |
+ state=NEED_KEY_PAIR
|
|
|
e0e1b7 |
+ autorenew=0
|
|
|
e0e1b7 |
+ monitor=0
|
|
|
e0e1b7 |
+ submitted=19700101000000
|
|
|
e0e1b7 |
+ """)
|
|
|
e0e1b7 |
+ # stop certmonger service
|
|
|
e0e1b7 |
+ self.master.run_command(['systemctl', 'stop', 'certmonger'])
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ # place an empty cert request file to certmonger request dir
|
|
|
e0e1b7 |
+ self.master.put_file_contents(
|
|
|
e0e1b7 |
+ os.path.join(paths.CERTMONGER_REQUESTS_DIR, '20211125062617'),
|
|
|
e0e1b7 |
+ empty_cert_req_content
|
|
|
e0e1b7 |
+ )
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ # start certmonger, it should not fail
|
|
|
e0e1b7 |
+ self.master.run_command(['systemctl', 'start', 'certmonger'])
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ # request a new cert, should succeed and certmonger doesn't goes
|
|
|
e0e1b7 |
+ # to segfault
|
|
|
e0e1b7 |
+ result = self.master.run_command([
|
|
|
e0e1b7 |
+ "ipa-getcert", "request",
|
|
|
e0e1b7 |
+ "-f", os.path.join(paths.OPENSSL_CERTS_DIR, "test.pem"),
|
|
|
e0e1b7 |
+ "-k", os.path.join(paths.OPENSSL_PRIVATE_DIR, "test.key"),
|
|
|
e0e1b7 |
+ ])
|
|
|
e0e1b7 |
+ request_id = re.findall(r'\d+', result.stdout_text)
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ # check if certificate is in MONITORING state
|
|
|
e0e1b7 |
+ status = tasks.wait_for_request(self.master, request_id[0], 50)
|
|
|
e0e1b7 |
+ assert status == "MONITORING"
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ self.master.run_command(
|
|
|
e0e1b7 |
+ ['ipa-getcert', 'stop-tracking', '-i', request_id[0]]
|
|
|
e0e1b7 |
+ )
|
|
|
e0e1b7 |
+ self.master.run_command([
|
|
|
e0e1b7 |
+ 'rm', '-rf',
|
|
|
e0e1b7 |
+ os.path.join(paths.CERTMONGER_REQUESTS_DIR, '20211125062617'),
|
|
|
e0e1b7 |
+ os.path.join(paths.OPENSSL_CERTS_DIR, 'test.pem'),
|
|
|
e0e1b7 |
+ os.path.join(paths.OPENSSL_PRIVATE_DIR, 'test.key')
|
|
|
e0e1b7 |
+ ])
|
|
|
e0e1b7 |
--
|
|
|
e0e1b7 |
2.34.1
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
From edbd8f692a28fc999b92e9032614d366511db323 Mon Sep 17 00:00:00 2001
|
|
|
e0e1b7 |
From: Anuja More <amore@redhat.com>
|
|
|
e0e1b7 |
Date: Mon, 6 Dec 2021 20:50:01 +0530
|
|
|
e0e1b7 |
Subject: [PATCH] ipatests: webui: Tests for subordinate ids.
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Added web-ui tests to verify where operations
|
|
|
e0e1b7 |
using subordinate ids are working as expected.
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Related : https://pagure.io/freeipa/issue/8361
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Signed-off-by: Anuja More <amore@redhat.com>
|
|
|
e0e1b7 |
Reviewed-By: Michal Polovka <mpolovka@redhat.com>
|
|
|
e0e1b7 |
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
|
|
|
e0e1b7 |
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
|
|
|
e0e1b7 |
---
|
|
|
e0e1b7 |
ipatests/test_webui/test_subid.py | 141 ++++++++++++++++++++++++++++++
|
|
|
e0e1b7 |
ipatests/test_webui/ui_driver.py | 28 ++++++
|
|
|
e0e1b7 |
2 files changed, 169 insertions(+)
|
|
|
e0e1b7 |
create mode 100644 ipatests/test_webui/test_subid.py
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
diff --git a/ipatests/test_webui/test_subid.py b/ipatests/test_webui/test_subid.py
|
|
|
e0e1b7 |
new file mode 100644
|
|
|
e0e1b7 |
index 000000000..26decdba0
|
|
|
e0e1b7 |
--- /dev/null
|
|
|
e0e1b7 |
+++ b/ipatests/test_webui/test_subid.py
|
|
|
e0e1b7 |
@@ -0,0 +1,141 @@
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+"""
|
|
|
e0e1b7 |
+Tests for subordinateid.
|
|
|
e0e1b7 |
+"""
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+from ipatests.test_webui.ui_driver import UI_driver
|
|
|
e0e1b7 |
+import ipatests.test_webui.data_config as config_data
|
|
|
e0e1b7 |
+import ipatests.test_webui.data_user as user_data
|
|
|
e0e1b7 |
+from ipatests.test_webui.ui_driver import screenshot
|
|
|
e0e1b7 |
+import re
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+class test_subid(UI_driver):
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ def add_user(self, pkey, name, surname):
|
|
|
e0e1b7 |
+ self.add_record('user', {
|
|
|
e0e1b7 |
+ 'pkey': pkey,
|
|
|
e0e1b7 |
+ 'add': [
|
|
|
e0e1b7 |
+ ('textbox', 'uid', pkey),
|
|
|
e0e1b7 |
+ ('textbox', 'givenname', name),
|
|
|
e0e1b7 |
+ ('textbox', 'sn', surname),
|
|
|
e0e1b7 |
+ ]
|
|
|
e0e1b7 |
+ })
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ def set_default_subid(self):
|
|
|
e0e1b7 |
+ self.navigate_to_entity(config_data.ENTITY)
|
|
|
e0e1b7 |
+ self.check_option('ipauserdefaultsubordinateid', 'checked')
|
|
|
e0e1b7 |
+ self.facet_button_click('save')
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ def get_user_count(self, user_pkey):
|
|
|
e0e1b7 |
+ self.navigate_to_entity('subid', facet='search')
|
|
|
e0e1b7 |
+ self.apply_search_filter(user_pkey)
|
|
|
e0e1b7 |
+ self.wait_for_request()
|
|
|
e0e1b7 |
+ return self.get_rows()
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ @screenshot
|
|
|
e0e1b7 |
+ def test_set_defaultsubid(self):
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ Test to verify that enable/disable is working for
|
|
|
e0e1b7 |
+ adding subids to new users.
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ self.init_app()
|
|
|
e0e1b7 |
+ self.add_record(user_data.ENTITY, user_data.DATA2)
|
|
|
e0e1b7 |
+ self.navigate_to_entity(config_data.ENTITY)
|
|
|
e0e1b7 |
+ # test subid can be enabled/disabled.
|
|
|
e0e1b7 |
+ self.set_default_subid()
|
|
|
e0e1b7 |
+ assert self.get_field_checked('ipauserdefaultsubordinateid')
|
|
|
e0e1b7 |
+ self.set_default_subid()
|
|
|
e0e1b7 |
+ assert not self.get_field_checked('ipauserdefaultsubordinateid')
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ @screenshot
|
|
|
e0e1b7 |
+ def test_user_defaultsubid(self):
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ Test to verify that subid is generated for new user.
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ self.init_app()
|
|
|
e0e1b7 |
+ user_pkey = "some-user"
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ self.set_default_subid()
|
|
|
e0e1b7 |
+ assert self.get_field_checked('ipauserdefaultsubordinateid')
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ before_count = self.get_user_count(user_pkey)
|
|
|
e0e1b7 |
+ assert len(before_count) == 0
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ self.add_user(user_pkey, 'Some', 'User')
|
|
|
e0e1b7 |
+ after_count = self.get_user_count(user_pkey)
|
|
|
e0e1b7 |
+ assert len(after_count) == 1
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ @screenshot
|
|
|
e0e1b7 |
+ def test_user_subid_mod_desc(self):
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ Test to verify that auto-assigned subid description is modified.
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ self.init_app()
|
|
|
e0e1b7 |
+ self.navigate_to_record("some-user")
|
|
|
e0e1b7 |
+ self.switch_to_facet('memberof_subid')
|
|
|
e0e1b7 |
+ rows = self.get_rows()
|
|
|
e0e1b7 |
+ self.navigate_to_row_record(rows[-1])
|
|
|
e0e1b7 |
+ self.fill_textbox("description", "some-user-subid-desc")
|
|
|
e0e1b7 |
+ self.facet_button_click('save')
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ @screenshot
|
|
|
e0e1b7 |
+ def test_admin_subid(self):
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ Test to verify that subid range is created with owner admin.
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ self.init_app()
|
|
|
e0e1b7 |
+ self.navigate_to_entity('subid', facet='search')
|
|
|
e0e1b7 |
+ self.facet_button_click('add')
|
|
|
e0e1b7 |
+ self.select_combobox('ipaowner', 'admin')
|
|
|
e0e1b7 |
+ self.dialog_button_click('add')
|
|
|
e0e1b7 |
+ self.wait(0.3)
|
|
|
e0e1b7 |
+ self.assert_no_error_dialog()
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ @screenshot
|
|
|
e0e1b7 |
+ def test_admin_subid_negative(self):
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ Test to verify that readding the subid fails with error.
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ self.init_app()
|
|
|
e0e1b7 |
+ self.navigate_to_entity('subid', facet='search')
|
|
|
e0e1b7 |
+ self.facet_button_click('add')
|
|
|
e0e1b7 |
+ self.select_combobox('ipaowner', 'admin')
|
|
|
e0e1b7 |
+ self.dialog_button_click('add')
|
|
|
e0e1b7 |
+ self.wait(0.3)
|
|
|
e0e1b7 |
+ err_dialog = self.get_last_error_dialog(dialog_name='error_dialog')
|
|
|
e0e1b7 |
+ text = self.get_text('.modal-body div p', err_dialog)
|
|
|
e0e1b7 |
+ text = text.strip()
|
|
|
e0e1b7 |
+ pattern = r'Subordinate id with with name .* already exists.'
|
|
|
e0e1b7 |
+ assert re.search(pattern, text) is not None
|
|
|
e0e1b7 |
+ self.close_all_dialogs()
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ @screenshot
|
|
|
e0e1b7 |
+ def test_user_subid_add(self):
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ Test to verify that subid range is created for given user.
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ self.init_app()
|
|
|
e0e1b7 |
+ self.navigate_to_entity('subid', facet='search')
|
|
|
e0e1b7 |
+ before_count = self.get_rows()
|
|
|
e0e1b7 |
+ self.facet_button_click('add')
|
|
|
e0e1b7 |
+ self.select_combobox('ipaowner', user_data.PKEY2)
|
|
|
e0e1b7 |
+ self.dialog_button_click('add')
|
|
|
e0e1b7 |
+ self.wait(0.3)
|
|
|
e0e1b7 |
+ self.assert_no_error_dialog()
|
|
|
e0e1b7 |
+ after_count = self.get_rows()
|
|
|
e0e1b7 |
+ assert len(before_count) < len(after_count)
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ @screenshot
|
|
|
e0e1b7 |
+ def test_subid_del(self):
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ Test to remove subordinate id for given user.
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ self.init_app()
|
|
|
e0e1b7 |
+ self.navigate_to_entity('subid', facet='search')
|
|
|
e0e1b7 |
+ user_uid = self.get_record_pkey("some-user", "ipaowner",
|
|
|
e0e1b7 |
+ table_name="ipauniqueid")
|
|
|
e0e1b7 |
+ before_count = self.get_rows()
|
|
|
e0e1b7 |
+ self.delete_record(user_uid, table_name="ipauniqueid")
|
|
|
e0e1b7 |
+ after_count = self.get_rows()
|
|
|
e0e1b7 |
+ assert len(before_count) > len(after_count)
|
|
|
e0e1b7 |
diff --git a/ipatests/test_webui/ui_driver.py b/ipatests/test_webui/ui_driver.py
|
|
|
e0e1b7 |
index 46fd512ae..77fd74e49 100644
|
|
|
e0e1b7 |
--- a/ipatests/test_webui/ui_driver.py
|
|
|
e0e1b7 |
+++ b/ipatests/test_webui/ui_driver.py
|
|
|
e0e1b7 |
@@ -1151,6 +1151,34 @@ class UI_driver:
|
|
|
e0e1b7 |
return row
|
|
|
e0e1b7 |
return None
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
+ def get_row_by_column_value(self, key, column_name, parent=None,
|
|
|
e0e1b7 |
+ table_name=None):
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ Get the first matched row element of a search table with given key
|
|
|
e0e1b7 |
+ matched against selected column. None if not found
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ rows = self.get_rows(parent, table_name)
|
|
|
e0e1b7 |
+ s = "td div[name='%s']" % column_name
|
|
|
e0e1b7 |
+ for row in rows:
|
|
|
e0e1b7 |
+ has = self.find(s, By.CSS_SELECTOR, row)
|
|
|
e0e1b7 |
+ if has.text == key:
|
|
|
e0e1b7 |
+ return row
|
|
|
e0e1b7 |
+ return None
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ def get_record_pkey(self, key, column, parent=None, table_name=None):
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ Get record pkey if value of column is known
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ row = self.get_row_by_column_value(key,
|
|
|
e0e1b7 |
+ column_name=column,
|
|
|
e0e1b7 |
+ parent=parent,
|
|
|
e0e1b7 |
+ table_name=table_name)
|
|
|
e0e1b7 |
+ val = None
|
|
|
e0e1b7 |
+ if row:
|
|
|
e0e1b7 |
+ el = self.find("td input", By.CSS_SELECTOR, row)
|
|
|
e0e1b7 |
+ val = el.get_attribute("value")
|
|
|
e0e1b7 |
+ return val
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
def navigate_to_row_record(self, row, pkey_column=None):
|
|
|
e0e1b7 |
"""
|
|
|
e0e1b7 |
Navigate to record by clicking on a link.
|
|
|
e0e1b7 |
--
|
|
|
e0e1b7 |
2.34.1
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
From 419d7fd6e5a9ed2d356ad05eef1043309f5646ef Mon Sep 17 00:00:00 2001
|
|
|
e0e1b7 |
From: Michal Polovka <mpolovka@redhat.com>
|
|
|
e0e1b7 |
Date: Fri, 7 Jan 2022 12:12:26 +0100
|
|
|
e0e1b7 |
Subject: [PATCH] ipatests: webui: Use safe-loader for loading YAML
|
|
|
e0e1b7 |
configuration file
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
FullLoader class for YAML loader was introduced in version 5.1 which
|
|
|
e0e1b7 |
also deprecated default loader. SafeLoader, however, stays consistent
|
|
|
e0e1b7 |
across the versions and brings added security.
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
This fix is necessary as PyYAML > 5.1 is not available in downstream.
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Related: https://pagure.io/freeipa/issue/9009
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Signed-off-by: Michal Polovka <mpolovka@redhat.com>
|
|
|
e0e1b7 |
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
|
|
|
e0e1b7 |
---
|
|
|
e0e1b7 |
ipatests/test_webui/ui_driver.py | 2 +-
|
|
|
e0e1b7 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
diff --git a/ipatests/test_webui/ui_driver.py b/ipatests/test_webui/ui_driver.py
|
|
|
e0e1b7 |
index 77fd74e49..519efee9b 100644
|
|
|
e0e1b7 |
--- a/ipatests/test_webui/ui_driver.py
|
|
|
e0e1b7 |
+++ b/ipatests/test_webui/ui_driver.py
|
|
|
e0e1b7 |
@@ -192,7 +192,7 @@ class UI_driver:
|
|
|
e0e1b7 |
if not NO_YAML and os.path.isfile(path):
|
|
|
e0e1b7 |
try:
|
|
|
e0e1b7 |
with open(path, 'r') as conf:
|
|
|
e0e1b7 |
- cls.config = yaml.load(stream=conf, Loader=yaml.FullLoader)
|
|
|
e0e1b7 |
+ cls.config = yaml.safe_load(stream=conf)
|
|
|
e0e1b7 |
except yaml.YAMLError as e:
|
|
|
e0e1b7 |
pytest.skip("Invalid Web UI config.\n%s" % e)
|
|
|
e0e1b7 |
except IOError as e:
|
|
|
e0e1b7 |
--
|
|
|
e0e1b7 |
2.34.1
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
From 5444da016edc416c0c9481c660c013053dbb93b5 Mon Sep 17 00:00:00 2001
|
|
|
e0e1b7 |
From: Mohammad Rizwan <myusuf@redhat.com>
|
|
|
e0e1b7 |
Date: Thu, 18 Nov 2021 18:43:22 +0530
|
|
|
e0e1b7 |
Subject: [PATCH] PEP8 Fixes
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Signed-off-by: Mohammad Rizwan <myusuf@redhat.com>
|
|
|
e0e1b7 |
---
|
|
|
e0e1b7 |
.../test_integration/test_replica_promotion.py | 14 +++++++-------
|
|
|
e0e1b7 |
1 file changed, 7 insertions(+), 7 deletions(-)
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
diff --git a/ipatests/test_integration/test_replica_promotion.py b/ipatests/test_integration/test_replica_promotion.py
|
|
|
e0e1b7 |
index 1a4e9bc12..c328b1a08 100644
|
|
|
e0e1b7 |
--- a/ipatests/test_integration/test_replica_promotion.py
|
|
|
e0e1b7 |
+++ b/ipatests/test_integration/test_replica_promotion.py
|
|
|
e0e1b7 |
@@ -138,7 +138,6 @@ class TestReplicaPromotionLevel1(ReplicaPromotionBase):
|
|
|
e0e1b7 |
assert res.returncode == 1
|
|
|
e0e1b7 |
assert expected_err in res.stderr_text
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
-
|
|
|
e0e1b7 |
@replicas_cleanup
|
|
|
e0e1b7 |
def test_one_command_installation(self):
|
|
|
e0e1b7 |
"""
|
|
|
e0e1b7 |
@@ -150,11 +149,11 @@ class TestReplicaPromotionLevel1(ReplicaPromotionBase):
|
|
|
e0e1b7 |
Firewall(self.replicas[0]).enable_services(["freeipa-ldap",
|
|
|
e0e1b7 |
"freeipa-ldaps"])
|
|
|
e0e1b7 |
self.replicas[0].run_command(['ipa-replica-install', '-w',
|
|
|
e0e1b7 |
- self.master.config.admin_password,
|
|
|
e0e1b7 |
- '-n', self.master.domain.name,
|
|
|
e0e1b7 |
- '-r', self.master.domain.realm,
|
|
|
e0e1b7 |
- '--server', self.master.hostname,
|
|
|
e0e1b7 |
- '-U'])
|
|
|
e0e1b7 |
+ self.master.config.admin_password,
|
|
|
e0e1b7 |
+ '-n', self.master.domain.name,
|
|
|
e0e1b7 |
+ '-r', self.master.domain.realm,
|
|
|
e0e1b7 |
+ '--server', self.master.hostname,
|
|
|
e0e1b7 |
+ '-U'])
|
|
|
e0e1b7 |
# Ensure that pkinit is properly configured, test for 7566
|
|
|
e0e1b7 |
result = self.replicas[0].run_command(['ipa-pkinit-manage', 'status'])
|
|
|
e0e1b7 |
assert "PKINIT is enabled" in result.stdout_text
|
|
|
e0e1b7 |
@@ -321,7 +320,7 @@ class TestWrongClientDomain(IntegrationTest):
|
|
|
e0e1b7 |
result1 = client.run_command(['ipa-replica-install', '-U', '-w',
|
|
|
e0e1b7 |
self.master.config.dirman_password],
|
|
|
e0e1b7 |
raiseonerr=False)
|
|
|
e0e1b7 |
- assert(result1.returncode == 0), (
|
|
|
e0e1b7 |
+ assert (result1.returncode == 0), (
|
|
|
e0e1b7 |
'Failed to promote the client installed with the upcase domain name')
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
def test_client_rollback(self):
|
|
|
e0e1b7 |
@@ -355,6 +354,7 @@ class TestWrongClientDomain(IntegrationTest):
|
|
|
e0e1b7 |
assert("An error occurred while removing SSSD" not in
|
|
|
e0e1b7 |
result.stdout_text)
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
class TestRenewalMaster(IntegrationTest):
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
topology = 'star'
|
|
|
e0e1b7 |
--
|
|
|
e0e1b7 |
2.34.1
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
From 1d19b860d4cd3bd65a4b143b588425d9a64237fd Mon Sep 17 00:00:00 2001
|
|
|
e0e1b7 |
From: Mohammad Rizwan <myusuf@redhat.com>
|
|
|
e0e1b7 |
Date: Thu, 18 Nov 2021 18:36:58 +0530
|
|
|
e0e1b7 |
Subject: [PATCH] Test cases for ipa-replica-conncheck command
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Following test cases would be checked:
|
|
|
e0e1b7 |
- when called with --principal (it should then prompt for a password)
|
|
|
e0e1b7 |
- when called with --principal / --password
|
|
|
e0e1b7 |
- when called without principal and password but with a kerberos TGT,
|
|
|
e0e1b7 |
kinit admin done before calling ipa-replica-conncheck
|
|
|
e0e1b7 |
- when called without principal and password, and without any kerberos
|
|
|
e0e1b7 |
TGT (it should default to principal=admin and prompt for a password)
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
related: https://pagure.io/freeipa/issue/9047
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
Signed-off-by: Mohammad Rizwan <myusuf@redhat.com>
|
|
|
e0e1b7 |
---
|
|
|
e0e1b7 |
.../test_replica_promotion.py | 70 +++++++++++++++++++
|
|
|
e0e1b7 |
1 file changed, 70 insertions(+)
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
diff --git a/ipatests/test_integration/test_replica_promotion.py b/ipatests/test_integration/test_replica_promotion.py
|
|
|
e0e1b7 |
index b9c56f775..1a4e9bc12 100644
|
|
|
e0e1b7 |
--- a/ipatests/test_integration/test_replica_promotion.py
|
|
|
e0e1b7 |
+++ b/ipatests/test_integration/test_replica_promotion.py
|
|
|
e0e1b7 |
@@ -437,6 +437,76 @@ class TestRenewalMaster(IntegrationTest):
|
|
|
e0e1b7 |
self.assertCARenewalMaster(master, replica.hostname)
|
|
|
e0e1b7 |
self.assertCARenewalMaster(replica, replica.hostname)
|
|
|
e0e1b7 |
|
|
|
e0e1b7 |
+ def test_replica_concheck(self):
|
|
|
e0e1b7 |
+ """Test cases for ipa-replica-conncheck command
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ Following test cases would be checked:
|
|
|
e0e1b7 |
+ - when called with --principal (it should then prompt for a password)
|
|
|
e0e1b7 |
+ - when called with --principal / --password
|
|
|
e0e1b7 |
+ - when called without principal and password but with a kerberos TGT,
|
|
|
e0e1b7 |
+ kinit admin done before calling ipa-replica-conncheck
|
|
|
e0e1b7 |
+ - when called without principal and password, and without any kerberos
|
|
|
e0e1b7 |
+ TGT (it should default to principal=admin and prompt for a password)
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ related: https://pagure.io/freeipa/issue/9047
|
|
|
e0e1b7 |
+ """
|
|
|
e0e1b7 |
+ exp_str1 = "Connection from replica to master is OK."
|
|
|
e0e1b7 |
+ exp_str2 = "Connection from master to replica is OK"
|
|
|
e0e1b7 |
+ tasks.kdestroy_all(self.replicas[0])
|
|
|
e0e1b7 |
+ # when called with --principal (it should then prompt for a password)
|
|
|
e0e1b7 |
+ result = self.replicas[0].run_command(
|
|
|
e0e1b7 |
+ ['ipa-replica-conncheck', '--auto-master-check',
|
|
|
e0e1b7 |
+ '--master', self.master.hostname,
|
|
|
e0e1b7 |
+ '-r', self.replicas[0].domain.realm,
|
|
|
e0e1b7 |
+ '-p', self.replicas[0].config.admin_name],
|
|
|
e0e1b7 |
+ stdin_text=self.master.config.admin_password
|
|
|
e0e1b7 |
+ )
|
|
|
e0e1b7 |
+ assert result.returncode == 0
|
|
|
e0e1b7 |
+ assert (
|
|
|
e0e1b7 |
+ exp_str1 in result.stderr_text and exp_str2 in result.stderr_text
|
|
|
e0e1b7 |
+ )
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ # when called with --principal / --password
|
|
|
e0e1b7 |
+ result = self.replicas[0].run_command([
|
|
|
e0e1b7 |
+ 'ipa-replica-conncheck', '--auto-master-check',
|
|
|
e0e1b7 |
+ '--master', self.master.hostname,
|
|
|
e0e1b7 |
+ '-r', self.replicas[0].domain.realm,
|
|
|
e0e1b7 |
+ '-p', self.replicas[0].config.admin_name,
|
|
|
e0e1b7 |
+ '-w', self.master.config.admin_password
|
|
|
e0e1b7 |
+ ])
|
|
|
e0e1b7 |
+ assert result.returncode == 0
|
|
|
e0e1b7 |
+ assert (
|
|
|
e0e1b7 |
+ exp_str1 in result.stderr_text and exp_str2 in result.stderr_text
|
|
|
e0e1b7 |
+ )
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ # when called without principal and password, and without
|
|
|
e0e1b7 |
+ # any kerberos TGT, it should default to principal=admin
|
|
|
e0e1b7 |
+ # and prompt for a password
|
|
|
e0e1b7 |
+ result = self.replicas[0].run_command(
|
|
|
e0e1b7 |
+ ['ipa-replica-conncheck', '--auto-master-check',
|
|
|
e0e1b7 |
+ '--master', self.master.hostname,
|
|
|
e0e1b7 |
+ '-r', self.replicas[0].domain.realm],
|
|
|
e0e1b7 |
+ stdin_text=self.master.config.admin_password
|
|
|
e0e1b7 |
+ )
|
|
|
e0e1b7 |
+ assert result.returncode == 0
|
|
|
e0e1b7 |
+ assert (
|
|
|
e0e1b7 |
+ exp_str1 in result.stderr_text and exp_str2 in result.stderr_text
|
|
|
e0e1b7 |
+ )
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
+ # when called without principal and password but with a kerberos TGT,
|
|
|
e0e1b7 |
+ # kinit admin done before calling ipa-replica-conncheck
|
|
|
e0e1b7 |
+ tasks.kinit_admin(self.replicas[0])
|
|
|
e0e1b7 |
+ result = self.replicas[0].run_command(
|
|
|
e0e1b7 |
+ ['ipa-replica-conncheck', '--auto-master-check',
|
|
|
e0e1b7 |
+ '--master', self.master.hostname,
|
|
|
e0e1b7 |
+ '-r', self.replicas[0].domain.realm]
|
|
|
e0e1b7 |
+ )
|
|
|
e0e1b7 |
+ assert result.returncode == 0
|
|
|
e0e1b7 |
+ assert (
|
|
|
e0e1b7 |
+ exp_str1 in result.stderr_text and exp_str2 in result.stderr_text
|
|
|
e0e1b7 |
+ )
|
|
|
e0e1b7 |
+ tasks.kdestroy_all(self.replicas[0])
|
|
|
e0e1b7 |
+
|
|
|
e0e1b7 |
def test_automatic_renewal_master_transfer_ondelete(self):
|
|
|
e0e1b7 |
# Test that after replica uninstallation, master overtakes the cert
|
|
|
e0e1b7 |
# renewal master role from replica (which was previously set there)
|
|
|
e0e1b7 |
--
|
|
|
e0e1b7 |
2.34.1
|
|
|
e0e1b7 |
|