SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
Securing the
Message Bus with
Kafka Streams
SBA 8(a) Certified, WOSB, and EDWOSB
https://goraft.tech
Kafka Summit, Americas
September 14 – 15, 2021
Presenters: Paul Otto & Ryan Salcido
• Introduction
• Objective
• Why is this needed?
• Caveats
• Architecture Diagram
• Open Policy Agent
• Kafka Streams
• Kafka Consumer Examples
• Demo
• Final Remarks/Questions
Agenda. 2
Introduction. 3
• Inspired by the Raft Consensus Model, Raft
strives to deliver solutions that are
dependable, accessible, and viable at scale
within the public sector
• This presentation describes how we
developed an event-streaming service using
Confluent Platform, Open Policy Agent, and
Kafka Streams to provide topic and message
level security
• Researched and prototyped a solution that
simplified the integration process for
applications while leveraging the native Kafka
capabilities to provide a “single-source-of-
truth” data solution
Objective.
• Provide message-level security with
Kafka using Open Policy Agent and
Kafka Streams
• Use native Kafka capabilities without
the need for a REST API
• Protect sensitive data (i.e., PII) without
the need for multiple sub-topics
• Allow for different consumers to
subscribe to the same topic, but
receive appropriate messages
according to access-level
4
Why is this needed?
• With Event Streaming Architecture becoming more prevalent within
enterprises, the need for securing data streams containing PII (or
classified) data is important.
• Within the public sector, protecting classified data is a must and
becomes more difficult when working with ESA
• A common solution for adding security controls at the topic and
message level within Kafka is to create a REST API to enforce RBAC
• Lose the ability to get the data to the consumer when it is needed
• Another solution is to create sub-topics that consumers can then
subscribe to, but can quickly run into scalability issues
5
Caveats.
• Use case being shown here is a way to help
prevent PII leakage when using Kafka
• Additional steps would need to be taken to
prevent a consumer from directly accessing the
Kafka broker rather than Kafka Streams
• Would work in an environment where
the consumers/producers and Kafka platform
can have a trusted, mutual agreement
• Could include periodic audits of Kafka
usage
• In zero-trust environments, a Kafka proxy would
be needed between the Kafka Streams
interface and the consumers
6
Architecture Diagram. 7
What is Open Policy Agent?
• Policy engine typically used for cloud
native environments
• Fits our use case on integrating with
Kafka to provide topic-level security
• Utilizes its own declarative policy
language called Rego to define policies
(".rego" file extension)
• Obtained CNCF graduated status in
early 2021
8
Example of OPA's Rego Query Language.
• The screenshot on the left shows a data structure for controlling access
to topics
• The screenshot on the right processes the input and ultimately
determines if the user has access to the requested topic
• A boolean value is returned to Kafka based on whether the user has
access or not
9
Rego Policy: Defining levels of access for users.
• Additionally, we can restrict users from doing certain operations within
Kafka
• In this example, "bobjones" is allowed to read, write, describe, and create
the "pii" topic
• However, "alicesmith" is only granted permission to read and describe the
"pii" topic
• Any other operations not explicitly
granted will result in an
unauthorized error
10
How do we write the allow policies in OPA?
• To allow certain operations, we create an "allow" block with the necessary logic
• The first "allow" block checks the list of clients defined earlier against the
requested operation
• Example:
• principal.name == "bobjones"
• input.resource.name == "pii" (the topic name)
• input.operation.name == "read"
• Can also be "write", "create",
"describe", "delete"
• The "[_]" is a for loop in Rego syntax and
checks to see if the list of allowed operations
for the user matches the requested operation
• If it does, then return "true" to Kafka,
otherwise return "false"
11
Leveraging GitOps with OPA.
• Rather than storing RBAC policies directly (the
previous example), we can leverage GitOps to
reduce the issue of change management
• Can integrate policy-as-code to help automate the
process to deployment by using CI/CD pipelines
• Changes to the git repository can automatically be
picked up, tested, validated, and deployed
12
Identity and Access Management with OPA.
• In addition to leveraging GitOps, an IAM framework such as Keycloak
can be used to store the RBAC policies for users
• Helps declutter the Rego files
• As a result, once a user authenticates via IAM, the JWT response can
contain the RBAC policies granted to the user
13
How does Kafka communicate with OPA?
• For Kafka to be able to communicate with OPA to provide topic-level
security, we need to create a derivative Docker image to inject the OPA
jar into the base Kafka image
• Then, we need to provide the Kafka broker with additional configuration
properties
14
What does the derivative Docker image look like?
# Base image: Confluent Kafka v5.5.2
FROM confluentinc/cp-server:5.5.2
WORKDIR /opt
# Copy the OPA jar that handles the role-based access control
COPY ./target/kafka-opa-1.0.0.jar /usr/share/java/kafka
# Change to non-root user
USER 1001
Dockerfile:
15
Additional Kafka Broker Properties.
• As mentioned earlier, we need to add additional properties to the Kafka broker,
so that it knows how to communicate with OPA
• If environment variables are needed instead (i.e., Docker-Compose), replace
the "." with "_", capitalize all property names, and prepend "KAFKA"
• Example: authorizer.class.name == KAFKA_AUTHORIZER_CLASS_NAME
# Properties
# Specify full class name
authorizer.class.name=tech.goraft.kafka.opa.OpaAuthorizer
# The url that handles the logic on whether to allow the user to access the topic
opa.authorizer.url=http://opa:8181/v1/data/kafka/authz/allow
# Fail secure
opa.authorizer.allow.on.error=false
opa.authorizer.cache.initial.capacity=100
opa.authorizer.cache.maximum.size=100
opa.authorizer.cache.expire.after.ms=10000
16
Kafka Streams.
• A library for building real-time stream-processing applications
• In this case, we leveraged Kafka Streams to provide message-level
security based on the authenticated consumer
• Once a user is granted access to the requested topic in OPA, the Kafka
Streams microservice checks each outgoing message
• Messages are filtered out if the end user does not have access
• In this scenario, we can still leverage the native Kafka capabilities for
processing streams in real-time
17
Kafka Streams (cont.).
• If needed, this can be taken a step further by redacting certain fields of
an outgoing message
• Kafka Streams can transform messages, so that certain sensitive data is
not consumed
• For example, if one of the fields is a person's SSN, there may be a
situation where we want to return only the last 4 digits or even remove
the field altogether
• Can use a combination of the "filter" and "map" methods provided in the
KStream Java class
18
Example: Consumer subscribing to Kafka topic.
• This example shows the messages "bobjones" receives when
subscribing to the "pii" Kafka topic
• Even though there are many other messages in the Kafka topic for
other users, "bobjones" can only see his
19
Example: TopicAuthorizationException Error.
• This examples shows the result of a consumer attempting to subscribe
to a topic they do not have access to
• The user was able to authenticate properly via username/password,
but OPA prohibited the user, "johnhernandez", from reading the "pii"
topic
20
Demo.
• Encompasses the concepts we discussed
earlier with Open Policy Agent for topic-
level security and Kafka Streams for
message-level security
• The repository contains source code for
bootstrapping a Confluent Kafka cluster
with Open Policy Agent and a Kafka
Stream running for each of the 3 users:
"bobjones", "alicesmith", "johnhernandez"
• Uses Docker-Compose to start up all the
necessary services
• GitHub repository: https://github.com/raft-
tech/kafka-summit-2021
21
GitHub Repository.
We have set-up a sandbox environment using Docker-Compose
to allow for hands-on experimentation with Confluent, Open
Policy Agent, and Kafka Streams.
Please feel free to check it out after this presentation!
GitHub repository: https://github.com/raft-tech/kafka-summit-
2021
22
Thank you.
SBA 8(a) Certified, WOSB, and EDWOSB
https://goraft.tech
Paul Otto
Email: potto@goraft.tech
Twitter: @potto007
LinkedIn: https://www.linkedin.com/in/paulhotto
Ryan Salcido
Email: rsalcido@goraft.tech
Twitter: @ryan__salcido
LinkedIn: https://www.linkedin.com/in/ryan-salcido
GitHub repository: https://github.com/raft-tech/kafka-summit-2021
23

