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

Add YAML to Markdown conversion script and generated Markdown files #497

Merged
merged 46 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
691af86
initial version of cis hardening reference
eaudetcobello Jun 14, 2024
bffb2d2
replace variable
eaudetcobello Jun 14, 2024
ae1a04a
add expected output to each control
eaudetcobello Jun 15, 2024
4f52fc7
add newline before audit
eaudetcobello Jun 15, 2024
1910950
remove newline from top of file
eaudetcobello Jun 15, 2024
058e22f
add cis yaml to markdown script
eaudetcobello Jun 15, 2024
9c6386b
change usage and run isort
eaudetcobello Jun 15, 2024
010e5b4
move file logic out of generate_markdown
eaudetcobello Jun 15, 2024
e778872
remove $DATA_DIR subst
eaudetcobello Jun 15, 2024
dd39725
revert changing $data_dir in the files
eaudetcobello Jun 15, 2024
4b5140c
add markdownlint-disable to template
eaudetcobello Jun 15, 2024
c01dc9f
each control is anchored for easy reference
eaudetcobello Jun 15, 2024
7c6bd6f
remove bold from id because it is part of a title now
eaudetcobello Jun 15, 2024
ecf9ddf
Update cis-yaml-to-md.py
eaudetcobello Jun 15, 2024
602ab7e
update type hint
eaudetcobello Jun 17, 2024
9d2aa63
use proper current directory
eaudetcobello Jun 20, 2024
99c2c6a
add spacing to template file
eaudetcobello Jun 20, 2024
c5a59a1
wordwrap description and add spacing
eaudetcobello Jun 20, 2024
78fdc62
Merge branch 'main' into cis-hardening-docs-2
eaudetcobello Jun 20, 2024
e00833a
use global var
eaudetcobello Jun 20, 2024
ed244db
add expected outputs from node.md
eaudetcobello Jun 20, 2024
c490de6
controlplane.md and etcd.md in expected-outputs
eaudetcobello Jun 20, 2024
30b9450
add master.md to expected-outputs
eaudetcobello Jun 20, 2024
e192998
change expected-outputs file format
eaudetcobello Jun 21, 2024
f827577
refactor cis-yaml-to-md.py and cis-template.jinja2
eaudetcobello Jun 21, 2024
dd683a3
add default to custom output
eaudetcobello Jun 21, 2024
6d8bd3b
generate docs
eaudetcobello Jun 21, 2024
62e9b2b
change empty output to TODO for now
eaudetcobello Jun 21, 2024
267dffd
move cis output to _parts
eaudetcobello Jun 25, 2024
ad16e1f
modify expected outputs of etcd controls
eaudetcobello Jun 26, 2024
6479818
more accurate expected outputs
eaudetcobello Jun 27, 2024
7c4dfaf
reorder fields, change code blocks to normal text
eaudetcobello Jun 27, 2024
5c83175
output to _parts/cis
eaudetcobello Jun 27, 2024
08e7af9
delete files from howto/cis-hardening
eaudetcobello Jun 27, 2024
f743969
don't say "not applicable" and re-generate
eaudetcobello Jun 27, 2024
756a014
fix double newlines
eaudetcobello Jun 27, 2024
081cd0d
improve description
eaudetcobello Jun 27, 2024
16cf932
s/pod specification/configuration
eaudetcobello Jun 27, 2024
eaa3dc1
re-generate after modifying kube-bench etcd.yaml
eaudetcobello Jun 27, 2024
1585060
re-generate with kube-bench changes
eaudetcobello Jun 27, 2024
aa13351
improve formatting in node.md
eaudetcobello Jun 27, 2024
8354b8e
re-generate following major wording rework
eaudetcobello Jun 27, 2024
eec027f
re-generate after improving etcd.md format
eaudetcobello Jun 27, 2024
1ffd8cb
re-generate after small changes in master and node yamls
eaudetcobello Jun 27, 2024
11353c2
add readme and requirements file
eaudetcobello Jun 27, 2024
b37d55d
improve readme
eaudetcobello Jun 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions docs/src/_parts/cis/controlplane.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
## Control Plane Configuration

### Authentication and Authorization

#### Control 3.1.1

Description: Client certificate authentication should not be used for users
(Manual)

Remediation:

Alternative mechanisms provided by Kubernetes such as the use of
OIDC should be
implemented in place of client certificates.

### Logging

#### Control 3.2.1

Description: Ensure that a minimal audit policy is created (Manual)

Audit:

