SlideShare uma empresa Scribd logo
1 de 43
Baixar para ler offline
Policy as code: What Helm
Developers Need to Know About
Security
1
Cesar Rodriguez
Head of Developer Advocacy
2
CNCF Survey 2020 / Photo by CHUTTERSNAP on Unsplash
92%
organizations
using containers
in production
83%
organizations
using
Kubernetes in
production
Cloud Breaches
3
200
cloud breaches in
the last 24 months
30B+
records exposed due to
cloud infrastructure
misconfigurations
4
➜ ~
5
➜ ~ brew install mysql
6
➜ ~ brew install mysql
➜ ~ docker run --name cesar-mysql -e
MYSQL_ROOT_PASSWORD=super-secret-password -d mysql:latest
7
➜ ~ brew install mysql
➜ ~ docker run --name cesar-mysql -e
MYSQL_ROOT_PASSWORD=super-secret-password -d mysql:latest
➜ ~ helm install mysql bitnami/mysql
How do I secure Helm?
Cesar Rodriguez
Developer Advocate
Cloud Security Architect
OSS Contributor
cesar@accurics.com
#3
Implement
Guardrails
#1 Define
Requirements
#2 Use Policy
as Code
3 Steps for Using Helm Securely
Photo by Rafael Garcin on Unsplash
Step #1: Define
Requirements
Photo by Rafael Garcin on Unsplash
Security
Functionality
Usability
Frameworks, Compliance, & Benchmarks
Security Risk Categories
14
Data
Protection
Enforcing encryption helps
protect data traversing
network boundaries and
at-rest
Access
Management
Access to cloud resources
should be controlled
enforcing least privilege
and avoid accidental public
exposure
Network
Security
Security controls should be
applied at the network
layer to prevent
unintended exposure
Visibility
Ensuring logging and
monitoring of cloud
systems is enabled and
accessible by security team
Example - Wordpress Architecture
15
Example Architecture Security Requirements
16
Example - Wordpress Architecture Policies
17
1. Secrets in environment vars
(CIS k8s benchmark 5.4.1)
Example - Wordpress Architecture Policies
18
1. Secrets in environment vars
(CIS k8s benchmark 5.4.1)
2. Containers running as root
(CIS k8s benchmark 5.2.6)
Example - Wordpress Architecture Policies
19
1. Secrets in environment vars
(CIS k8s benchmark 5.4.1)
2. Containers running as root
(CIS k8s benchmark 5.2.6)
3. Privilege escalation setting
(CIS k8s benchmark 5.2.5)
Step #2: Use Policy as Code
Photo by Scott Graham on Unsplash
What is Policy as Code?
PaC Benefits
22
1. Low friction
2. Secure by default
3. Increased Security Visibility
23
openpolicyagent.org
Rego #1: Avoid Secrets in Env Variables
24
containerUsesSecretsInEnvironmentVar[api.id] {
api = input.kubernetes_deployment[_]
spec = api.config.spec.template.spec
containers = spec.containers[_]
envVars := containers.env[_]
envVars.valueFrom.secretKeyRef
}
1
2
3
4
5
6
7
Rego #1: Avoid Secrets in Env Variables
25
containerUsesSecretsInEnvironmentVar[api.id]{
api = input.kubernetes_deployment[_]
spec = api.config.spec.template.spec
containers = spec.containers[_]
envVars := containers.env[_]
envVars.valueFrom.secretKeyRef
}
1
2
3
4
5
6
7
apiVersion: v1
kind: Deployment
metadata:
name: secret-env-pod
spec:
containers:
- name: mycontainer
image: redis
env:
- name: SECRET_USERNAME
valueFrom:
secretKeyRef:
name: mysecret
key: username
- name: SECRET_PASSWORD
valueFrom:
secretKeyRef:
name: mysecret
key: password
restartPolicy: Never
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Rego #2: Privilege Escalation
26
privilegeEscalationCheck
[pod.id] {
pod := object.get(input, "kubernetes_deployment", "undefined")[_]
secContext := pod.config.spec.template.spec.securityContext
podSecurityCheck(secContext)
}
podSecurityCheck(secContext) {
secContext.allowPrivilegeEscalation == "true"
}
podSecurityCheck(secContext) {
object.get(secContext, "allowPrivilegeEscalation", "undefined") == "undefined"
}
1
2
3
4
5
6
7
8
9
10
11
Rego #2: Privilege Escalation
27
privilegeEscalationCheck[pod.id] {
pod := object.get(input, "kubernetes_deployment", "undefined")[_]
secContext := pod.config.spec.template.spec.securityContext
podSecurityCheck(secContext)
}
podSecurityCheck(secContext) {
secContext.allowPrivilegeEscalation == "true"
}
podSecurityCheck(secContext) {
object.get(secContext, "allowPrivilegeEscalation", "undefined") == "undefined"
}
1
2
3
4
5
6
7
8
9
10
11
Rego #2: Privilege Escalation
28
privilegeEscalationCheck[pod.id] {
pod := object.get(input, "kubernetes_deployment", "undefined")[_]
secContext := pod.config.spec.template.spec.securityContext
podSecurityCheck(secContext)
}
podSecurityCheck(secContext) {
secContext.allowPrivilegeEscalation == "true"
}
podSecurityCheck(secContext) {
object.get(secContext, "allowPrivilegeEscalation", "undefined")== "undefined"
}
1
2
3
4
5
6
7
8
9
10
11
Rego #2: Privilege Escalation
29
podSecurityCheck(secContext) {
secContext.allowPrivilegeEscalation == "true"
}
podSecurityCheck(secContext) {
object.get(secContext,
"allowPrivilegeEscalation", "undefined") ==
"undefined"
}
securityContext:
runAsUser: 1000
runAsGroup: 3000
fsGroup: 2000
allowPrivilegeEscalation: true
1
2
3
4
5
8
9
10
11
12
13
14
15
Rego #3 Running as Root
30
runAsNonRootCheck(secContext) {
secContext.runAsNonRoot == "false"
}
runAsNonRootCheck(secContext) {
object.get(secContext, "runAsNonRoot", "undefined") == "undefined"
}
runAsUserCheck(secContext) {
secContext.runAsUser == "0"
}
runAsUserCheck(secContext) {
object.get(secContext, "runAsUser", "undefined") == "undefined"
}
10
11
12
13
14
15
16
17
18
19
20
21
Rego #3 Running as Root
31
10
11
12
13
14
15
16
17
18
19
20
21
runAsNonRootCheck(secContext) {
secContext.runAsNonRoot == "false"
}
runAsNonRootCheck(secContext) {
object.get(secContext, "runAsNonRoot", "undefined") == "undefined"
}
runAsUserCheck(secContext) {
secContext.runAsUser == "0"
}
runAsUserCheck(secContext) {
object.get(secContext, "runAsUser", "undefined") == "undefined"
}
Rego #3 Running as Root
32
runAsNonRootCheck(secContext) {
secContext.runAsNonRoot == "false"
}
runAsNonRootCheck(secContext) {
object.get(secContext,
"runAsNonRoot", "undefined") ==
"undefined"
}
runAsUserCheck(secContext) {
secContext.runAsUser == "0"
}
runAsUserCheck(secContext) {
object.get(secContext, "runAsUser",
"undefined") == "undefined"
}
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
securityContext:
runAsNonRoot: false
runAsGroup: 3000
fsGroup: 2000
securityContext:
runAsUser: 0
runAsGroup: 3000
fsGroup: 2000
1
2
3
4
1
2
3
4
Step #3: Implement Guardrails
Photo by Aditya Rathod on Unsplash
What are security guardrails?
35
github.com/accurics/terrascan
36
➜ ~ terrascan scan -p policies -i helm
Violation Details -
Description: Container uses secrets in environment variables
File : wordpress/templates/deployment.yaml
Line : 1
Severity : HIGH
-----------------------------------------------------------------------
Description: Containers Should Not Run with AllowPrivilegeEscalation
File : wordpress/templates/deployment.yaml
Line : 1
Severity : HIGH
-----------------------------------------------------------------------
Description: Minimize Admission of Root Containers
File : wordpress/templates/deployment.yaml
Line : 1
Severity : HIGH
37
➜ ~ terrascan scan -p policies -i helm -r git -u
git@github.com:helm/charts.git//stable//wordpress
Violation Details -
Description: Container uses secrets in environment variables
File : wordpress/templates/deployment.yaml
Line : 1
Severity : HIGH
-----------------------------------------------------------------------
Description: Containers Should Not Run with AllowPrivilegeEscalation
File : wordpress/templates/deployment.yaml
Line : 1
Severity : HIGH
-----------------------------------------------------------------------
38
➜ ~ alias no_terrascan_highs='terrascan scan -p policies -i helm -o json | ((
$(jq ".results.scan_summary.high") == 0 ))'
➜ ~ no_terrascan_highs && helm install wordpress .
CI/CD
39
Build
Continuous Integration
Deploy
Continuous Deployment
Develop
Continuous Code
Posture Management
Run
Continuous Cloud
Posture Management
RUNTIME
DEVELOPMENT
Cloud
Infrastructure as Code Secure Code
Management
CI/CD Cloud Service Provider
40
Admission Controller
Demo
#3
Implement
Guardrails
#2 Use Policy
as Code
3 Steps for Using Helm Securely
#1 Define
Requirements
43
Thank You
accurics.com/blog

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Cloud Native Security: New Approach for a New Reality
Cloud Native Security: New Approach for a New RealityCloud Native Security: New Approach for a New Reality
Cloud Native Security: New Approach for a New Reality
 
Security threats with Kubernetes - Igor Khoroshchenko
 Security threats with Kubernetes - Igor Khoroshchenko Security threats with Kubernetes - Igor Khoroshchenko
Security threats with Kubernetes - Igor Khoroshchenko
 
Native cloud security monitoring
Native cloud security monitoringNative cloud security monitoring
Native cloud security monitoring
 
Exploiting IAM in the google cloud platform - dani_goland_mohsan_farid
Exploiting IAM in the google cloud platform - dani_goland_mohsan_faridExploiting IAM in the google cloud platform - dani_goland_mohsan_farid
Exploiting IAM in the google cloud platform - dani_goland_mohsan_farid
 
Pragmatic Cloud Security Automation
Pragmatic Cloud Security AutomationPragmatic Cloud Security Automation
Pragmatic Cloud Security Automation
 
Monitoring Your AWS EKS Environment with Datadog
Monitoring Your AWS EKS Environment with DatadogMonitoring Your AWS EKS Environment with Datadog
Monitoring Your AWS EKS Environment with Datadog
 
Terrascan - Cloud Native Security Tool
Terrascan - Cloud Native Security Tool Terrascan - Cloud Native Security Tool
Terrascan - Cloud Native Security Tool
 
Of CORS thats a thing how CORS in the cloud still kills security
Of CORS thats a thing how CORS in the cloud still kills securityOf CORS thats a thing how CORS in the cloud still kills security
Of CORS thats a thing how CORS in the cloud still kills security
 
AnsibleFest 2020 - Automate cybersecurity solutions in a cloud native scenario
AnsibleFest 2020 - Automate cybersecurity solutions in a cloud native scenarioAnsibleFest 2020 - Automate cybersecurity solutions in a cloud native scenario
AnsibleFest 2020 - Automate cybersecurity solutions in a cloud native scenario
 
HashiTalks 2020 - Chef Tools & Terraform: Better Together
HashiTalks 2020 - Chef Tools & Terraform: Better TogetherHashiTalks 2020 - Chef Tools & Terraform: Better Together
HashiTalks 2020 - Chef Tools & Terraform: Better Together
 
Alfredo Reino - Monitoring aws and azure
Alfredo Reino - Monitoring aws and azureAlfredo Reino - Monitoring aws and azure
Alfredo Reino - Monitoring aws and azure
 
(SACON) Madhu Akula - Automated Defense Using Cloud Service Aws, Azure, Gcp
(SACON) Madhu Akula  - Automated Defense Using Cloud Service Aws, Azure, Gcp(SACON) Madhu Akula  - Automated Defense Using Cloud Service Aws, Azure, Gcp
(SACON) Madhu Akula - Automated Defense Using Cloud Service Aws, Azure, Gcp
 
Scaling Security in the Cloud With Open Source
Scaling Security in the Cloud With Open SourceScaling Security in the Cloud With Open Source
Scaling Security in the Cloud With Open Source
 