Weitere ähnliche Inhalte

Was ist angesagt?

Event Streaming in the Telco Industry with Apache Kafka® and Confluent
Event Streaming in the Telco Industry with Apache Kafka® and ConfluentEvent Streaming in the Telco Industry with Apache Kafka® and Confluent
Event Streaming in the Telco Industry with Apache Kafka® and Confluentconfluent
 
Introduction to Kafka connect
Introduction to Kafka connectIntroduction to Kafka connect
Introduction to Kafka connectKnoldus Inc.
 
Introduction to Kubernetes RBAC
Introduction to Kubernetes RBACIntroduction to Kubernetes RBAC
Introduction to Kubernetes RBACKublr
 
The Beginner’s Guide To Spring Cloud
The Beginner’s Guide To Spring CloudThe Beginner’s Guide To Spring Cloud
The Beginner’s Guide To Spring CloudVMware Tanzu
 
The story of SonarQube told to a DevOps Engineer
The story of SonarQube told to a DevOps EngineerThe story of SonarQube told to a DevOps Engineer
The story of SonarQube told to a DevOps EngineerManu Pk
 
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-RegionJi-Woong Choi
 
KSQL-ops! Running ksqlDB in the Wild (Simon Aubury, ThoughtWorks) Kafka Summi...
KSQL-ops! Running ksqlDB in the Wild (Simon Aubury, ThoughtWorks) Kafka Summi...KSQL-ops! Running ksqlDB in the Wild (Simon Aubury, ThoughtWorks) Kafka Summi...
KSQL-ops! Running ksqlDB in the Wild (Simon Aubury, ThoughtWorks) Kafka Summi...confluent
 
Java troubleshooting thread dump
Java troubleshooting thread dumpJava troubleshooting thread dump
Java troubleshooting thread dumpejlp12
 
Visualizing Kafka Security
Visualizing Kafka SecurityVisualizing Kafka Security
Visualizing Kafka SecurityDataWorks Summit
 
APIC/DataPower security
APIC/DataPower securityAPIC/DataPower security
APIC/DataPower securityShiu-Fun Poon
 
Role based access control - RBAC - Kubernetes
Role based access control - RBAC - KubernetesRole based access control - RBAC - Kubernetes
Role based access control - RBAC - KubernetesMilan Das
 
Token Authentication in ASP.NET Core
Token Authentication in ASP.NET CoreToken Authentication in ASP.NET Core
Token Authentication in ASP.NET CoreStormpath
 
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)Roman Kharkovski
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache CamelClaus Ibsen
 
Real-Life Use Cases & Architectures for Event Streaming with Apache Kafka
Real-Life Use Cases & Architectures for Event Streaming with Apache KafkaReal-Life Use Cases & Architectures for Event Streaming with Apache Kafka
Real-Life Use Cases & Architectures for Event Streaming with Apache KafkaKai Wähner
 
A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices Nebulaworks
 
OpenShift Virtualization - VM and OS Image Lifecycle
OpenShift Virtualization - VM and OS Image LifecycleOpenShift Virtualization - VM and OS Image Lifecycle
OpenShift Virtualization - VM and OS Image LifecycleMihai Criveti
 
Building secure applications with keycloak
Building secure applications with keycloak Building secure applications with keycloak
Building secure applications with keycloak Abhishek Koserwal
 

Was ist angesagt? (20)

Event Streaming in the Telco Industry with Apache Kafka® and Confluent
Event Streaming in the Telco Industry with Apache Kafka® and ConfluentEvent Streaming in the Telco Industry with Apache Kafka® and Confluent
Event Streaming in the Telco Industry with Apache Kafka® and Confluent
 
Spring Cloud Gateway
Spring Cloud GatewaySpring Cloud Gateway
Spring Cloud Gateway
 
Introduction to Kafka connect
Introduction to Kafka connectIntroduction to Kafka connect
Introduction to Kafka connect
 
Introduction to Kubernetes RBAC
Introduction to Kubernetes RBACIntroduction to Kubernetes RBAC
Introduction to Kubernetes RBAC
 
The Beginner’s Guide To Spring Cloud
The Beginner’s Guide To Spring CloudThe Beginner’s Guide To Spring Cloud
The Beginner’s Guide To Spring Cloud
 
The story of SonarQube told to a DevOps Engineer
The story of SonarQube told to a DevOps EngineerThe story of SonarQube told to a DevOps Engineer
The story of SonarQube told to a DevOps Engineer
 
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
 
KSQL-ops! Running ksqlDB in the Wild (Simon Aubury, ThoughtWorks) Kafka Summi...
KSQL-ops! Running ksqlDB in the Wild (Simon Aubury, ThoughtWorks) Kafka Summi...KSQL-ops! Running ksqlDB in the Wild (Simon Aubury, ThoughtWorks) Kafka Summi...
KSQL-ops! Running ksqlDB in the Wild (Simon Aubury, ThoughtWorks) Kafka Summi...
 
Java troubleshooting thread dump
Java troubleshooting thread dumpJava troubleshooting thread dump
Java troubleshooting thread dump
 
Visualizing Kafka Security
Visualizing Kafka SecurityVisualizing Kafka Security
Visualizing Kafka Security
 
APIC/DataPower security
APIC/DataPower securityAPIC/DataPower security
APIC/DataPower security
 
Role based access control - RBAC - Kubernetes
Role based access control - RBAC - KubernetesRole based access control - RBAC - Kubernetes
Role based access control - RBAC - Kubernetes
 
Token Authentication in ASP.NET Core
Token Authentication in ASP.NET CoreToken Authentication in ASP.NET Core
Token Authentication in ASP.NET Core
 
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
 
Apache Spark Crash Course
Apache Spark Crash CourseApache Spark Crash Course
Apache Spark Crash Course
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache Camel
 
Real-Life Use Cases & Architectures for Event Streaming with Apache Kafka
Real-Life Use Cases & Architectures for Event Streaming with Apache KafkaReal-Life Use Cases & Architectures for Event Streaming with Apache Kafka
Real-Life Use Cases & Architectures for Event Streaming with Apache Kafka
 
A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices A Hands-on Introduction on Terraform Best Concepts and Best Practices
A Hands-on Introduction on Terraform Best Concepts and Best Practices
 
OpenShift Virtualization - VM and OS Image Lifecycle
OpenShift Virtualization - VM and OS Image LifecycleOpenShift Virtualization - VM and OS Image Lifecycle
OpenShift Virtualization - VM and OS Image Lifecycle
 
Building secure applications with keycloak
Building secure applications with keycloak Building secure applications with keycloak
Building secure applications with keycloak
 

Ähnlich wie Securing the Message Bus with Kafka Streams | Paul Otto and Ryan Salcido, Raft LLC

Knock Knock, Who’s There? With Justin Chen and Dhruv Jauhar | Current 2022
Knock Knock, Who’s There? With Justin Chen and Dhruv Jauhar | Current 2022Knock Knock, Who’s There? With Justin Chen and Dhruv Jauhar | Current 2022
Knock Knock, Who’s There? With Justin Chen and Dhruv Jauhar | Current 2022HostedbyConfluent
 
Distributed & Highly Available server applications in Java and Scala
Distributed & Highly Available server applications in Java and ScalaDistributed & Highly Available server applications in Java and Scala
Distributed & Highly Available server applications in Java and ScalaMax Alexejev
 
Implementing FaaS on Kubernetes using Kubeless
Implementing FaaS on Kubernetes using KubelessImplementing FaaS on Kubernetes using Kubeless
Implementing FaaS on Kubernetes using KubelessAhmed Misbah
 
Consensus in Apache Kafka: From Theory to Production.pdf
Consensus in Apache Kafka: From Theory to Production.pdfConsensus in Apache Kafka: From Theory to Production.pdf
Consensus in Apache Kafka: From Theory to Production.pdfGuozhang Wang
 
Kubernetes Internals
Kubernetes InternalsKubernetes Internals
Kubernetes InternalsShimi Bandiel
 
Fundamentals and Architecture of Apache Kafka
Fundamentals and Architecture of Apache KafkaFundamentals and Architecture of Apache Kafka
Fundamentals and Architecture of Apache KafkaAngelo Cesaro
 
Kubernetes Security with Calico and Open Policy Agent
Kubernetes Security with Calico and Open Policy AgentKubernetes Security with Calico and Open Policy Agent
Kubernetes Security with Calico and Open Policy AgentCloudOps2005
 
Unleashing Real-time Power with Kafka.pptx
Unleashing Real-time Power with Kafka.pptxUnleashing Real-time Power with Kafka.pptx
Unleashing Real-time Power with Kafka.pptxKnoldus Inc.
 
Java Library for High Speed Streaming Data
Java Library for High Speed Streaming Data Java Library for High Speed Streaming Data
Java Library for High Speed Streaming Data Oracle Developers
 
Apache Airflow Introduction
Apache Airflow IntroductionApache Airflow Introduction
Apache Airflow IntroductionLiangjun Jiang
 
How Apache Kafka® Works
How Apache Kafka® WorksHow Apache Kafka® Works
How Apache Kafka® Worksconfluent
 
Designing your API Server for mobile apps
Designing your API Server for mobile appsDesigning your API Server for mobile apps
Designing your API Server for mobile appsMugunth Kumar
 
What's new in the OSGi Enterprise Release 5.0
What's new in the OSGi Enterprise Release 5.0What's new in the OSGi Enterprise Release 5.0
What's new in the OSGi Enterprise Release 5.0David Bosschaert
 
Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.
Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.
Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.Opcito Technologies
 
Meetup - Brasil - Data In Motion - 2023 September 19
Meetup - Brasil - Data In Motion - 2023 September 19Meetup - Brasil - Data In Motion - 2023 September 19
Meetup - Brasil - Data In Motion - 2023 September 19ssuser73434e
 
Meetup - Brasil - Data In Motion - 2023 September 19
Meetup - Brasil - Data In Motion - 2023 September 19Meetup - Brasil - Data In Motion - 2023 September 19
Meetup - Brasil - Data In Motion - 2023 September 19Timothy Spann
 

Ähnlich wie Securing the Message Bus with Kafka Streams | Paul Otto and Ryan Salcido, Raft LLC (20)

Knock Knock, Who’s There? With Justin Chen and Dhruv Jauhar | Current 2022
Knock Knock, Who’s There? With Justin Chen and Dhruv Jauhar | Current 2022Knock Knock, Who’s There? With Justin Chen and Dhruv Jauhar | Current 2022
Knock Knock, Who’s There? With Justin Chen and Dhruv Jauhar | Current 2022
 
Distributed & Highly Available server applications in Java and Scala
Distributed & Highly Available server applications in Java and ScalaDistributed & Highly Available server applications in Java and Scala
Distributed & Highly Available server applications in Java and Scala
 
Implementing FaaS on Kubernetes using Kubeless
Implementing FaaS on Kubernetes using KubelessImplementing FaaS on Kubernetes using Kubeless
Implementing FaaS on Kubernetes using Kubeless
 
Kafka Explainaton
Kafka ExplainatonKafka Explainaton
Kafka Explainaton
 
Consensus in Apache Kafka: From Theory to Production.pdf
Consensus in Apache Kafka: From Theory to Production.pdfConsensus in Apache Kafka: From Theory to Production.pdf
Consensus in Apache Kafka: From Theory to Production.pdf
 
Kubernetes Internals
Kubernetes InternalsKubernetes Internals
Kubernetes Internals
 
