Awesome
<p align="center"> <img width="360" src="kubernetes-security-specialist-logo.png"> </p> <p align="center"> <img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat"> <img src="https://img.shields.io/badge/status-preview-brightgreen?style=flat"> <img src="https://img.shields.io/github/issues-raw/ijelliti/CKSS-Certified-Kubernetes-Security-Specialist?style=flat"> <img src="https://img.shields.io/github/license/ijelliti/CKSS-Certified-Kubernetes-Security-Specialist?style=flat"> <img src="https://img.shields.io/github/stars/ijelliti/CKSS-Certified-Kubernetes-Security-Specialist?style=social"> <img src="https://img.shields.io/github/forks/ijelliti/CKSS-Certified-Kubernetes-Security-Specialist?style=social"> </p>Certified Kubernetes Security Specialist - CKSS
This repository is a collection of resources to prepare for the Certified Kubernetes Security Specialist (CKSS) exam.
The given references and links below are just assumptions and ideas around the CKSS curriculum.
CKS Overview
The Kubernetes Security Specialist (CKS) certification ensure that the holder has the skills, knowledge, and competence on a broad range of best practices for securing container-based applications and Kubernetes platforms during build, deployment and runtime.
The certification is generally available to take from here as anounced during the KubeCon NA20
CKS Outline
The CKS test will be online, proctored and performance-based with 15-20 hands-on performance based tasks, and candidates have 2 hours to complete the exam tasks.
From the CKS Exam Curriculum repository, The exam will test domains and competencies including:
- Cluster Setup (10%): Best practice configuration to control the environment's access, rights and platform conformity.
- Cluster Hardening (15%): Protecting K8s API and utilize RBAC.
- System Hardening (15%): Improve the security of OS & Network; restrict access through IAM
- Minimize Microservice Vulnerabilities (20%): Utilizing on K8s various mechanisms to isolate, protect and control workload.
- Supply Chain Security (20%): Container oriented security, trusted resources, optimized container images, CVE scanning.
- Monitoring, Logging, and Runtime Security (20%): Analyse and detect threads.
CKS Exam Preparation
In order to take the CKS exam, you must have Valid CKA certification prior to attempting the CKS exam to demonstrate you possess sufficient Kubernetes expertise. A first good starting point for securing Kubernetes is the Task section Securing a Cluster of the official K8s documentation. The exam will be based on Kubernetes v1.19 documentation as of November general availability announcement.
Allowed resources to access during my CKS exam:
According to the LF docs, during the CKS exam the candidates may:
- review the Exam content instructions that are presented in the command line terminal.
- review Documents installed by the distribution (i.e. /usr/share and its subdirectories)
- use their Chrome or Chromium browser to open one additional tab in order to access
- Kubernetes Documentation:
- https://kubernetes.io/docs/ and their subdomains
- https://github.com/kubernetes/ and their subdomains
- https://kubernetes.io/blog/ and their subdomains
- Tools:
- Trivy documentation https://github.com/aquasecurity/trivy
- Sysdig documentation https://docs.sysdig.com/
- Falco documentation https://falco.org/docs/
- App Armor:
- Kubernetes Documentation:
Cluster Setup (10%)
<details><summary>Use Network security policies to restrict cluster level access</summary>Allowed Ressources
3rd Party Ressources
- Get started with Kubernetes network policy
- kubernetes-network-policy-recipes
- Kubernetes Network Policies Best Practices
- Exploring Network Policies in Kubernetes
3rd Party Ressources
- CIS benchmark for Kubernetes
- The benchmark is not yet available for
Kubernetes 1.19
, but it gives great understanding.
- The benchmark is not yet available for
- What is Center for Internet Security (CIS) Benchmarks
- Kube-bench: A tool for running Kubernetes CIS Benchmark tests
- GKE: CIS Benchmarks for etcd & kubelet
Allowed Ressources
- Ingress
- Ingress Controllers
- Set up Ingress on Minikube with the NGINX Ingress Controller
- secure an Ingress by specifying a Secret that contains a TLS private key and certificate
- How to deploy NGINX Ingress Controller
- TLS/HTTPS
Allowed Ressources
3rd Party Ressources
- Kubelet API
- Setting up secure endpoints in Kubernetes
- GKE Protecting cluster metadata
- Retrieving EC2 instance metadata
- EC2 Instance user data
Allowed Ressources
3rd Party Ressources
</details> <details><summary>Verify platform binaries before deploying</summary>Allowed Ressources
</details>Cluster Hardening (15%)
<details><summary>Restrict access to Kubernetes API</summary>Allowed Ressources
- Controlling Access to the Kubernetes API
- Certificate Signing Requests: Create Normal User
- Generate cluster certificates (easyrsa, openssl or cfssl)
3rd Party Ressources
- GKE: Hardening your cluster's security
- Kubernetes RBAC and TLS certificates – Kubernetes security guide
- Securing Your Kubernetes API Server
Allowed Ressources
3rd Party Ressources
</details> <details><summary>Exercise caution in using service accounts e.g. disable defaults, minimize permissions on newly created ones</summary>Allowed Ressources
- Managing Service Accounts
- Default roles and role bindings
- Authorization Modes
- Configure Service Accounts for Pods
- Kubernetes should not mount default service account credentials by default
3rd Party Ressources
- Kubernetes: Creating Service Accounts and Kubeconfigs
- Kubernetes Access Control: Exploring Service Accounts
- Disable default service account by deployments in Kubernetes
- Securing Kubernetes Clusters by Eliminating Risky Permissions
- Understand Role Based Access Control in Kubernetes
Allowed Ressources
</details>System Hardening (15%)
<details><summary>Minimize host OS footprint (reduce attack surface)</summary>Allowed Ressources
3rd Party Ressources
- Reduce Kubernetes Attack Surfaces
- distribution independent linux
- CIS Benchmark Ubuntu Linux
- CIS Benchmark RedHat
- CIS Benchmark Debian
- CIS Benchmark Centos
- CIS Benchmark SUSE
- CIS Benchmark Oracle
3rd Party Ressources
</details> <details><summary>Minimize external access to the network</summary>Allowed Ressources
- K8s quotas (services.loadbalancers)
- Restrict Access For LoadBalancer Service
- Admission control plugin: ResourceQuota
3rd Party Ressources
- Secure hosts with OS-level firewall (ufw)
- Configure firewall with ufw
- Use security groups to secure network (Azure)
- Amazon EKS security group considerations
- Amazon EC2 security groups for Linux instances
Allowed Ressources
- Restrict a Container's Access to Resources with AppArmor
- Restrict a Container's Syscalls with Seccomp
3rd Party Ressources
- Kubernetes Hardening Best Practices
- Container Security: Fundamental Technology Concepts that Protect Containerized Application by Liz Rice
Minimize Microservice Vulnerabilities (20%)
<details><summary>Setup appropriate OS level security domains e.g. using PSP, OPA, security contexts</summary>Allowed Ressources
- Pod Security Policies
- Configure a Security Context for a Pod or Container
- OPA Gatekeeper: Policy and Governance for Kubernetes
- Kubernetes security context, security policy, and network policy – Kubernetes security guide (part 2)
3rd Party Ressources
</details> <details><summary>Manage kubernetes secrets</summary>Allowed Ressources
3rd Party Ressources
- katacoda lab around Secrets
- Managing Secrets in Kubernetes
- Secrets Store CSI driver
- How to Manage Secrets in Kubernetes
Allowed Ressources
- container runtime
- container runtime sandboxes examples
- Enforce tenant isolation (Limit Ranges, Quotas, PSPs) with Policies
- Affinity and anti-affinity
3rd Party Ressources
- What is gVisor?
- Cluster multi-tenancy
- Use gVisor to run Kubernetes pods
- Implementing secure Containers using Google’s gVisor
- Kata containers and Kubernetes: How they fit together?
- How to use Kata Containers with Kubernetes?
Allowed Ressources
3rd Party Ressources
- Secure communication between services in Istio with mutual TLS
- Mutual TLS Authentication (mTLS) De-Mystified
- Traffic encryption using mTLS
- Using Istio to improve end-to-end security
- Linerd: automatic mtls
Supply Chain Security (20%)
<details><summary>Minimize base image footprint</summary>3rd Party Ressources
- Why build small container images in Kubernetes
- Use the smallest base image possible
- 7 best practices for building containers
- distroless containers
- Docker multi-stage builds
- Tips to Reduce Docker Image Sizes
- 3 simple tricks for smaller Docker images
Allowed Ressources
- Using Admission Controllers
- Dynamic Admission Control
- A Guide to Kubernetes Admission Controllers
- Ensure images only from approved sources are run
3rd Party Ressources
- Content trust in Docker
- How to reject docker registries in Kubernetes?
- Restrict pulling images from Registry
- Container image signatures in Kubernetes
Allowed Ressources
3rd Party Ressources
- Trivy
- Static analysis with Clair
- Static analysis with Kube-score
- kubehunter
- kubesec
- Kubernetes static code analysis with Checkov
3rd Party Ressources
</details>Monitoring, Logging and Runtime Security (20%)
<details><summary>Perform behavioral analytics of syscall process and file activities at the host and container level to detect malicious activities</summary>Allowed Ressources
- Restrict a Container's Syscalls with Seccomp
- Auditing with Falco (Obsoledted)
- How to detect a Kubernetes vulnerability using Falco
3rd Party Ressources
</details> <details><summary>Detect threats within physical infrastructure, apps, networks, data, users and workloads</summary>3rd Party Ressources
- Common Kubernetes config security threats
- A guidance on Kubernetes threat modeling
- Threat matrix for Kubernetes
3rd Party Ressources
- Investigating Kubernetes attack scenarios in Threat Stack
- Anatomy of a Kubernetes attack – How untrusted Docker images fails us
- Investigating Kubernetes Attack Scenarios in Threat Stack (part 1)
- The seven phases of a cyber attack
- Threat matrix for Kubernetes
- MITRE ATT&CK framework for container runtime security with Falco
- Mitigating Kubernetes attacks
3rd Party Ressources
</details> <details><summary>Ensure immutability of containers at runtime</summary>Allowed Ressources
- "ReadOnlyRootFilesystem" (securityContext, PSP)
- "readOnly" volume mount
- Principles of Container-based Application Design
3rd Party Ressources
- Leverage Kubernetes to ensure that containers are immutable
- Why I think we should all use immutable Docker images
- With immutable infrastructure, your systems can rise from the dead
Allowed Ressources
3rd Party Ressources
</details>Related Kubernetes security resources
- Kubernetes Security Essentials (LFS260)
- Cloud Native Security Tutorial
- Killer Shell CKS Simulator
- Sysdig Kubernetes Security Guide
- Kubernetes Security Best Practices - Ian Lewis, Google
- Kubernetes security concepts and demos
- Tutorial: Getting Started With Cloud Native Security - Liz Rice, Aqua Security & Michael Hausenblas
- 11 Ways (Not) to Get Hacked
- Kubernetes Goat
- Kubernetes CTF on vagrant environment
- Udemy Kubernetes CKS 2020 Complete Course and killer.sh Simulator
- NSA/CISA Kubernetes Hardening Guidance 08/2021
White Papers
Keep Updating
- LIVING DOCUMENT - I WILL UPDATE IT FREQUENTLY WHEN I HAVE NEW INFORMATIONS
- PRs are always welcome so star, fork and contribute
- please make a pull request if you would like to add or update
Ibrahim Jelliti © 2020