diff options
-rwxr-xr-x | install/tools/ipa-server-install | 55 | ||||
-rw-r--r-- | ipaserver/install/installutils.py | 53 |
2 files changed, 54 insertions, 54 deletions
diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install index 94c385032..43095a499 100755 --- a/install/tools/ipa-server-install +++ b/install/tools/ipa-server-install @@ -268,59 +268,6 @@ def resolve_host(host_name): print "Unable to lookup the IP address of the provided host" return ip -def verify_ip_address(ip): - is_ok = True - try: - socket.inet_pton(socket.AF_INET, ip) - except: - try: - socket.inet_pton(socket.AF_INET6, ip) - except: - print "Unable to verify IP address" - is_ok = False - return is_ok - -def read_ip_address(host_name): - while True: - ip = user_input("Please provide the IP address to be used for this host name", allow_empty = False) - - if ip == "127.0.0.1" or ip == "::1": - print "The IPA Server can't use localhost as a valid IP" - continue - - if not verify_ip_address(ip): - continue - - print "Adding ["+ip+" "+host_name+"] to your /etc/hosts file" - fstore.backup_file("/etc/hosts") - hosts_fd = open('/etc/hosts', 'r+') - hosts_fd.seek(0, 2) - hosts_fd.write(ip+'\t'+host_name+' '+host_name.split('.')[0]+'\n') - hosts_fd.close() - - return ip - -def read_dns_forwarders(): - addrs = [] - while True: - ip = user_input("Enter IP address for a DNS forwarder (empty to stop)", allow_empty=True) - - if not ip: - break - if ip == "127.0.0.1" or ip == "::1": - print "You cannot use localhost as a DNS forwarder" - continue - if not verify_ip_address(ip): - continue - - print "DNS forwarder %s added" % ip - addrs.append(ip) - - if not addrs: - print "No DNS forwarders configured" - - return addrs - def read_ds_user(): print "The server must run as a specific user in a specific group." print "It is strongly recommended that this user should have no privileges" @@ -630,7 +577,7 @@ def main(): return 1 if not ip: - ip = read_ip_address(host_name) + ip = read_ip_address(host_name, fstore) ip_address = ip print "The IPA Master Server will be configured with" diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py index 501d0e80c..6365fe82e 100644 --- a/ipaserver/install/installutils.py +++ b/ipaserver/install/installutils.py @@ -117,6 +117,59 @@ def verify_fqdn(host_name,no_host_dns=False): if forward != reverse: raise RuntimeError("The DNS forward record %s does not match the reverse address %s" % (forward, reverse)) +def verify_ip_address(ip): + is_ok = True + try: + socket.inet_pton(socket.AF_INET, ip) + except: + try: + socket.inet_pton(socket.AF_INET6, ip) + except: + print "Unable to verify IP address" + is_ok = False + return is_ok + +def read_ip_address(host_name, fstore): + while True: + ip = ipautil.user_input("Please provide the IP address to be used for this host name", allow_empty = False) + + if ip == "127.0.0.1" or ip == "::1": + print "The IPA Server can't use localhost as a valid IP" + continue + + if verify_ip_address(ip): + break + + print "Adding ["+ip+" "+host_name+"] to your /etc/hosts file" + fstore.backup_file("/etc/hosts") + hosts_fd = open('/etc/hosts', 'r+') + hosts_fd.seek(0, 2) + hosts_fd.write(ip+'\t'+host_name+' '+host_name.split('.')[0]+'\n') + hosts_fd.close() + + return ip + +def read_dns_forwarders(): + addrs = [] + while True: + ip = ipautil.user_input("Enter IP address for a DNS forwarder (empty to stop)", allow_empty=True) + + if not ip: + break + if ip == "127.0.0.1" or ip == "::1": + print "You cannot use localhost as a DNS forwarder" + continue + if not verify_ip_address(ip): + continue + + print "DNS forwarder %s added" % ip + addrs.append(ip) + + if not addrs: + print "No DNS forwarders configured" + + return addrs + def port_available(port): """Try to bind to a port on the wildcard host Return 1 if the port is available |