From patchwork Thu Sep 10 18:54:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 516388 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 521CF1400CB for ; Fri, 11 Sep 2015 04:54:17 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id C3EBD10B63; Thu, 10 Sep 2015 11:54:16 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id BB56010B5B for ; Thu, 10 Sep 2015 11:54:14 -0700 (PDT) Received: from bar2.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 3B49E1E01CC for ; Thu, 10 Sep 2015 12:54:14 -0600 (MDT) X-ASG-Debug-ID: 1441911253-03dc531aa022cd10001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar2.cudamail.com with ESMTP id ax5sDoFa8MxFxQ0r (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 10 Sep 2015 12:54:13 -0600 (MDT) X-Barracuda-Envelope-From: blp@nicira.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO mail-pa0-f52.google.com) (209.85.220.52) by mx1-pf2.cudamail.com with ESMTPS (RC4-SHA encrypted); 10 Sep 2015 18:54:13 -0000 Received-SPF: unknown (mx1-pf2.cudamail.com: Multiple SPF records returned) X-Barracuda-RBL-Trusted-Forwarder: 209.85.220.52 Received: by padhy16 with SMTP id hy16so50513167pad.1 for ; Thu, 10 Sep 2015 11:54:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=aOrQ8kUKDl5eIYOg2+s8ilLlH/RvRcDcpp+tVIAfEZs=; b=g0PuqWbwdkYDf8BjugLmsnULwUrdLmjVuHHxLWAk65wuMyADTmLAncoYNGruJN8vza O74oXhWhPPDlq1NP9TqyDsyVQ+S+0OSwzD99CbHpX0tXwPnMjE+i3hv3tCKX/OPBCILd IWngjeT+Cs4ut67PdDYUCLC6S6l/k/1R01jEnc+iUOvw6VBmaH2q89L8be4vteA/pjjS 4QFAikizWUrpgrjDrwD69yIk5bZzCfi+uhJQ05LgABB90lcS/9vgtJmFGloV5tNSOr2L +JepsvsAyWxT5iL9qVZ7GHl3n2vG/kCPEIPlm4RnVCDBNFTqGrw/vUT0qVIPIerlWr8e cG2Q== X-Gm-Message-State: ALoCoQlZYFRCxbdsicolkVIidR4/Wrmq6wGKzfeUbCu2OVNqpG4phdSDSaw8+15r8lYytvPFTfZ2 X-Received: by 10.68.239.69 with SMTP id vq5mr85992463pbc.111.1441911252235; Thu, 10 Sep 2015 11:54:12 -0700 (PDT) Received: from sigabrt.benpfaff.org (173-228-112-165.dsl.dynamic.fusionbroadband.com. [173.228.112.165]) by smtp.gmail.com with ESMTPSA id gs2sm13413397pbc.15.2015.09.10.11.54.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Sep 2015 11:54:11 -0700 (PDT) X-CudaMail-Envelope-Sender: blp@nicira.com X-Barracuda-Apparent-Source-IP: 173.228.112.165 From: Ben Pfaff To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E2-909074096 X-CudaMail-DTE: 091015 X-CudaMail-Originating-IP: 209.85.220.52 Date: Thu, 10 Sep 2015 11:54:25 -0700 X-ASG-Orig-Subj: [##CM-E2-909074096##][PATCH] ovn-nb: Add port_security proposal. Message-Id: <1441911265-15310-1-git-send-email-blp@nicira.com> X-Mailer: git-send-email 2.1.3 X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1441911253 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH] ovn-nb: Add port_security proposal. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" The "obvious" implementation of port security based on this proposal would be a single long match expression. For example, suppose that the port_security expression is "00:00:00:00:00:01 192.168.0.1". Then one might naturally write: eth.src == 00:00:00:00:00:01 && (!arp || (arp && arp.sha == 00:00:00:00:00:01 && arp.spa == 192.168.0.1)) && (!ip || (ip && ip.src == 192.168.0.1)), actions=next However this fails because 'arp' and 'ip' may not be negated, which is in turn because OVS does not allow bitwise matching on Ethertype. The following solutions have occurred to me: * Allow bitwise matching on Ethertype. I don't think this is a good idea. First, the OpenFlow Ethertype does not come directly from a wire protocol header, so bitwise matches don't necessarily make any sense. But even if we solve that, "eth.type != 0x800" (for example) requires 16 OpenFlow flows, each of which ends up in a different classifier subtable. Thus, this would be a very expensive solution, classification-wise. * Rewrite the single OVN flow as a series of OVN flows with different priorities, e.g.: priority=100, eth.src == 00:00:00:00:00:01 && arp && arp.sha == 00:00:00:00:00:01 && arp.spa == 192.168.0.1, actions=next priority=100, eth.src == 00:00:00:00:00:01 && ip && ip.src == 192.168.0.1, actions=next priority=90, eth.src == 00:00:00:00:00:01 && (ip || arp), actions=drop priority=80, eth.src == 00:00:00:00:00:01, actions=next This will obviously work but it might make it harder to write up all the expressions. * Add support to OVN for handling specific negated matches. For example, the first OpenFlow flow table could have flows that look something like this: ip, actions=load:1->NXM_NX_REG0[0], resubmit(,1) arp, actions=load:1->NXM_NX_REG0[1], resubmit(,1) and then later flow tables could implement !ip as a match on reg0[0] == 0 and !arp as a match on reg0[1] == 0. This has nice properties and the only question I have is whether it's worth the implementation work. Signed-off-by: Ben Pfaff --- This is unchanged from http://openvswitch.org/pipermail/dev/2015-July/057141.html except that it is provided as a source patch instead of formatted plaintext. ovn/ovn-nb.xml | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 110 insertions(+), 7 deletions(-) diff --git a/ovn/ovn-nb.xml b/ovn/ovn-nb.xml index 42a94b9..5830943 100644 --- a/ovn/ovn-nb.xml +++ b/ovn/ovn-nb.xml @@ -189,21 +189,124 @@

- A set of L2 (Ethernet) addresses - from which the logical port is allowed to send packets and to which it + This column controls the addresses from which the host attached to the + logical port (``the host'') is allowed to send packets and to which it is allowed to receive packets. If this column is empty, all addresses - are permitted. Logical ports are always allowed to receive packets - addressed to multicast and broadcast addresses. + are permitted.

- Each member of the set is an Ethernet address in the form - xx:xx:xx:xx:xx:xx. + Each element in the set must contain one or more Ethernet addresses, + optionally masked. An element that contains only Ethernet addresses + restricts the host to sending packets from and receiving packets to + those addresses. It also restricts the inner source MAC addresses that + the host may send in ARP and IPv6 Neighbor Discovery packets. It does + not restrict the logical port to any particular L3 addresses. The host + is always allowed to receive packets to multicast and broadcast + Ethernet addresses.

- This specification will be extended to support L3 port security. + Each element in the set may additionally contain one or more IPv4 or + IPv6 addresses (or both), with optional masks. If a mask is given, it + must be a CIDR mask. In addition to the restrictions described for + Ethernet addresses above, such an element restricts the IPv4 or IPv6 + addresses from the host may send and to which it may receive to packets + to the specified addresses. A masked address, if the host part is + zero, indicates that the host is allowed to use any addresses in the + subnet; if the host part is nonzero, the mask simply indicates the size + of the subnet. In addition:

+ +
    +
  • +

    + If any IPv4 address is given, the host is also allowed to receive + packets to the IPv4 local broadcast address 255.255.255.255 and to + IPv4 multicast addresses (224.0.0.0/4). If an IPv4 address with a + mask is given, the host is also allowed to receive packets to the + broadcast address in that specified subnet. +

    + +

    + If any IPv4 address is given, the host is additionally restricted + to sending ARP packets with the specified source address. (RARP is + not restricted.) +

    +
  • + +
  • +

    + If any IPv6 address is given, the host is also allowed to receive + packets to IPv6 multicast addresses (ff00::/8). +

    + +

    + If any IPv6 address is given, the host is additionally restricted + to sending IPv6 Neighbor Discovery Solicitation or Advertisement + packets with the specified source address or, for solicitations, + the unspecified address. +

    +
  • +
+ +

+ If an element includes an IPv4 address, but no IPv6 addresses, then + IPv6 traffic is not allowed. If an element includes an IPv6 address, + but no IPv4 address, then IPv4 and ARP traffic is not allowed. +

+ +

+ Multiple elements act as a disjunction. That is, when multiple + elements exist, any packet that would be permitted by any individual + element, as described above, is permitted by the overall policy. +

+ +

+ This column uses the same lexical syntax as the column in the OVN Southbound + database's table. Multiple + addresses within an element may be space or comma separated. +

+ +

+ This column is provided as a convenience to cloud management systems, + but all of the features that it implements can be implemented as ACLs + using the table. +

+ +

+ Examples: +

+ +
+
80:fa:5b:06:72:b7
+
+ The host may send traffic from and receive traffic to the specified + MAC address, and to receive traffic to Ethernet multicast and + broadcast addresses, but not otherwise. The host may not send ARP or + IPv6 Neighbor Discovery packets with inner source Ethernet addresses + other than the one specified. +
+ +
00:23:20:00:00:00/ff:ff:ff:00:00:00
+
+ Similar to the first example, except that any Ethernet address in the + Nicira OUI is allowed. +
+ +
80:fa:5b:06:72:b7 192.168.1.10/24
+
+ This adds further restrictions to the first example. The host may + send IPv4 packets from or receive IPv4 packets to only 192.168.1.10, + except that it may also receive IPv4 packets to 192.168.1.255 (based + on the subnet mask), 255.255.255.255, and any address n 224.0.0.0/4. + The host may not send ARPs with a source Ethernet address other than + 80:fa:5b:06:72:b7 or source IPv4 address other than 192.168.1.10. + The host may not send or receive any IPv6 (including IPv6 Neighbor + Discovery) traffic. +
+