SlideShare uma empresa Scribd logo
1 de 24
12 ways NOT TO GET ‘HACKED’ your
$whoami
• Suman Chakraborty - Senior Devops Engineer @SAP
Labs
• Community member & Speaker - Docker
Bangalore, CNCF Bangalore group
• Tech Blogger on PaaS, Cloud-Native & Microservices
https://www.linkedin.com/in/schakraborty007/
@itsmesumanc
The Current State of Security
Source: UDC TechBrief: Containers
Break the BASICS !!!
Think before you leap ??
 Have you reviewed access rights to the Kubernetes cluster(s) to understand potential insider
attack vectors?
 Do you have visibility of Kubernetes pods being deployed? For example how the
application pods or clusters are communicating with each others?
 Do you have a way to detect bad behavior in east/west traffic between containers?
 Are you able to monitor what’s going on inside a pod or container to determine if there is a
potential exploit?
 How do you simplify security alerts and operations team monitoring to pin-point the most
important attacks requiring attention?
 How do you segment particular containers or network connections in a Kubernetes
environment?
A hacker’s inception
Control Plane
• TLS encryption
• RBAC Management
• Encryption key
Management
etc
Workloads
• Securing container
images
• Pod boundaries
• Running as “Non root”,
etc
Networking
• Node to Node
• Node to Pod
• Firewall policies etc
K8s attack
vectors
Controlling access to the Kubernetes API
 Use Transport Layer Security (TLS) for all API traffic
 All API clients must be authenticated, even those that are part of the infrastructure like
nodes, proxies, the scheduler and volume plugins
 The API call needs to be authrorized, preferably by RBAC component that matches an
incoming user or group to a set of permissions bundled into roles.
 Integrating Kubernetes with third party auth providers (like Google or GitHub) uses the
remote platform's identity guarantees and prevents administrators having to reconfigure
the Kubernetes API server to add or remove users . Eg Dex, OAUTH 2.0
Enable RBAC with Least Privilege, Disable
ABAC
 The default RBAC settings permit only limited API access for anonymous users. that
allows for health and discovery checks to be made.
 Set --authorization-mode on the API server to enable the RBAC authorization module
 Configuring RBAC for kubelets by including node authorizer in --authorization-mode
list.
 Incorrect or excessively permissive RBAC policies are a security threat in case of a
compromised pod.
 Specify Roles & ClusterRoles to specific users or Group of Users
 Avoid duplication of permission and remove unused roles.
Securing Kubelet
 The Kubelet gives one of the entry point, if compromised for an anuthorized user who can
run malicious code to gain control of the cluster
 Disable anonymous access with --anonymous-auth=false, so that unauthenticated requests
will receive unauthorized access error responses.
 Ensure that requests are authorized by setting –authorizationmode to something other than
AlwaysAllow
 Limit the permissions of kubelets by including NodeRestriction in the --admission-control
settings on the API server. This restricts a kubelet so that it can modify only pods that are
bound to it and its own Node object.
Running etcd safely
 etcd should be configured with peer and client TLS certificates and deployed on dedicated
nodes and secure by firewall
 Setting “--cert-file” and “--key-file” to enable HTTPS connections to etcd.
 Set --client-cert-auth=true to ensure that access to etcd requires authentication. Set --trusted-
ca-file to specify the certificate authority that has signed the client certificates
 Require etcd nodes to communicate with each other securely by using --peer-client-cert-
auth=true.
 Set --auto-tls=false to disallow the generation and use of self-signed certificates
 Specify --etcd-certfile and --etcd-keyfile so that the API server can identify itself to etcd
Managing Service Account
 Disable automounting of the default service account token. This can be done by specifying the
“automountServiceAccountToken: false” in the PodSpec for all an application. This can be executed
as a patch also
$ kubectl patch serviceaccount default -p $'automountServiceAccountToken: false’
serviceaccount "default" patched
 The best practice to create a dedicate service account per application and configure RBAC to be
specifically limited to the needs of that application.
Restricting Network access
 By default, Kubernetes networking allows all pod to pod traffic; this can be restricted using a Network
Policy .
 Network policies come with a field called PodSelector, which determines which pods are affected by
that policy. A pod that is associated to a policy can communicate only in those ways allowed by that
policy
• Best practice is to start by denying all traffic for a namespace and incrementally add routes to
allow an application to pass its acceptance test suite.
• Restricting Cloud Metadata API access via the network policies
• Deep packet inspection (DPI) techniques are essential for in-depth network security in a container
firewall. Layer 7 DPI based inspection looks for malicious XML object executables, blocking
connection
Running Workloads with least privilege
 Linux kernel has a number of overlapping security extensions (capabilities, SELinux,
AppArmor, seccomp-bpf) that can be configured to provide least privilege to
applications and harden the runtime configuration
 Limiting Resource usage on a cluster through Resource Quota.
 Limit Ranges can restrict the maximum or minimum size of some of the resources to
