Description
AlwaysAllow approves requests that reach authorization without checking permission for each operation. This can include anonymous requests when anonymous authentication is enabled.
Potential impact
A user or workload may be able to read or change resources unrelated to its work.
Remediation
For the API server, prepare the roles and bindings administrators and system components need before replacing AlwaysAllow with an authorizer such as RBAC. For kubelet, use Webhook authorization and provide the connectivity and permissions it needs to consult the API server. Test allowed and denied requests on both components.
Examples
These are historical Kubernetes 1.6 API server arguments. Use a supported release in your environment.
Before
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
command: ["kube-apiserver"]
args:
["--anonymous-auth=false", "--authorization-mode=AlwaysAllow"]
restartPolicy: OnFailure
After
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
command: ["kube-apiserver"]
args:
["--anonymous-auth=false", "--authorization-mode=RBAC"]
restartPolicy: OnFailure
Both excerpts disable anonymous authentication. The second uses --authorization-mode=RBAC to authorize authenticated users according to their roles and bindings.