Getting Started with Runtime Security on Azure Kubernetes Service (AKS)
Getting Started with Runtime Security on Azure Kubernetes Service (AKS)Getting Started with Runtime Security on Azure Kubernetes Service (AKS)
Getting Started with Runtime Security on Azure Kubernetes Service (AKS)
 
Keeping your Kubernetes Cluster Secure
Keeping your Kubernetes Cluster SecureKeeping your Kubernetes Cluster Secure
Keeping your Kubernetes Cluster Secure
 
Secure Infrastructure Provisioning with Terraform Cloud, Vault + GitLab CI
Secure Infrastructure Provisioning with Terraform Cloud, Vault + GitLab CISecure Infrastructure Provisioning with Terraform Cloud, Vault + GitLab CI
Secure Infrastructure Provisioning with Terraform Cloud, Vault + GitLab CI
 
DevSecOps - CrikeyCon 2017
DevSecOps - CrikeyCon 2017DevSecOps - CrikeyCon 2017
DevSecOps - CrikeyCon 2017
 
AWS Security Week | Getting to Continuous Security and Compliance Monitoring ...
AWS Security Week | Getting to Continuous Security and Compliance Monitoring ...AWS Security Week | Getting to Continuous Security and Compliance Monitoring ...
AWS Security Week | Getting to Continuous Security and Compliance Monitoring ...
 
All Your Containers Are Belong To Us
All Your Containers Are Belong To UsAll Your Containers Are Belong To Us
All Your Containers Are Belong To Us
 
Integrating Security into DevOps and CI / CD Environments - Pop-up Loft TLV 2017
Integrating Security into DevOps and CI / CD Environments - Pop-up Loft TLV 2017Integrating Security into DevOps and CI / CD Environments - Pop-up Loft TLV 2017
Integrating Security into DevOps and CI / CD Environments - Pop-up Loft TLV 2017
 

Semelhante a Policy as code what helm developers need to know about security

Secure development on Kubernetes by Andreas Falk
Secure development on Kubernetes by Andreas FalkSecure development on Kubernetes by Andreas Falk
Secure development on Kubernetes by Andreas Falk
SBA Research
 
Session 3 - CloudStack Test Automation and CI
Session 3 - CloudStack Test Automation and CISession 3 - CloudStack Test Automation and CI
Session 3 - CloudStack Test Automation and CI
tcloudcomputing-tw
 
Evolution of security strategies in K8s environments- All day devops
Evolution of security strategies in K8s environments- All day devops Evolution of security strategies in K8s environments- All day devops
Evolution of security strategies in K8s environments- All day devops
Jose Manuel Ortega Candel
 

Semelhante a Policy as code what helm developers need to know about security (20)

Behind the Code 'September 2022 // by Exness
Behind the Code 'September 2022 // by ExnessBehind the Code 'September 2022 // by Exness
Behind the Code 'September 2022 // by Exness
 
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 202010 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
 
Secure development on Kubernetes by Andreas Falk
Secure development on Kubernetes by Andreas FalkSecure development on Kubernetes by Andreas Falk
Secure development on Kubernetes by Andreas Falk
 
SEC301 - New AWS security services for container threat detection - final.pdf
SEC301 - New AWS security services for container threat detection - final.pdfSEC301 - New AWS security services for container threat detection - final.pdf
SEC301 - New AWS security services for container threat detection - final.pdf
 
Keeping Your Kubernetes Cluster Secure
Keeping Your Kubernetes Cluster SecureKeeping Your Kubernetes Cluster Secure
Keeping Your Kubernetes Cluster Secure
 
Evolution of security strategies in K8s environments.pdf
Evolution of security strategies in K8s environments.pdfEvolution of security strategies in K8s environments.pdf
Evolution of security strategies in K8s environments.pdf
 
How to make a high-quality Node.js app, Nikita Galkin
How to make a high-quality Node.js app, Nikita GalkinHow to make a high-quality Node.js app, Nikita Galkin
How to make a high-quality Node.js app, Nikita Galkin
 
Taking advantage of the Amazon Web Services (AWS) Family
Taking advantage of the Amazon Web Services (AWS) FamilyTaking advantage of the Amazon Web Services (AWS) Family
Taking advantage of the Amazon Web Services (AWS) Family
 