Fundamentals and Architecture of Apache Kafka
Fundamentals and Architecture of Apache KafkaFundamentals and Architecture of Apache Kafka
Fundamentals and Architecture of Apache Kafka
 
Kubernetes Security with Calico and Open Policy Agent
Kubernetes Security with Calico and Open Policy AgentKubernetes Security with Calico and Open Policy Agent
Kubernetes Security with Calico and Open Policy Agent
 
Unleashing Real-time Power with Kafka.pptx
Unleashing Real-time Power with Kafka.pptxUnleashing Real-time Power with Kafka.pptx
Unleashing Real-time Power with Kafka.pptx
 
Kafka for DBAs
Kafka for DBAsKafka for DBAs
Kafka for DBAs
 
Intro to kubernetes
Intro to kubernetesIntro to kubernetes
Intro to kubernetes
 
Docker Kubernetes Istio
Docker Kubernetes IstioDocker Kubernetes Istio
Docker Kubernetes Istio
 
Java Library for High Speed Streaming Data
Java Library for High Speed Streaming Data Java Library for High Speed Streaming Data
Java Library for High Speed Streaming Data
 
Apache Airflow Introduction
Apache Airflow IntroductionApache Airflow Introduction
Apache Airflow Introduction
 
How Apache Kafka® Works
How Apache Kafka® WorksHow Apache Kafka® Works
How Apache Kafka® Works
 
Designing your API Server for mobile apps
Designing your API Server for mobile appsDesigning your API Server for mobile apps
Designing your API Server for mobile apps
 
What's new in the OSGi Enterprise Release 5.0
What's new in the OSGi Enterprise Release 5.0What's new in the OSGi Enterprise Release 5.0
What's new in the OSGi Enterprise Release 5.0
 
Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.
Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.
Securing & Monitoring Your K8s Cluster with RBAC and Prometheus”.
 
Meetup - Brasil - Data In Motion - 2023 September 19
Meetup - Brasil - Data In Motion - 2023 September 19Meetup - Brasil - Data In Motion - 2023 September 19
Meetup - Brasil - Data In Motion - 2023 September 19
 
Meetup - Brasil - Data In Motion - 2023 September 19
Meetup - Brasil - Data In Motion - 2023 September 19Meetup - Brasil - Data In Motion - 2023 September 19
Meetup - Brasil - Data In Motion - 2023 September 19
 

Mehr von HostedbyConfluent

Renaming a Kafka Topic | Kafka Summit London
Renaming a Kafka Topic | Kafka Summit LondonRenaming a Kafka Topic | Kafka Summit London
Renaming a Kafka Topic | Kafka Summit LondonHostedbyConfluent
 
Evolution of NRT Data Ingestion Pipeline at Trendyol
Evolution of NRT Data Ingestion Pipeline at TrendyolEvolution of NRT Data Ingestion Pipeline at Trendyol
Evolution of NRT Data Ingestion Pipeline at TrendyolHostedbyConfluent
 
Ensuring Kafka Service Resilience: A Dive into Health-Checking Techniques
Ensuring Kafka Service Resilience: A Dive into Health-Checking TechniquesEnsuring Kafka Service Resilience: A Dive into Health-Checking Techniques
Ensuring Kafka Service Resilience: A Dive into Health-Checking TechniquesHostedbyConfluent
 
Exactly-once Stream Processing with Arroyo and Kafka
Exactly-once Stream Processing with Arroyo and KafkaExactly-once Stream Processing with Arroyo and Kafka
Exactly-once Stream Processing with Arroyo and KafkaHostedbyConfluent
 
Fish Plays Pokemon | Kafka Summit London
Fish Plays Pokemon | Kafka Summit LondonFish Plays Pokemon | Kafka Summit London
Fish Plays Pokemon | Kafka Summit LondonHostedbyConfluent
 
Tiered Storage 101 | Kafla Summit London
Tiered Storage 101 | Kafla Summit LondonTiered Storage 101 | Kafla Summit London
Tiered Storage 101 | Kafla Summit LondonHostedbyConfluent
 
Building a Self-Service Stream Processing Portal: How And Why
Building a Self-Service Stream Processing Portal: How And WhyBuilding a Self-Service Stream Processing Portal: How And Why
Building a Self-Service Stream Processing Portal: How And WhyHostedbyConfluent
 
From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...
From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...
From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...HostedbyConfluent
 
Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...
Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...
Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...HostedbyConfluent
 
Navigating Private Network Connectivity Options for Kafka Clusters
Navigating Private Network Connectivity Options for Kafka ClustersNavigating Private Network Connectivity Options for Kafka Clusters
Navigating Private Network Connectivity Options for Kafka ClustersHostedbyConfluent
 
Apache Flink: Building a Company-wide Self-service Streaming Data Platform
Apache Flink: Building a Company-wide Self-service Streaming Data PlatformApache Flink: Building a Company-wide Self-service Streaming Data Platform
Apache Flink: Building a Company-wide Self-service Streaming Data PlatformHostedbyConfluent
 
Explaining How Real-Time GenAI Works in a Noisy Pub
Explaining How Real-Time GenAI Works in a Noisy PubExplaining How Real-Time GenAI Works in a Noisy Pub
Explaining How Real-Time GenAI Works in a Noisy PubHostedbyConfluent
 
TL;DR Kafka Metrics | Kafka Summit London
TL;DR Kafka Metrics | Kafka Summit LondonTL;DR Kafka Metrics | Kafka Summit London
TL;DR Kafka Metrics | Kafka Summit LondonHostedbyConfluent
 
A Window Into Your Kafka Streams Tasks | KSL
A Window Into Your Kafka Streams Tasks | KSLA Window Into Your Kafka Streams Tasks | KSL
A Window Into Your Kafka Streams Tasks | KSLHostedbyConfluent
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Mastering Kafka Producer Configs: A Guide to Optimizing Performance
Mastering Kafka Producer Configs: A Guide to Optimizing PerformanceMastering Kafka Producer Configs: A Guide to Optimizing Performance
Mastering Kafka Producer Configs: A Guide to Optimizing PerformanceHostedbyConfluent
 
Data Contracts Management: Schema Registry and Beyond
Data Contracts Management: Schema Registry and BeyondData Contracts Management: Schema Registry and Beyond
Data Contracts Management: Schema Registry and BeyondHostedbyConfluent
 
Code-First Approach: Crafting Efficient Flink Apps
Code-First Approach: Crafting Efficient Flink AppsCode-First Approach: Crafting Efficient Flink Apps
Code-First Approach: Crafting Efficient Flink AppsHostedbyConfluent
 
Debezium vs. the World: An Overview of the CDC Ecosystem
Debezium vs. the World: An Overview of the CDC EcosystemDebezium vs. the World: An Overview of the CDC Ecosystem
Debezium vs. the World: An Overview of the CDC EcosystemHostedbyConfluent
 
Beyond Tiered Storage: Serverless Kafka with No Local Disks
Beyond Tiered Storage: Serverless Kafka with No Local DisksBeyond Tiered Storage: Serverless Kafka with No Local Disks
Beyond Tiered Storage: Serverless Kafka with No Local DisksHostedbyConfluent
 

Mehr von HostedbyConfluent (20)

Renaming a Kafka Topic | Kafka Summit London
Renaming a Kafka Topic | Kafka Summit LondonRenaming a Kafka Topic | Kafka Summit London
Renaming a Kafka Topic | Kafka Summit London
 
Evolution of NRT Data Ingestion Pipeline at Trendyol
Evolution of NRT Data Ingestion Pipeline at TrendyolEvolution of NRT Data Ingestion Pipeline at Trendyol
Evolution of NRT Data Ingestion Pipeline at Trendyol
 
Ensuring Kafka Service Resilience: A Dive into Health-Checking Techniques
Ensuring Kafka Service Resilience: A Dive into Health-Checking TechniquesEnsuring Kafka Service Resilience: A Dive into Health-Checking Techniques
Ensuring Kafka Service Resilience: A Dive into Health-Checking Techniques
 
Exactly-once Stream Processing with Arroyo and Kafka
Exactly-once Stream Processing with Arroyo and KafkaExactly-once Stream Processing with Arroyo and Kafka
Exactly-once Stream Processing with Arroyo and Kafka
 
Fish Plays Pokemon | Kafka Summit London
Fish Plays Pokemon | Kafka Summit LondonFish Plays Pokemon | Kafka Summit London
Fish Plays Pokemon | Kafka Summit London
 
Tiered Storage 101 | Kafla Summit London
Tiered Storage 101 | Kafla Summit LondonTiered Storage 101 | Kafla Summit London
Tiered Storage 101 | Kafla Summit London
 
Building a Self-Service Stream Processing Portal: How And Why
Building a Self-Service Stream Processing Portal: How And WhyBuilding a Self-Service Stream Processing Portal: How And Why
Building a Self-Service Stream Processing Portal: How And Why
 
From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...
From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...
From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...
 
Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...
Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...
Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...
 
Navigating Private Network Connectivity Options for Kafka Clusters
Navigating Private Network Connectivity Options for Kafka ClustersNavigating Private Network Connectivity Options for Kafka Clusters
Navigating Private Network Connectivity Options for Kafka Clusters
 
Apache Flink: Building a Company-wide Self-service Streaming Data Platform
Apache Flink: Building a Company-wide Self-service Streaming Data PlatformApache Flink: Building a Company-wide Self-service Streaming Data Platform
Apache Flink: Building a Company-wide Self-service Streaming Data Platform
 
Explaining How Real-Time GenAI Works in a Noisy Pub
Explaining How Real-Time GenAI Works in a Noisy PubExplaining How Real-Time GenAI Works in a Noisy Pub
Explaining How Real-Time GenAI Works in a Noisy Pub
 
