Skip to content

Commit 4c013d7

Browse files
toggle cis hardening for rke2 (#696)
1 parent c9336b0 commit 4c013d7

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

docs/src/topics/flavors/rke2.md

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
# RKE2
22

3-
This flavor uses RKE2 for the kubernetes distribution. By default it configures the cluster
4-
with the [CIS profile](https://docs.rke2.io/security/hardening_guide#rke2-configuration):
5-
> Using the generic cis profile will ensure that the cluster passes the CIS benchmark (rke2-cis-1.XX-profile-hardened) associated with the Kubernetes version that RKE2 is running. For example, RKE2 v1.28.XX with the profile: cis will pass the rke2-cis-1.7-profile-hardened in Rancher.
6-
7-
```admonish warning
8-
Until [this upstream PR](https://github.com/rancher-sandbox/cluster-api-provider-rke2/pull/301) is merged, CIS profile enabling
9-
will not work for RKE2 versions >= v1.29.
10-
```
3+
This flavor uses RKE2 for the kubernetes distribution.
114

125
## Specification
136
| Control Plane | CNI | Default OS | Installs ClusterClass | IPv4 | IPv6 |
@@ -20,6 +13,15 @@ will not work for RKE2 versions >= v1.29.
2013
```shell
2114
clusterctl init --bootstrap rke2 --control-plane rke2
2215
```
16+
17+
### CIS Hardening
18+
The default configuration does not enable [CIS hardening](https://docs.rke2.io/security/hardening_guide#rke2-configuration).
19+
To enable this, set the following variables:
20+
```bash
21+
export CIS_PROFILE=cis
22+
export CIS_ENABLED=true
23+
```
24+
2325
## Usage
2426
1. Generate cluster yaml
2527
```bash
@@ -32,3 +34,4 @@ will not work for RKE2 versions >= v1.29.
3234
```bash
3335
kubectl apply -f test-rke2-cluster.yaml
3436
```
37+

templates/flavors/rke2/default/rke2ConfigTemplate.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ spec:
88
spec:
99
agentConfig:
1010
nodeName: '{{ ds.meta_data.label }}'
11-
cisProfile: ${CIS_PROFILE:-"cis-1.23"}
12-
protectKernelDefaults: true
11+
cisProfile: ${CIS_PROFILE:-""}
12+
protectKernelDefaults: ${CIS_ENABLED:-false}
1313
kubelet:
1414
extraArgs:
1515
- "provider-id=linode://{{ ds.meta_data.id }}"

templates/flavors/rke2/default/rke2ControlPlane.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ spec:
2424
- "kubeProxy"
2525
agentConfig:
2626
nodeName: '{{ ds.meta_data.label }}'
27-
cisProfile: ${CIS_PROFILE:-"cis-1.23"}
28-
protectKernelDefaults: true
27+
cisProfile: ${CIS_PROFILE:-""}
28+
protectKernelDefaults: ${CIS_ENABLED:-false}
2929
preRKE2Commands:
3030
- sed -i '/swap/d' /etc/fstab
3131
- swapoff -a

0 commit comments

Comments
 (0)