[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Freeipa-devel] [PATCH] 079 DNS installation fails when domain and host domain mismatch



This patch depends on my patch 078. A special patch for stable branch
attached.

---

Create DNS domain for IPA server hostname first so that it's forward
record can be added. This results in 2 forward DNS zones created
when server hostname doesn't equal server domain.

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

>From c2190f7a4cbd9770c1e89c4c7a4ae0db0f205c46 Mon Sep 17 00:00:00 2001
From: Martin Kosek <mkosek redhat com>
Date: Thu, 9 Jun 2011 12:33:09 +0200
Subject: [PATCH] DNS installation fails when domain and host domain mismatch

Create DNS domain for IPA server hostname first so that it's forward
record can be added. This results in 2 forward DNS zones created
when server hostname doesn't equal server domain.

https://fedorahosted.org/freeipa/ticket/1194
---
 ipaserver/install/bindinstance.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index 2f897b423f30b6b08127783f00adcd6352f09ca4..e151eb38635faa3b725fe0c393d90dd4c394b5cf 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -308,6 +308,10 @@ class BindInstance(service.Service):
         self.domain = domain_name
         self.forwarders = forwarders
         self.host = fqdn.split(".")[0]
+        if '.' in self.fqdn:
+            self.host_domain = '.'.join(fqdn.split(".")[1:])
+        else:
+            self.host_domain = self.domain
         self.suffix = util.realm_to_suffix(self.realm)
         self.ntp = ntp
         self.create_reverse = create_reverse
@@ -402,6 +406,14 @@ class BindInstance(service.Service):
         self._ldap_mod("dns.ldif", self.sub_dict)
 
     def __setup_zone(self):
+        if self.host_domain != self.domain:
+            # add DNS domain for host first
+            logging.debug("Host domain (%s) is different from DNS domain (%s)!" \
+                    % (self.host_domain, self.domain))
+            logging.debug("Add DNS zone for host first.")
+
+            add_zone(self.host_domain, self.zonemgr, dns_backup=self.dns_backup,
+                    ns_hostname=api.env.host, ns_ip_address=self.ip_address)
         add_zone(self.domain, self.zonemgr, dns_backup=self.dns_backup,
                 ns_hostname=api.env.host, ns_ip_address=self.ip_address)
 
-- 
1.7.5.2

>From 6324769ac79efecfe31bdc715c3441d40df1edd9 Mon Sep 17 00:00:00 2001
From: Martin Kosek <mkosek redhat com>
Date: Thu, 9 Jun 2011 12:55:01 +0200
Subject: [PATCH] DNS installation fails when domain and host domain mismatch

Create DNS domain for IPA server hostname first so that it's forward
record can be added. This results in 2 forward DNS zones created
when server hostname doesn't equal server domain.

https://fedorahosted.org/freeipa/ticket/1194
---
 ipaserver/install/bindinstance.py |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index fa27451703d39b7d9607066fb1901fd58c1c9ee9..dd1590dda03c3e6fd185465210b7e23e8fc174b4 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -267,6 +267,10 @@ class BindInstance(service.Service):
         self.domain = domain_name
         self.forwarders = forwarders
         self.host = fqdn.split(".")[0]
+        if '.' in self.fqdn:
+            self.host_domain = '.'.join(fqdn.split(".")[1:])
+        else:
+            self.host_domain = self.domain
         self.suffix = util.realm_to_suffix(self.realm)
         self.ntp = ntp
         self.create_reverse = create_reverse
@@ -361,6 +365,13 @@ class BindInstance(service.Service):
         self._ldap_mod("dns.ldif", self.sub_dict)
 
     def __setup_zone(self):
+        if self.host_domain != self.domain:
+            # add DNS domain for host first
+            logging.debug("Host domain (%s) is different from DNS domain (%s)!" \
+                    % (self.host_domain, self.domain))
+            logging.debug("Add DNS zone for host first.")
+            zone = add_zone(self.host_domain, self.zonemgr,
+                        self.dns_backup, self.ip_address)
         zone = add_zone(self.domain, self.zonemgr,
                         self.dns_backup, self.ip_address)
 
-- 
1.7.5.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]