Session 3 - CloudStack Test Automation and CI
Session 3 - CloudStack Test Automation and CISession 3 - CloudStack Test Automation and CI
Session 3 - CloudStack Test Automation and CI
 
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Belgium 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Belgium 201910 Excellent Ways to Secure Your Spring Boot Application - Devoxx Belgium 2019
10 Excellent Ways to Secure Your Spring Boot Application - Devoxx Belgium 2019
 
Cloud-native .NET-Microservices mit Kubernetes @BASTAcon
Cloud-native .NET-Microservices mit Kubernetes @BASTAconCloud-native .NET-Microservices mit Kubernetes @BASTAcon
Cloud-native .NET-Microservices mit Kubernetes @BASTAcon
 
Shifting security to the left with kubernetes, azure, and istio
Shifting security to the left with kubernetes, azure, and istioShifting security to the left with kubernetes, azure, and istio
Shifting security to the left with kubernetes, azure, and istio
 
Cloud-native .NET Microservices mit Kubernetes
Cloud-native .NET Microservices mit KubernetesCloud-native .NET Microservices mit Kubernetes
Cloud-native .NET Microservices mit Kubernetes
 
Exploring MySQL Operator for Kubernetes in Python
Exploring MySQL Operator for Kubernetes in PythonExploring MySQL Operator for Kubernetes in Python
Exploring MySQL Operator for Kubernetes in Python
 
Kubernetes 101 for_penetration_testers_-_null_mumbai
Kubernetes 101 for_penetration_testers_-_null_mumbaiKubernetes 101 for_penetration_testers_-_null_mumbai
Kubernetes 101 for_penetration_testers_-_null_mumbai
 
Dive into DevOps | March, Building with Terraform, Volodymyr Tsap
Dive into DevOps | March, Building with Terraform, Volodymyr TsapDive into DevOps | March, Building with Terraform, Volodymyr Tsap
Dive into DevOps | March, Building with Terraform, Volodymyr Tsap
 
JavaFest. Nanne Baars. Web application security for developers
JavaFest. Nanne Baars. Web application security for developersJavaFest. Nanne Baars. Web application security for developers
JavaFest. Nanne Baars. Web application security for developers
 
Evolution of security strategies in K8s environments- All day devops
Evolution of security strategies in K8s environments- All day devops Evolution of security strategies in K8s environments- All day devops
Evolution of security strategies in K8s environments- All day devops
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Whatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processWhatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the process
 

Mais de LibbySchulze

Mais de LibbySchulze (20)

Running distributed tests with k6.pdf
Running distributed tests with k6.pdfRunning distributed tests with k6.pdf
Running distributed tests with k6.pdf
 
Extending Kubectl.pptx
Extending Kubectl.pptxExtending Kubectl.pptx
Extending Kubectl.pptx
 
Enhancing Data Protection Workflows with Kanister And Argo Workflows
Enhancing Data Protection Workflows with Kanister And Argo WorkflowsEnhancing Data Protection Workflows with Kanister And Argo Workflows
Enhancing Data Protection Workflows with Kanister And Argo Workflows
 
Fallacies in Platform Engineering.pdf
Fallacies in Platform Engineering.pdfFallacies in Platform Engineering.pdf
Fallacies in Platform Engineering.pdf
 
Intro to Fluvio.pptx.pdf
Intro to Fluvio.pptx.pdfIntro to Fluvio.pptx.pdf
Intro to Fluvio.pptx.pdf
 
Enhance your Kafka Infrastructure with Fluvio.pptx
Enhance your Kafka Infrastructure with Fluvio.pptxEnhance your Kafka Infrastructure with Fluvio.pptx
Enhance your Kafka Infrastructure with Fluvio.pptx
 
CNCF On-Demand Webinar_ LitmusChaos Project Updates.pdf
CNCF On-Demand Webinar_ LitmusChaos Project Updates.pdfCNCF On-Demand Webinar_ LitmusChaos Project Updates.pdf
CNCF On-Demand Webinar_ LitmusChaos Project Updates.pdf
 
Oh The Places You'll Sign.pdf
Oh The Places You'll Sign.pdfOh The Places You'll Sign.pdf
Oh The Places You'll Sign.pdf
 
