Event Streaming with Kafka

Deep Dive into Kafka Beyond the Basics

Kafka Security

Welcome to this deep dive into Kafka security. In this guide, we'll explore how to protect sensitive data in transit, in use, and at rest using Kafka’s built-in mechanisms.


Use Case Overview

Imagine a banking application that publishes two types of events to a Kafka cluster:

  • Login Events
    When a customer logs in, the app writes a message to the login-events topic.

  • Card Payment Events
    When a payment is processed, the app writes a message to the card-payment-events topic.

Downstream microservices consume these events for auditing, notifications, analytics, and more.


Key Security Layers

Both login and payment events contain sensitive customer data. To safeguard this information, address these three layers:

LayerGoalKafka Feature
Data in TransitEncrypt and authenticate communication between clients and brokersTLS / SSL
Data in UseAuthenticate clients and authorize topic-level operationsSASL Authentication + ACLs
Data at RestEncrypt log segments and snapshots on diskVolume encryption or Native Kafka DSP

Note

Always rotate certificates and keys periodically to minimize risk in case of credential leakage.


Kafka Security Features

Kafka provides several built-in mechanisms to meet these requirements:

FeatureDescriptionReference
TLS EncryptionEncrypt data in transit between producers, brokers, and consumers.TLS Setup
SASL AuthenticationSupport for SCRAM, GSSAPI (Kerberos), OAUTHBEARER, and PLAIN mechanisms.SASL Mechanisms
ACL AuthorizationFine-grained control over which principals can read/write specific topics and consumer groups.ACLs
Disk EncryptionUse OS-level volume encryption or integrate third-party solutions for encrypting log directories.

Next Steps

  1. Configure TLS on brokers and clients.
  2. Enable SASL for authenticating producers and consumers.
  3. Define ACLs to restrict topic access.
  4. Implement disk encryption for log segments and snapshots.

By following these steps, you’ll achieve end-to-end protection of sensitive Kafka data.


Watch Video

Watch video content

Previous
Demo Kafka Setup with KRaft