Only add an NTP SRV record if we really are setting up NTP

The sample bind zone file that is generated if we don't use --setup-dns
is also changed.

Fixes #500238
This commit is contained in:
Martin Nagy 2009-11-10 15:16:38 +01:00 committed by Rob Crittenden
parent 686203c074
commit 7aa78ee060
4 changed files with 16 additions and 8 deletions

View File

@ -23,6 +23,4 @@ _kerberos-master._tcp IN SRV 0 100 88 $HOST
_kerberos-master._udp IN SRV 0 100 88 $HOST
_kpasswd._tcp IN SRV 0 100 464 $HOST
_kpasswd._udp IN SRV 0 100 464 $HOST
;ntp server
_ntp._udp IN SRV 0 100 123 $HOST
$OPTIONAL_NTP

View File

@ -219,7 +219,8 @@ def install_bind(config, options):
forwarders = ()
bind = bindinstance.BindInstance(dm_password=config.dirman_password)
ip_address = resolve_host(config.host_name)
bind.setup(config.host_name, ip_address, config.realm_name, config.domain_name, forwarders)
bind.setup(config.host_name, ip_address, config.realm_name,
config.domain_name, forwarders, options.conf_ntp)
bind.create_instance()
def check_dirsrv():

View File

@ -808,7 +808,7 @@ def main():
# Create a BIND instance
bind = bindinstance.BindInstance(fstore, dm_password)
bind.setup(host_name, ip_address, realm_name, domain_name, dns_forwarders)
bind.setup(host_name, ip_address, realm_name, domain_name, dns_forwarders, options.conf_ntp)
if options.setup_dns:
api.Backend.ldap2.connect(bind_dn="cn=Directory Manager", bind_pw=dm_password)

View File

@ -121,7 +121,7 @@ class BindInstance(service.Service):
else:
self.fstore = sysrestore.FileStore('/var/lib/ipa/sysrestore')
def setup(self, fqdn, ip_address, realm_name, domain_name, forwarders, named_user="named"):
def setup(self, fqdn, ip_address, realm_name, domain_name, forwarders, ntp, named_user="named"):
self.named_user = named_user
self.fqdn = fqdn
self.ip_address = ip_address
@ -130,6 +130,7 @@ class BindInstance(service.Service):
self.forwarders = forwarders
self.host = fqdn.split(".")[0]
self.suffix = util.realm_to_suffix(self.realm)
self.ntp = ntp
tmp = ip_address.split(".")
tmp.reverse()
@ -210,13 +211,20 @@ class BindInstance(service.Service):
else:
fwds = " "
if self.ntp:
optional_ntp = "\n;ntp server\n"
optional_ntp += "_ntp._udp\t\tIN SRV 0 100 123\t%s""" % self.host
else:
optional_ntp = ""
self.sub_dict = dict(FQDN=self.fqdn,
IP=self.ip_address,
DOMAIN=self.domain,
HOST=self.host,
REALM=self.realm,
FORWARDERS=fwds,
SUFFIX=self.suffix)
SUFFIX=self.suffix,
OPTIONAL_NTP=optional_ntp)
def __setup_dns_container(self):
self._ldap_mod("dns.ldif", self.sub_dict)
@ -237,7 +245,8 @@ class BindInstance(service.Service):
zone = add_zone(self.domain)
for (host, type, rdata) in resource_records:
add_rr(zone, host, type, rdata)
add_rr(zone, "_ntp._udp", "SRV", "0 100 123 "+self.host)
if self.ntp:
add_rr(zone, "_ntp._udp", "SRV", "0 100 123 "+self.host)
def __setup_reverse_zone(self):
add_reverze_zone(self.ip_address)