SlideShare a Scribd company logo
Microservices Security with
OPA and Service Mesh
Leonardo G. Silva
Solutions Architect
© 2018 Cloud Native Computing Foundation2
$whoami
● Certified Kubernetes Administrator
● AWS Certified Sysops Administrator
● 20 years of experience with Software Architecture
● Head of Solutions Architecture @ GrupoMult
© 2018 Cloud Native Computing Foundation3
Source: https://www.nginx.com/resources/library/app-dev-survey
© 2018 Cloud Native Computing Foundation4
Cybersecurity
Source: Foundations of Cybersecurity, Springer
© 2018 Cloud Native Computing Foundation5
IAAA Framework
● Identification: suporte à múltiplas identidades e atributos
(usuários finais, componentes de sistema, domínios)
● Authentication: suporte à múltiplos métodos de
autenticação;
● Authorization: permissão ou negação de uma requisição
baseado em atributos de uma requisição.
● Accountability: captura de informações relevantes de
segurança à cada chamada de API.
Cncf microservices security
© 2018 Cloud Native Computing Foundation7
Kubernetes
● Ambiente de gerenciamento de containers
● Alta taxa de adoção
● Extensível
● Em evolução
● Portabilidade
● Declarativo
● Resiliente
● Escalável
● Não é o suficiente...
© 2018 Cloud Native Computing Foundation8
Service Mesh
© 2018 Cloud Native Computing Foundation9
Arquitetura de APINorte-Sul
Leste - Oeste
© 2018 Cloud Native Computing Foundation10
Service Mesh - Arquitetura de Segurança
Source: Istio Documentation
© 2018 Cloud Native Computing Foundation11
Istio - Arquitetura alto-nível
Source: Istio Documentation
© 2018 Cloud Native Computing Foundation12
Exemplo
Source: Google Cloud
Multi-level security
© 2018 Cloud Native Computing Foundation14
Security for EDGE: OIDC e Oauth2
● Protocolos conhecidos: Openid Connect,
Oauth2
● Id Token
● Access Token
● Token Exchange
● Identity Propagation
© 2018 Cloud Native Computing Foundation15
Security for Service Communication
● Identity for Services
● SPIFFE: Secure Production Identity
Framework for Everyone
● MUTUAL TLS
© 2018 Cloud Native Computing Foundation16
Workload Security
© 2018 Cloud Native Computing Foundation17
Compliance
● Which users can access which resources.
● Which subnets egress traffic is allowed to.
● Which clusters a workload must be deployed to.
● Which registries binaries can be downloaded from.
● Which OS capabilities a container can execute with.
● Which times of day the system can be accessed at.
Open Policy Agent
© 2018 Cloud Native Computing Foundation19
Open Policy Agent
● Policy as Code
● hosted by CNCF as
incubating-level project
● custom language: REGO
● ultra fast
● decouples policy definition from
policy execution
© 2018 Cloud Native Computing Foundation20
© 2018 Cloud Native Computing Foundation21
Why decoupling matters
decoupling results in policy
implementations that are
easier to understand,
flexible enough to handle
future requirements, and
less expensive to maintain
© 2018 Cloud Native Computing Foundation22
Execution Mode: Library
Fonte: https://github.com/open-policy-agent/opa
© 2018 Cloud Native Computing Foundation23
Example: JWT Validation
package istio.authz
import input.attributes.request.http as http_request
import input.attributes.source.address as source_address
certificate = `-----BEGIN CERTIFICATE-----
MIICmzCC
-----END CERTIFICATE-----`
constraint = {
"cert": certificate,
"alg": "RS256",
"aud": "account"
}
jwt_string = jwt_token {
[jwt_token] := split(http_request.headers["x-access-token"], " ")
}
# Decode Token
parsed_token = token {
[jose, payload, sig] := io.jwt.decode(jwt_string)
token = {
"jose" : jose,
"payload" : payload,
"sig": sig
}
}
valid_token = payload {
[valid, header, payload] := io.jwt.decode(jwt_string)
}
valid_auds [valid_aud] {
valid_aud := parsed_token.payload.aud[_]
group := parsed_token.payload.groups[_]
required_roles[group]
io.jwt.verify_rs256(jwt_string, certificate)
}
required_roles[r] {
perm := role_perms[r][_]
perm.method = http_request.method
perm.path = http_request.path
}
role_perms = {
"/Normal": [
{"method": "GET", "path": "/"},
{"method": "GET", "path": "/productpage?u=normal"},
],
"/Moderators": [
{"method": "GET", "path": "/productpage?u=test"},
{"method": "GET", "path": "/"},
{"method": "GET", "path": "/api/v1/products"},
],
}
default allow = {
"allowed": false,
"headers": {"x-ext-auth-allow": "no"},
"body": "Unauthorized Request",
"http_status": 301
}
}
1
2
4
3
© 2018 Cloud Native Computing Foundation24
Policy for Service Communication
© 2018 Cloud Native Computing Foundation25
Execution mode: Daemon
Fonte: OPA Istio Plugin Project
© 2018 Cloud Native Computing Foundation26
Kubernetes: Admission Controller
■ authentication, authorization webhooks
■ admission, mutating webhooks
© 2018 Cloud Native Computing Foundation27
OPA Gatekeeper
- hosted by CNCF as incubating-level project.
- Allow kubernetes administrators to detect and reject
non-compliant modifications to kubernetes resources
© 2018 Cloud Native Computing Foundation28
Gatekeeper architecture
© 2018 Cloud Native Computing Foundation29
Policy Template
A ConstraintTemplate
defines the policy code.
© 2018 Cloud Native Computing Foundation30
Policy Constraint
A
ConstraintTemplate
is instantiated
© 2018 Cloud Native Computing Foundation31
Audit non-compliance
The gatekeeper can display all
violations in a given context
© 2018 Cloud Native Computing Foundation32
Key Takeaways
Your Infrastructure MUST be:
- OPA is becoming THE standard for
policy as code
- Policy for user authz
- Policy for service mesh governance
- Policy for Organizational compliance
Please follow up with Leonardo
Gonçalves
https://www.linkedin.com/in/leogsilva on Linkedin

