Skip to content

Commit f5238e5

Browse files
author
Dan Lavu
committed
ipa dns forwarders are no longer necessary
1 parent fcecd69 commit f5238e5

1 file changed

Lines changed: 0 additions & 51 deletions

File tree

sssd_test_framework/topology_controllers.py

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import re
4-
import socket
54
import tempfile
65

76
from pytest_mh import BackupTopologyController
@@ -208,7 +207,6 @@ def topology_setup(self, client: ClientHost, ipa: IPAHost) -> None:
208207
client.conn.run(f"echo {hostname} > /etc/hostname")
209208
client.fs.write("/etc/hosts", client.fs.read("/etc/hosts").replace("client.test", hostname))
210209

211-
212210
# Change client hostname to match the domain
213211
self.logger.info(f"Changing hostname to {hostname}")
214212
client.conn.run(f"hostname {hostname}")
@@ -277,9 +275,6 @@ def topology_setup(self, client: ClientHost, ipa: IPAHost, trusted: ADHost | Sam
277275
self.logger.info(f"Topology '{self.name}' is already provisioned")
278276
return
279277

280-
# Configure DNS forwarder for AD domain on IPA server
281-
self.setup_dns_forwarder(ipa, trusted)
282-
283278
# Create trust
284279
self.logger.info(f"Establishing trust between {ipa.domain} and {trusted.domain}")
285280
ipa.kinit()
@@ -293,52 +288,6 @@ def topology_setup(self, client: ClientHost, ipa: IPAHost, trusted: ADHost | Sam
293288
# Backup so we can restore to this state after each test
294289
super().topology_setup()
295290

296-
def setup_dns_forwarder(self, ipa: IPAHost, trusted: ADHost | SambaHost) -> None:
297-
"""
298-
Configure DNS forwarder on IPA server for the trusted AD domain.
299-
300-
This ensures IPA can resolve the AD domain for trust establishment.
301-
"""
302-
self.logger.info(f"Configuring DNS forwarder for {trusted.domain} on {ipa.hostname}")
303-
ipa.kinit()
304-
305-
# Check if forwarder already exists
306-
result = ipa.conn.exec(
307-
["ipa", "dnsforwardzone-show", trusted.domain],
308-
raise_on_error=False,
309-
)
310-
311-
if result.rc == 0:
312-
self.logger.info(f"DNS forwarder for {trusted.domain} already exists, skipping")
313-
return
314-
315-
# Resolve AD server hostname to IP address (forwarder requires IP)
316-
# Use getattr to safely access the host attribute from the connection
317-
ad_hostname = getattr(trusted.conn, "host", trusted.hostname)
318-
try:
319-
ad_ip = socket.gethostbyname(ad_hostname)
320-
except socket.gaierror:
321-
self.logger.error(
322-
f"Could not resolve hostname '{ad_hostname}'. "
323-
"Please ensure it is resolvable from the test controller."
324-
)
325-
raise
326-
327-
# Add DNS forward zone pointing to the AD server IP
328-
ipa.conn.exec(
329-
[
330-
"ipa",
331-
"dnsforwardzone-add",
332-
trusted.domain,
333-
f"--forwarder={ad_ip}",
334-
"--forward-policy=only",
335-
]
336-
)
337-
338-
# Restart named to ensure it picks up the new forwarder zone
339-
ipa.conn.exec(["systemctl", "restart", "named"])
340-
self.logger.info(f"DNS forwarder for {trusted.domain} configured successfully")
341-
342291
# If this command is run on freshly started containers, it is possible the IPA is not yet
343292
# fully ready to create the trust. It takes a while for it to start working.
344293
@retry_command(max_retries=20, delay=5, match_stderr='CIFS server communication error: code "3221225581"')

0 commit comments

Comments
 (0)