Auto-detect default value for --forward-policy option in installers
Forward policy defaults to 'first' if no IP address belonging to a private or reserved ranges is detected on local interfaces (RFC 6303). Defaults to only if a private IP address is detected. This prevents problems with BIND automatic empty zones because conflicting zones cannot be disabled unless forwarding policy == only. https://fedorahosted.org/freeipa/ticket/5710 Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
1 parent
c7ee765c4d
commit
51907d5bb8
6 files changed
+25
-5
No files matched your search
@@ -58,7 +58,7 @@ def parse_options():
|
||||
action="store_true", default=False,
|
||||
help="Use DNS forwarders configured in /etc/resolv.conf")
|
||||
parser.add_option("--forward-policy", dest="forward_policy",
|
||||
choices=("first", "only"), default="first",
|
||||
choices=("first", "only"), default=None,
|
||||
help="DNS forwarding policy for global forwarders")
|
||||
parser.add_option("--reverse-zone", dest="reverse_zones",
|
||||
default=[], action="append", metavar="REVERSE_ZONE",
|
||||
|
||||
@@ -42,7 +42,10 @@ Do not add any DNS forwarders, send non\-resolvable addresses to the DNS root se
|
||||
Add DNS forwarders configured in /etc/resolv.conf to the list of forwarders used by IPA DNS.
|
||||
.TP
|
||||
\fB\-\-forward\-policy\fR=\fIfirst|only\fR
|
||||
DNS forwarding policy for global forwarders specified using other options. Defaults to first.
|
||||
DNS forwarding policy for global forwarders specified using other options.
|
||||
Defaults to first if no IP address belonging to a private or reserved ranges is
|
||||
detected on local interfaces (RFC 6303). Defaults to only if a private
|
||||
IP address is detected.
|
||||
.TP
|
||||
\fB\-\-reverse\-zone\fR=\fIREVERSE_ZONE\fR
|
||||
The reverse DNS zone to use. This option can be used multiple times to specify multiple reverse zones.
|
||||
|
||||
@@ -150,7 +150,10 @@ Do not add any DNS forwarders. Root DNS servers will be used instead.
|
||||
Add DNS forwarders configured in /etc/resolv.conf to the list of forwarders used by IPA DNS.
|
||||
.TP
|
||||
\fB\-\-forward\-policy\fR=\fIfirst|only\fR
|
||||
DNS forwarding policy for global forwarders specified using other options. Defaults to first.
|
||||
DNS forwarding policy for global forwarders specified using other options.
|
||||
Defaults to first if no IP address belonging to a private or reserved ranges is
|
||||
detected on local interfaces (RFC 6303). Defaults to only if a private
|
||||
IP address is detected.
|
||||
.TP
|
||||
\fB\-\-reverse\-zone\fR=\fIREVERSE_ZONE\fR
|
||||
The reverse DNS zone to use. This option can be used multiple times to specify multiple reverse zones.
|
||||
|
||||
@@ -159,7 +159,10 @@ Do not add any DNS forwarders. Root DNS servers will be used instead.
|
||||
Add DNS forwarders configured in /etc/resolv.conf to the list of forwarders used by IPA DNS.
|
||||
.TP
|
||||
\fB\-\-forward\-policy\fR=\fIfirst|only\fR
|
||||
DNS forwarding policy for global forwarders specified using other options. Defaults to first.
|
||||
DNS forwarding policy for global forwarders specified using other options.
|
||||
Defaults to first if no IP address belonging to a private or reserved ranges is
|
||||
detected on local interfaces (RFC 6303). Defaults to only if a private
|
||||
IP address is detected.
|
||||
.TP
|
||||
\fB\-\-reverse\-zone\fR=\fIREVERSE_ZONE\fR
|
||||
The reverse DNS zone to use. This option can be used multiple times to specify multiple reverse zones.
|
||||
|
||||
@@ -259,6 +259,17 @@ def install_check(standalone, api, replica, options, hostname):
|
||||
ip_addresses = get_server_ip_address(hostname, options.unattended,
|
||||
True, options.ip_addresses)
|
||||
|
||||
if not options.forward_policy:
|
||||
# user did not specify policy, derive it: default is 'first' but
|
||||
# if any of local IP addresses belongs to private ranges use 'only'
|
||||
options.forward_policy = 'first'
|
||||
for ip in ip_addresses:
|
||||
if dnsutil.inside_auto_empty_zone(dnsutil.DNSName(ip.reverse_dns)):
|
||||
options.forward_policy = 'only'
|
||||
root_logger.debug('IP address %s belongs to a private range, '
|
||||
'using forward policy only', ip)
|
||||
break
|
||||
|
||||
if options.no_forwarders:
|
||||
options.forwarders = []
|
||||
elif options.forwarders or options.auto_forwarders:
|
||||
|
||||
@@ -170,7 +170,7 @@ class BaseServerDNS(common.Installable, core.Group, core.Composite):
|
||||
)
|
||||
|
||||
forward_policy = Knob(
|
||||
{'only', 'first'}, 'first',
|
||||
{'only', 'first'}, None,
|
||||
description=("DNS forwarding policy for global forwarders"),
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user