mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Replace DNS client based on acutil with python-dns
IPA client and server tool set used authconfig acutil module to for client DNS operations. This is not optimal DNS interface for several reasons: - does not provide native Python object oriented interface but but rather C-like interface based on functions and structures which is not easy to use and extend - acutil is not meant to be used by third parties besides authconfig and thus can break without notice Replace the acutil with python-dns package which has a feature rich interface for dealing with all different aspects of DNS including DNSSEC. The main target of this patch is to replace all uses of acutil DNS library with a use python-dns. In most cases, even though the larger parts of the code are changed, the actual functionality is changed only in the following cases: - redundant DNS checks were removed from verify_fqdn function in installutils to make the whole DNS check simpler and less error-prone. Logging was improves for the remaining checks - improved logging for ipa-client-install DNS discovery https://fedorahosted.org/freeipa/ticket/2730 https://fedorahosted.org/freeipa/ticket/1837
This commit is contained in:
@@ -30,8 +30,7 @@ from ipalib.plugins.baseldap import *
|
||||
from ipalib import _, ngettext
|
||||
from ipalib.util import (validate_zonemgr, normalize_zonemgr,
|
||||
validate_hostname, validate_dns_label, validate_domain_name)
|
||||
from ipapython import dnsclient
|
||||
from ipapython.ipautil import valid_ip, CheckedIPAddress
|
||||
from ipapython.ipautil import valid_ip, CheckedIPAddress, is_host_resolvable
|
||||
from ldap import explode_dn
|
||||
|
||||
__doc__ = _("""
|
||||
@@ -2610,17 +2609,8 @@ class dns_resolve(Command):
|
||||
query = '%s.%s.' % (query, api.env.domain)
|
||||
if query[-1] != '.':
|
||||
query = query + '.'
|
||||
reca = dnsclient.query(query, dnsclient.DNS_C_IN, dnsclient.DNS_T_A)
|
||||
rec6 = dnsclient.query(query, dnsclient.DNS_C_IN, dnsclient.DNS_T_AAAA)
|
||||
records = reca + rec6
|
||||
found = False
|
||||
for rec in records:
|
||||
if rec.dns_type == dnsclient.DNS_T_A or \
|
||||
rec.dns_type == dnsclient.DNS_T_AAAA:
|
||||
found = True
|
||||
break
|
||||
|
||||
if not found:
|
||||
if not is_host_resolvable(query):
|
||||
raise errors.NotFound(
|
||||
reason=_('Host \'%(host)s\' not found') % {'host': query}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user