mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
add --no-host-dns option to ipa-server-install - allows specifying a hostname that might actually exist but you do not want to even attempt to resolve it via DNS
This commit is contained in:
committed by
Rob Crittenden
parent
5a5bfa2c70
commit
be5e783f72
@@ -86,6 +86,9 @@ def parse_options():
|
|||||||
help="The password of the Directory Server PKCS#12 file")
|
help="The password of the Directory Server PKCS#12 file")
|
||||||
parser.add_option("--http_pin", dest="http_pin",
|
parser.add_option("--http_pin", dest="http_pin",
|
||||||
help="The password of the Apache Server PKCS#12 file")
|
help="The password of the Apache Server PKCS#12 file")
|
||||||
|
parser.add_option("--no-host-dns", dest="no_host_dns", action="store_true",
|
||||||
|
default=False,
|
||||||
|
help="Do not use DNS for hostname lookup during installation")
|
||||||
|
|
||||||
options, args = parser.parse_args()
|
options, args = parser.parse_args()
|
||||||
|
|
||||||
@@ -119,7 +122,7 @@ def signal_handler(signum, frame):
|
|||||||
ipaserver.dsinstance.erase_ds_instance_data (ds.serverid)
|
ipaserver.dsinstance.erase_ds_instance_data (ds.serverid)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def read_host_name(host_default):
|
def read_host_name(host_default,no_host_dns=False):
|
||||||
host_name = ""
|
host_name = ""
|
||||||
|
|
||||||
print "Enter the fully qualified domain name of the computer"
|
print "Enter the fully qualified domain name of the computer"
|
||||||
@@ -134,7 +137,7 @@ def read_host_name(host_default):
|
|||||||
host_name = user_input("Server host name", host_default, allow_empty = False)
|
host_name = user_input("Server host name", host_default, allow_empty = False)
|
||||||
print ""
|
print ""
|
||||||
try:
|
try:
|
||||||
verify_fqdn(host_name)
|
verify_fqdn(host_name,no_host_dns)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
raise e
|
raise e
|
||||||
else:
|
else:
|
||||||
@@ -394,14 +397,14 @@ def main():
|
|||||||
|
|
||||||
if options.unattended:
|
if options.unattended:
|
||||||
try:
|
try:
|
||||||
verify_fqdn(host_default)
|
verify_fqdn(host_default,options.no_host_dns)
|
||||||
except RuntimeError, e:
|
except RuntimeError, e:
|
||||||
logging.error(str(e) + "\n")
|
logging.error(str(e) + "\n")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
host_name = host_default
|
host_name = host_default
|
||||||
else:
|
else:
|
||||||
host_name = read_host_name(host_default)
|
host_name = read_host_name(host_default,options.no_host_dns)
|
||||||
|
|
||||||
host_name = host_name.lower()
|
host_name = host_name.lower()
|
||||||
|
|
||||||
|
|||||||
@@ -64,14 +64,6 @@ changetype: modify
|
|||||||
add: nsIndexType
|
add: nsIndexType
|
||||||
nsIndexType:sub
|
nsIndexType:sub
|
||||||
|
|
||||||
dn: cn=memberof,cn=index,cn=userRoot,cn=ldbm database,cn=plugins,cn=config
|
|
||||||
changetype: add
|
|
||||||
objectClass:top
|
|
||||||
objectClass:nsIndex
|
|
||||||
cn:memberof
|
|
||||||
nsSystemIndex:false
|
|
||||||
nsIndexType:eq
|
|
||||||
|
|
||||||
dn: cn=uidnumber,cn=index,cn=userRoot,cn=ldbm database,cn=plugins,cn=config
|
dn: cn=uidnumber,cn=index,cn=userRoot,cn=ldbm database,cn=plugins,cn=config
|
||||||
changetype: add
|
changetype: add
|
||||||
objectClass:top
|
objectClass:top
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ def get_fqdn():
|
|||||||
fqdn = ""
|
fqdn = ""
|
||||||
return fqdn
|
return fqdn
|
||||||
|
|
||||||
def verify_fqdn(host_name):
|
def verify_fqdn(host_name,no_host_dns=False):
|
||||||
|
|
||||||
if len(host_name.split(".")) < 2 or host_name == "localhost.localdomain":
|
if len(host_name.split(".")) < 2 or host_name == "localhost.localdomain":
|
||||||
raise RuntimeError("Invalid hostname: " + host_name)
|
raise RuntimeError("Invalid hostname: " + host_name)
|
||||||
@@ -66,6 +66,10 @@ def verify_fqdn(host_name):
|
|||||||
if revname != host_name:
|
if revname != host_name:
|
||||||
raise RuntimeError("The host name %s does not match the reverse lookup %s" % (host_name, revname))
|
raise RuntimeError("The host name %s does not match the reverse lookup %s" % (host_name, revname))
|
||||||
|
|
||||||
|
if no_host_dns:
|
||||||
|
print "Warning: skipping DNS resolution of host", host_name
|
||||||
|
return
|
||||||
|
|
||||||
# Verify this is NOT a CNAME
|
# Verify this is NOT a CNAME
|
||||||
rs = dnsclient.query(host_name+".", dnsclient.DNS_C_IN, dnsclient.DNS_T_CNAME)
|
rs = dnsclient.query(host_name+".", dnsclient.DNS_C_IN, dnsclient.DNS_T_CNAME)
|
||||||
if len(rs) != 0:
|
if len(rs) != 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user