Bug 1759338

Summary: [OVN] hostnetwork pod can access MCS port 22623 or 22624 on master
Product: OpenShift Container Platform Reporter: Anurag saxena <anusaxen>
Component: NetworkingAssignee: Ricardo Carrillo Cruz <ricarril>
Networking sub component: ovn-kubernetes QA Contact: Anurag saxena <anusaxen>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: bbennett, danw, huirwang, ricarril, scuppett
Version: 4.2.0   
Target Milestone: ---   
Target Release: 4.5.0   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-13 17:11:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Anurag saxena 2019-10-07 21:07:08 UTC
Description of problem: A hostnetwork pod can access MCS port 22623 or 22624 on master on OVNKubernetes cluster. We should restrict that on OVN as well like we do in OpenShiftSDN

Version-Release number of selected component (if applicable):4.2.0-0.nightly-2019-10-07-011045

How reproducible:Always

Steps to Reproduce:
1.Create a hostnetwork pod with kubeadmin as user
$ oc login -u kubeadmin -p xxxxx
$oc create -f https://raw.githubusercontent.com/anuragthehatter/v3-testfiles/master/networking/hostnetwork-pod.json

2.oc rsh into pod and curl on master IP on port 22623 and 22624

$ oc rsh hello-pod
 ~$curl -I -k
     HTTP/2 200 
 ~$curl -I -k
     HTTP/2 200 

Actual results: Hostnetwork pod can access MCS ports

Expected results: Hostnetwork pod should not access MCS ports

Additional info:

Comment 1 Dan Winship 2019-10-07 22:24:26 UTC
Oh, I think this is not a bug; we originally had to block hostNetwork access to MCS, but I think MCS now recognizes that the node is already provisioned and so there's no danger in connect to it from an existing node IP. I need to double-check this though... (And if it's correct we should remove the hostNetwork blocking from openshift-sdn too.)

Comment 2 Casey Callendrello 2019-10-09 12:02:58 UTC
I don't think that's true, because the MCS is also exposed via the internal load balancer.

Comment 3 Dan Winship 2019-10-09 14:12:10 UTC
Hm... it looks like https://github.com/openshift/machine-config-operator/pull/784 never merged so probably we do still need to block from hostNetwork

Comment 6 huirwang 2020-05-25 07:31:48 UTC
Verified on 4.5.0-0.nightly-2020-05-24-223848.

oc rsh hostnetwork-pod 
~ $ curl  -I -k
curl: (7) Failed to connect to port 22623: Connection refused
~ $ exit
command terminated with exit code 7

Comment 8 errata-xmlrpc 2020-07-13 17:11:31 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.