Skip to content

Commit

Permalink
Rke2 cis 1.6 hardened & permissive (rancher#40)
Browse files Browse the repository at this point in the history
* add rke2_cis_1.6_hardened

* add rke2 CIS 1.6 permissive
  • Loading branch information
MonzElmasry authored Apr 8, 2021
1 parent d8e247d commit ca94c13
Show file tree
Hide file tree
Showing 13 changed files with 4,061 additions and 0 deletions.
14 changes: 14 additions & 0 deletions package/cfg/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ version_mapping:
"v1.18.10+rke2r1": "rke2-cis-1.5-permissive"
"eks-1.0": "eks-1.0"
"gke-1.0": "gke-1.0"
"v1.20.4+rke2r1": "rke2-cis-1.6-hardened"
"v1.20.4+rke2r1": "rke2-cis-1.6-permissive"

target_mapping:
"cis-1.4":
Expand Down Expand Up @@ -264,3 +266,15 @@ target_mapping:
- "node"
- "managedservices"
- "policies"
"rke2-cis-1.6-hardened":
- "master"
- "node"
- "controlplane"
- "etcd"
- "policies"
"rke2-cis-1.6-permissive":
- "master"
- "node"
- "controlplane"
- "etcd"
- "policies"
54 changes: 54 additions & 0 deletions package/cfg/rke2-cis-1.6-hardened/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
## Version-specific settings that override the values in cfg/config.yaml

master:
components:
- apiserver
- scheduler
- controllermanager
- etcd
- policies

apiserver:
bins:
- kube-apiserver
confs:
- /var/lib/rancher/rke2/agent/pod-manifests/kube-apiserver.yaml
defaultconf: /var/lib/rancher/rke2/agent/pod-manifests/kube-apiserver.yaml

scheduler:
bins:
- kube-scheduler
confs:
- /var/lib/rancher/rke2/agent/pod-manifests/kube-scheduler.yaml
defaultconf: /var/lib/rancher/rke2/agent/pod-manifests/kube-scheduler.yaml

controllermanager:
bins:
- kube-controller-manager
confs:
- /var/lib/rancher/rke2/agent/pod-manifests/kube-controller-manager.yaml
defaultconf: /var/lib/rancher/rke2/agent/pod-manifests/kube-controller-manager.yaml

etcd:
bins:
- etcd
confs:
- /var/lib/rancher/rke2/agent/pod-manifests/etcd.yaml
defaultconf: /var/lib/rancher/rke2/agent/pod-manifests/etcd.yaml

node:
components:
- kubelet
- proxy

kubelet:
defaultkubeconfig: /var/lib/rancher/rke2/agent/kubelet.kubeconfig
defaultcafile: /var/lib/rancher/rke2/agent/client-ca.crt

proxy:
defaultkubeconfig: /var/lib/rancher/rke2/agent/kubeproxy.kubeconfig

policies:
components:
- policies
42 changes: 42 additions & 0 deletions package/cfg/rke2-cis-1.6-hardened/controlplane.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
controls:
version: 1.6
id: 3
text: "Control Plane Configuration"
type: "controlplane"
groups:
- id: 3.1
text: "Authentication and Authorization"
checks:
- id: 3.1.1
text: "Client certificate authentication should not be used for users (Manual)"
type: "manual"
remediation: |
Alternative mechanisms provided by Kubernetes such as the use of OIDC should be
implemented in place of client certificates.
scored: false

- id: 3.2
text: "Logging"
checks:
- id: 3.2.1
text: "Ensure that a minimal audit policy is created (Automated)"
audit: "/bin/ps -ef | grep kube-apiserver | grep -v grep | grep -o audit-policy-file"
tests:
test_items:
- flag: "audit-policy-file"
compare:
op: eq
value: "audit-policy-file"
set: true
remediation: |
Create an audit policy file for your cluster.
scored: true

- id: 3.2.2
text: "Ensure that the audit policy covers key security concerns (Manual)"
type: "manual"
remediation: |
Consider modification of the audit policy in use on the cluster to include these items, at a
minimum.
scored: false
128 changes: 128 additions & 0 deletions package/cfg/rke2-cis-1.6-hardened/etcd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
---
controls:
version: 1.6
id: 2
text: "Etcd Node Configuration"
type: "etcd"
groups:
- id: 2
text: "Etcd Node Configuration Files"
checks:
- id: 2.1
text: "Ensure that the --cert-file and --key-file arguments are set as appropriate (Automated)"
audit: "/bin/ps -ef | /bin/grep $etcdbin | /bin/grep -v grep"
tests:
bin_op: and
test_items:
- flag: "--cert-file"
- flag: "--key-file"
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>
scored: true
type: "skip"

- id: 2.2
text: "Ensure that the --client-cert-auth argument is set to true (Automated)"
audit: "/bin/ps -ef | /bin/grep $etcdbin | /bin/grep -v grep"
tests:
test_items:
- flag: "--client-cert-auth"
compare:
op: eq
value: true
type: "skip"
remediation: |
Edit the etcd pod specification file $etcdconf on the master
node and set the below parameter.
--client-cert-auth="true"
scored: true

- id: 2.3
text: "Ensure that the --auto-tls argument is not set to true (Automated)"
audit: "/bin/ps -ef | /bin/grep $etcdbin | /bin/grep -v grep"
tests:
bin_op: or
test_items:
- flag: "--auto-tls"
set: false
- flag: "--auto-tls"
compare:
op: eq
value: false
remediation: |
Edit the etcd pod specification file $etcdconf on the master
node and either remove the --auto-tls parameter or set it to false.
--auto-tls=false
scored: true

- id: 2.4
text: "Ensure that the --peer-cert-file and --peer-key-file arguments are
set as appropriate (Automated)"
audit: "/bin/ps -ef | /bin/grep $etcdbin | /bin/grep -v grep"
tests:
bin_op: and
test_items:
- flag: "--peer-cert-file"
- flag: "--peer-key-file"
remediation: |
Follow the etcd service documentation and configure peer TLS encryption as appropriate
for your etcd cluster.
Then, edit the etcd pod specification file $etcdconf 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>
scored: true
type: skip

- id: 2.5
text: "Ensure that the --peer-client-cert-auth argument is set to true (Automated)"
audit: "/bin/ps -ef | /bin/grep $etcdbin | /bin/grep -v grep"
tests:
test_items:
- flag: "--peer-client-cert-auth"
compare:
op: eq
value: true
remediation: |
Edit the etcd pod specification file $etcdconf on the master
node and set the below parameter.
--peer-client-cert-auth=true
scored: true
type: skip

- id: 2.6
text: "Ensure that the --peer-auto-tls argument is not set to true (Automated)"
audit: "/bin/ps -ef | /bin/grep $etcdbin | /bin/grep -v grep"
tests:
bin_op: or
test_items:
- flag: "--peer-auto-tls"
set: false
- flag: "--peer-auto-tls"
compare:
op: eq
value: false
remediation: |
Edit the etcd pod specification file $etcdconf on the master
node and either remove the --peer-auto-tls parameter or set it to false.
--peer-auto-tls=false
scored: true

- id: 2.7
text: "Ensure that a unique Certificate Authority is used for etcd (Manual)"
audit: "/bin/ps -ef | /bin/grep $etcdbin | /bin/grep -v grep"
tests:
test_items:
- flag: "--trusted-ca-file"
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 $etcdconf on the
master node and set the below parameter.
--trusted-ca-file=</path/to/ca-file>
scored: false
Loading

0 comments on commit ca94c13

Please sign in to comment.