neutron/neutron
Dustin Lundquist a8a9d225d8 IPtables firewall prevent ICMPv6 spoofing
IPv6 includes the concept of link-local addresses. There are address
within the fe80::/64 prefix which are used only within the local layer 2
network. They should never be routed. DHCPv6 is one of several protocols
which utilize link-local addresses.

Previously the blanket permit DHCPv6 rule permitted DHCPv6 requests from
a link-local source, before the source address was validated.

The structure of the IPtables egress firewall is:

  a. fixed rules for special traffic
  b. validate source address
  c. fixed rules necessary for host to function
  d. user rules defined by security groups

This change restricts the special traffic permitted in part (a) to only
that traffic which utilizes the "unspecified address" (::), by moving
the fixed permit ICMPv6 and DHCPv6 rules to part (c), so they are
applied after the source address has been validated. In order to enable
DHCPv6 and other protocols utilizing link-local addresses, the
link-local address corresponding to each MAC address are included in the
permitted source addresses. After the source address is verified, the
fixed rules permit ICMPv6 and DHCPv6, then the user defined security
group rules are applied.

In the existing implementation ICMPv6 and DHCPv6 rules in the fixed
ip6tables firewall rules are too permissive: they permit ICMPv6 and
DHCPv6 traffic, regardless of source MAC or IPv6 address. These rules
where intended to allow a host to acquire an IPv6 address, but
inadvertently allowed a malicious or compromised host to spoof another's
MAC or IPv6 address.

A host acquiring an IPv6 address should preform DAD (duplicate address
detection). To preform this the host must join the multicast group
corresponding to the tentative IPv6 address and the all nodes multicast
group. To join these groups the host sends ICMP MLD (multicast listener
discovery) report messages before it has an IPv6 address assigned, so
the unspecified address is used as the source address. To complete DAD,
ICMP neighbor solicitation messages are sent to solicit if any nodes
using that address. This should be the only use of the unspecified IPv6
address as a source address. The IPv4 case is similar the unspecified
address is used for DHCP discovery and request messages.

To summarize, this patch permits only ICMPv6 traffic from the unspecified
address which is used for duplicate address detection. Then it enforces
the source IPv6 and MAC addresses and finally, allows only ICMPv6 traffic
which has passed this source address validation.

In addition this patch permits traffic from all link-local addresses
associated with each MAC address assigned to the port. This is required
by many IPv6 protocols, such as DHCPv6, which depend on the link-local
addresses. This traffic was previously allowed by the blanket allow
ICMPv6 and allow DHCPv6 rules before the source address was validated.

Finally, it includes a functional test for IPv6 spoofing using both
ICMPv6 and DHCPv6 traffic. OVSFirewall currently permits this spoofed
DHCPv6 traffic. I'm excluding the OVSFirewall implementation from test
so it can be fixed in a follow on patch.

Change-Id: Ice1c9dd349864da28806c5053e38ef86f43b7771
Partial-Bug: 1502933
2016-04-26 10:24:27 -05:00
..
agent IPtables firewall prevent ICMPv6 spoofing 2016-04-26 10:24:27 -05:00
api Use converters and validators from neutron-lib 2016-04-24 19:13:10 -04:00
callbacks Use exceptions from neutron-lib 2016-04-21 21:29:44 -04:00
cmd Use constants from neutron-lib 2016-04-23 21:23:56 -04:00
common Use converters and validators from neutron-lib 2016-04-24 19:13:10 -04:00
core_extensions Objects DB api: added composite key to handle multiple primary key 2016-03-01 17:05:11 +00:00
db Merge "Add device_id index to Port" 2016-04-26 08:18:39 +00:00
debug Use constants from neutron-lib 2016-04-23 21:23:56 -04:00
extensions Use converters and validators from neutron-lib 2016-04-24 19:13:10 -04:00
hacking Revert "Switch to inheriting hacking checks from neutron-lib" 2016-04-24 15:19:20 +00:00
ipam Use converters and validators from neutron-lib 2016-04-24 19:13:10 -04:00
locale Imported Translations from Zanata 2016-04-18 06:57:03 +00:00
notifiers Use constants from neutron-lib 2016-04-23 21:23:56 -04:00
objects Use constants from neutron-lib 2016-04-23 21:23:56 -04:00
openstack Fix module's import order 2016-01-22 06:38:42 -08:00
pecan_wsgi Use converters and validators from neutron-lib 2016-04-24 19:13:10 -04:00
plugins Merge "Use converters and validators from neutron-lib" 2016-04-26 05:54:04 +00:00
quota Use exceptions from neutron-lib 2016-04-21 21:29:44 -04:00
scheduler Use constants from neutron-lib 2016-04-23 21:23:56 -04:00
server Moved CORS middleware configuration into oslo-config-generator 2016-03-01 12:21:33 -08:00
services Merge "Use constants from neutron-lib" 2016-04-26 05:49:47 +00:00
tests IPtables firewall prevent ICMPv6 spoofing 2016-04-26 10:24:27 -05:00
__init__.py Hacking rule to check i18n usage 2016-03-30 21:28:37 -04:00
_i18n.py Move i18n to _i18n, as per oslo_i18n guidelines 2015-12-01 19:29:10 -07:00
auth.py Consume ConfigurableMiddleware from oslo_middleware 2015-10-08 17:59:43 +00:00
context.py Define context.roles with base class 2016-04-06 11:47:13 -04:00
i18n.py Move i18n to _i18n, as per oslo_i18n guidelines 2015-12-01 19:29:10 -07:00
manager.py Pecan: replace dashes with underscores on controller lookup 2016-02-19 00:54:32 -08:00
neutron_plugin_base_v2.py Fix module's import order 2016-01-22 06:38:42 -08:00
opts.py Return oslo_config Opts to config generator 2016-03-15 10:08:14 +11:00
policy.py Use constants from neutron-lib 2016-04-23 21:23:56 -04:00
service.py Check if plugin supports starting rpc listeners 2016-03-01 15:43:44 -06:00
version.py
worker.py Some minor misspellings in comment block. 2015-11-24 00:01:21 -06:00
wsgi.py Use exceptions from neutron-lib 2016-04-21 21:29:44 -04:00