Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Using Client Authentication with Kafka

If you want to expose your Kafka brokers so that external clients can communicate with them, it is important to make sure that your implementation is secure. In some situations, this means implementing client authentication. In this lab, you will have the opportunity to work hands-on with one of the client authentication methods available in Kafka: client certificates. You will implement authentication with client certificates in an existing cluster, and then authenticate as a client to verify that your implementation works. This will give you hands-on experience with the process of securing a Kafka cluster.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Sep 17, 2025
Duration
30m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Generate Your Client Certificate Files
    1. Generate a client certificate. Choose a password for the client keystore when prompted:
    cd ~/certs/
    
    keytool -keystore client.keystore.jks -alias kafkauser -validity 365 -genkey -keyalg RSA -dname "CN=kafkauser, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown"
    
    1. Sign the key, then import the certificate authority and signed key into the keystore. When asked for the password to the ca-key, enter the password AllTheKeys:
    keytool -keystore client.keystore.jks -alias kafkauser -certreq -file client-cert-file
    
    openssl x509 -req -CA ca-cert -CAkey ca-key -in client-cert-file -out client-cert-signed -days 365 -CAcreateserial
    
    keytool -keystore client.keystore.jks -alias CARoot -import -file ca-cert
    
    keytool -keystore client.keystore.jks -alias kafkauser -import -file client-cert-signed
    
    1. Move the client keystore into an appropriate location:
    sudo cp client.keystore.jks /var/private/ssl/
    
    sudo chown root:root /var/private/ssl/client.keystore.jks
    
  2. Challenge

    Enable Client Authentication for the Broker
    1. Set client authentication to required in server.properties:
    sudo vi /etc/kafka/server.properties
    
    1. Locate the line that begins with ssl.client.auth and change it:
    ssl.client.auth=required
    
    1. Restart Kafka and then verify that everything is working:
    sudo systemctl restart confluent-kafka
    
    sudo systemctl status confluent-kafka
    
  3. Challenge

    Add Client Authentication Settings to Your Client Config File
    1. Edit client-ssl.properties:
    cd ~/
    
    vi client-ssl.properties
    
    1. Add the following lines:
    ssl.keystore.location=/var/private/ssl/client.keystore.jks
    ssl.keystore.password=<your client keystore password>
    ssl.key.password=<your client key password>
    
    1. Create a console consumer using client authentication to make verify that everything is working:
    kafka-console-consumer --bootstrap-server zoo1:9093 --topic inventory_purchases --from-beginning --consumer.config client-ssl.properties
    
About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight