ComplianceAsCode / ComplianceAsCode/content

implement section 5 rules of CIS Benchmark for OpenShift with "count" function

Open
#6,529 8 comments 0 reactions 0 assignees View on GitHub
CIS OpenShift
Dominant language
Shell
Stars
2.8k
Forks
828
Avg merge
3d 8m
Merged PRs (30d)
80

Description

## Which products and profiles does the rule apply to?

- Red Hat OpenShift

## Describe the configuration setting enforced by this rule.

Rules in section 5 of [CIS Benchmark for Kubernetes (OpenShift)](https://www.cisecurity.org/benchmark/kubernetes/) (Control 5.1.2-5.1.4, 5.2.1-5.2.9) which require counting the number of elements in YAML files. Count the number of elements, and compare them with predefined constants.

## Why is the configuration security relevant?

The numbers of the configurations should be minimized to reduce security risks; for example, the grater number of wildcard role (section 5.1.3) indicates higher security risk.

## How to check the configuration?

Get resources of kubernetes, count the number of specific elements in the resources and check whether the number is grater than a predefined constant value.

### Is it order dependent? (does it need to be at certain place in the file?)

No.

### What is correct and incorrect syntax?

(N/A)

## How to remediate

(TBD; Automated remediation is difficult)

### Does any command need to be run?

`api-resource-collector` of Compliance Operator will be used to fetch kubernetes resources.

## Are there going to be other rules like this one in the future? Is it worth creating template? (similar configuration format, similar remediation process...)

Yes; a number of rules may use this type of rule.

## Are there any caveats to be considered when testing?

(TBD)

## Is the configuration loaded directly by the or is it stored in some intermediate database (similar to dconf)?

`api-resource-collector` of Compliance Operator can load the configurations.

## Is it possible to check / remediate this configuration in offline mode? (scanning containers or offline systems)

No

## Please provide security policy references if possible e.g. STIG

[CIS Benchmark for Kubernetes (OpenShift)](https://www.cisecurity.org/benchmark/kubernetes/)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.