URL: https://github.com/SSSD/sssd/pull/5892 Author: jakub-vavra-cz Title: #5892: Tests: Add a test for BZ2004406 Action: synchronized
To pull the PR as Git branch: git remote add ghsssd https://github.com/SSSD/sssd git fetch ghsssd pull/5892/head:pr5892 git checkout pr5892
From 30397d43101ab9f38eafd8b4b671d94d69c2dc43 Mon Sep 17 00:00:00 2001 From: Jakub Vavra <jva...@redhat.com> Date: Fri, 26 Nov 2021 07:24:15 +0100 Subject: [PATCH] Tests: Add a test for BZ2004406 Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2004406 Verifies: MR#5791 --- src/tests/multihost/ipa/test_adtrust.py | 64 ++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/src/tests/multihost/ipa/test_adtrust.py b/src/tests/multihost/ipa/test_adtrust.py index 3f2fc66c1b..d1c2dd95a4 100644 --- a/src/tests/multihost/ipa/test_adtrust.py +++ b/src/tests/multihost/ipa/test_adtrust.py @@ -6,13 +6,14 @@ :upstream: yes """ +import random import re import time import pytest import paramiko from sssd.testlib.common.utils import sssdTools from sssd.testlib.common.utils import SSHClient - +from sssd.testlib.common.utils import ADOperations @pytest.mark.usefixtures('setup_ipa_client') @pytest.mark.tier2 @@ -379,3 +380,64 @@ def test_nss_get_by_name_with_private_group(self, multihost): assert cmd_adm.returncode == 0, 'Something wrong with setup!' assert cmd_usr.returncode == 0, \ f"pysss_nss_idmap.getsidbyname for {username} failed" + + @staticmethod + def test_idview_override_group(multihost, create_aduser_group): + """ + :title: IPA clients fail to resolve override group names + :id: 7a0dc871-fdad-4c07-9d07-a092baa83178 + :bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2004406 + :description: Overriding both group names and ids in an idview for + group from AD results in error in sssd when running id command + for IPA user that was assigned to overridden AD group via his gid. + :setup: + 1. Create group (group1) on AD. + 2. Create IPA user with gid=<GID1>. + :steps: + 1. ID views to override AD groupname and gid of group1 to <GID1> in + the 'Default Trust View'. + 2. Run an "id" command for the user. + :expectedresults: + 1. View with an override is created. + 2. Id command succeeds, group override is visible, all groups are + properly resolved. + """ + (_, adgroup) = create_aduser_group + run_id = f"{random.randint(9999, 999999)}" + + domain = multihost.ad[0].domainname + + ipauser = f"ipauser_{run_id}" + + multihost.master[0].run_command(f"ipa user-add {ipauser} --first=Bob " + f"--last=Sad --gid=987654", + raiseonerr=False) + + multihost.master[0].run_command("service ipa.service restart", + raiseonerr=False) + ipa_client = sssdTools(multihost.client[0]) + ipa_client.clear_sssd_cache() + + view = 'Default Trust View' + + create_grp_override = f'ipa idoverridegroup-add "{view}" ' \ + f'{adgroup}@{domain} --group-name "borci" ' \ + f'--gid=987654' + multihost.master[0].run_command(create_grp_override, raiseonerr=False) + + ipa_client.clear_sssd_cache() + time.sleep(5) + + id_cmd = f'id {ipauser}' + cmd = multihost.client[0].run_command(id_cmd, raiseonerr=False) + + # TEARDOWN + multihost.master[0].run_command(f"ipa user-del {ipauser} ", + raiseonerr=False) + + ipa_client.clear_sssd_cache() + # Test result Evaluation + assert cmd.returncode == 0, f"User {ipauser} was not found." + assert f"borci@{domain}" in cmd.stdout_text,\ + f"Group 1 {adgroup} name was not overridden/resolved." + assert "987654" in cmd.stdout_text, "Group id was not overridden."
_______________________________________________ sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/sssd-devel@lists.fedorahosted.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure