diff options
author | Amitay Isaacs <amitay@gmail.com> | 2011-09-08 15:33:41 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-09-12 20:42:16 +1000 |
commit | 0b089880f021121320744f4f1b742857c0cb5cbf (patch) | |
tree | 4f697d624b1a31cfba7a9ff47fe00b6fc84a5a3e /source4 | |
parent | 295361c13d12782b2248e53b30e4101a41a96f90 (diff) | |
download | samba-0b089880f021121320744f4f1b742857c0cb5cbf.tar.gz samba-0b089880f021121320744f4f1b742857c0cb5cbf.tar.bz2 samba-0b089880f021121320744f4f1b742857c0cb5cbf.zip |
s4-provision: Generate appropriate named.conf file depending on dns_backend
For --dns_backend=BIND9, generate the dns zone file, and named.conf with
zone information.
For --dns-backend=BIND9_DLZ, generate the named.conf with dlz directive.
If no option is specified, default dns_backend is BIND9.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/scripting/python/samba/provision/__init__.py | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/source4/scripting/python/samba/provision/__init__.py b/source4/scripting/python/samba/provision/__init__.py index 2d9d867593..47b7e63619 100644 --- a/source4/scripting/python/samba/provision/__init__.py +++ b/source4/scripting/python/samba/provision/__init__.py @@ -1784,6 +1784,10 @@ def provision(logger, session_info, credentials, smbconf=None, dnsdomain=names.dnsdomain, dns_keytab_path=paths.dns_keytab, dnspass=dnspass) + # Default DNS backend is BIND9 using txt files for zone information + if not dns_backend: + dns_backend = "BIND9" + setup_ad_dns(samdb, names, logger, hostip=hostip, hostip6=hostip6, dns_backend=dns_backend, os_level=dom_for_fun_level) @@ -1793,13 +1797,14 @@ def provision(logger, session_info, credentials, smbconf=None, # Only make a zone file on the first DC, it should be # replicated with DNS replication - create_zone_file(lp, logger, paths, targetdir, - dnsdomain=names.dnsdomain, hostip=hostip, hostip6=hostip6, - hostname=names.hostname, realm=names.realm, - domainguid=domainguid, ntdsguid=names.ntdsguid) + if dns_backend == "BIND9": + create_zone_file(lp, logger, paths, targetdir, + dnsdomain=names.dnsdomain, hostip=hostip, hostip6=hostip6, + hostname=names.hostname, realm=names.realm, + domainguid=domainguid, ntdsguid=names.ntdsguid) create_named_conf(paths, realm=names.realm, - dnsdomain=names.dnsdomain, private_dir=paths.private_dir) + dnsdomain=names.dnsdomain, dns_backend=dns_backend) create_named_txt(paths.namedtxt, realm=names.realm, dnsdomain=names.dnsdomain, @@ -2029,28 +2034,37 @@ def create_dns_update_list(lp, logger, paths): setup_file(setup_path("spn_update_list"), paths.spn_update_list, None) -def create_named_conf(paths, realm, dnsdomain, - private_dir): +def create_named_conf(paths, realm, dnsdomain, dns_backend): """Write out a file containing zone statements suitable for inclusion in a named.conf file (including GSS-TSIG configuration). :param paths: all paths :param realm: Realm name :param dnsdomain: DNS Domain name - :param private_dir: Path to private directory + :param dns_backend: DNS backend type :param keytab_name: File name of DNS keytab file """ - setup_file(setup_path("named.conf"), paths.namedconf, { - "DNSDOMAIN": dnsdomain, - "REALM": realm, - "ZONE_FILE": paths.dns, - "REALM_WC": "*." + ".".join(realm.split(".")[1:]), - "NAMED_CONF": paths.namedconf, - "NAMED_CONF_UPDATE": paths.namedconf_update - }) + if dns_backend == "BIND9": + setup_file(setup_path("named.conf"), paths.namedconf, { + "DNSDOMAIN": dnsdomain, + "REALM": realm, + "ZONE_FILE": paths.dns, + "REALM_WC": "*." + ".".join(realm.split(".")[1:]), + "NAMED_CONF": paths.namedconf, + "NAMED_CONF_UPDATE": paths.namedconf_update + }) + + setup_file(setup_path("named.conf.update"), paths.namedconf_update) + + elif dns_backend == "BIND9_DLZ": + dlz_module_path = os.path.join(samba.param.modules_dir(), + "bind9/dlz_bind9.so") + setup_file(setup_path("named.conf.dlz"), paths.namedconf, { + "NAMED_CONF": paths.namedconf, + "BIND9_DLZ_MODULE": dlz_module_path, + }) - setup_file(setup_path("named.conf.update"), paths.namedconf_update) def create_named_txt(path, realm, dnsdomain, dnsname, private_dir, |