summaryrefslogtreecommitdiffstats
path: root/ipaserver
diff options
context:
space:
mode:
authorMartin Nagy <mnagy@redhat.com>2009-05-12 15:20:24 +0200
committerMartin Nagy <mnagy@redhat.com>2009-06-02 12:32:01 +0200
commit1bc786e379ed5575cf4dffaa23bf7d66f42e44d7 (patch)
tree88e2027f90907587f7138704776db8264441f966 /ipaserver
parent1893a802c78399c27c99523edcac4de0ab2a0ef0 (diff)
downloadfreeipa-1bc786e379ed5575cf4dffaa23bf7d66f42e44d7.tar.gz
freeipa-1bc786e379ed5575cf4dffaa23bf7d66f42e44d7.tar.xz
freeipa-1bc786e379ed5575cf4dffaa23bf7d66f42e44d7.zip
Use LDAP instead of flat file for zone storage
Diffstat (limited to 'ipaserver')
-rw-r--r--ipaserver/install/bindinstance.py31
-rw-r--r--ipaserver/install/dsinstance.py1
-rw-r--r--ipaserver/install/krbinstance.py1
-rw-r--r--ipaserver/install/service.py2
4 files changed, 16 insertions, 19 deletions
diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index 08b781d25..72d1102b6 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -27,20 +27,26 @@ import logging
import service
from ipapython import sysrestore
from ipapython import ipautil
+from ipalib import util
def check_inst():
# So far this file is always present in both RHEL5 and Fedora if all the necessary
# bind packages are installed (RHEL5 requires also the pkg: caching-nameserver)
if not os.path.exists('/etc/named.rfc1912.zones'):
- return False
+ return False
+
+ # Also check for the LDAP BIND plug-in
+ if not os.path.exists('/usr/lib/bind/ldap.so') and \
+ not os.path.exists('/usr/lib64/bind/ldap.so'):
+ return False
return True
class BindInstance(service.Service):
- def __init__(self, fstore=None):
- service.Service.__init__(self, "named")
+ def __init__(self, fstore=None, dm_password=None):
+ service.Service.__init__(self, "named", dm_password=dm_password)
self.fqdn = None
- self.domain = None
+ self.domain = None
self.host = None
self.ip_address = None
self.realm = None
@@ -57,6 +63,7 @@ class BindInstance(service.Service):
self.realm = realm_name
self.domain = domain_name
self.host = fqdn.split(".")[0]
+ self.suffix = util.realm_to_suffix(self.realm)
self.__setup_sub_dict()
@@ -99,15 +106,12 @@ class BindInstance(service.Service):
IP=self.ip_address,
DOMAIN=self.domain,
HOST=self.host,
- REALM=self.realm)
+ REALM=self.realm,
+ SUFFIX=self.suffix)
def __setup_zone(self):
self.backup_state("domain", self.domain)
- zone_txt = ipautil.template_file(ipautil.SHARE_DIR + "bind.zone.db.template", self.sub_dict)
- self.fstore.backup_file('/var/named/'+self.domain+'.zone.db')
- zone_fd = open('/var/named/'+self.domain+'.zone.db', 'w')
- zone_fd.write(zone_txt)
- zone_fd.close()
+ self._ldap_mod("dns.ldif", self.sub_dict)
def __setup_named_conf(self):
self.fstore.backup_file('/etc/named.conf')
@@ -135,13 +139,6 @@ class BindInstance(service.Service):
if not running is None:
self.stop()
- if not domain is None:
- try:
- self.fstore.restore_file(os.path.join ("/var/named/", domain + ".zone.db"))
- except ValueError, error:
- logging.debug(error)
- pass
-
for f in ["/etc/named.conf", "/etc/resolv.conf"]:
try:
self.fstore.restore_file(f)
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py
index 7bd9aa69e..b9b74e685 100644
--- a/ipaserver/install/dsinstance.py
+++ b/ipaserver/install/dsinstance.py
@@ -26,7 +26,6 @@ import sys
import os
import re
import time
-import tempfile
import stat
from ipapython import ipautil
diff --git a/ipaserver/install/krbinstance.py b/ipaserver/install/krbinstance.py
index 66ee63f81..1c3489725 100644
--- a/ipaserver/install/krbinstance.py
+++ b/ipaserver/install/krbinstance.py
@@ -19,7 +19,6 @@
import subprocess
import string
-import tempfile
import shutil
import logging
import fileinput
diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py
index 41e77a73e..a07a382ab 100644
--- a/ipaserver/install/service.py
+++ b/ipaserver/install/service.py
@@ -18,6 +18,8 @@
#
import logging, sys
+import os
+import tempfile
from ipapython import sysrestore
from ipapython import ipautil