-
Notifications
You must be signed in to change notification settings - Fork 706
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10142 from jhrozek/SRG-APP-000038-CTR-000105
OCP4 STIG: Fix up rules that dealt with network policy
- Loading branch information
Showing
15 changed files
with
154 additions
and
80 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
applications/openshift/networking/configure_network_policies/policy/stig/shared.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
checktext: |- | ||
Verify that the CNI supports NetworkPolicies: | ||
> oc get network cluster -oyaml -ojsonpath='{.spec.networkType}' | ||
The result should list a CNI plugin that supports NetworkPolicies, | ||
currently the plugins that do support NetworkPolicies are OpenShiftSDN, | ||
OVN and Calico. | ||
If the cluster does not return a CNI that supports NetworkPolicies, | ||
this is a finding. | ||
fixtext: |- | ||
Migration to a supported CNI plugin is not automated. | ||
For additional information regarding network policies, see | ||
https://docs.openshift.com/container-platform/latest/networking/network_policy/about-network-policy.html | ||
srg_requirement: |- | ||
Red Hat OpenShift Container Platform 4 must enforce approved authorizations | ||
for controlling the flow of information within Red Hat OpenShift Container | ||
Platform 4 based on organization-defined information flow control policies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...cations/openshift/networking/configure_network_policies_namespaces/policy/stig/shared.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
checktext: |- | ||
Verify that each user namespace has a Network Policy | ||
1. Get a list of existing projects(namespaces), exclude default, kube-*, openshift-* | ||
> oc get namespaces -ojson | jq -r '[.items[] | select((.metadata.name | startswith("openshift") | not) and (.metadata.name | startswith("kube-") | not) and .metadata.name != "default") | .metadata.name]' | ||
2. Get a list of namespaces, excluding default, kube-* and openshift-* that contain | ||
a NetworkPolicy object. | ||
> oc get NetworkPolicy -A -ojson | jq -r '[.items[] | select((.metadata.namespace | startswith("openshift") | not) and (.metadata.namespace | startswith("kube-") | not) and .metadata.namespace != "default") | .metadata.namespace] | unique' | ||
If the two lists do not match, in other words, if a project does not | ||
have any NetworkPolicy definitions, this is a finding. | ||
fixtext: |- | ||
Configure a default network policy as necessary to protect the flow of | ||
information by performing the following steps. | ||
1. Create a networkpolicy.yaml file with the NetworkPolicy object | ||
definitions desired. For example, the following section defines two | ||
policies one to allow requests from the same namespace, the other to | ||
allow from the openshift ingress routing service. | ||
apiVersion: v1 | ||
kind: List | ||
items: | ||
- apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: allow-from-same-namespace | ||
spec: | ||
podSelector: | ||
ingress: | ||
- from: | ||
- podSelector: {} | ||
- apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: allow-from-openshift-ingress | ||
spec: | ||
ingress: | ||
- from: | ||
- namespaceSelector: | ||
matchLabels: | ||
network.openshift.io/policy-group: ingress | ||
podSelector: {} | ||
policyTypes: | ||
- Ingress | ||
3. Apply the NetworkPolicy object to the appropriate namespaces by | ||
running the following command: | ||
> oc apply -f networkpolicy.yaml -n <PROJECT> | ||
For additional information regarding network policies, see | ||
https://docs.openshift.com/container-platform/latest/networking/network_policy/about-network-policy.html | ||
srg_requirement: |- | ||
Red Hat OpenShift Container Platform 4 must enforce approved authorizations | ||
for controlling the flow of information within Red Hat OpenShift Container | ||
Platform 4 based on organization-defined information flow control policies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters