Tighten permissions (security best practices)
- Dominant language
- Go
- Stars
- 2.6k
- Forks
- 233
- PR merge metrics
- No merged PRs in 30d
Description
I've been going through security review of our Kubernetes infrastructure, using kubescape specifically, and there are couple of valid findings that I think can be fixed. It's clear why we need `hostPID: true` and `privileged: true`, and why we're running the container as root, but a few others are left as Kubernetes defaults and are too lax.
I'm not 100% sure how exactly Kured operates, but to me it looks like all it does is call `/bin/systemctl reboot` by accessing host's mount namespace directly. Thus I suspect that this DaemonSet would work equally as well, while being much tighter on security.
```
apiVersion: apps/v1
kind: DaemonSet
spec:
template:
spec:
containers:
- name: kured
securityContext:
allowPrivilegeEscalation: false # not 100% sure how privilege escalation works, and if we need it or not in this case
capabilities:
add:
- SYS_BOOT
drop:
- ALL
privileged: true
readOnlyRootFilesystem: true
hostPID: true
securityContext:
seccompProfile:
type: RuntimeDefault
```
Thoughts?
Contributor guide
Assessment
This issue has not been assessed yet.