prevent users from requesting unreasonably high or low values for commonly reserved
resources like memory.
 Utilize Seccomp, have R/O Mount access, using minimal OS to reduce the surface area
for attack
 Update System pactches and run CIS benchmark security tests
Securing Container Images
 Web servers present an attack surface to the network they're attached to: scanning an image's
installed files ensures the absence of known vulnerabilities that an attacker could exploit to
gain remote access to the container
 Scanning container images for known vulnerabilities can reduce the window of time that an
attacker can exploit a disclosed CVE. Tools such as “Clair” provides image scanning,
“Notary” uses signing to preserve the integrity
 Whichever registry solution are being used for public images, it’s a good practice to use “read-
only” account for the purpose (DTR, Elastic Container Registry, Quay from RedHat)
 Updating the podSpec with unique digest of the image, along with full registry name instead
of just using image:tag parameter
 Using the ‘AlwaysPullImages’ admission controller to ensure that the most recent version that
matches the specified tag isobtained
Running Containers securely
 SAY “NO” to ROOT
Containers that run as root frequently have far more permissions than their workload requires
which, in case of compromise, could help an attacker further their attack
 Many container images use the root user to run PID 1 - if that process is compromised, the
attacker has root in the container and any mis-configurations become much easier to exploit
!!
Thumb Rule – Configure PodSecurityPolicy to run as non-root user that prevents binding to
the privileged ports under 1024 (this is gated by the CAP_NET_BIND_SERVICE kernel
capability)
Managing secrets effectively
 Kubernetes Secret values protecting sensitive data that is bound to the application source
code.
 Encryption is done both ‘at Rest’ and ‘in Transit’
 Secret values are stored alongside other configuration information in the etcd database; they
are simply base64 encoded. Some are stored in third-party stores (HashiCorp KeyVault /
CyberArk Conjur) along with being stored in etcd.
 Secrets shouldn’t be passed into the build image, rather pass as environment variable or
mounted by volumes.
• Periodic Rotation and Revocation of Secrets prevents being misused by an attacker
quickly
Securing Host Machines
 If the host (e.g. Kubernetes worker node) on which containers run is compromised, all kinds
of bad things can happen !!!!
 Privilege escalations to root
 Stealing of secrets used for secure application or infrastructure access
 Changing of cluster admin privileges
 Host resource damage or hijacking (e.g. crypto mining software)
Kill Chain that
exploits the cluster
• Node Recycling brings more confidence in system capability to cope through node
failure
• Implementing a robust Sandboxing and Runtime Protection
• Achieving Multitenancy on a non-trusted network.
Service Mesh : the future
 Service Mesh offers the possibility offloading microservice security and networking from the
application over a secure TLS mutual connection end to end
 In "Zero Trust" networks there may be no need for traditional firewalling or Kubernetes network
policy, as every interaction occurs over mTLS (mutual TLS), ensuring that both parties are not only
communicating securely, but that the identity of both services is known.
MITRE ATT&CK – threat matrix
Credit: Microsoft
Tools & technologies
References
List of all tools used in security and penetration testing
https://collabnix.github.io/kubetools/
Blogs:
https://kubernetes.io/blog/
http://techgenix.com/kubernetes-security-tools/
Thank You !!!
……Questions Please??

Mais conteúdo relacionado

Mais procurados

Palo Alto Networks PANOS 5.0 Radius Authentication OTP using Yubikey
Palo Alto Networks PANOS 5.0 Radius Authentication OTP using YubikeyPalo Alto Networks PANOS 5.0 Radius Authentication OTP using Yubikey
Palo Alto Networks PANOS 5.0 Radius Authentication OTP using YubikeyAlberto Rivai
 
DevOps and the Future of Enterprise Security
DevOps and the Future of Enterprise SecurityDevOps and the Future of Enterprise Security
DevOps and the Future of Enterprise SecurityPriyanka Aash
 
EKS security best practices
EKS security best practicesEKS security best practices
EKS security best practicesJohn Varghese
 
Container Security Essentials
Container Security EssentialsContainer Security Essentials
Container Security EssentialsDNIF
 