More Related Content

PDF
Opa gatekeeper
PDF
Kubecon 2019_eu-k8s-secrets-csi
PDF
Fine-grained Authorization in a Containerized World
PDF
DSO-LG 2021 Reboot: Policy As Code (Anders Eknert)
PDF
Where is my cache architectural patterns for caching microservices by example
PDF
5 Levels of High Availability: From Multi-instance to Hybrid Cloud
PDF
Big Data and Machine Learning with FIWARE
PDF
Scaling event aggregation at twitter
Opa gatekeeper
Kubecon 2019_eu-k8s-secrets-csi
Fine-grained Authorization in a Containerized World
DSO-LG 2021 Reboot: Policy As Code (Anders Eknert)
Where is my cache architectural patterns for caching microservices by example
5 Levels of High Availability: From Multi-instance to Hybrid Cloud
Big Data and Machine Learning with FIWARE
Scaling event aggregation at twitter

What's hot (20)

PDF
RGW S3: Features vs deep compatibility - Robin Johnson
PDF
Open Policy Agent
PDF
Intro to open source observability with grafana, prometheus, loki, and tempo(...
PDF
OSMC 2018 | Distributed Tracing FAQ by Gianluca Arbezzano
PDF
Kafka Streams
PDF
NATS vs HTTP
PDF
What we learnt at carousell tw for golang gathering #31
PDF
Nzitf Velociraptor Workshop
PPTX
gRPC on .NET Core - NDC Oslo 2020
PDF
Reactive database access with Slick3
PDF
202104 technical challenging and our solutions - golang taipei
PDF
Monolithic to microservices
PDF
Story of migrating event pipeline from batch to streaming
PPTX
InterPlanetary File System (IPFS)
PPTX
How to deploy a smart city platform?
PDF
Digital Forensics and Incident Response in The Cloud
PPTX
Performance is not an Option - gRPC and Cassandra
PDF
Putting Kafka Together with the Best of Google Cloud Platform
PDF
Kafka Streams - From the Ground Up to the Cloud
PDF
Gyula Fóra - RBEA- Scalable Real-Time Analytics at King
RGW S3: Features vs deep compatibility - Robin Johnson
Open Policy Agent
Intro to open source observability with grafana, prometheus, loki, and tempo(...
OSMC 2018 | Distributed Tracing FAQ by Gianluca Arbezzano
Kafka Streams
NATS vs HTTP
What we learnt at carousell tw for golang gathering #31
Nzitf Velociraptor Workshop
gRPC on .NET Core - NDC Oslo 2020
Reactive database access with Slick3
202104 technical challenging and our solutions - golang taipei
Monolithic to microservices
Story of migrating event pipeline from batch to streaming
InterPlanetary File System (IPFS)
How to deploy a smart city platform?
Digital Forensics and Incident Response in The Cloud
Performance is not an Option - gRPC and Cassandra
Putting Kafka Together with the Best of Google Cloud Platform
Kafka Streams - From the Ground Up to the Cloud
Gyula Fóra - RBEA- Scalable Real-Time Analytics at King
Ad

Similar to Cncf microservices security (20)

PPTX
Webinar: Extend The Power of The ForgeRock Identity Platform Through Scripting
PPTX
What's New in NGINX Plus R10?
PPTX
[2019.1] 하이퍼레저 패브릭 v1.3, v1.4 새로운 기능
PDF
Anthos Security: modernize your security posture for cloud native applications
PDF
The Current And Future State Of Service Mesh
PDF
Kubernetes security
PDF
Introduction to PaaS and Heroku
PDF
Kubernetes fingerprinting with Prometheus.pdf
PPTX
What's new in NGINX Plus R19
PPTX
Configs, Configs, Everywhere! (Actually, Let's Simplify All Those Configs)
PPTX
Orchestration Tool Roundup - Arthur Berezin & Trammell Scruggs
PDF
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
PPTX
Q Con New York 2015 Presentation - Conjur
PPTX
OWASP ZAP Workshop for QA Testers
PDF
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
PDF
Microservices on a budget meetup
PDF
Check Point automatizace a orchestrace
PDF
AWS User Group November
PDF
AWS November meetup Slides
PDF
Security model for a remote company
Webinar: Extend The Power of The ForgeRock Identity Platform Through Scripting
What's New in NGINX Plus R10?
[2019.1] 하이퍼레저 패브릭 v1.3, v1.4 새로운 기능
Anthos Security: modernize your security posture for cloud native applications
The Current And Future State Of Service Mesh
Kubernetes security
Introduction to PaaS and Heroku
Kubernetes fingerprinting with Prometheus.pdf
What's new in NGINX Plus R19
Configs, Configs, Everywhere! (Actually, Let's Simplify All Those Configs)
Orchestration Tool Roundup - Arthur Berezin & Trammell Scruggs
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
Q Con New York 2015 Presentation - Conjur
OWASP ZAP Workshop for QA Testers
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
Microservices on a budget meetup
Check Point automatizace a orchestrace
AWS User Group November
AWS November meetup Slides
Security model for a remote company
Ad

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Big Data Technologies - Introduction.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPT
Teaching material agriculture food technology
PDF
cuic standard and advanced reporting.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
KodekX | Application Modernization Development
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
The AUB Centre for AI in Media Proposal.docx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Big Data Technologies - Introduction.pptx
Review of recent advances in non-invasive hemoglobin estimation
NewMind AI Weekly Chronicles - August'25 Week I
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Teaching material agriculture food technology
cuic standard and advanced reporting.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
KodekX | Application Modernization Development
Reach Out and Touch Someone: Haptics and Empathic Computing
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Spectroscopy.pptx food analysis technology
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
“AI and Expert System Decision Support & Business Intelligence Systems”

Cncf microservices security

  • 1. Microservices Security with OPA and Service Mesh Leonardo G. Silva Solutions Architect
  • 2. © 2018 Cloud Native Computing Foundation2 $whoami ● Certified Kubernetes Administrator ● AWS Certified Sysops Administrator ● 20 years of experience with Software Architecture ● Head of Solutions Architecture @ GrupoMult
  • 3. © 2018 Cloud Native Computing Foundation3 Source: https://www.nginx.com/resources/library/app-dev-survey
  • 4. © 2018 Cloud Native Computing Foundation4 Cybersecurity Source: Foundations of Cybersecurity, Springer
  • 5. © 2018 Cloud Native Computing Foundation5 IAAA Framework ● Identification: suporte à múltiplas identidades e atributos (usuários finais, componentes de sistema, domínios) ● Authentication: suporte à múltiplos métodos de autenticação; ● Authorization: permissão ou negação de uma requisição baseado em atributos de uma requisição. ● Accountability: captura de informações relevantes de segurança à cada chamada de API.
  • 7. © 2018 Cloud Native Computing Foundation7 Kubernetes ● Ambiente de gerenciamento de containers ● Alta taxa de adoção ● Extensível ● Em evolução ● Portabilidade ● Declarativo ● Resiliente ● Escalável ● Não é o suficiente...
  • 8. © 2018 Cloud Native Computing Foundation8 Service Mesh
  • 9. © 2018 Cloud Native Computing Foundation9 Arquitetura de APINorte-Sul Leste - Oeste
  • 10. © 2018 Cloud Native Computing Foundation10 Service Mesh - Arquitetura de Segurança Source: Istio Documentation
  • 11. © 2018 Cloud Native Computing Foundation11 Istio - Arquitetura alto-nível Source: Istio Documentation
  • 12. © 2018 Cloud Native Computing Foundation12 Exemplo Source: Google Cloud
  • 14. © 2018 Cloud Native Computing Foundation14 Security for EDGE: OIDC e Oauth2 ● Protocolos conhecidos: Openid Connect, Oauth2 ● Id Token ● Access Token ● Token Exchange ● Identity Propagation
  • 15. © 2018 Cloud Native Computing Foundation15 Security for Service Communication ● Identity for Services ● SPIFFE: Secure Production Identity Framework for Everyone ● MUTUAL TLS
  • 16. © 2018 Cloud Native Computing Foundation16 Workload Security
  • 17. © 2018 Cloud Native Computing Foundation17 Compliance ● Which users can access which resources. ● Which subnets egress traffic is allowed to. ● Which clusters a workload must be deployed to. ● Which registries binaries can be downloaded from. ● Which OS capabilities a container can execute with. ● Which times of day the system can be accessed at.
  • 19. © 2018 Cloud Native Computing Foundation19 Open Policy Agent ● Policy as Code ● hosted by CNCF as incubating-level project ● custom language: REGO ● ultra fast ● decouples policy definition from policy execution
  • 20. © 2018 Cloud Native Computing Foundation20
  • 21. © 2018 Cloud Native Computing Foundation21 Why decoupling matters decoupling results in policy implementations that are easier to understand, flexible enough to handle future requirements, and less expensive to maintain
  • 22. © 2018 Cloud Native Computing Foundation22 Execution Mode: Library Fonte: https://github.com/open-policy-agent/opa
  • 23. © 2018 Cloud Native Computing Foundation23 Example: JWT Validation package istio.authz import input.attributes.request.http as http_request import input.attributes.source.address as source_address certificate = `-----BEGIN CERTIFICATE----- MIICmzCC -----END CERTIFICATE-----` constraint = { "cert": certificate, "alg": "RS256", "aud": "account" } jwt_string = jwt_token { [jwt_token] := split(http_request.headers["x-access-token"], " ") } # Decode Token parsed_token = token { [jose, payload, sig] := io.jwt.decode(jwt_string) token = { "jose" : jose, "payload" : payload, "sig": sig } } valid_token = payload { [valid, header, payload] := io.jwt.decode(jwt_string) } valid_auds [valid_aud] { valid_aud := parsed_token.payload.aud[_] group := parsed_token.payload.groups[_] required_roles[group] io.jwt.verify_rs256(jwt_string, certificate) } required_roles[r] { perm := role_perms[r][_] perm.method = http_request.method perm.path = http_request.path } role_perms = { "/Normal": [ {"method": "GET", "path": "/"}, {"method": "GET", "path": "/productpage?u=normal"}, ], "/Moderators": [ {"method": "GET", "path": "/productpage?u=test"}, {"method": "GET", "path": "/"}, {"method": "GET", "path": "/api/v1/products"}, ], } default allow = { "allowed": false, "headers": {"x-ext-auth-allow": "no"}, "body": "Unauthorized Request", "http_status": 301 } } 1 2 4 3
  • 24. © 2018 Cloud Native Computing Foundation24 Policy for Service Communication
  • 25. © 2018 Cloud Native Computing Foundation25 Execution mode: Daemon Fonte: OPA Istio Plugin Project
  • 26. © 2018 Cloud Native Computing Foundation26 Kubernetes: Admission Controller ■ authentication, authorization webhooks ■ admission, mutating webhooks
  • 27. © 2018 Cloud Native Computing Foundation27 OPA Gatekeeper - hosted by CNCF as incubating-level project. - Allow kubernetes administrators to detect and reject non-compliant modifications to kubernetes resources
  • 28. © 2018 Cloud Native Computing Foundation28 Gatekeeper architecture
  • 29. © 2018 Cloud Native Computing Foundation29 Policy Template A ConstraintTemplate defines the policy code.
  • 30. © 2018 Cloud Native Computing Foundation30 Policy Constraint A ConstraintTemplate is instantiated
  • 31. © 2018 Cloud Native Computing Foundation31 Audit non-compliance The gatekeeper can display all violations in a given context
  • 32. © 2018 Cloud Native Computing Foundation32 Key Takeaways Your Infrastructure MUST be: - OPA is becoming THE standard for policy as code - Policy for user authz - Policy for service mesh governance - Policy for Organizational compliance
  • 33. Please follow up with Leonardo Gonçalves https://www.linkedin.com/in/leogsilva on Linkedin