0
0
Kafkadevops~30 mins

SSL/TLS encryption in Kafka - Mini Project: Build & Apply

Choose your learning style9 modes available
SSL/TLS Encryption Setup for Kafka
📖 Scenario: You are setting up a Kafka broker to securely communicate with clients using SSL/TLS encryption. This protects data by encrypting messages sent between Kafka and its clients.
🎯 Goal: Configure Kafka broker properties to enable SSL/TLS encryption with a keystore and truststore, then verify the configuration by printing the SSL settings.
📋 What You'll Learn
Create a dictionary called kafka_config with Kafka SSL properties
Add a variable called ssl_enabled set to True
Use a dictionary comprehension to filter only SSL-related properties into ssl_config
Print the ssl_config dictionary to show SSL settings
💡 Why This Matters
🌍 Real World
Kafka brokers often need SSL/TLS encryption to secure data in transit between clients and servers, protecting sensitive information from eavesdropping.
💼 Career
Understanding how to configure SSL/TLS in Kafka is important for roles like DevOps engineers, backend developers, and security specialists working with data streaming platforms.
Progress0 / 4 steps
1
Create Kafka SSL configuration dictionary
Create a dictionary called kafka_config with these exact entries: 'ssl.keystore.location': '/var/private/ssl/kafka.keystore.jks', 'ssl.keystore.password': 'keystorepass', 'ssl.key.password': 'keypass', 'ssl.truststore.location': '/var/private/ssl/kafka.truststore.jks', 'ssl.truststore.password': 'truststorepass', and 'listeners': 'SSL://:9093'.
Kafka
Need a hint?

Use curly braces {} to create the dictionary with the exact keys and values.

2
Add SSL enabled flag
Add a variable called ssl_enabled and set it to True to indicate SSL is enabled.
Kafka
Need a hint?

Just write ssl_enabled = True on a new line.

3
Filter SSL properties using dictionary comprehension
Create a new dictionary called ssl_config that contains only the entries from kafka_config where the key starts with 'ssl.'.
Kafka
Need a hint?

Use dictionary comprehension with key.startswith('ssl.') to filter keys.

4
Print SSL configuration
Write a print statement to display the ssl_config dictionary.
Kafka
Need a hint?

Use print(ssl_config) to show the filtered SSL settings.