Skip to content

Commit da86d2a

Browse files
authored
Updated as the commands
Updated as the commands As per Piyush Gupta's review comments.
1 parent b055056 commit da86d2a

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

articles/hdinsight/kafka/apache-esp-kafka-ssl-encryption-authentication.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Set up TLS encryption for communication between Kafka clients and K
44
ms.service: hdinsight
55
ms.topic: how-to
66
ms.custom: hdinsightactive
7-
ms.date: 02/17/2023
7+
ms.date: 04/03/2023
88
---
99

1010
# Set up TLS encryption and authentication for ESP Apache Kafka cluster in Azure HDInsight
@@ -317,25 +317,42 @@ Run these steps on the client machine.
317317
### Kafka 2.1 or above
318318
319319
> [!Note]
320-
> Below commands will work if you are either using Kafka user or a custom user which have access to do CRUD operation.
320+
> Below commands will work if you are either using kafka user or a custom user which have access to do CRUD operation.
321321
322322
:::image type="content" source="./media/apache-esp-kafka-ssl-encryption-authentication/access-to-crud-operation.png" alt-text="Screenshot showing how to provide access CRUD operations." border="true":::
323323
324324
Using Command Line Tool
325325
326-
1. Create a topic if it doesn't exist already.
326+
1. Make sure you check the local kerberos ticket for custom user you want to use to submit commands.
327+
328+
1. `klist`
329+
330+
If ticket is present, then you are good to proceed. Otherwise generate a Kerberos principle and keytab using below command.
331+
332+
1. `ktutil`
333+
334+
```
335+
ktutil: addent -password -p [email protected] -k 1 -e RC4-HMAC
336+
Password for [email protected]:
337+
ktutil: wkt user1.keytab
338+
ktutil: q
339+
kinit –kt espkafkauser.keytab [email protected]
340+
```
327341
342+
1. Klist again to check kerberos cached ticket.
343+
344+
1. Create a topic if it doesn't exist already.
328345
```bash
329346
sudo su kafka –c "/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --zookeeper <ZOOKEEPER_NODE>:2181 --create --topic topic1 --partitions 2 --replication-factor 2"
330347
```
331-
To use a keytab, create a JAAS file with the following content. Be sure to point the keyTab property to your keytab file and reference the principal used inside the keytab. Following is a sample JAAS file created and placed in the location in VM: **/home/hdiuser/kafka_client_jaas_keytab.conf**
348+
To use a keytab, create a Keytab file with the following content. Be sure to point the Keytab property to your Keytab file and reference the principal used inside the Keytab. Following is a sample JAAS file created and placed in the location in VM: **/home/sshuser/kafka_client_jaas_keytab.conf**
332349

333350
```
334351
KafkaClient {
335352
com.sun.security.auth.module.Krb5LoginModule required
336353
useKeyTab=true
337354
storeKey=true
338-
keyTab="/home/hdiuser/espkafkauser.keytab"
355+
keyTab="/home/sshuser/espkafkauser.keytab"
339356
principal="[email protected]";
340357
};
341358
```
@@ -351,7 +368,7 @@ Using Command Line Tool
351368
1. Open another ssh connection to client machine and start console consumer and provide the path to `client-ssl-auth.properties` as a configuration file for the consumer.
352369

353370
```bash
354-
export KAFKA_OPTS="-Djava.security.auth.login.config=/home/hdiuser/kafka_client_jaas_keytab.conf"
371+
export KAFKA_OPTS="-Djava.security.auth.login.config=/home/sshuser/kafka_client_jaas_keytab.conf"
355372

356373
/usr/hdp/current/kafka-broker/bin/kafka-console-consumer.sh --bootstrap-server <FQDN_WORKER_NODE>:9093 --topic topic1 --consumer.config ~/ssl/client-ssl-auth.properties --from-beginning
357374
```

0 commit comments

Comments
 (0)