TL;DR Kafka Metrics | Kafka Summit London
TL;DR Kafka Metrics | Kafka Summit LondonTL;DR Kafka Metrics | Kafka Summit London
TL;DR Kafka Metrics | Kafka Summit London
 
A Window Into Your Kafka Streams Tasks | KSL
A Window Into Your Kafka Streams Tasks | KSLA Window Into Your Kafka Streams Tasks | KSL
A Window Into Your Kafka Streams Tasks | KSL
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Mastering Kafka Producer Configs: A Guide to Optimizing Performance
Mastering Kafka Producer Configs: A Guide to Optimizing PerformanceMastering Kafka Producer Configs: A Guide to Optimizing Performance
Mastering Kafka Producer Configs: A Guide to Optimizing Performance
 
Data Contracts Management: Schema Registry and Beyond
Data Contracts Management: Schema Registry and BeyondData Contracts Management: Schema Registry and Beyond
Data Contracts Management: Schema Registry and Beyond
 
Code-First Approach: Crafting Efficient Flink Apps
Code-First Approach: Crafting Efficient Flink AppsCode-First Approach: Crafting Efficient Flink Apps
Code-First Approach: Crafting Efficient Flink Apps
 
Debezium vs. the World: An Overview of the CDC Ecosystem
Debezium vs. the World: An Overview of the CDC EcosystemDebezium vs. the World: An Overview of the CDC Ecosystem
Debezium vs. the World: An Overview of the CDC Ecosystem
 
Beyond Tiered Storage: Serverless Kafka with No Local Disks
Beyond Tiered Storage: Serverless Kafka with No Local DisksBeyond Tiered Storage: Serverless Kafka with No Local Disks
Beyond Tiered Storage: Serverless Kafka with No Local Disks
 

Kürzlich hochgeladen

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 

Kürzlich hochgeladen (20)

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 

