Security best practices in Kafka - Commands & Configuration
listeners=SASL_SSL://:9093 advertised.listeners=SASL_SSL://localhost:9093 security.inter.broker.protocol=SASL_SSL sasl.enabled.mechanisms=PLAIN sasl.mechanism.inter.broker.protocol=PLAIN ssl.keystore.location=/var/private/ssl/kafka.server.keystore.jks ssl.keystore.password=changeit ssl.key.password=changeit ssl.truststore.location=/var/private/ssl/kafka.server.truststore.jks ssl.truststore.password=changeit authorizer.class.name=kafka.security.auth.SimpleAclAuthorizer allow.everyone.if.no.acl.found=false super.users=User:admin
listeners: Defines how Kafka accepts connections securely using SASL_SSL.
advertised.listeners: How Kafka tells clients to connect.
security.inter.broker.protocol: Secures communication between Kafka servers.
sasl.enabled.mechanisms: Enables PLAIN authentication.
ssl.keystore.location/password: Location and password for server keys.
ssl.truststore.location/password: Location and password for trusted certificates.
authorizer.class.name: Enables access control lists (ACLs) for permissions.
allow.everyone.if.no.acl.found: Denies access if no ACL is set.
super.users: Defines admin users with full access.
kafka-acls --authorizer-properties zookeeper.connect=localhost:2181 --add --allow-principal User:alice --operation Read --topic my-topic--add - Adds a new ACL rule--allow-principal - Specifies the user allowed--operation - Defines the allowed action (Read)--topic - Specifies the topic for the ACLkafka-configs --zookeeper localhost:2181 --entity-type users --entity-name alice --alter --add-config 'sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="alice" password="alice-secret";'
--alter - Changes existing user config--add-config - Adds SASL authentication detailskafka-topics --bootstrap-server localhost:9093 --describe --topic my-topic--describe - Shows topic details--bootstrap-server - Connects to Kafka securelyIf you remember nothing else from this pattern, remember: securing Kafka means controlling who connects, encrypting data, and setting clear permissions.