BAUG Meetup #1 2022: Публикация ресурсов в Интернет в Microsoft Azure. Обзор ...
BAUG Meetup #1 2022: Публикация ресурсов в Интернет в Microsoft Azure. Обзор ...BAUG Meetup #1 2022: Публикация ресурсов в Интернет в Microsoft Azure. Обзор ...
BAUG Meetup #1 2022: Публикация ресурсов в Интернет в Microsoft Azure. Обзор ...Dzmitry Durasau
 
Lessons learned from writing over 300,000 lines of infrastructure code
Lessons learned from writing over 300,000 lines of infrastructure codeLessons learned from writing over 300,000 lines of infrastructure code
Lessons learned from writing over 300,000 lines of infrastructure codeYevgeniy Brikman
 
Securing Kafka
Securing Kafka Securing Kafka
Securing Kafka confluent
 
Application DoS In Microservice Architectures
Application DoS In Microservice ArchitecturesApplication DoS In Microservice Architectures
Application DoS In Microservice ArchitecturesScott Behrens
 
OpenStack: Security Beyond Firewalls
OpenStack: Security Beyond FirewallsOpenStack: Security Beyond Firewalls
OpenStack: Security Beyond FirewallsGiuseppe Paterno'
 
AWS VPN with Juniper SRX- Lab Sheet
AWS VPN with Juniper SRX- Lab SheetAWS VPN with Juniper SRX- Lab Sheet
AWS VPN with Juniper SRX- Lab SheetKimberly Macias
 
Building Fast and Scalable Persistence Layers with Spring Data JPA
Building Fast and Scalable Persistence Layers with Spring Data JPABuilding Fast and Scalable Persistence Layers with Spring Data JPA
Building Fast and Scalable Persistence Layers with Spring Data JPAVMware Tanzu
 
Crypto Miners in the Cloud
Crypto Miners in the CloudCrypto Miners in the Cloud
Crypto Miners in the CloudTeri Radichel
 
