CKS (Certified Kubernetes Security Specialist) #
2024真题 #
CKS Goal #
https://devopscube.com/cks-exam-guide-tips/
Exam Objects #
- Cluster Setup - 10%
- Cluster Hardening - 15%
- System Hardening - 15%
- Minimize Microservice Vulnerabilities - 20%
- Supply Chain Security - 20%
- Monitoring, Logging and Runtime Security - 20%
🌈 Cluster Setup - 10% #
Use Network security policies to restrict cluster level access
Use CIS benchmark to review the security configuration of Kubernetes components (etcd, kubelet, kubedns, kubeapi)
- Kube-bench - Checks whether Kubernetes is deployed securely by running the checks documented ain the CIS Kubernetes Benchmark.
Properly set up Ingress objects with security control
Protect node metadata and endpoints
Using Kubernetes network policy to restrict pods access to cloud metadata
- This example assumes AWS cloud, and metadata IP address is 169.254.169.254 should be blocked while all other external addresses are not.
apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: deny-only-cloud-metadata-access spec: podSelector: {} policyTypes: - Egress egress: - to: - ipBlock: cidr: 0.0.0.0/0 except: - 169.254.169.254/32
Verify platform binaries before deploying
Kubernetes binaries can be verified by their digest **sha512 hash**
- Checking the Kubernetes release page for the specific release
- Checking the change log for the images and their digests
🌈 Cluster Hardening - 15% #
Exercise caution in using service accounts e.g. disable defaults, minimize permissions on newly created ones
Opt out of automounting API credentials for a service account
Opt out at service account scope #
apiVersion: v1 kind: ServiceAccount metadata: name: build-robot automountServiceAccountToken: false
Opt out at pod scope #
apiVersion: v1 kind: Pod metadata: name: cks-pod spec: serviceAccountName: default automountServiceAccountToken: false
🌈 System Hardening - 15% #
Minimize host OS footprint (reduce attack surface)
Reduce host attack surface
- seccomp which stands for secure computing was originally intended as a means of safely running untrusted compute-bound programs
- AppArmor can be configured for any application to reduce its potential host attack surface and provide greater in-depth defense.
- PSA enforces
- Apply host updates
- Install minimal required OS fingerprint
- Identify and address open ports
- Remove unnecessary packages
- Protect access to data with permissions
Using least-privilege identity and access management
Minimize external access to the network
if it means deny external traffic to outside the cluster?!!
- not tested, however, the thinking is that all pods can talk to all pods in all name spaces but not to the outside of the cluster!!!
apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: deny-external-egress spec: podSelector: {} policyTypes: - Egress egress: to: - namespaceSelector: {}
Appropriately use kernel hardening tools such as AppArmor, seccomp
🌈 Minimize Microservice Vulnerabilities - 20% #
- Use appropriate pod security standards
- Manage kubernetes secrets
- Understand and implement isolation techniques (multi-tenancy, sandbox containers, etc)
- Use container runtime sandboxes in multi-tenant environments (e.g. gvisor, kata containers)
- Implement pod to pod encryption using Cilium
- Implement pod to pod encryption by use of mTLS
- check if service mesh is part of the CKS exam
🌈 Supply Chain Security - 20% #
Minimize base image footprint
Minimize base Image
- Use distroless, UBI minimal, Alpine, or relavent to your app nodejs, python but the minimal build.
- Do not include uncessary software not required for container during runtime e.g build tools and utilities, troubleshooting and debug binaries.
Understand your supply chain (e.g. SBOM, CI/CD, artifact repositories)
Secure your supply chain: whitelist allowed image registries, sign and validate images
- Preform static analysis of user workloads and container images (e.g. kubesec, kubelinter)
Old
🌈 Monitoring, Logging and Runtime Security - 20% #
Perform behavioural analytics to detect malicious activities
Detect threats within a physical infrastructure, apps, networks, data, users and workloads
Investigate and identify of attach and bad actors within the environment
Attack Phases
Mock Exams #
https://killercoda.com/killer-shell-cks
https://github.com/moabukar/CKS-Exercises-Certified-Kubernetes-Security-Specialist
云原生|kubernetes|2022年底cks真题解析(1-10)
云原生|kubernetes|2022年底cks真题解析(11-16
https://www.cnblogs.com/huss2016/p/17055905.html
http://www.dtcms.com/a/696.html
Reference #
https://github.com/vedmichv/CKS-Certified-Kubernetes-Security-Specialist