2020-03-03 14:51:48 +00:00
|
|
|
---
|
|
|
|
controls:
|
|
|
|
version: "gke-1.0"
|
|
|
|
id: 4
|
|
|
|
text: "Worker Node Security Configuration"
|
|
|
|
type: "node"
|
|
|
|
groups:
|
|
|
|
- id: 4.1
|
|
|
|
text: "Worker Node Configuration Files"
|
|
|
|
checks:
|
|
|
|
- id: 4.1.1
|
|
|
|
text: "Ensure that the kubelet service file permissions are set to 644 or more restrictive (Not Scored)"
|
2021-05-18 13:37:55 +00:00
|
|
|
type: skip
|
2020-03-03 14:51:48 +00:00
|
|
|
remediation: "This control cannot be modified in GKE."
|
|
|
|
scored: false
|
|
|
|
|
|
|
|
- id: 4.1.2
|
|
|
|
text: "Ensure that the kubelet service file ownership is set to root:root (Not Scored)"
|
2021-05-18 13:37:55 +00:00
|
|
|
type: skip
|
2020-03-03 14:51:48 +00:00
|
|
|
remediation: "This control cannot be modified in GKE."
|
|
|
|
scored: false
|
|
|
|
|
|
|
|
- id: 4.1.3
|
|
|
|
text: "Ensure that the proxy kubeconfig file permissions are set to 644 or more restrictive (Scored)"
|
2021-05-18 13:37:55 +00:00
|
|
|
audit: '/bin/sh -c ''if test -e $proxykubeconfig; then stat -c permissions=%a $proxykubeconfig; fi'' '
|
2020-03-03 14:51:48 +00:00
|
|
|
tests:
|
|
|
|
test_items:
|
2021-05-18 13:37:55 +00:00
|
|
|
- flag: "permissions"
|
2020-03-03 14:51:48 +00:00
|
|
|
compare:
|
2021-05-18 13:37:55 +00:00
|
|
|
op: bitmask
|
2020-03-03 14:51:48 +00:00
|
|
|
value: "644"
|
|
|
|
remediation: |
|
|
|
|
Run the below command (based on the file location on your system) on each worker node.
|
|
|
|
For example,
|
2020-09-07 08:33:21 +00:00
|
|
|
chmod 644 $proxykubeconfig
|
2020-03-03 14:51:48 +00:00
|
|
|
scored: true
|
|
|
|
|
|
|
|
- id: 4.1.4
|
|
|
|
text: "Ensure that the proxy kubeconfig file ownership is set to root:root (Scored)"
|
|
|
|
audit: '/bin/sh -c ''if test -e $proxykubeconfig; then stat -c %U:%G $proxykubeconfig; fi'' '
|
|
|
|
tests:
|
|
|
|
test_items:
|
|
|
|
- flag: root:root
|
|
|
|
remediation: |
|
|
|
|
Run the below command (based on the file location on your system) on each worker node.
|
|
|
|
For example, chown root:root $proxykubeconfig
|
|
|
|
scored: true
|
|
|
|
|
|
|
|
- id: 4.1.5
|
|
|
|
text: "Ensure that the kubelet.conf file permissions are set to 644 or more restrictive (Not Scored)"
|
2021-05-18 13:37:55 +00:00
|
|
|
type: skip
|
2020-03-03 14:51:48 +00:00
|
|
|
remediation: "This control cannot be modified in GKE."
|
|
|
|
scored: false
|
|
|
|
|
|
|
|
- id: 4.1.6
|
|
|
|
text: "Ensure that the kubelet.conf file ownership is set to root:root (Not Scored)"
|
2021-05-18 13:37:55 +00:00
|
|
|
type: skip
|
2020-03-03 14:51:48 +00:00
|
|
|
remediation: "This control cannot be modified in GKE."
|
|
|
|
scored: false
|
|
|
|
|
|
|
|
- id: 4.1.7
|
|
|
|
text: "Ensure that the certificate authorities file permissions are set to 644 or more restrictive (Not Scored)"
|
2021-05-18 13:37:55 +00:00
|
|
|
type: skip
|
2020-03-03 14:51:48 +00:00
|
|
|
remediation: "This control cannot be modified in GKE."
|
|
|
|
scored: false
|
|
|
|
|
|
|
|
- id: 4.1.8
|
|
|
|
text: "Ensure that the client certificate authorities file ownership is set to root:root (Not Scored)"
|
2021-05-18 13:37:55 +00:00
|
|
|
type: skip
|
2020-03-03 14:51:48 +00:00
|
|
|
remediation: "This control cannot be modified in GKE."
|
|
|
|
scored: false
|
|
|
|
|
|
|
|
- id: 4.1.9
|
|
|
|
text: "Ensure that the kubelet configuration file has permissions set to 644 or more restrictive (Scored)"
|
2021-05-18 13:37:55 +00:00
|
|
|
audit: '/bin/sh -c ''if test -e $kubeletconf; then stat -c permissions=%a $kubeletconf; fi'' '
|
2020-03-03 14:51:48 +00:00
|
|
|
tests:
|
|
|
|
test_items:
|
2021-05-18 13:37:55 +00:00
|
|
|
- flag: "permissions"
|
2020-03-03 14:51:48 +00:00
|
|
|
set: true
|
|
|
|
compare:
|
2021-08-30 12:33:59 +00:00
|
|
|
op: bitmask
|
2020-03-03 14:51:48 +00:00
|
|
|
value: "644"
|
|
|
|
remediation: |
|
2020-06-17 14:08:20 +00:00
|
|
|
Run the following command (using the config file location identified in the Audit step)
|
2020-03-03 14:51:48 +00:00
|
|
|
chmod 644 $kubeletconf
|
|
|
|
scored: true
|
|
|
|
|
|
|
|
- id: 4.1.10
|
|
|
|
text: "Ensure that the kubelet configuration file ownership is set to root:root (Scored)"
|
|
|
|
audit: '/bin/sh -c ''if test -e $kubeletconf; then stat -c %U:%G $kubeletconf; fi'' '
|
|
|
|
tests:
|
|
|
|
test_items:
|
|
|
|
- flag: root:root
|
|
|
|
remediation: |
|
2020-06-17 14:08:20 +00:00
|
|
|
Run the following command (using the config file location identified in the Audit step)
|
2020-03-03 14:51:48 +00:00
|
|
|
chown root:root $kubeletconf
|
|
|
|
scored: true
|
|
|
|
|
|
|
|
- id: 4.2
|
|
|
|
text: "Kubelet"
|
|
|
|
checks:
|
|
|
|
- id: 4.2.1
|
|
|
|
text: "Ensure that the --anonymous-auth argument is set to false (Scored)"
|
|
|
|
audit: "/bin/ps -fC $kubeletbin"
|
|
|
|
audit_config: "/bin/cat $kubeletconf"
|
|
|
|
tests:
|
|
|
|
test_items:
|
|
|
|
- flag: "--anonymous-auth"
|
|
|
|
path: '{.authentication.anonymous.enabled}'
|
|
|
|
compare:
|
|
|
|
op: eq
|
|
|
|
value: false
|
|
|
|
remediation: |
|
|
|
|
If using a Kubelet config file, edit the file to set authentication: anonymous: enabled to
|
|
|
|
false.
|
|
|
|
If using executable arguments, edit the kubelet service file
|
|
|
|
$kubeletsvc on each worker node and
|
|
|
|
set the below parameter in KUBELET_SYSTEM_PODS_ARGS variable.
|
|
|
|
--anonymous-auth=false
|
|
|
|
Based on your system, restart the kubelet service. For example:
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl restart kubelet.service
|
|
|
|
scored: true
|
|
|
|
|
|
|
|
- id: 4.2.2
|
|
|
|
text: "Ensure that the --authorization-mode argument is not set to AlwaysAllow (Scored)"
|
|
|
|
audit: "/bin/ps -fC $kubeletbin"
|
|
|
|
audit_config: "/bin/cat $kubeletconf"
|
|
|
|
tests:
|
|
|
|
test_items:
|
|
|
|
- flag: --authorization-mode
|
|
|
|
path: '{.authorization.mode}'
|
|
|
|
compare:
|
|
|
|
op: nothave
|
|
|
|
value: AlwaysAllow
|
|
|
|
remediation: |
|
|
|
|
If using a Kubelet config file, edit the file to set authorization: mode to Webhook. If
|
|
|
|
using executable arguments, edit the kubelet service file
|
|
|
|
$kubeletsvc on each worker node and
|
|
|
|
set the below parameter in KUBELET_AUTHZ_ARGS variable.
|
|
|
|
--authorization-mode=Webhook
|
|
|
|
Based on your system, restart the kubelet service. For example:
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl restart kubelet.service
|
|
|
|
scored: true
|
|
|
|
|
|
|
|
- id: 4.2.3
|
|
|
|
text: "Ensure that the --client-ca-file argument is set as appropriate (Scored)"
|
|
|
|
audit: "/bin/ps -fC $kubeletbin"
|
|
|
|
audit_config: "/bin/cat $kubeletconf"
|
|
|
|
tests:
|
|
|
|
test_items:
|
|
|
|
- flag: --client-ca-file
|
|
|
|
path: '{.authentication.x509.clientCAFile}'
|
|
|
|
set: true
|
|
|
|
remediation: |
|
|
|
|
If using a Kubelet config file, edit the file to set authentication: x509: clientCAFile to
|
|
|
|
the location of the client CA file.
|
|
|
|
If using command line arguments, edit the kubelet service file
|
|
|
|
$kubeletsvc on each worker node and
|
|
|
|
set the below parameter in KUBELET_AUTHZ_ARGS variable.
|
|
|
|
--client-ca-file=<path/to/client-ca-file>
|
|
|
|
Based on your system, restart the kubelet service. For example:
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl restart kubelet.service
|
|
|
|
scored: true
|
|
|
|
|
|
|
|
- id: 4.2.4
|
|
|
|
text: "Ensure that the --read-only-port argument is set to 0 (Scored)"
|
2021-08-30 12:33:59 +00:00
|
|
|
type: skip
|
|
|
|
remediation: "This control cannot be modified in GKE."
|
2020-03-03 14:51:48 +00:00
|
|
|
scored: true
|
|
|
|
|
|
|
|
- id: 4.2.5
|
|
|
|
text: "Ensure that the --streaming-connection-idle-timeout argument is not set to 0 (Scored)"
|
|
|
|
audit: "/bin/ps -fC $kubeletbin"
|
|
|
|
audit_config: "/bin/cat $kubeletconf"
|
|
|
|
tests:
|
|
|
|
test_items:
|
|
|
|
- flag: --streaming-connection-idle-timeout
|
|
|
|
path: '{.streamingConnectionIdleTimeout}'
|
|
|
|
compare:
|
|
|
|
op: noteq
|
|
|
|
value: 0
|
|
|
|
- flag: --streaming-connection-idle-timeout
|
|
|
|
path: '{.streamingConnectionIdleTimeout}'
|
|
|
|
set: false
|
|
|
|
bin_op: or
|
|
|
|
remediation: |
|
|
|
|
If using a Kubelet config file, edit the file to set streamingConnectionIdleTimeout to a
|
|
|
|
value other than 0.
|
|
|
|
If using command line arguments, edit the kubelet service file
|
|
|
|
$kubeletsvc on each worker node and
|
|
|
|
set the below parameter in KUBELET_SYSTEM_PODS_ARGS variable.
|
|
|
|
--streaming-connection-idle-timeout=5m
|
|
|
|
Based on your system, restart the kubelet service. For example:
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl restart kubelet.service
|
|
|
|
scored: true
|
|
|
|
|
|
|
|
- id: 4.2.6
|
|
|
|
text: "Ensure that the --protect-kernel-defaults argument is set to true (Scored)"
|
2021-08-30 12:33:59 +00:00
|
|
|
type: skip
|
|
|
|
remediation: "This control cannot be modified in GKE."
|
2020-03-03 14:51:48 +00:00
|
|
|
|
|
|
|
- id: 4.2.7
|
|
|
|
text: "Ensure that the --make-iptables-util-chains argument is set to true (Scored) "
|
|
|
|
audit: "/bin/ps -fC $kubeletbin"
|
|
|
|
audit_config: "/bin/cat $kubeletconf"
|
|
|
|
tests:
|
|
|
|
test_items:
|
|
|
|
- flag: --make-iptables-util-chains
|
|
|
|
path: '{.makeIPTablesUtilChains}'
|
|
|
|
compare:
|
|
|
|
op: eq
|
|
|
|
value: true
|
|
|
|
- flag: --make-iptables-util-chains
|
|
|
|
path: '{.makeIPTablesUtilChains}'
|
|
|
|
set: false
|
|
|
|
bin_op: or
|
|
|
|
remediation: |
|
|
|
|
If using a Kubelet config file, edit the file to set makeIPTablesUtilChains: true.
|
|
|
|
If using command line arguments, edit the kubelet service file
|
|
|
|
$kubeletsvc on each worker node and
|
|
|
|
remove the --make-iptables-util-chains argument from the
|
|
|
|
KUBELET_SYSTEM_PODS_ARGS variable.
|
|
|
|
Based on your system, restart the kubelet service. For example:
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl restart kubelet.service
|
|
|
|
scored: true
|
|
|
|
|
|
|
|
- id: 4.2.8
|
|
|
|
text: "Ensure that the --hostname-override argument is not set (Scored)"
|
|
|
|
audit: "/bin/ps -fC $kubeletbin "
|
|
|
|
tests:
|
|
|
|
test_items:
|
|
|
|
- flag: --hostname-override
|
|
|
|
set: false
|
|
|
|
remediation: |
|
|
|
|
Edit the kubelet service file $kubeletsvc
|
|
|
|
on each worker node and remove the --hostname-override argument from the
|
|
|
|
KUBELET_SYSTEM_PODS_ARGS variable.
|
|
|
|
Based on your system, restart the kubelet service. For example:
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl restart kubelet.service
|
|
|
|
scored: true
|
|
|
|
|
|
|
|
- id: 4.2.9
|
|
|
|
text: "Ensure that the --event-qps argument is set to 0 or a level which ensures appropriate event capture (Scored)"
|
2021-08-30 12:33:59 +00:00
|
|
|
type: skip
|
|
|
|
remediation: "This control cannot be modified in GKE."
|
2020-03-03 14:51:48 +00:00
|
|
|
|
|
|
|
- id: 4.2.10
|
|
|
|
text: "Ensure that the --tls-cert-file and --tls-private-key-file arguments are set as appropriate (Scored)"
|
2021-08-30 12:33:59 +00:00
|
|
|
type: skip
|
|
|
|
remediation: "This control cannot be modified in GKE."
|
2020-03-03 14:51:48 +00:00
|
|
|
|
|
|
|
- id: 4.2.11
|
|
|
|
text: "Ensure that the --rotate-certificates argument is not set to false (Scored)"
|
|
|
|
audit: "/bin/ps -fC $kubeletbin"
|
|
|
|
audit_config: "/bin/cat $kubeletconf"
|
|
|
|
tests:
|
|
|
|
test_items:
|
|
|
|
- flag: --rotate-certificates
|
|
|
|
path: '{.rotateCertificates}'
|
|
|
|
compare:
|
|
|
|
op: eq
|
|
|
|
value: true
|
|
|
|
- flag: --rotate-certificates
|
|
|
|
path: '{.rotateCertificates}'
|
|
|
|
set: false
|
|
|
|
bin_op: or
|
|
|
|
remediation: |
|
|
|
|
If using a Kubelet config file, edit the file to add the line rotateCertificates: true or
|
|
|
|
remove it altogether to use the default value.
|
|
|
|
If using command line arguments, edit the kubelet service file
|
|
|
|
$kubeletsvc on each worker node and
|
|
|
|
remove --rotate-certificates=false argument from the KUBELET_CERTIFICATE_ARGS
|
|
|
|
variable.
|
|
|
|
Based on your system, restart the kubelet service. For example:
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl restart kubelet.service
|
|
|
|
scored: true
|
|
|
|
|
|
|
|
- id: 4.2.12
|
|
|
|
text: "Ensure that the RotateKubeletServerCertificate argument is set to true (Scored)"
|
|
|
|
audit: "/bin/ps -fC $kubeletbin"
|
|
|
|
audit_config: "/bin/cat $kubeletconf"
|
|
|
|
tests:
|
|
|
|
test_items:
|
|
|
|
- flag: RotateKubeletServerCertificate
|
|
|
|
path: '{.featureGates.RotateKubeletServerCertificate}'
|
|
|
|
compare:
|
|
|
|
op: eq
|
|
|
|
value: true
|
|
|
|
remediation: |
|
|
|
|
Edit the kubelet service file $kubeletsvc
|
|
|
|
on each worker node and set the below parameter in KUBELET_CERTIFICATE_ARGS variable.
|
|
|
|
--feature-gates=RotateKubeletServerCertificate=true
|
|
|
|
Based on your system, restart the kubelet service. For example:
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl restart kubelet.service
|
|
|
|
scored: true
|
|
|
|
|
|
|
|
- id: 4.2.13
|
|
|
|
text: "Ensure that the Kubelet only makes use of Strong Cryptographic Ciphers (Not Scored)"
|
2021-05-18 13:37:55 +00:00
|
|
|
type: skip
|
2020-03-03 14:51:48 +00:00
|
|
|
remediation: "This control cannot be modified in GKE."
|
|
|
|
scored: false
|