Information
Do not generally permit containers to be run with the hostNetwork flag set to true.
Rationale:
A container running in the host's network namespace could access the local loopback device, and could access network traffic to and from other pods.
There should be at least one Security Context Constraint (SCC) defined which does not permit containers to share the host network namespace.
If you have need to run containers which require hostNetwork, this should be defined in a separate SCC and you should carefully check RBAC controls to ensure that only limited service accounts and users are given permission to access that SCC.
Impact:
Pods defined with Allow Host Network: true will not be permitted unless they are run under a specific SCC.
Solution
Create a SCC as described in the OpenShift documentation, ensuring that the Allow Host Network field is omitted or set to false.
Default Value:
By default, OpenShift 4 clusters include the following SCCs:
anyuid Allow Host Network: false
hostaccess Allow Host Network: true
hostmount-anyuid. Allow Host Network: false
hostnetwork Allow Host Network: true
node-exporter Allow Host Network: true
non-root Allow Host Network: false
privileged Allow Host Network: true
restricted Allow Host Network: false