Securing the Message Bus with Kafka Streams | Paul Otto and Ryan Salcido, Raft LLC

  • 1. Securing the Message Bus with Kafka Streams SBA 8(a) Certified, WOSB, and EDWOSB https://goraft.tech Kafka Summit, Americas September 14 – 15, 2021 Presenters: Paul Otto & Ryan Salcido
  • 2. • Introduction • Objective • Why is this needed? • Caveats • Architecture Diagram • Open Policy Agent • Kafka Streams • Kafka Consumer Examples • Demo • Final Remarks/Questions Agenda. 2
  • 3. Introduction. 3 • Inspired by the Raft Consensus Model, Raft strives to deliver solutions that are dependable, accessible, and viable at scale within the public sector • This presentation describes how we developed an event-streaming service using Confluent Platform, Open Policy Agent, and Kafka Streams to provide topic and message level security • Researched and prototyped a solution that simplified the integration process for applications while leveraging the native Kafka capabilities to provide a “single-source-of- truth” data solution
  • 4. Objective. • Provide message-level security with Kafka using Open Policy Agent and Kafka Streams • Use native Kafka capabilities without the need for a REST API • Protect sensitive data (i.e., PII) without the need for multiple sub-topics • Allow for different consumers to subscribe to the same topic, but receive appropriate messages according to access-level 4
  • 5. Why is this needed? • With Event Streaming Architecture becoming more prevalent within enterprises, the need for securing data streams containing PII (or classified) data is important. • Within the public sector, protecting classified data is a must and becomes more difficult when working with ESA • A common solution for adding security controls at the topic and message level within Kafka is to create a REST API to enforce RBAC • Lose the ability to get the data to the consumer when it is needed • Another solution is to create sub-topics that consumers can then subscribe to, but can quickly run into scalability issues 5
  • 6. Caveats. • Use case being shown here is a way to help prevent PII leakage when using Kafka • Additional steps would need to be taken to prevent a consumer from directly accessing the Kafka broker rather than Kafka Streams • Would work in an environment where the consumers/producers and Kafka platform can have a trusted, mutual agreement • Could include periodic audits of Kafka usage • In zero-trust environments, a Kafka proxy would be needed between the Kafka Streams interface and the consumers 6
  • 8. What is Open Policy Agent? • Policy engine typically used for cloud native environments • Fits our use case on integrating with Kafka to provide topic-level security • Utilizes its own declarative policy language called Rego to define policies (".rego" file extension) • Obtained CNCF graduated status in early 2021 8
  • 9. Example of OPA's Rego Query Language. • The screenshot on the left shows a data structure for controlling access to topics • The screenshot on the right processes the input and ultimately determines if the user has access to the requested topic • A boolean value is returned to Kafka based on whether the user has access or not 9
  • 10. Rego Policy: Defining levels of access for users. • Additionally, we can restrict users from doing certain operations within Kafka • In this example, "bobjones" is allowed to read, write, describe, and create the "pii" topic • However, "alicesmith" is only granted permission to read and describe the "pii" topic • Any other operations not explicitly granted will result in an unauthorized error 10
  • 11. How do we write the allow policies in OPA? • To allow certain operations, we create an "allow" block with the necessary logic • The first "allow" block checks the list of clients defined earlier against the requested operation • Example: • principal.name == "bobjones" • input.resource.name == "pii" (the topic name) • input.operation.name == "read" • Can also be "write", "create", "describe", "delete" • The "[_]" is a for loop in Rego syntax and checks to see if the list of allowed operations for the user matches the requested operation • If it does, then return "true" to Kafka, otherwise return "false" 11
  • 12. Leveraging GitOps with OPA. • Rather than storing RBAC policies directly (the previous example), we can leverage GitOps to reduce the issue of change management • Can integrate policy-as-code to help automate the process to deployment by using CI/CD pipelines • Changes to the git repository can automatically be picked up, tested, validated, and deployed 12
  • 13. Identity and Access Management with OPA. • In addition to leveraging GitOps, an IAM framework such as Keycloak can be used to store the RBAC policies for users • Helps declutter the Rego files • As a result, once a user authenticates via IAM, the JWT response can contain the RBAC policies granted to the user 13
  • 14. How does Kafka communicate with OPA? • For Kafka to be able to communicate with OPA to provide topic-level security, we need to create a derivative Docker image to inject the OPA jar into the base Kafka image • Then, we need to provide the Kafka broker with additional configuration properties 14
  • 15. What does the derivative Docker image look like? # Base image: Confluent Kafka v5.5.2 FROM confluentinc/cp-server:5.5.2 WORKDIR /opt # Copy the OPA jar that handles the role-based access control COPY ./target/kafka-opa-1.0.0.jar /usr/share/java/kafka # Change to non-root user USER 1001 Dockerfile: 15
  • 16. Additional Kafka Broker Properties. • As mentioned earlier, we need to add additional properties to the Kafka broker, so that it knows how to communicate with OPA • If environment variables are needed instead (i.e., Docker-Compose), replace the "." with "_", capitalize all property names, and prepend "KAFKA" • Example: authorizer.class.name == KAFKA_AUTHORIZER_CLASS_NAME # Properties # Specify full class name authorizer.class.name=tech.goraft.kafka.opa.OpaAuthorizer # The url that handles the logic on whether to allow the user to access the topic opa.authorizer.url=http://opa:8181/v1/data/kafka/authz/allow # Fail secure opa.authorizer.allow.on.error=false opa.authorizer.cache.initial.capacity=100 opa.authorizer.cache.maximum.size=100 opa.authorizer.cache.expire.after.ms=10000 16
  • 17. Kafka Streams. • A library for building real-time stream-processing applications • In this case, we leveraged Kafka Streams to provide message-level security based on the authenticated consumer • Once a user is granted access to the requested topic in OPA, the Kafka Streams microservice checks each outgoing message • Messages are filtered out if the end user does not have access • In this scenario, we can still leverage the native Kafka capabilities for processing streams in real-time 17
  • 18. Kafka Streams (cont.). • If needed, this can be taken a step further by redacting certain fields of an outgoing message • Kafka Streams can transform messages, so that certain sensitive data is not consumed • For example, if one of the fields is a person's SSN, there may be a situation where we want to return only the last 4 digits or even remove the field altogether • Can use a combination of the "filter" and "map" methods provided in the KStream Java class 18
  • 19. Example: Consumer subscribing to Kafka topic. • This example shows the messages "bobjones" receives when subscribing to the "pii" Kafka topic • Even though there are many other messages in the Kafka topic for other users, "bobjones" can only see his 19
  • 20. Example: TopicAuthorizationException Error. • This examples shows the result of a consumer attempting to subscribe to a topic they do not have access to • The user was able to authenticate properly via username/password, but OPA prohibited the user, "johnhernandez", from reading the "pii" topic 20
  • 21. Demo. • Encompasses the concepts we discussed earlier with Open Policy Agent for topic- level security and Kafka Streams for message-level security • The repository contains source code for bootstrapping a Confluent Kafka cluster with Open Policy Agent and a Kafka Stream running for each of the 3 users: "bobjones", "alicesmith", "johnhernandez" • Uses Docker-Compose to start up all the necessary services • GitHub repository: https://github.com/raft- tech/kafka-summit-2021 21
  • 22. GitHub Repository. We have set-up a sandbox environment using Docker-Compose to allow for hands-on experimentation with Confluent, Open Policy Agent, and Kafka Streams. Please feel free to check it out after this presentation! GitHub repository: https://github.com/raft-tech/kafka-summit- 2021 22
  • 23. Thank you. SBA 8(a) Certified, WOSB, and EDWOSB https://goraft.tech Paul Otto Email: potto@goraft.tech Twitter: @potto007 LinkedIn: https://www.linkedin.com/in/paulhotto Ryan Salcido Email: rsalcido@goraft.tech Twitter: @ryan__salcido LinkedIn: https://www.linkedin.com/in/ryan-salcido GitHub repository: https://github.com/raft-tech/kafka-summit-2021 23