When replica with DNS is installed, NS records for the managed zone
are not updated with the replica FQDN. The administrator then has
to do it manually to enroll the new DNS server to the zone.

This patch also removes the newly created NS records when the
replica is removed via ipa-replica-manage command.

https://fedorahosted.org/freeipa/ticket/1034

>From fcaf3c93efc0ebc44ef5424791e2cf901440329d Mon Sep 17 00:00:00 2001
From: Martin Kosek <mko...@redhat.com>
Date: Tue, 3 May 2011 11:31:16 +0200
Subject: [PATCH] NS records not updated by replica

When replica with DNS is installed, NS records for the managed zone
are not updated with the replica FQDN. The administrator then has
to do it manually to enroll the new DNS server to the zone.

This patch also removes the newly created NS records when the
replica is removed via ipa-replica-manage command.

https://fedorahosted.org/freeipa/ticket/1034
---
 ipaserver/install/bindinstance.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index e0056536d2bdb1f233d4dee933857edda07dc090..3208688926a462f48b03d67d046c4e8b8c30cb4e 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -300,7 +300,9 @@ class BindInstance(service.Service):
 
         if not dns_container_exists(self.fqdn, self.suffix):
             self.step("adding DNS container", self.__setup_dns_container)
-        if not dns_zone_exists(self.domain):
+        if dns_zone_exists(self.domain):
+            self.step("adding NS record to the zone", self.__add_self_ns)
+        else:
             self.step("setting up our zone", self.__setup_zone)
         if self.create_reverse:
             self.step("setting up reverse zone", self.__setup_reverse_zone)
@@ -362,6 +364,8 @@ class BindInstance(service.Service):
         zone = add_zone(self.domain, self.zonemgr,
                         self.dns_backup, self.ip_address)
 
+    def __add_self_ns(self):
+        add_rr(self.domain, "@", "NS", api.env.host+'.', self.dns_backup, force=True)
 
     def __add_self(self):
         zone = self.domain
@@ -472,6 +476,7 @@ class BindInstance(service.Service):
             ("_kpasswd._tcp", "SRV", "0 100 464 %s" % host),
             ("_kpasswd._udp", "SRV", "0 100 464 %s" % host),
             ("_ntp._udp", "SRV", "0 100 123 %s" % host),
+            ("@", "NS", fqdn+"."),
         )
 
         for (record, type, rdata) in resource_records:
@@ -485,6 +490,8 @@ class BindInstance(service.Service):
                 rzone, record = get_reverse_zone(rdata)
                 if dns_zone_exists(rzone):
                     del_rr(rzone, record, "PTR", fqdn+".")
+                    # remove also master NS record from the reverse zone
+                    del_rr(rzone, "@", "NS", fqdn+".")
 
 
     def uninstall(self):
-- 
1.7.4.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to