ipatests: when talking to AD DCs, use FQDN credentials

Samba 4.13+ in Fedora 33+ and RHEL 8.4+ defaults to Kerberos
authentication. This means user name used for authentication must be
mapped to a target realm.

We have to remove trust on AD side first before removing it locally or
otherwise MIT Kerberos might not be able to locate DCs from AD as
removal of the trust information would cause SSSD to clear the details
for a KDC locator plugin as well.

For the test that modifies AD DNS zone on IPA side to inject unreachable
DCs addresses, the configuration has to be reverted first, to allow
plain 'kinit' during removal of trust to reach AD DCs directly.

Fixes: https://pagure.io/freeipa/issue/8678
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
Alexander Bokovoy authored and Rob Crittenden committed 2021-01-26 13:05:27 -05:00
1 parent 642b81e99f
commit c91a1a078a
4 files changed
+17 -12

No files matched your search

+8 -7
View File
@@ -702,11 +702,13 @@ def establish_trust_with_ad(master, ad_domain, ad_admin=None, extra_args=(),
time.sleep(60)
def remove_trust_with_ad(master, ad_domain):
def remove_trust_with_ad(master, ad_domain, ad_hostname):
"""
Removes trust with Active Directory. Also removes the associated ID range.
"""
remove_trust_info_from_ad(master, ad_domain, ad_hostname)
kinit_admin(master)
# Remove the trust
@@ -716,14 +718,13 @@ def remove_trust_with_ad(master, ad_domain):
range_name = ad_domain.upper() + '_id_range'
master.run_command(['ipa', 'idrange-del', range_name])
remove_trust_info_from_ad(master, ad_domain)
def remove_trust_info_from_ad(master, ad_domain):
def remove_trust_info_from_ad(master, ad_domain, ad_hostname):
# Remove record about trust from AD
master.run_command(['rpcclient', ad_domain,
'-U\\Administrator%{}'.format(
master.config.ad_admin_password),
kinit_as_user(master,
'Administrator@{}'.format(ad_domain.upper()),
master.config.ad_admin_password)
master.run_command(['rpcclient', '-k', ad_hostname,
'-c', 'deletetrustdom {}'.format(master.domain.name)],
raiseonerr=False)