(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, GcpPriyanka Aash
 
Packet Capture on AWS
Packet Capture on AWSPacket Capture on AWS
Packet Capture on AWSTeri Radichel
 
DevSecCon Tel Aviv 2018 - Serverless Security
DevSecCon Tel Aviv 2018 - Serverless SecurityDevSecCon Tel Aviv 2018 - Serverless Security
DevSecCon Tel Aviv 2018 - Serverless SecurityAvi Shulman
 
AWS re:Invent 2016: Encryption: It Was the Best of Controls, It Was the Worst...
AWS re:Invent 2016: Encryption: It Was the Best of Controls, It Was the Worst...AWS re:Invent 2016: Encryption: It Was the Best of Controls, It Was the Worst...
AWS re:Invent 2016: Encryption: It Was the Best of Controls, It Was the Worst...Amazon Web Services
 
Automating the VMware Virtual Datacenter
Automating the VMware Virtual DatacenterAutomating the VMware Virtual Datacenter
Automating the VMware Virtual DatacenterJosh Atwell
 

Mais procurados (20)

Kafka Security
Kafka SecurityKafka Security
Kafka Security
 
Palo Alto Networks PANOS 5.0 Radius Authentication OTP using Yubikey
Palo Alto Networks PANOS 5.0 Radius Authentication OTP using YubikeyPalo Alto Networks PANOS 5.0 Radius Authentication OTP using Yubikey
Palo Alto Networks PANOS 5.0 Radius Authentication OTP using Yubikey
 
DevOps and the Future of Enterprise Security
DevOps and the Future of Enterprise SecurityDevOps and the Future of Enterprise Security
DevOps and the Future of Enterprise Security
 
EKS security best practices
EKS security best practicesEKS security best practices
EKS security best practices
 
Container Security Essentials
Container Security EssentialsContainer Security Essentials
Container Security Essentials
 
BAUG Meetup #1 2022: Публикация ресурсов в Интернет в Microsoft Azure. Обзор ...
BAUG Meetup #1 2022: Публикация ресурсов в Интернет в Microsoft Azure. Обзор ...BAUG Meetup #1 2022: Публикация ресурсов в Интернет в Microsoft Azure. Обзор ...
BAUG Meetup #1 2022: Публикация ресурсов в Интернет в Microsoft Azure. Обзор ...
 
Lessons learned from writing over 300,000 lines of infrastructure code
Lessons learned from writing over 300,000 lines of infrastructure codeLessons learned from writing over 300,000 lines of infrastructure code
Lessons learned from writing over 300,000 lines of infrastructure code
 
Securing Kafka
Securing Kafka Securing Kafka
Securing Kafka
 
Application DoS In Microservice Architectures
Application DoS In Microservice ArchitecturesApplication DoS In Microservice Architectures
Application DoS In Microservice Architectures
 
OpenStack: Security Beyond Firewalls
OpenStack: Security Beyond FirewallsOpenStack: Security Beyond Firewalls
OpenStack: Security Beyond Firewalls
 
AWS VPN with Juniper SRX- Lab Sheet
AWS VPN with Juniper SRX- Lab SheetAWS VPN with Juniper SRX- Lab Sheet
AWS VPN with Juniper SRX- Lab Sheet
 
Building Fast and Scalable Persistence Layers with Spring Data JPA
Building Fast and Scalable Persistence Layers with Spring Data JPABuilding Fast and Scalable Persistence Layers with Spring Data JPA
Building Fast and Scalable Persistence Layers with Spring Data JPA
 
Secure DevOps: A Puma's Tail
Secure DevOps: A Puma's TailSecure DevOps: A Puma's Tail
Secure DevOps: A Puma's Tail
 
Crypto Miners in the Cloud
Crypto Miners in the CloudCrypto Miners in the Cloud
Crypto Miners in the Cloud
 
Fiware cloud developers week brussels
Fiware cloud developers week brusselsFiware cloud developers week brussels
Fiware cloud developers week brussels
 
(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
 
Packet Capture on AWS
Packet Capture on AWSPacket Capture on AWS
Packet Capture on AWS
 
DevSecCon Tel Aviv 2018 - Serverless Security
DevSecCon Tel Aviv 2018 - Serverless SecurityDevSecCon Tel Aviv 2018 - Serverless Security
DevSecCon Tel Aviv 2018 - Serverless Security
 
AWS re:Invent 2016: Encryption: It Was the Best of Controls, It Was the Worst...
AWS re:Invent 2016: Encryption: It Was the Best of Controls, It Was the Worst...AWS re:Invent 2016: Encryption: It Was the Best of Controls, It Was the Worst...
AWS re:Invent 2016: Encryption: It Was the Best of Controls, It Was the Worst...
 
Automating the VMware Virtual Datacenter
Automating the VMware Virtual DatacenterAutomating the VMware Virtual Datacenter
Automating the VMware Virtual Datacenter
 

Semelhante a 12 Ways Not to get 'Hacked' your Kubernetes Cluster

Security for cloud native workloads
Security for cloud native workloadsSecurity for cloud native workloads
Security for cloud native workloadsRuncy Oommen
 
Hybrid - Seguridad en Contenedores v3.pptx
Hybrid - Seguridad en Contenedores v3.pptxHybrid - Seguridad en Contenedores v3.pptx
Hybrid - Seguridad en Contenedores v3.pptxHansFarroCastillo1
 
Appsecco Kubernetes Hacking Masterclass Presentation Slides
Appsecco Kubernetes Hacking Masterclass Presentation SlidesAppsecco Kubernetes Hacking Masterclass Presentation Slides
Appsecco Kubernetes Hacking Masterclass Presentation SlidesAppsecco
 
Attacking and Defending Kubernetes - Nithin Jois
Attacking and Defending Kubernetes - Nithin JoisAttacking and Defending Kubernetes - Nithin Jois
Attacking and Defending Kubernetes - Nithin JoisOWASP Hacker Thursday
 
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
 
How we can do Multi-Tenancy on Kubernetes
How we can do Multi-Tenancy on KubernetesHow we can do Multi-Tenancy on Kubernetes
How we can do Multi-Tenancy on KubernetesOpsta
 
The State of Kubernetes Security
The State of Kubernetes Security The State of Kubernetes Security
The State of Kubernetes Security Jimmy Mesta
 
Kubernetes Ransomware Threat - How to Protect and Recover.pdf
Kubernetes Ransomware Threat - How to Protect and Recover.pdfKubernetes Ransomware Threat - How to Protect and Recover.pdf
Kubernetes Ransomware Threat - How to Protect and Recover.pdfUrolime Technologies
 
GDG Cloud Southlake 29 Jimmy Mesta OWASP Top 10 for Kubernetes
GDG Cloud Southlake 29 Jimmy Mesta OWASP Top 10 for KubernetesGDG Cloud Southlake 29 Jimmy Mesta OWASP Top 10 for Kubernetes
GDG Cloud Southlake 29 Jimmy Mesta OWASP Top 10 for KubernetesJames Anderson
 
Build cloud native solution using open source
Build cloud native solution using open source Build cloud native solution using open source
Build cloud native solution using open source Nitesh Jadhav
 
Control Plane: Continuous Kubernetes Security (DevSecOps - London Gathering, ...
Control Plane: Continuous Kubernetes Security (DevSecOps - London Gathering, ...Control Plane: Continuous Kubernetes Security (DevSecOps - London Gathering, ...
Control Plane: Continuous Kubernetes Security (DevSecOps - London Gathering, ...Michael Man
 
Kubernetes: Beyond Baby Steps
Kubernetes: Beyond Baby StepsKubernetes: Beyond Baby Steps
Kubernetes: Beyond Baby StepsDigitalOcean
 
DevOpsDaysRiga 2018: Andrew Martin - Continuous Kubernetes Security
DevOpsDaysRiga 2018: Andrew Martin - Continuous Kubernetes Security DevOpsDaysRiga 2018: Andrew Martin - Continuous Kubernetes Security
DevOpsDaysRiga 2018: Andrew Martin - Continuous Kubernetes Security DevOpsDays Riga
 
Securing Kubernetes Workloads
Securing Kubernetes WorkloadsSecuring Kubernetes Workloads
Securing Kubernetes WorkloadsJim Bugwadia
 
Overview of secret management solutions and architecture
Overview of secret management solutions and architectureOverview of secret management solutions and architecture
Overview of secret management solutions and architectureYuechuan (Mike) Chen
 
Container Security Deep Dive & Kubernetes
Container Security Deep Dive & Kubernetes Container Security Deep Dive & Kubernetes
Container Security Deep Dive & Kubernetes Aqua Security
 
(SACON) Anand Tapikar - Attack vectors of Kubernetes infra. Are we on right ...
 (SACON) Anand Tapikar - Attack vectors of Kubernetes infra. Are we on right ... (SACON) Anand Tapikar - Attack vectors of Kubernetes infra. Are we on right ...
(SACON) Anand Tapikar - Attack vectors of Kubernetes infra. Are we on right ...Priyanka Aash
 

Semelhante a 12 Ways Not to get 'Hacked' your Kubernetes Cluster (20)

Security for cloud native workloads
Security for cloud native workloadsSecurity for cloud native workloads
Security for cloud native workloads
 
Hybrid - Seguridad en Contenedores v3.pptx
Hybrid - Seguridad en Contenedores v3.pptxHybrid - Seguridad en Contenedores v3.pptx
Hybrid - Seguridad en Contenedores v3.pptx
 
Appsecco Kubernetes Hacking Masterclass Presentation Slides
Appsecco Kubernetes Hacking Masterclass Presentation SlidesAppsecco Kubernetes Hacking Masterclass Presentation Slides
Appsecco Kubernetes Hacking Masterclass Presentation Slides
 
Kubernetes security
Kubernetes securityKubernetes security
Kubernetes security
 
Attacking and Defending Kubernetes - Nithin Jois
Attacking and Defending Kubernetes - Nithin JoisAttacking and Defending Kubernetes - Nithin Jois
Attacking and Defending Kubernetes - Nithin Jois
 
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
 
How we can do Multi-Tenancy on Kubernetes
How we can do Multi-Tenancy on KubernetesHow we can do Multi-Tenancy on Kubernetes
How we can do Multi-Tenancy on Kubernetes
 
The State of Kubernetes Security
The State of Kubernetes Security The State of Kubernetes Security
The State of Kubernetes Security
 
Kubernetes security with AWS
Kubernetes security with AWSKubernetes security with AWS
Kubernetes security with AWS
 
Kubernetes Ransomware Threat - How to Protect and Recover.pdf
Kubernetes Ransomware Threat - How to Protect and Recover.pdfKubernetes Ransomware Threat - How to Protect and Recover.pdf
Kubernetes Ransomware Threat - How to Protect and Recover.pdf
 
GDG Cloud Southlake 29 Jimmy Mesta OWASP Top 10 for Kubernetes
GDG Cloud Southlake 29 Jimmy Mesta OWASP Top 10 for KubernetesGDG Cloud Southlake 29 Jimmy Mesta OWASP Top 10 for Kubernetes
GDG Cloud Southlake 29 Jimmy Mesta OWASP Top 10 for Kubernetes
 
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
 
Build cloud native solution using open source
Build cloud native solution using open source Build cloud native solution using open source
Build cloud native solution using open source
 
Control Plane: Continuous Kubernetes Security (DevSecOps - London Gathering, ...
Control Plane: Continuous Kubernetes Security (DevSecOps - London Gathering, ...Control Plane: Continuous Kubernetes Security (DevSecOps - London Gathering, ...
Control Plane: Continuous Kubernetes Security (DevSecOps - London Gathering, ...
 
Kubernetes: Beyond Baby Steps
Kubernetes: Beyond Baby StepsKubernetes: Beyond Baby Steps
Kubernetes: Beyond Baby Steps
 
DevOpsDaysRiga 2018: Andrew Martin - Continuous Kubernetes Security
DevOpsDaysRiga 2018: Andrew Martin - Continuous Kubernetes Security DevOpsDaysRiga 2018: Andrew Martin - Continuous Kubernetes Security
DevOpsDaysRiga 2018: Andrew Martin - Continuous Kubernetes Security
 
Securing Kubernetes Workloads
Securing Kubernetes WorkloadsSecuring Kubernetes Workloads
Securing Kubernetes Workloads
 
Overview of secret management solutions and architecture
Overview of secret management solutions and architectureOverview of secret management solutions and architecture
Overview of secret management solutions and architecture
 
Container Security Deep Dive & Kubernetes
Container Security Deep Dive & Kubernetes Container Security Deep Dive & Kubernetes
Container Security Deep Dive & Kubernetes
 
(SACON) Anand Tapikar - Attack vectors of Kubernetes infra. Are we on right ...
 (SACON) Anand Tapikar - Attack vectors of Kubernetes infra. Are we on right ... (SACON) Anand Tapikar - Attack vectors of Kubernetes infra. Are we on right ...
(SACON) Anand Tapikar - Attack vectors of Kubernetes infra. Are we on right ...
 

Mais de Suman Chakraborty

Git lab 101 certificate suman chakraborty
Git lab 101 certificate suman chakrabortyGit lab 101 certificate suman chakraborty
Git lab 101 certificate suman chakrabortySuman Chakraborty
 
Turning Virtual Machines Cloud-Native using KubeVirt
Turning Virtual Machines Cloud-Native using KubeVirtTurning Virtual Machines Cloud-Native using KubeVirt
Turning Virtual Machines Cloud-Native using KubeVirtSuman Chakraborty
 
Cloud native buildpacks-cncf
Cloud native buildpacks-cncfCloud native buildpacks-cncf
Cloud native buildpacks-cncfSuman Chakraborty
 
Message Broker implementation in Kubernetes
Message Broker implementation in KubernetesMessage Broker implementation in Kubernetes
Message Broker implementation in KubernetesSuman Chakraborty
 
Cloud native buildpacks_collabnix
Cloud native buildpacks_collabnixCloud native buildpacks_collabnix
Cloud native buildpacks_collabnixSuman Chakraborty
 
CI/CD Development in Kubernetes - Skaffold
CI/CD Development in Kubernetes -  SkaffoldCI/CD Development in Kubernetes -  Skaffold
CI/CD Development in Kubernetes - SkaffoldSuman Chakraborty
 
CI/CD Development in Kubernetes - Skaffold
CI/CD Development in Kubernetes -  SkaffoldCI/CD Development in Kubernetes -  Skaffold
CI/CD Development in Kubernetes - SkaffoldSuman Chakraborty
 
Red hat Certified Openstack Administrator
Red hat Certified Openstack Administrator Red hat Certified Openstack Administrator
Red hat Certified Openstack Administrator Suman Chakraborty
 
Red Hat Certified System Administrator (RHCSA)
Red Hat Certified System Administrator (RHCSA)Red Hat Certified System Administrator (RHCSA)
Red Hat Certified System Administrator (RHCSA)Suman Chakraborty
 
Red Hat Certified Engineer (RHCE)
Red Hat Certified Engineer (RHCE)Red Hat Certified Engineer (RHCE)
Red Hat Certified Engineer (RHCE)Suman Chakraborty
 

Mais de Suman Chakraborty (14)

k8s troubleshooting-guide
k8s troubleshooting-guidek8s troubleshooting-guide
k8s troubleshooting-guide
 
Git lab 101 certificate suman chakraborty
Git lab 101 certificate suman chakrabortyGit lab 101 certificate suman chakraborty
Git lab 101 certificate suman chakraborty
 
Turning Virtual Machines Cloud-Native using KubeVirt
Turning Virtual Machines Cloud-Native using KubeVirtTurning Virtual Machines Cloud-Native using KubeVirt
Turning Virtual Machines Cloud-Native using KubeVirt
 
Cloud native buildpacks-cncf
Cloud native buildpacks-cncfCloud native buildpacks-cncf
Cloud native buildpacks-cncf
 
Securing Devops_toolchain
Securing  Devops_toolchainSecuring  Devops_toolchain
Securing Devops_toolchain
 
Message Broker implementation in Kubernetes
Message Broker implementation in KubernetesMessage Broker implementation in Kubernetes
Message Broker implementation in Kubernetes
 
Cloud native buildpacks_collabnix
Cloud native buildpacks_collabnixCloud native buildpacks_collabnix
Cloud native buildpacks_collabnix
 
CI/CD Development in Kubernetes - Skaffold
CI/CD Development in Kubernetes -  SkaffoldCI/CD Development in Kubernetes -  Skaffold
CI/CD Development in Kubernetes - Skaffold
 
CI/CD Development in Kubernetes - Skaffold
CI/CD Development in Kubernetes -  SkaffoldCI/CD Development in Kubernetes -  Skaffold
CI/CD Development in Kubernetes - Skaffold
 
Red hat Certified Openstack Administrator
Red hat Certified Openstack Administrator Red hat Certified Openstack Administrator
Red hat Certified Openstack Administrator
 
Red Hat Certified System Administrator (RHCSA)
Red Hat Certified System Administrator (RHCSA)Red Hat Certified System Administrator (RHCSA)
Red Hat Certified System Administrator (RHCSA)
 
Red Hat Certified Engineer (RHCE)
Red Hat Certified Engineer (RHCE)Red Hat Certified Engineer (RHCE)
Red Hat Certified Engineer (RHCE)
 
Demystifying k8s operators
Demystifying k8s operatorsDemystifying k8s operators
Demystifying k8s operators
 
XaaS-EEMM
XaaS-EEMMXaaS-EEMM
XaaS-EEMM
 

Último

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Último (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

12 Ways Not to get 'Hacked' your Kubernetes Cluster

  • 1. 12 ways NOT TO GET ‘HACKED’ your
  • 2. $whoami • Suman Chakraborty - Senior Devops Engineer @SAP Labs • Community member & Speaker - Docker Bangalore, CNCF Bangalore group • Tech Blogger on PaaS, Cloud-Native & Microservices https://www.linkedin.com/in/schakraborty007/ @itsmesumanc
  • 3. The Current State of Security Source: UDC TechBrief: Containers
  • 5. Think before you leap ??  Have you reviewed access rights to the Kubernetes cluster(s) to understand potential insider attack vectors?  Do you have visibility of Kubernetes pods being deployed? For example how the application pods or clusters are communicating with each others?  Do you have a way to detect bad behavior in east/west traffic between containers?  Are you able to monitor what’s going on inside a pod or container to determine if there is a potential exploit?  How do you simplify security alerts and operations team monitoring to pin-point the most important attacks requiring attention?  How do you segment particular containers or network connections in a Kubernetes environment?
  • 6.
  • 7. A hacker’s inception Control Plane • TLS encryption • RBAC Management • Encryption key Management etc Workloads • Securing container images • Pod boundaries • Running as “Non root”, etc Networking • Node to Node • Node to Pod • Firewall policies etc
  • 9. Controlling access to the Kubernetes API  Use Transport Layer Security (TLS) for all API traffic  All API clients must be authenticated, even those that are part of the infrastructure like nodes, proxies, the scheduler and volume plugins  The API call needs to be authrorized, preferably by RBAC component that matches an incoming user or group to a set of permissions bundled into roles.  Integrating Kubernetes with third party auth providers (like Google or GitHub) uses the remote platform's identity guarantees and prevents administrators having to reconfigure the Kubernetes API server to add or remove users . Eg Dex, OAUTH 2.0
  • 10. Enable RBAC with Least Privilege, Disable ABAC  The default RBAC settings permit only limited API access for anonymous users. that allows for health and discovery checks to be made.  Set --authorization-mode on the API server to enable the RBAC authorization module  Configuring RBAC for kubelets by including node authorizer in --authorization-mode list.  Incorrect or excessively permissive RBAC policies are a security threat in case of a compromised pod.  Specify Roles & ClusterRoles to specific users or Group of Users  Avoid duplication of permission and remove unused roles.
  • 11. Securing Kubelet  The Kubelet gives one of the entry point, if compromised for an anuthorized user who can run malicious code to gain control of the cluster  Disable anonymous access with --anonymous-auth=false, so that unauthenticated requests will receive unauthorized access error responses.  Ensure that requests are authorized by setting –authorizationmode to something other than AlwaysAllow  Limit the permissions of kubelets by including NodeRestriction in the --admission-control settings on the API server. This restricts a kubelet so that it can modify only pods that are bound to it and its own Node object.
  • 12. Running etcd safely  etcd should be configured with peer and client TLS certificates and deployed on dedicated nodes and secure by firewall  Setting “--cert-file” and “--key-file” to enable HTTPS connections to etcd.  Set --client-cert-auth=true to ensure that access to etcd requires authentication. Set --trusted- ca-file to specify the certificate authority that has signed the client certificates  Require etcd nodes to communicate with each other securely by using --peer-client-cert- auth=true.  Set --auto-tls=false to disallow the generation and use of self-signed certificates  Specify --etcd-certfile and --etcd-keyfile so that the API server can identify itself to etcd
  • 13. Managing Service Account  Disable automounting of the default service account token. This can be done by specifying the “automountServiceAccountToken: false” in the PodSpec for all an application. This can be executed as a patch also $ kubectl patch serviceaccount default -p $'automountServiceAccountToken: false’ serviceaccount "default" patched  The best practice to create a dedicate service account per application and configure RBAC to be specifically limited to the needs of that application.
  • 14. Restricting Network access  By default, Kubernetes networking allows all pod to pod traffic; this can be restricted using a Network Policy .  Network policies come with a field called PodSelector, which determines which pods are affected by that policy. A pod that is associated to a policy can communicate only in those ways allowed by that policy • Best practice is to start by denying all traffic for a namespace and incrementally add routes to allow an application to pass its acceptance test suite. • Restricting Cloud Metadata API access via the network policies • Deep packet inspection (DPI) techniques are essential for in-depth network security in a container firewall. Layer 7 DPI based inspection looks for malicious XML object executables, blocking connection
  • 15. Running Workloads with least privilege  Linux kernel has a number of overlapping security extensions (capabilities, SELinux, AppArmor, seccomp-bpf) that can be configured to provide least privilege to applications and harden the runtime configuration  Limiting Resource usage on a cluster through Resource Quota.  Limit Ranges can restrict the maximum or minimum size of some of the resources to prevent users from requesting unreasonably high or low values for commonly reserved resources like memory.  Utilize Seccomp, have R/O Mount access, using minimal OS to reduce the surface area for attack  Update System pactches and run CIS benchmark security tests
  • 16. Securing Container Images  Web servers present an attack surface to the network they're attached to: scanning an image's installed files ensures the absence of known vulnerabilities that an attacker could exploit to gain remote access to the container  Scanning container images for known vulnerabilities can reduce the window of time that an attacker can exploit a disclosed CVE. Tools such as “Clair” provides image scanning, “Notary” uses signing to preserve the integrity  Whichever registry solution are being used for public images, it’s a good practice to use “read- only” account for the purpose (DTR, Elastic Container Registry, Quay from RedHat)  Updating the podSpec with unique digest of the image, along with full registry name instead of just using image:tag parameter  Using the ‘AlwaysPullImages’ admission controller to ensure that the most recent version that matches the specified tag isobtained
  • 17. Running Containers securely  SAY “NO” to ROOT Containers that run as root frequently have far more permissions than their workload requires which, in case of compromise, could help an attacker further their attack  Many container images use the root user to run PID 1 - if that process is compromised, the attacker has root in the container and any mis-configurations become much easier to exploit !! Thumb Rule – Configure PodSecurityPolicy to run as non-root user that prevents binding to the privileged ports under 1024 (this is gated by the CAP_NET_BIND_SERVICE kernel capability)
  • 18. Managing secrets effectively  Kubernetes Secret values protecting sensitive data that is bound to the application source code.  Encryption is done both ‘at Rest’ and ‘in Transit’  Secret values are stored alongside other configuration information in the etcd database; they are simply base64 encoded. Some are stored in third-party stores (HashiCorp KeyVault / CyberArk Conjur) along with being stored in etcd.  Secrets shouldn’t be passed into the build image, rather pass as environment variable or mounted by volumes. • Periodic Rotation and Revocation of Secrets prevents being misused by an attacker quickly
  • 19. Securing Host Machines  If the host (e.g. Kubernetes worker node) on which containers run is compromised, all kinds of bad things can happen !!!!  Privilege escalations to root  Stealing of secrets used for secure application or infrastructure access  Changing of cluster admin privileges  Host resource damage or hijacking (e.g. crypto mining software) Kill Chain that exploits the cluster • Node Recycling brings more confidence in system capability to cope through node failure • Implementing a robust Sandboxing and Runtime Protection • Achieving Multitenancy on a non-trusted network.
  • 20. Service Mesh : the future  Service Mesh offers the possibility offloading microservice security and networking from the application over a secure TLS mutual connection end to end  In "Zero Trust" networks there may be no need for traditional firewalling or Kubernetes network policy, as every interaction occurs over mTLS (mutual TLS), ensuring that both parties are not only communicating securely, but that the identity of both services is known.
  • 21. MITRE ATT&CK – threat matrix Credit: Microsoft
  • 23. References List of all tools used in security and penetration testing https://collabnix.github.io/kubetools/ Blogs: https://kubernetes.io/blog/ http://techgenix.com/kubernetes-security-tools/