Rancher MasterClass - Avoiding-configuration-drift.pptx
Rancher  MasterClass - Avoiding-configuration-drift.pptxRancher  MasterClass - Avoiding-configuration-drift.pptx
Rancher MasterClass - Avoiding-configuration-drift.pptx
 
vFunction Konveyor Meetup - Why App Modernization Projects Fail - Aug 2022.pptx
vFunction Konveyor Meetup - Why App Modernization Projects Fail - Aug 2022.pptxvFunction Konveyor Meetup - Why App Modernization Projects Fail - Aug 2022.pptx
vFunction Konveyor Meetup - Why App Modernization Projects Fail - Aug 2022.pptx
 
CNCF Live Webinar: Low Footprint Java Containers with GraalVM
CNCF Live Webinar: Low Footprint Java Containers with GraalVMCNCF Live Webinar: Low Footprint Java Containers with GraalVM
CNCF Live Webinar: Low Footprint Java Containers with GraalVM
 
EnRoute-OPA-Integration.pdf
EnRoute-OPA-Integration.pdfEnRoute-OPA-Integration.pdf
EnRoute-OPA-Integration.pdf
 
AirGap_zusammen_neu.pdf
AirGap_zusammen_neu.pdfAirGap_zusammen_neu.pdf
AirGap_zusammen_neu.pdf
 
Copy of OTel Me All About OpenTelemetry The Current & Future State, Navigatin...
Copy of OTel Me All About OpenTelemetry The Current & Future State, Navigatin...Copy of OTel Me All About OpenTelemetry The Current & Future State, Navigatin...
Copy of OTel Me All About OpenTelemetry The Current & Future State, Navigatin...
 
OTel Me All About OpenTelemetry The Current & Future State, Navigating the Pr...
OTel Me All About OpenTelemetry The Current & Future State, Navigating the Pr...OTel Me All About OpenTelemetry The Current & Future State, Navigating the Pr...
OTel Me All About OpenTelemetry The Current & Future State, Navigating the Pr...
 
CNCF_ A step to step guide to platforming your delivery setup.pdf
CNCF_ A step to step guide to platforming your delivery setup.pdfCNCF_ A step to step guide to platforming your delivery setup.pdf
CNCF_ A step to step guide to platforming your delivery setup.pdf
 
CNCF Online - Data Protection Guardrails using Open Policy Agent (OPA).pdf
CNCF Online - Data Protection Guardrails using Open Policy Agent (OPA).pdfCNCF Online - Data Protection Guardrails using Open Policy Agent (OPA).pdf
CNCF Online - Data Protection Guardrails using Open Policy Agent (OPA).pdf
 
Securing Windows workloads.pdf
Securing Windows workloads.pdfSecuring Windows workloads.pdf
Securing Windows workloads.pdf
 
Securing Windows workloads.pdf
Securing Windows workloads.pdfSecuring Windows workloads.pdf
Securing Windows workloads.pdf
 
Advancements in Kubernetes Workload Identity for Azure
Advancements in Kubernetes Workload Identity for AzureAdvancements in Kubernetes Workload Identity for Azure
Advancements in Kubernetes Workload Identity for Azure
 

Último

6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
@Chandigarh #call #Girls 9053900678 @Call #Girls in @Punjab 9053900678
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
Diya Sharma
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 

Último (20)

Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft DatingDubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
 
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 

