FYI re CIS test 4.2.6 Ensure that the --protect-kernel-defaults argument is set to true #857
davidhay1969
started this conversation in
Development
Replies: 1 comment
-
@davidhay1969 Thank you for sharing your experience glad to hear kube-bench helped you ! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Purely FYI, just spent a happy hour or two trying to work out how to mitigate CIS 4.2.6: -
in my K8s
v1.19.1
cluster.Running
kube-bench
as follows: -kube-bench run --targets node --version 1.19 --config-dir $GOPATH/src/github.com/aquasecurity/kube-bench/cfg/
I had one
FAIL
: -I modified the
kubelet
configuration file: -vi /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
and inserted: -
and restarted
kubelet
: -and checked the configuration: -
systemctl show --property=Environment kubelet
BUT
kube-bench
still threw the sameFAIL
😢 😢 😢
Then I realised what a doofus I was ....
I was setting the
KUBELET_SYSTEM_PODS_ARGS
variable BUT not actually using it 🤦I further edited
10-kubeadm.conf
and changed from: -ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
to: -
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS $KUBELET_SYSTEM_PODS_ARGS
and again restarted
kubelet
: -I also validated how
kubelet
was now running: -ps -eaf | grep kubelet
This time, all is good: -
kube-bench run --targets node --version 1.19 --config-dir $GOPATH/src/github.com/aquasecurity/kube-bench/cfg/
Final point, in my single node K8s cluster,
kubelet
is running on BOTH the Master and Worker nodes, so I needed to make the change on BOTH.Thanks for an awesome tool
Cheers, Dave
Beta Was this translation helpful? Give feedback.
All reactions