This repository has been archived by the owner on Jun 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #980 from phoenixking25/config-correction
Config correction
- Loading branch information
Showing
31 changed files
with
521 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 35 additions & 10 deletions
45
benchmarks/kubectl-mtb/test/benchmarks/block_access_to_cluster_resources/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,37 @@ | ||
# Block access to cluster resources <small>[MTB-PL1-CC-CPI-1] </small> | ||
**Profile Applicability:** | ||
1 <br> | ||
**Type:** | ||
Configuration Check <br> | ||
**Category:** | ||
Control Plane Isolation <br> | ||
**Description:** | ||
Tenants should not be able to view, edit, create, or delete cluster (non-namespaced) resources such Node, ClusterRole, ClusterRoleBinding, etc. <br> | ||
**Remediation:** | ||
<br> | ||
|
||
**Profile Applicability:** | ||
|
||
1 | ||
|
||
**Type:** | ||
|
||
Configuration Check | ||
|
||
**Category:** | ||
|
||
Control Plane Isolation | ||
|
||
**Description:** | ||
|
||
Tenants should not be able to view, edit, create, or delete cluster (non-namespaced) resources such Node, ClusterRole, ClusterRoleBinding, etc. | ||
|
||
**Rationale:** | ||
|
||
Access controls should be configured for tenants so that a tenant cannot list, create, modify or delete cluster resources | ||
|
||
**Audit:** | ||
|
||
Run the following commands to retrieve the list of non-namespaced resources | ||
```bash | ||
kubectl --kubeconfig cluster-admin api-resources --namespaced=false | ||
``` | ||
For all non-namespaced resources, and each verb (get, list, create, update, patch, watch, delete, and deletecollection) issue the following commands | ||
```bash | ||
kubectl --kubeconfig tenant-a auth can-i verb resource | ||
``` | ||
Each command must return 'no' | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 26 additions & 10 deletions
36
benchmarks/kubectl-mtb/test/benchmarks/block_add_capabilities/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
# Block add capabilities <small>[MTB-PL1-BC-CPI-3] </small> | ||
**Profile Applicability:** | ||
1 <br> | ||
**Type:** | ||
Behavioral Check <br> | ||
**Category:** | ||
Control Plane Isolation <br> | ||
**Description:** | ||
Linux allows defining fine-grained permissions using capabilities. With Kubernetes, it is possible to add capabilities for pods that escalate the level of kernel access and allow other potentially dangerous behaviors. <br> | ||
**Remediation:** | ||
Define a `PodSecurityPolicy` with `allowedCapabilities` and map the policy to each tenant namespace, or use a policy engine such as [OPA/Gatekeeper](https://github.com/open-policy-agent/gatekeeper) or [Kyverno](https://kyverno.io) to enforce new capabilities cannot be added. You can use the policies present [here](https://github.com/kubernetes-sigs/multi-tenancy/tree/master/benchmarks/kubectl-mtb/test/policies). <br> | ||
|
||
**Profile Applicability:** | ||
|
||
1 | ||
|
||
**Type:** | ||
|
||
Behavioral Check | ||
|
||
**Category:** | ||
|
||
Control Plane Isolation | ||
|
||
**Description:** | ||
|
||
Linux | ||
|
||
**Rationale:** | ||
|
||
Linux allows defining fine-grained permissions using capabilities. With Kubernetes, it is possible to add capabilities for pods that escalate the level of kernel access and allow other potentially dangerous behaviors. | ||
|
||
**Audit:** | ||
|
||
Create a pod or container that adds new `capabilities` in its `securityContext`. The pod creation must fail. | ||
|
||
Define a `PodSecurityPolicy` with `allowedCapabilities` and map the policy to each tenant namespace, or use a policy engine such as [OPA/Gatekeeper](https://github.com/open-policy-agent/gatekeeper) or [Kyverno](https://kyverno.io) to enforce new capabilities cannot be added. You can use the policies present [here](https://github.com/kubernetes-sigs/multi-tenancy/tree/master/benchmarks/kubectl-mtb/test/policies). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 34 additions & 10 deletions
44
benchmarks/kubectl-mtb/test/benchmarks/block_ns_quota/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,36 @@ | ||
# Block modification of resource quotas <small>[MTB-PL1-CC-TI-1] </small> | ||
**Profile Applicability:** | ||
1 <br> | ||
**Type:** | ||
Behavioral Check <br> | ||
**Category:** | ||
Tenant Isolation <br> | ||
**Description:** | ||
Tenants should not be able to modify the resource quotas defined in their namespaces <br> | ||
**Remediation:** | ||
<br> | ||
|
||
**Profile Applicability:** | ||
|
||
1 | ||
|
||
**Type:** | ||
|
||
Behavioral Check | ||
|
||
**Category:** | ||
|
||
Tenant Isolation | ||
|
||
**Description:** | ||
|
||
Tenants should not be able to modify the resource quotas defined in their namespaces | ||
|
||
**Rationale:** | ||
|
||
Resource quotas must be configured for isolation and fairness between tenants. Tenants should not be able to modify existing resource quotas as they may exhaust cluster resources and impact other tenants. | ||
|
||
**Audit:** | ||
|
||
Run the following commands to check for permissions to manage quotas in the tenant namespace: | ||
```shell | ||
kubectl --kubeconfig=tenant-a -n a1 auth can-i create quota | ||
kubectl --kubeconfig=tenant-a -n a1 auth can-i update quota | ||
kubectl --kubeconfig=tenant-a -n a1 auth can-i patch quota | ||
kubectl --kubeconfig=tenant-a -n a1 auth can-i delete quota | ||
kubectl --kubeconfig=tenant-a -n a1 auth can-i deletecollection quota | ||
``` | ||
Each command must return 'no'" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 26 additions & 10 deletions
36
benchmarks/kubectl-mtb/test/benchmarks/block_privilege_escalation/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
# Block privilege escalation <small>[MTB-PL1-BC-CPI-6] </small> | ||
**Profile Applicability:** | ||
1 <br> | ||
**Type:** | ||
Behavioral Check <br> | ||
**Category:** | ||
Control Plane Isolation <br> | ||
**Description:** | ||
The `securityContext.allowPrivilegeEscalation` setting allows a process to gain more privileges from its parent process. Processes in tenant containers should not be allowed to gain additional priviliges. <br> | ||
**Remediation:** | ||
Define a `PodSecurityPolicy` with `allowPrivilegeEscalation` set to `false` and map the policy to each tenant's namespace, or use a policy engine such as [OPA/Gatekeeper](https://github.com/open-policy-agent/gatekeeper) or [Kyverno](https://kyverno.io) to prevent privilege escalation. You can use the policies present [here](https://github.com/kubernetes-sigs/multi-tenancy/tree/master/benchmarks/kubectl-mtb/test/policies). <br> | ||
|
||
**Profile Applicability:** | ||
|
||
1 | ||
|
||
**Type:** | ||
|
||
Behavioral Check | ||
|
||
**Category:** | ||
|
||
Control Plane Isolation | ||
|
||
**Description:** | ||
|
||
The `securityContext.allowPrivilegeEscalation` setting allows a process to gain more privileges from its parent process. Processes in tenant containers should not be allowed to gain additional priviliges. | ||
|
||
**Rationale:** | ||
|
||
The `securityContext.allowPrivilegeEscalation` setting allows a process to gain more privileges from its parent process. Processes in tenant containers should not be allowed to gain additional priviliges. | ||
|
||
**Audit:** | ||
|
||
Create a pod or container that sets `allowPrivilegeEscalation` to `true` in its `securityContext`. The pod creation must fail. | ||
|
||
Define a `PodSecurityPolicy` with `allowPrivilegeEscalation` set to `false` and map the policy to each tenant's namespace, or use a policy engine such as [OPA/Gatekeeper](https://github.com/open-policy-agent/gatekeeper) or [Kyverno](https://kyverno.io) to prevent privilege escalation. You can use the policies present [here](https://github.com/kubernetes-sigs/multi-tenancy/tree/master/benchmarks/kubectl-mtb/test/policies). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 26 additions & 10 deletions
36
benchmarks/kubectl-mtb/test/benchmarks/block_privileged_containers/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
# Block privileged containers <small>[MTB-PL1-BC-CPI-5] </small> | ||
**Profile Applicability:** | ||
1 <br> | ||
**Type:** | ||
Behavioral Check <br> | ||
**Category:** | ||
Control Plane Isolation <br> | ||
**Description:** | ||
By default a container is not allowed to access any devices on the host, but a “privileged” container can access all devices on the host. A process within a privileged container can also get unrestricted host access. Hence, tenants should not be allowed to run privileged containers. <br> | ||
**Remediation:** | ||
Define a `PodSecurityPolicy` with `privileged` set to `false` and map the policy to each tenant's namespace, or use a policy engine such as [OPA/Gatekeeper](https://github.com/open-policy-agent/gatekeeper) or [Kyverno](https://kyverno.io) to prevent tenants from running privileged containers. You can use the policies present [here](https://github.com/kubernetes-sigs/multi-tenancy/tree/master/benchmarks/kubectl-mtb/test/policies). <br> | ||
|
||
**Profile Applicability:** | ||
|
||
1 | ||
|
||
**Type:** | ||
|
||
Behavioral Check | ||
|
||
**Category:** | ||
|
||
Control Plane Isolation | ||
|
||
**Description:** | ||
|
||
Linux | ||
|
||
**Rationale:** | ||
|
||
By default a container is not allowed to access any devices on the host, but a “privileged” container can access all devices on the host. A process within a privileged container can also get unrestricted host access. Hence, tenants should not be allowed to run privileged containers. | ||
|
||
**Audit:** | ||
|
||
Create a pod or container that sets `privileged` to `true` in its `securityContext`. The pod creation must fail. | ||
|
||
Define a `PodSecurityPolicy` with `privileged` set to `false` and map the policy to each tenant's namespace, or use a policy engine such as [OPA/Gatekeeper](https://github.com/open-policy-agent/gatekeeper) or [Kyverno](https://kyverno.io) to prevent tenants from running privileged containers. You can use the policies present [here](https://github.com/kubernetes-sigs/multi-tenancy/tree/master/benchmarks/kubectl-mtb/test/policies). | ||
|
Oops, something went wrong.