Policy as code what helm developers need to know about security

  • 1. Policy as code: What Helm Developers Need to Know About Security 1 Cesar Rodriguez Head of Developer Advocacy
  • 2. 2 CNCF Survey 2020 / Photo by CHUTTERSNAP on Unsplash 92% organizations using containers in production 83% organizations using Kubernetes in production
  • 3. Cloud Breaches 3 200 cloud breaches in the last 24 months 30B+ records exposed due to cloud infrastructure misconfigurations
  • 5. 5 ➜ ~ brew install mysql
  • 6. 6 ➜ ~ brew install mysql ➜ ~ docker run --name cesar-mysql -e MYSQL_ROOT_PASSWORD=super-secret-password -d mysql:latest
  • 7. 7 ➜ ~ brew install mysql ➜ ~ docker run --name cesar-mysql -e MYSQL_ROOT_PASSWORD=super-secret-password -d mysql:latest ➜ ~ helm install mysql bitnami/mysql
  • 8. How do I secure Helm?
  • 9. Cesar Rodriguez Developer Advocate Cloud Security Architect OSS Contributor cesar@accurics.com
  • 10. #3 Implement Guardrails #1 Define Requirements #2 Use Policy as Code 3 Steps for Using Helm Securely
  • 11. Photo by Rafael Garcin on Unsplash Step #1: Define Requirements
  • 12. Photo by Rafael Garcin on Unsplash Security Functionality Usability
  • 14. Security Risk Categories 14 Data Protection Enforcing encryption helps protect data traversing network boundaries and at-rest Access Management Access to cloud resources should be controlled enforcing least privilege and avoid accidental public exposure Network Security Security controls should be applied at the network layer to prevent unintended exposure Visibility Ensuring logging and monitoring of cloud systems is enabled and accessible by security team
  • 15. Example - Wordpress Architecture 15
  • 16. Example Architecture Security Requirements 16
  • 17. Example - Wordpress Architecture Policies 17 1. Secrets in environment vars (CIS k8s benchmark 5.4.1)
  • 18. Example - Wordpress Architecture Policies 18 1. Secrets in environment vars (CIS k8s benchmark 5.4.1) 2. Containers running as root (CIS k8s benchmark 5.2.6)
  • 19. Example - Wordpress Architecture Policies 19 1. Secrets in environment vars (CIS k8s benchmark 5.4.1) 2. Containers running as root (CIS k8s benchmark 5.2.6) 3. Privilege escalation setting (CIS k8s benchmark 5.2.5)
  • 20. Step #2: Use Policy as Code
  • 21. Photo by Scott Graham on Unsplash What is Policy as Code?
  • 22. PaC Benefits 22 1. Low friction 2. Secure by default 3. Increased Security Visibility
  • 24. Rego #1: Avoid Secrets in Env Variables 24 containerUsesSecretsInEnvironmentVar[api.id] { api = input.kubernetes_deployment[_] spec = api.config.spec.template.spec containers = spec.containers[_] envVars := containers.env[_] envVars.valueFrom.secretKeyRef } 1 2 3 4 5 6 7
  • 25. Rego #1: Avoid Secrets in Env Variables 25 containerUsesSecretsInEnvironmentVar[api.id]{ api = input.kubernetes_deployment[_] spec = api.config.spec.template.spec containers = spec.containers[_] envVars := containers.env[_] envVars.valueFrom.secretKeyRef } 1 2 3 4 5 6 7 apiVersion: v1 kind: Deployment metadata: name: secret-env-pod spec: containers: - name: mycontainer image: redis env: - name: SECRET_USERNAME valueFrom: secretKeyRef: name: mysecret key: username - name: SECRET_PASSWORD valueFrom: secretKeyRef: name: mysecret key: password restartPolicy: Never 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
  • 26. Rego #2: Privilege Escalation 26 privilegeEscalationCheck [pod.id] { pod := object.get(input, "kubernetes_deployment", "undefined")[_] secContext := pod.config.spec.template.spec.securityContext podSecurityCheck(secContext) } podSecurityCheck(secContext) { secContext.allowPrivilegeEscalation == "true" } podSecurityCheck(secContext) { object.get(secContext, "allowPrivilegeEscalation", "undefined") == "undefined" } 1 2 3 4 5 6 7 8 9 10 11
  • 27. Rego #2: Privilege Escalation 27 privilegeEscalationCheck[pod.id] { pod := object.get(input, "kubernetes_deployment", "undefined")[_] secContext := pod.config.spec.template.spec.securityContext podSecurityCheck(secContext) } podSecurityCheck(secContext) { secContext.allowPrivilegeEscalation == "true" } podSecurityCheck(secContext) { object.get(secContext, "allowPrivilegeEscalation", "undefined") == "undefined" } 1 2 3 4 5 6 7 8 9 10 11
  • 28. Rego #2: Privilege Escalation 28 privilegeEscalationCheck[pod.id] { pod := object.get(input, "kubernetes_deployment", "undefined")[_] secContext := pod.config.spec.template.spec.securityContext podSecurityCheck(secContext) } podSecurityCheck(secContext) { secContext.allowPrivilegeEscalation == "true" } podSecurityCheck(secContext) { object.get(secContext, "allowPrivilegeEscalation", "undefined")== "undefined" } 1 2 3 4 5 6 7 8 9 10 11
  • 29. Rego #2: Privilege Escalation 29 podSecurityCheck(secContext) { secContext.allowPrivilegeEscalation == "true" } podSecurityCheck(secContext) { object.get(secContext, "allowPrivilegeEscalation", "undefined") == "undefined" } securityContext: runAsUser: 1000 runAsGroup: 3000 fsGroup: 2000 allowPrivilegeEscalation: true 1 2 3 4 5 8 9 10 11 12 13 14 15
  • 30. Rego #3 Running as Root 30 runAsNonRootCheck(secContext) { secContext.runAsNonRoot == "false" } runAsNonRootCheck(secContext) { object.get(secContext, "runAsNonRoot", "undefined") == "undefined" } runAsUserCheck(secContext) { secContext.runAsUser == "0" } runAsUserCheck(secContext) { object.get(secContext, "runAsUser", "undefined") == "undefined" } 10 11 12 13 14 15 16 17 18 19 20 21
  • 31. Rego #3 Running as Root 31 10 11 12 13 14 15 16 17 18 19 20 21 runAsNonRootCheck(secContext) { secContext.runAsNonRoot == "false" } runAsNonRootCheck(secContext) { object.get(secContext, "runAsNonRoot", "undefined") == "undefined" } runAsUserCheck(secContext) { secContext.runAsUser == "0" } runAsUserCheck(secContext) { object.get(secContext, "runAsUser", "undefined") == "undefined" }
  • 32. Rego #3 Running as Root 32 runAsNonRootCheck(secContext) { secContext.runAsNonRoot == "false" } runAsNonRootCheck(secContext) { object.get(secContext, "runAsNonRoot", "undefined") == "undefined" } runAsUserCheck(secContext) { secContext.runAsUser == "0" } runAsUserCheck(secContext) { object.get(secContext, "runAsUser", "undefined") == "undefined" } 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 securityContext: runAsNonRoot: false runAsGroup: 3000 fsGroup: 2000 securityContext: runAsUser: 0 runAsGroup: 3000 fsGroup: 2000 1 2 3 4 1 2 3 4
  • 33. Step #3: Implement Guardrails
  • 34. Photo by Aditya Rathod on Unsplash What are security guardrails?
  • 36. 36 ➜ ~ terrascan scan -p policies -i helm Violation Details - Description: Container uses secrets in environment variables File : wordpress/templates/deployment.yaml Line : 1 Severity : HIGH ----------------------------------------------------------------------- Description: Containers Should Not Run with AllowPrivilegeEscalation File : wordpress/templates/deployment.yaml Line : 1 Severity : HIGH ----------------------------------------------------------------------- Description: Minimize Admission of Root Containers File : wordpress/templates/deployment.yaml Line : 1 Severity : HIGH
  • 37. 37 ➜ ~ terrascan scan -p policies -i helm -r git -u git@github.com:helm/charts.git//stable//wordpress Violation Details - Description: Container uses secrets in environment variables File : wordpress/templates/deployment.yaml Line : 1 Severity : HIGH ----------------------------------------------------------------------- Description: Containers Should Not Run with AllowPrivilegeEscalation File : wordpress/templates/deployment.yaml Line : 1 Severity : HIGH -----------------------------------------------------------------------
  • 38. 38 ➜ ~ alias no_terrascan_highs='terrascan scan -p policies -i helm -o json | (( $(jq ".results.scan_summary.high") == 0 ))' ➜ ~ no_terrascan_highs && helm install wordpress .
  • 39. CI/CD 39 Build Continuous Integration Deploy Continuous Deployment Develop Continuous Code Posture Management Run Continuous Cloud Posture Management RUNTIME DEVELOPMENT Cloud Infrastructure as Code Secure Code Management CI/CD Cloud Service Provider
  • 41. Demo
  • 42. #3 Implement Guardrails #2 Use Policy as Code 3 Steps for Using Helm Securely #1 Define Requirements