summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2011-05-27 20:29:33 +0200
committerMartin Kosek <mkosek@redhat.com>2011-05-30 13:37:03 +0200
commitdb78f362358862c5225f8d3b83ecc2a88d47e45b (patch)
treebcbab49f726e0521b17121b068197385e9b32692 /install
parent80b4b3d44bbbe745e644b56c5371ef5f4cda6600 (diff)
downloadfreeipa-db78f362358862c5225f8d3b83ecc2a88d47e45b.tar.gz
freeipa-db78f362358862c5225f8d3b83ecc2a88d47e45b.tar.xz
freeipa-db78f362358862c5225f8d3b83ecc2a88d47e45b.zip
Honor netmask in DNS reverse zone setup.
ticket 910
Diffstat (limited to 'install')
-rwxr-xr-xinstall/tools/ipa-dns-install3
-rwxr-xr-xinstall/tools/ipa-replica-install6
-rwxr-xr-xinstall/tools/ipa-replica-prepare34
-rwxr-xr-xinstall/tools/ipa-server-install3
4 files changed, 36 insertions, 10 deletions
diff --git a/install/tools/ipa-dns-install b/install/tools/ipa-dns-install
index e8379191a..91edcca8a 100755
--- a/install/tools/ipa-dns-install
+++ b/install/tools/ipa-dns-install
@@ -113,6 +113,7 @@ def main():
sys.exit("Unable to resolve IP address for host name")
else:
ip_address = read_ip_address(api.env.host, fstore)
+ ip_prefixlen = ip_address.prefixlen
ip_address = str(ip_address)
logging.debug("will use ip_address: %s\n", ip_address)
@@ -158,7 +159,7 @@ def main():
create_reverse = not options.no_reverse
elif not options.no_reverse:
create_reverse = bindinstance.create_reverse()
- bind.setup(api.env.host, ip_address, api.env.realm, api.env.domain, dns_forwarders, conf_ntp, create_reverse, zonemgr=options.zonemgr)
+ bind.setup(api.env.host, ip_address, ip_prefixlen, api.env.realm, api.env.domain, dns_forwarders, conf_ntp, create_reverse, zonemgr=options.zonemgr)
if bind.dm_password:
api.Backend.ldap2.connect(bind_dn="cn=Directory Manager", bind_pw=bind.dm_password)
diff --git a/install/tools/ipa-replica-install b/install/tools/ipa-replica-install
index 6df512312..2848366dd 100755
--- a/install/tools/ipa-replica-install
+++ b/install/tools/ipa-replica-install
@@ -272,6 +272,7 @@ def install_bind(config, options):
sys.exit("Unable to resolve IP address for host name")
ip = installutils.parse_ip_address(ip_address)
ip_address = str(ip)
+ ip_prefixlen = ip.prefixlen
create_reverse = True
if options.unattended:
@@ -285,7 +286,7 @@ def install_bind(config, options):
# specified, ask the user
create_reverse = bindinstance.create_reverse()
- bind.setup(config.host_name, ip_address, config.realm_name,
+ bind.setup(config.host_name, ip_address, ip_prefixlen, config.realm_name,
config.domain_name, forwarders, options.conf_ntp, create_reverse)
bind.create_instance()
@@ -309,8 +310,9 @@ def install_dns_records(config, options):
sys.exit("Unable to resolve IP address for host name")
ip = installutils.parse_ip_address(ip_address)
ip_address = str(ip)
+ ip_prefixlen = ip.prefixlen
- bind.add_master_dns_records(config.host_name, ip_address,
+ bind.add_master_dns_records(config.host_name, ip_address, ip_prefixlen,
config.realm_name, config.domain_name,
options.conf_ntp)
diff --git a/install/tools/ipa-replica-prepare b/install/tools/ipa-replica-prepare
index 21f30f072..2765e4a0e 100755
--- a/install/tools/ipa-replica-prepare
+++ b/install/tools/ipa-replica-prepare
@@ -27,7 +27,7 @@ import krbV
from ipapython import ipautil
from ipaserver.install import bindinstance, dsinstance, installutils, certs
-from ipaserver.install.bindinstance import add_zone, add_reverse_zone, add_rr, add_ptr_rr
+from ipaserver.install.bindinstance import add_zone, add_reverse_zone, add_fwd_rr, add_ptr_rr, dns_zone_exists
from ipaserver.install.replication import check_replication_plugin, enable_replication_version_checking
from ipaserver.install.installutils import resolve_host
from ipaserver.plugins.ldap2 import ldap2
@@ -426,12 +426,34 @@ def main():
name = domain.pop(0)
domain = ".".join(domain)
- ip_address = str(options.ip_address)
+ ip = options.ip_address
+ ip_address = str(ip)
+ ip_prefixlen = ip.prefixlen
+
+ if ip.defaultnet:
+ revzone = ip.reverse_dns
+ if ip.version == 4:
+ prefix = 32
+ dec = 8
+ elif ip.version == 6:
+ prefix = 128
+ dec = 4
+
+ while prefix > 0:
+ dummy, dot, revzone = revzone.partition('.')
+ prefix = prefix - dec
+ if dns_zone_exists(revzone):
+ break
+
+ if prefix > 0:
+ ip_prefixlen = prefix
+ else:
+ ns_ip_address = resolve_host(api.env.host)
+ add_reverse_zone(ip_address, ip_prefixlen, ns_ip_address)
+
zone = add_zone(domain, nsaddr=ip_address)
- add_rr(zone, name, "A", ip_address)
- ns_ip_address = resolve_host(api.env.host)
- add_reverse_zone(ip_address, ns_ip_address)
- add_ptr_rr(ip_address, replica_fqdn)
+ add_fwd_rr(zone, name, ip_address)
+ add_ptr_rr(ip_address, ip_prefixlen, replica_fqdn)
try:
if not os.geteuid()==0:
diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install
index e36d5af48..23e495e63 100755
--- a/install/tools/ipa-server-install
+++ b/install/tools/ipa-server-install
@@ -622,6 +622,7 @@ def main():
ip = read_ip_address(host_name, fstore)
logging.debug("read ip_address: %s\n" % str(ip))
ip_address = str(ip)
+ ip_prefixlen = ip.prefixlen
print "The IPA Master Server will be configured with"
print "Hostname: " + host_name
@@ -892,7 +893,7 @@ def main():
# specified, ask the user
create_reverse = bindinstance.create_reverse()
- bind.setup(host_name, ip_address, realm_name, domain_name, dns_forwarders, options.conf_ntp, create_reverse, zonemgr=options.zonemgr)
+ bind.setup(host_name, ip_address, ip_prefixlen, realm_name, domain_name, dns_forwarders, options.conf_ntp, create_reverse, zonemgr=options.zonemgr)
if options.setup_dns:
api.Backend.ldap2.connect(bind_dn="cn=Directory Manager", bind_pw=dm_password)