```
/bin/ps -ef | grep kube-apiserver | grep -v grep
```

Expected output:

```
--audit-policy-file=/var/snap/k8s/common/etc/audit-policy.yaml
```

Remediation:

Create an audit policy file for your cluster.

#### Control 3.2.2

Description: Ensure that the audit policy covers key security concerns
(Manual)

Remediation:

Review the audit policy provided for the cluster and ensure that
it covers
at least the following areas,
- Access to Secrets managed by the cluster. Care should be taken
to only
log Metadata for requests to Secrets, ConfigMaps, and
TokenReviews, in
order to avoid risk of logging sensitive data.
- Modification of Pod and Deployment objects.
- Use of `pods/exec`, `pods/portforward`, `pods/proxy` and
`services/proxy`.
For most requests, minimally logging at the Metadata level is
recommended
(the most basic level of logging).

179 changes: 179 additions & 0 deletions docs/src/_parts/cis/etcd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
## Etcd Node Configuration

### Etcd Node Configuration

#### Control 2.1

Description: Ensure that the --cert-file and --key-file arguments are set as
appropriate (Automated)

Audit:

```
/bin/ps -ef | /bin/grep etcd | /bin/grep -v grep
```

Expected output:

```
ETCD_CERT_FILE and ETCD_KEY_FILE are set
```

Remediation:

Follow the etcd service documentation and configure TLS
encryption.
Then, edit the etcd pod specification file
/etc/kubernetes/manifests/etcd.yaml
on the master node and set the below parameters.
--cert-file=</path/to/ca-file>
--key-file=</path/to/key-file>

#### Control 2.2

Description: Ensure that the --client-cert-auth argument is set to true
(Automated)

Audit:

```
/bin/ps -ef | /bin/grep etcd | /bin/grep -v grep
```

Expected output:

```
ETCD_CLIENT_CERT_AUTH is set to true
```

Remediation:

Edit the etcd pod specification file /etc/default/etcd on the master
node and set the below parameter.
--client-cert-auth="true"

#### Control 2.3

Description: Ensure that the --auto-tls argument is not set to true
(Automated)

Audit:

```
/bin/ps -ef | /bin/grep etcd | /bin/grep -v grep
```

Expected output:

```
ETCD_AUTO_TLS is not set
```

Remediation:

Edit the etcd pod specification file /etc/default/etcd on the master
node and either remove the --auto-tls parameter or set it to
false.
--auto-tls=false

#### Control 2.4

Description: Ensure that the --peer-cert-file and --peer-key-file arguments
are set as appropriate (Automated)

Audit:

```
/bin/ps -ef | /bin/grep etcd | /bin/grep -v grep
```

Expected output:

```
ETCD_PEER_CERT_FILE and ETCD_PEER_KEY_FILE are set
```

Remediation:

Follow the etcd service documentation and configure peer TLS
encryption as appropriate
for your etcd cluster.
Then, edit the etcd pod specification file /etc/default/etcd on the
master node and set the below parameters.
--peer-client-file=</path/to/peer-cert-file>
--peer-key-file=</path/to/peer-key-file>

#### Control 2.5

Description: Ensure that the --peer-client-cert-auth argument is set to true
(Automated)

Audit:

```
/bin/ps -ef | /bin/grep etcd | /bin/grep -v grep
```

Expected output:

```
ETCD_PEER_CLIENT_CERT_AUTH is set to true
```

Remediation:

Edit the etcd pod specification file /etc/default/etcd on the master
node and set the below parameter.
--peer-client-cert-auth=true

#### Control 2.6

Description: Ensure that the --peer-auto-tls argument is not set to true
(Automated)

Audit:

```
/bin/ps -ef | /bin/grep etcd | /bin/grep -v grep
```

Expected output:

```
ETCD_PEER_AUTO_TLS is not set
```

Remediation:

Edit the etcd pod specification file /etc/default/etcd on the master
node and either remove the --peer-auto-tls parameter or set it
to false.
--peer-auto-tls=false

#### Control 2.7

Description: Ensure that a unique Certificate Authority is used for etcd
(Manual)

Audit:

```
/bin/ps -ef | /bin/grep etcd | /bin/grep -v grep
```

Expected output:

```
ETCD_TRUSTED_CA_FILE is set
```

Remediation:

[Manual test]
Follow the etcd documentation and create a dedicated certificate
authority setup for the
etcd service.
Then, edit the etcd pod specification file /etc/default/etcd on the
master node and set the below parameter.
--trusted-ca-file=</path/to/ca-file>

Loading
Loading