42 lines
1.4 KiB
YAML
42 lines
1.4 KiB
YAML
id: k8s-ns-usage-check
|
|
|
|
info:
|
|
name: Ensure namespaces are utilized
|
|
author: princechaddha
|
|
severity: info
|
|
description: Checks if Kubernetes namespaces are actively used to separate resources, which is critical for resource organization and access control.
|
|
impact: |
|
|
Lack of namespaces usage can lead to disorganized resources and potentially flawed access controls, impacting security and management.
|
|
remediation: |
|
|
Implement and use namespaces to organize resources within the Kubernetes cluster effectively. Define access controls and resource quotas on a per-namespace basis.
|
|
reference:
|
|
- https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
|
|
tags: cloud,devops,kubernetes,devsecops,namespaces,k8s,k8s-cluster-security
|
|
|
|
variables:
|
|
argument: "namespaces"
|
|
|
|
self-contained: true
|
|
code:
|
|
- engine:
|
|
- sh
|
|
- bash
|
|
source: |
|
|
kubectl get namespaces --output=json
|
|
|
|
matchers-condition: and
|
|
matchers:
|
|
- type: word
|
|
words:
|
|
- '"items":'
|
|
|
|
- type: word
|
|
words:
|
|
- '"Namespace"'
|
|
negative: true
|
|
|
|
extractors:
|
|
- type: dsl
|
|
dsl:
|
|
- '"Kubernetes cluster is not utilizing " + argument'
|
|
# digest: 490a00463044022065295ceaacd9118c5eb2c498014dba124da623bebdf66bb463b5f10bbcad67ae02207540c4d0f8a26672d94ca58df27833d77196a9cf94501d31f3f12312f8f55866:922c64590222798bb761d5b6d8e72950 |