mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Show warning when net/broadcast IP address is used in installer
https://fedorahosted.org/freeipa/ticket/5814 Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
committed by
David Kupka
parent
f3d379071a
commit
b232ad463c
@@ -1651,6 +1651,20 @@ def update_dns(server, hostname, options):
|
|||||||
root_logger.info("Failed to determine this machine's ip address(es).")
|
root_logger.info("Failed to determine this machine's ip address(es).")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
for ip in update_ips:
|
||||||
|
if ip.is_network_addr():
|
||||||
|
root_logger.warning("IP address %s might be network address", ip)
|
||||||
|
# fixme: once when loggers will be fixed, we can remove this print
|
||||||
|
print(
|
||||||
|
"WARNING: IP address {} might be network address".format(ip),
|
||||||
|
file=sys.stderr)
|
||||||
|
if ip.is_broadcast_addr():
|
||||||
|
root_logger.warning("IP address %s might be broadcast address", ip)
|
||||||
|
# fixme: once when loggers will be fixed, we can remove this print
|
||||||
|
print(
|
||||||
|
"WARNING: IP address {} might be broadcast address".format(ip),
|
||||||
|
file=sys.stderr)
|
||||||
|
|
||||||
update_txt = "debug\n"
|
update_txt = "debug\n"
|
||||||
update_txt += ipautil.template_str(DELETE_TEMPLATE_A,
|
update_txt += ipautil.template_str(DELETE_TEMPLATE_A,
|
||||||
dict(HOSTNAME=hostname))
|
dict(HOSTNAME=hostname))
|
||||||
|
|||||||
@@ -609,6 +609,20 @@ def install_check(installer):
|
|||||||
not installer.interactive, False,
|
not installer.interactive, False,
|
||||||
options.ip_addresses)
|
options.ip_addresses)
|
||||||
|
|
||||||
|
for ip in ip_addresses:
|
||||||
|
if ip.is_network_addr():
|
||||||
|
root_logger.warning("IP address %s might be network address", ip)
|
||||||
|
# fixme: once when loggers will be fixed, we can remove this print
|
||||||
|
print(
|
||||||
|
"WARNING: IP address {} might be network address".format(ip),
|
||||||
|
file=sys.stderr)
|
||||||
|
if ip.is_broadcast_addr():
|
||||||
|
root_logger.warning("IP address %s might be broadcast address", ip)
|
||||||
|
# fixme: once when loggers will be fixed, we can remove this print
|
||||||
|
print(
|
||||||
|
"WARNING: IP address {} might be broadcast address".format(ip),
|
||||||
|
file=sys.stderr)
|
||||||
|
|
||||||
# installer needs to update hosts file when DNS subsystem will be
|
# installer needs to update hosts file when DNS subsystem will be
|
||||||
# installed or custom addresses are used
|
# installed or custom addresses are used
|
||||||
if options.ip_addresses or options.setup_dns:
|
if options.ip_addresses or options.setup_dns:
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import dns.reversename as dnsreversename
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import socket
|
import socket
|
||||||
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import six
|
import six
|
||||||
@@ -735,6 +736,28 @@ def install_check(installer):
|
|||||||
config.host_name, not installer.interactive, False,
|
config.host_name, not installer.interactive, False,
|
||||||
options.ip_addresses)
|
options.ip_addresses)
|
||||||
|
|
||||||
|
for ip in config.ips:
|
||||||
|
if ip.is_network_addr():
|
||||||
|
root_logger.warning(
|
||||||
|
"IP address %s might be network address", ip)
|
||||||
|
# fixme: once when loggers will be fixed, we can remove this
|
||||||
|
# print
|
||||||
|
print(
|
||||||
|
"WARNING: IP address {} might be network address".format(
|
||||||
|
ip),
|
||||||
|
file=sys.stderr
|
||||||
|
)
|
||||||
|
if ip.is_broadcast_addr():
|
||||||
|
root_logger.warning(
|
||||||
|
"IP address %s might be broadcast address", ip)
|
||||||
|
# fixme: once when loggers will be fixed, we can remove this
|
||||||
|
# print
|
||||||
|
print(
|
||||||
|
"WARNING: IP address {} might be broadcast address".format(
|
||||||
|
ip),
|
||||||
|
file=sys.stderr
|
||||||
|
)
|
||||||
|
|
||||||
except errors.ACIError:
|
except errors.ACIError:
|
||||||
raise ScriptError("\nThe password provided is incorrect for LDAP server "
|
raise ScriptError("\nThe password provided is incorrect for LDAP server "
|
||||||
"%s" % config.master_host_name)
|
"%s" % config.master_host_name)
|
||||||
@@ -1306,6 +1329,26 @@ def promote_check(installer):
|
|||||||
config.host_name, not installer.interactive,
|
config.host_name, not installer.interactive,
|
||||||
False, options.ip_addresses)
|
False, options.ip_addresses)
|
||||||
|
|
||||||
|
for ip in config.ips:
|
||||||
|
if ip.is_network_addr():
|
||||||
|
root_logger.warning(
|
||||||
|
"IP address %s might be network address", ip)
|
||||||
|
# fixme: once when loggers will be fixed, we can remove this
|
||||||
|
# print
|
||||||
|
print(
|
||||||
|
"WARNING: IP address {} might be network address".format(
|
||||||
|
ip), file=sys.stderr
|
||||||
|
)
|
||||||
|
if ip.is_broadcast_addr():
|
||||||
|
root_logger.warning(
|
||||||
|
"IP address %s might be broadcast address", ip)
|
||||||
|
# fixme: once when loggers will be fixed, we can remove this
|
||||||
|
# print
|
||||||
|
print(
|
||||||
|
"WARNING: IP address {} might be broadcast address".format(
|
||||||
|
ip), file=sys.stderr
|
||||||
|
)
|
||||||
|
|
||||||
except errors.ACIError:
|
except errors.ACIError:
|
||||||
raise ScriptError("\nInsufficient privileges to promote the server.")
|
raise ScriptError("\nInsufficient privileges to promote the server.")
|
||||||
except errors.LDAPError:
|
except errors.LDAPError:
|
||||||
|
|||||||
Reference in New Issue
Block a user