Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCP4 STIG: Fix up rules that dealt with network policy #10142

Merged
merged 7 commits into from
Feb 7, 2023

Conversation

jhrozek
Copy link
Collaborator

@jhrozek jhrozek commented Jan 30, 2023

Description:

This PR started as a patch to fix SRG-APP-000038-CTR-000105 but I went a
little overboard and checked all controls that deal with network policies
and routes.

  • OCP4 STIG: SRG-APP-000038-CTR-000105: Move metadata to the policy file, select the correct rules - This is the meat of this PR. This control is resolved by making sure that all namespaces have NetworkPolicies. Let's move the checks and fixes to the per-rule policy files and remove all unrelated SRGs from rhe rules themselves.
  • OCP4 STIG: SRG-APP-000141-CTR-000315: Add artifact description and justification, remove spurious rule: A rule that is inherently met shouldn't be resolved by a rule.
  • OCP4 STIG: SRG-APP-000141-CTR-000320: Fix rules, add check and fix, fix status - This is a manual rule that is not solved by a particular rule, but instead has a number of other related rules that pertain to configuration of registries. Also adds the check and fix texts.
  • OCP4 STIG: SRG-APP-000142-CTR-000325: Remove spurious rule, add mitigation and status_justification - A rule with a does not meet status should have a mitigation and status justification.
  • OCP4 STIG: SRG-APP-000645-CTR-001410: Fix rules, add artifact_description and status_justification - A rule that's inherently met shouldn't be resolved by a rule, but should have supporting evidence and status justification.
  • OCP4 STIG: Remove configure_network_policies and configure_network_policies_namespaces from controls that are not resolved by these rules - This is a catch-all where we remove configure_network_policies_namespaces and configure_network_policies and routes_protected_by_tls from the rules: attribute of unrelated controls. We fix those controls in a later patch.
  • OCP4 STIG: routes_protected_by_tls pertains to SRG-APP-000441-CTR-001090 and SRG-APP-000442-CTR-001095, not SRG-APP-000441-CTR-001090 - SRG-APP-000441-CTR-001090 and SRG-APP-000442-CTR-001095 talk about integrity, SRG-APP-000441-CTR-001090 is about network segmentation.

Rationale:

  • Clean up the OCP4 STIG.

Review Hints:

  • ./build_product --debug ocp4
  • export PYTHONPATH=$(pwd); python3 ./utils/rule_dir_json.py
  • export PYTHONPATH=$(pwd); python3 utils/create_srg_export.py -c controls/srg_ctr.yml -p ocp4 -m shared/references/disa-ctr-srg-v1r3.xml --out-format html --output /tmp/srg-mapping-ocp4.html
  • compare the controls touched by this PR with STIG draft

…e, select the correct rules

SRG-APP-000038-CTR-000105 is resolved by making sure all non-control
plane namespaces contain a `NetworkPolicy`. Let's move the metadata
to the rules' policy files and remove all unrelated SRGs from rhe rules
themselves.
…stification, remove spurious rule

A rule that is inherently met shouldn't be resolved by a rule.
…ix status

This is a manual rule that is not solved by a particular rule, but
instead has a number of other related rules that pertain to
configuration of registries.

Also adds the check and fix texts.
…ation and status_justification

A rule with a does not meet status should have a mitigation and status
justification.
…tion and status_justification

A rule that's inherently met shouldn't be resolved by a rule, but should
have supporting evidence and status justification.
…licies_namespaces from controls that are not resolved by these rules

This is a catch-all where we remove
configure_network_policies_namespaces and configure_network_policies and
routes_protected_by_tls from the `rules:` attribute of unrelated
controls. We fix those controls in a later patch.
…090 and SRG-APP-000442-CTR-001095, not SRG-APP-000441-CTR-001090

SRG-APP-000441-CTR-001090 and SRG-APP-000442-CTR-001095 talk about
integrity, SRG-APP-000441-CTR-001090 is about network segmentation.
@github-actions
Copy link

Start a new ephemeral environment with changes proposed in this pull request:

Fedora Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@codeclimate
Copy link

codeclimate bot commented Jan 30, 2023

Code Climate has analyzed commit a6a4fe6 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 49.5% (0.0% change).

View more on Code Climate.

@jhrozek
Copy link
Collaborator Author

jhrozek commented Jan 30, 2023

/retest
none of the test clusters installed

@marcusburghardt marcusburghardt added OpenShift OpenShift product related. STIG STIG Benchmark related. labels Jan 31, 2023
@jhrozek
Copy link
Collaborator Author

jhrozek commented Jan 31, 2023

more cluster install issues
/retest

@jhrozek
Copy link
Collaborator Author

jhrozek commented Jan 31, 2023

This time the operator didn't install, might be an outage
/retest

@jhrozek
Copy link
Collaborator Author

jhrozek commented Jan 31, 2023

/test e2e-aws-ocp4-e8
inredible, only one OCP test failed

@jhrozek
Copy link
Collaborator Author

jhrozek commented Feb 6, 2023

/test e2e-aws-ocp4-e8

1 similar comment
@jhrozek
Copy link
Collaborator Author

jhrozek commented Feb 6, 2023

/test e2e-aws-ocp4-e8

@openshift-ci
Copy link

openshift-ci bot commented Feb 6, 2023

@jhrozek: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-ocp4-e8 a6a4fe6 link true /test e2e-aws-ocp4-e8

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Contributor

@Vincent056 Vincent056 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@jhrozek jhrozek merged commit 5593c07 into ComplianceAsCode:master Feb 7, 2023
@Mab879 Mab879 added this to the 0.1.67 milestone Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OpenShift OpenShift product related. STIG STIG Benchmark related.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants