Skip to content

Commit c668a96

Browse files
authored
Add cis-1.11 assessment, update hardening guide (#489)
Signed-off-by: Derek Nola <derek.nola@suse.com>
1 parent ed0d352 commit c668a96

File tree

7 files changed

+3491
-57
lines changed

7 files changed

+3491
-57
lines changed

docs/security/hardening-guide.md

Lines changed: 75 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,80 @@ kernel.panic=10
3232
kernel.panic_on_oops=1
3333
```
3434

35+
## Configuration for Kubernetes Components
36+
37+
38+
The configuration below should be placed in the [configuration file](../installation/configuration.md#configuration-file), and contains all the necessary remediations to harden the Kubernetes components.
39+
40+
41+
<Tabs groupId="pod-sec" queryString>
42+
<TabItem value="v1.29 and Newer" default>
43+
44+
```yaml
45+
protect-kernel-defaults: true
46+
secrets-encryption: true
47+
kube-apiserver-arg:
48+
- "enable-admission-plugins=NodeRestriction,EventRateLimit"
49+
- 'admission-control-config-file=/var/lib/rancher/k3s/server/psa.yaml'
50+
- 'audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log'
51+
- 'audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml'
52+
- 'audit-log-maxage=30'
53+
- 'audit-log-maxbackup=10'
54+
- 'audit-log-maxsize=100'
55+
- 'service-account-extend-token-expiration=false'
56+
kube-controller-manager-arg:
57+
- 'terminated-pod-gc-threshold=10'
58+
kubelet-arg:
59+
- 'streaming-connection-idle-timeout=5m'
60+
- "tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305"
61+
```
62+
63+
</TabItem>
64+
<TabItem value="v1.25 - v1.28" default>
65+
66+
```yaml
67+
protect-kernel-defaults: true
68+
secrets-encryption: true
69+
kube-apiserver-arg:
70+
- "enable-admission-plugins=NodeRestriction,EventRateLimit"
71+
- 'admission-control-config-file=/var/lib/rancher/k3s/server/psa.yaml'
72+
- 'audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log'
73+
- 'audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml'
74+
- 'audit-log-maxage=30'
75+
- 'audit-log-maxbackup=10'
76+
- 'audit-log-maxsize=100'
77+
kube-controller-manager-arg:
78+
- 'terminated-pod-gc-threshold=10'
79+
kubelet-arg:
80+
- 'streaming-connection-idle-timeout=5m'
81+
- "tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305"
82+
```
83+
84+
</TabItem>
85+
86+
<TabItem value="v1.24 and Older" default>
87+
88+
```yaml
89+
protect-kernel-defaults: true
90+
secrets-encryption: true
91+
kube-apiserver-arg:
92+
- 'enable-admission-plugins=NodeRestriction,PodSecurityPolicy,NamespaceLifecycle,ServiceAccount'
93+
- 'audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log'
94+
- 'audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml'
95+
- 'audit-log-maxage=30'
96+
- 'audit-log-maxbackup=10'
97+
- 'audit-log-maxsize=100'
98+
kube-controller-manager-arg:
99+
- 'terminated-pod-gc-threshold=10'
100+
kubelet-arg:
101+
- 'streaming-connection-idle-timeout=5m'
102+
- 'make-iptables-util-chains=true'
103+
- "tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305"
104+
```
105+
106+
</TabItem>
107+
</Tabs>
108+
35109
## Kubernetes Runtime Requirements
36110
37111
The runtime requirements to comply with the CIS Benchmark are centered around pod security (via PSP or PSA), network policies and API Server auditing logs. These are outlined in this section.
@@ -487,6 +561,7 @@ kube-apiserver-arg:
487561
- 'audit-log-maxage=30'
488562
- 'audit-log-maxbackup=10'
489563
- 'audit-log-maxsize=100'
564+
- 'service-account-extend-token-expiration=false'
490565
```
491566
</TabItem>
492567
<TabItem value="cmdline">
@@ -506,58 +581,6 @@ sudo systemctl daemon-reload
506581
sudo systemctl restart k3s.service
507582
```
508583

509-
## Configuration for Kubernetes Components
510-
511-
512-
The configuration below should be placed in the [configuration file](../installation/configuration.md#configuration-file), and contains all the necessary remediations to harden the Kubernetes components.
513-
514-
515-
<Tabs groupId="pod-sec" queryString>
516-
<TabItem value="v1.25 and Newer" default>
517-
518-
```yaml
519-
protect-kernel-defaults: true
520-
secrets-encryption: true
521-
kube-apiserver-arg:
522-
- "enable-admission-plugins=NodeRestriction,EventRateLimit"
523-
- 'admission-control-config-file=/var/lib/rancher/k3s/server/psa.yaml'
524-
- 'audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log'
525-
- 'audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml'
526-
- 'audit-log-maxage=30'
527-
- 'audit-log-maxbackup=10'
528-
- 'audit-log-maxsize=100'
529-
kube-controller-manager-arg:
530-
- 'terminated-pod-gc-threshold=10'
531-
kubelet-arg:
532-
- 'streaming-connection-idle-timeout=5m'
533-
- "tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305"
534-
```
535-
536-
</TabItem>
537-
538-
<TabItem value="v1.24 and Older" default>
539-
540-
```yaml
541-
protect-kernel-defaults: true
542-
secrets-encryption: true
543-
kube-apiserver-arg:
544-
- 'enable-admission-plugins=NodeRestriction,PodSecurityPolicy,NamespaceLifecycle,ServiceAccount'
545-
- 'audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log'
546-
- 'audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml'
547-
- 'audit-log-maxage=30'
548-
- 'audit-log-maxbackup=10'
549-
- 'audit-log-maxsize=100'
550-
kube-controller-manager-arg:
551-
- 'terminated-pod-gc-threshold=10'
552-
kubelet-arg:
553-
- 'streaming-connection-idle-timeout=5m'
554-
- 'make-iptables-util-chains=true'
555-
- "tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305"
556-
```
557-
558-
</TabItem>
559-
</Tabs>
560-
561584
## Manual Operations
562585
The following are controls that K3s currently does not pass by with the above configuration applied. These controls require manual intervention to fully comply with the CIS Benchmark.
563586

docs/security/security.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ First the hardening guide provides a list of security best practices to secure a
1010

1111
Second, is the self assessment to validate a hardened cluster. We currently have two different assessments available:
1212

13-
* [CIS 1.7 Benchmark Self-Assessment Guide](self-assessment-1.7.md), for K3s version v1.25
13+
* [CIS 1.9 Benchmark Self-Assessment Guide](self-assessment-1.9.md), for K3s version v1.27-v1.29
1414

15-
* [CIS 1.8 Benchmark Self-Assessment Guide](self-assessment-1.8.md), for K3s version v1.26
15+
* [CIS 1.10 Benchmark Self-Assessment Guide](self-assessment-1.10.md), for K3s version v1.28-v1.31
1616

17-
* [CIS 1.9 Benchmark Self-Assessment Guide](self-assessment-1.8.md), for K3s version v1.27-v1.29
17+
* [CIS 1.11 Benchmark Self-Assessment Guide](self-assessment-1.11.md), for K3s version v1.29-v1.34
1818

docs/security/self-assessment-1.10.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: CIS 1.10 Self Assessment Guide
66

77
This document is a companion to the [K3s security hardening guide](hardening-guide.md). The hardening guide provides prescriptive guidance for hardening a production installation of K3s, and this benchmark guide is meant to help you evaluate the level of security of the hardened cluster against each control in the CIS Kubernetes Benchmark. It is to be used by K3s operators, security teams, auditors, and decision-makers.
88

9-
This guide is specific to the **v1.28-v1.33** release line of K3s and the **v1.10** release of the CIS Kubernetes Benchmark.
9+
This guide is specific to the **v1.28-v1.31** release line of K3s and the **v1.10** release of the CIS Kubernetes Benchmark.
1010

1111
For more information about each control, including detailed descriptions and remediations for failing tests, you can refer to the corresponding section of the CIS Kubernetes Benchmark v1.9. You can download the benchmark, after creating a free account, in [Center for Internet Security (CIS)](https://www.cisecurity.org/benchmark/kubernetes).
1212

0 commit comments

Comments
 (0)