[openstack-dev] [Neutron] blueprint ovs-firewall-driver: Security groups extension API addition

Amir Sadoughi amir.sadoughi at RACKSPACE.COM
Tue Dec 17 23:17:05 UTC 2013

Hi all,

Monday at 2000 UTC I held an IRC meeting for blueprint ovs-firewall-driver to discuss implementation choices with the community. Only a handful of people attended so I wanted to open the discussion to the mailing list.

(I’ve also uploaded this to the wiki <https://wiki.openstack.org/wiki/Neutron/blueprint_ovs-firewall-driver#Security_groups_extension_API_addition_discussion>.)

tl;dr: To implement a performant OVS-based security groups solution in Neutron today, source port matching is a required addition to the security groups extension API.

=== Background ===

In Open vSwitch today, there are two best practice options of implementing firewalls[1]:

1. reflexive learn actions (available in OVS today)
2. stateless ACLs with tcp_flags=ack (available in OVS git, to be released in v2.1.0 - early 2014[6])

In the same e-mail thread[2], the tradeoffs between the two choices were discussed:

- reflexive learning is not as performant as it cuts into how many flows a megaflow can wildcard, e.g. the less that can be wildcarded, the more OVS will have to hit userspace for flows

- "Using the learn action is strictly more correct, since it's only allowing return traffic that's in response to traffic that was previously seen.  TCP flag matching allows reasonable megaflows, but just blocking on the SYN flags isn't as secure, since an attacker can get traffic through--they just can't initiate a new connection."

My preferred implementation is 'stateless ACLs with tcp_flags=ack' to emulate stateful behavior (at least in TCP) because reflexive learning is not as performant.

=== Discussion: why? ===

Following through with the 'stateless ACLs with tcp_flags=ack' approach, UDP clients on the instance will need explicit security group rules to match source IP address and source port.

Example 1. A remote UDP client connecting to an instance UDP server
A. nw_src=$remote_ip, tp_src=random, nw_dst=$instance_ip, tp_dst=9987
B. nw_src=$instance_ip, tp_src=9987, nw_dst=$remote_ip, tp_src=random

So, in the case of the instance being a UDP server and default security groups already allowing all egress, adding a rule to allow ingress on UDP destination port 9987 will behave as expected.

Example 2. An instance UDP client connecting to a remote UDP server
C. nw_src=$instance_ip, tp_src=random, nw_dst=$remote_ip, tp_dst=9987
D. nw_src=$remote_ip, tp_src=9987, nw_dst=$instance_ip, tp_dst=random

In the case of the instance being a UDP client and default security groups already allowing all egress, we will need a new security group rule to allow ingress from source port 9987 from the remote UDP server in a stateless firewall. This is different behavior than the iptables-based stateful firewall implementation because it is able to add the reverse flow in its state table for a specific timeout length when it initially sees flow C.

So, in security groups, we will need an additional rule that will define flow D (remote UDP server’s IP address, UDP source port 9987, and of course the instance’s IP address). However, if you look at the security groups API as it is today[3], you will see there is no match for source port (tp_src), only destination port (—port-range-min, —port-range-max).

=== Suggested change: how to fix it ===

So, to solve the lack of source port information, I propose the following addition to the security groups extension API to allow a match on source port: —source-port-range-min, —source-port-range-max. I already have WIP patches uploaded for neutron[4] and python-neutronclient[5] implementing these suggested additions. The security groups RPC API already has a field for source-port-range-min and source-port-range-max so this change would only affect the DB and frontend API.

I’m open to any and all feedback.


Amir Sadoughi

[1] e-mail thread on ovs-discuss mailing list. http://openvswitch.org/pipermail/discuss/2013-December/012425.html
[2] http://openvswitch.org/pipermail/discuss/2013-December/012433.html
[3] http://paste.openstack.org/show/55103/
[4] https://review.openstack.org/#/c/62129/
[5] https://review.openstack.org/#/c/62130/
[6] http://openvswitch.org/pipermail/discuss/2013-December/012457.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20131217/205b0a32/attachment.html>

More information about the OpenStack-dev mailing list