Bug 1507871 - [hwivBoNF] Should not be able to access the denied network which defined in EgressNetworkPolicy via the egressIP
Summary: [hwivBoNF] Should not be able to access the denied network which defined in E...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Networking
Version: 3.7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 3.7.0
Assignee: Dan Winship
QA Contact: Meng Bo
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-10-31 11:01 UTC by Meng Bo
Modified: 2017-11-28 22:20 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
Environment:
Last Closed: 2017-11-28 22:20:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Origin (Github) 17099 0 None None None 2017-10-31 20:26:12 UTC
Red Hat Product Errata RHSA-2017:3188 0 normal SHIPPED_LIVE Moderate: Red Hat OpenShift Container Platform 3.7 security, bug, and enhancement update 2017-11-29 02:34:54 UTC

Description Meng Bo 2017-10-31 11:01:35 UTC
Description of problem:
Add both egressIPs and EgressNetworkPolicy to the project, try to access the network which is defined as denied in the EgressNetworkPolicy.

It will be able to access the network through the egressIP.


Version-Release number of selected component (if applicable):
v3.7.0-0.188.0

How reproducible:
always

Steps to Reproduce:
1. Setup multi node env with multitenant or networkpolicy plugin

2. Add the egressIP to one of the node
10.66.140.100

3. Add the egressIP defined above to the user's netnamespace

4. Add the following egressnetworkpolicy to the same project above
{
    "kind": "EgressNetworkPolicy",
    "apiVersion": "v1",
    "metadata": {
        "name": "default"
    },
    "spec": {
        "egress": [
            {
                "type": "Deny",
                "to": {
                    "cidrSelector": "10.66.140.0/23"
                }
            }
        ]
    }
}

5. Try to access the denied network which defined in above rule from the pod in the project.


Actual results:
The denied network is able to be accessed by the pod which landed on the egressNode.

Expected results:
Should not be able to access the denied network by the pods.

Additional info:
Looks like the openflow rules for the egressnetworkpolicy which defined in table 101 was bypassed, since the packet goes out from table 100.


# ovs-appctl ofproto/trace br0 "in_port=6,ip,ct_state(trk),nw_dst=10.66.141.175,nw_src=10.128.0.29,tun_id=0x696634"
Flow: ct_state=trk,ip,tun_id=0x696634,in_port=6,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,nw_src=10.128.0.29,nw_dst=10.66.141.175,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=0

bridge("br0")
-------------
 0. ip, priority 100
    goto_table:20   
20. ip,in_port=6,nw_src=10.128.0.29, priority 100
    load:0x696634->NXM_NX_REG0[]
    goto_table:21   
21. priority 0
    goto_table:30   
30. ip, priority 0  
    goto_table:100  
100. ip,reg0=0x696634, priority 100
    set_field:0xa428c64->pkt_mark
    output:2

Final flow: pkt_mark=0xa428c64,ct_state=trk,ip,reg0=0x696634,tun_id=0x696634,in_port=6,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,nw_src=10.128.0.29,nw_dst=10.66.141.175,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=0
Megaflow: pkt_mark=0,recirc_id=0,ip,in_port=6,nw_src=10.128.0.29,nw_dst=10.0.0.0/9,nw_frag=no
Datapath actions: set(skb_mark(0xa428c64)),2

Comment 1 Dan Winship 2017-10-31 14:47:11 UTC
added a fix for this to the existing PR https://github.com/openshift/origin/pull/17099

Comment 3 Meng Bo 2017-11-07 02:54:20 UTC
Tested on ocp v3.7.0-0.194.0

Issue has been fixed, all the connections will follow the rules defined in egressnetworkpolicy.

Comment 6 errata-xmlrpc 2017-11-28 22:20:29 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:3188


Note You need to log in before you can comment on or make changes to this bug.