Skip to content

Commit 5a720a1

Browse files
Merge pull request #271425 from sreekzz/patch-25
HDInsight Kafka doc changes on TLS 1.3 support
2 parents c3f5e43 + 7643660 commit 5a720a1

File tree

2 files changed

+68
-31
lines changed

2 files changed

+68
-31
lines changed

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

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
title: Apache Kafka TLS encryption & authentication for ESP Kafka Clusters - Azure HDInsight
3-
description: Set up TLS encryption for communication between Kafka clients and Kafka brokers, Set up SSL authentication of clients for ESP Kafka clusters
3+
description: Set up TLS encryption for communication between Kafka clients and Kafka brokers, Set up SSL authentication of clients for ESP Kafka clusters.
44
ms.service: hdinsight
55
ms.topic: how-to
66
ms.custom: hdinsightactive
7-
ms.date: 04/03/2023
7+
ms.date: 04/08/2024
88
---
99

1010
# Set up TLS encryption and authentication for ESP Apache Kafka cluster in Azure HDInsight
@@ -37,10 +37,10 @@ The summary of the broker setup process is as follows:
3737
1. Once you have all of the certificates, put the certs into the cert store.
3838
1. Go to Ambari and change the configurations.
3939

40-
Use the following detailed instructions to complete the broker setup:
40+
Use the following detailed instructions to complete the broker setup:
4141

42-
> [!Important]
43-
> In the following code snippets wnX is an abbreviation for one of the three worker nodes and should be substituted with `wn0`, `wn1` or `wn2` as appropriate. `WorkerNode0_Name` and `HeadNode0_Name` should be substituted with the names of the respective machines.
42+
> [!Important]
43+
> In the following code snippets wnX is an abbreviation for one of the three worker nodes and should be substituted with `wn0`, `wn1` or `wn2` as appropriate. `WorkerNode0_Name` and `HeadNode0_Name` should be substituted with the names of the respective machines.
4444
4545
1. Perform initial setup on head node 0, which for HDInsight fills the role of the Certificate Authority (CA).
4646

@@ -64,7 +64,7 @@ Use the following detailed instructions to complete the broker setup:
6464
1. SCP the certificate signing request to the CA (headnode0)
6565

6666
```bash
67-
keytool -genkey -keystore kafka.server.keystore.jks -validity 365 -storepass "MyServerPassword123" -keypass "MyServerPassword123" -dname "CN=FQDN_WORKER_NODE" -storetype pkcs12
67+
keytool -genkey -keystore kafka.server.keystore.jks -keyalg RSA -validity 365 -storepass "MyServerPassword123" -keypass "MyServerPassword123" -dname "CN=FQDN_WORKER_NODE" -ext SAN=DNS:FQDN_WORKER_NODE -storetype pkcs12
6868
keytool -keystore kafka.server.keystore.jks -certreq -file cert-file -storepass "MyServerPassword123" -keypass "MyServerPassword123"
6969
scp cert-file sshuser@HeadNode0_Name:~/ssl/wnX-cert-sign-request
7070
```
@@ -128,7 +128,7 @@ To complete the configuration modification, do the following steps:
128128
1. Under **Kafka Broker** set the **listeners** property to `PLAINTEXT://localhost:9092,SASL_SSL://localhost:9093`
129129
1. Under **Advanced kafka-broker** set the **security.inter.broker.protocol** property to `SASL_SSL`
130130
131-
:::image type="content" source="./media/apache-esp-kafka-ssl-encryption-authentication/properties-file-with-sasl.png" alt-text="Screenshot showing how to edit Kafka sasl configuration properties in Ambari." border="true":::
131+
:::image type="content" source="./media/apache-esp-kafka-ssl-encryption-authentication/properties-file-with-sasl.png" alt-text="Screenshot showing how to edit Kafka configuration properties in Ambari." border="true":::
132132
133133
1. Under **Custom kafka-broker** set the **ssl.client.auth** property to `required`.
134134
@@ -144,16 +144,23 @@ To complete the configuration modification, do the following steps:
144144
> 1. ssl.keystore.location and ssl.truststore.location is the complete path of your keystore, truststore location in Certificate Authority (hn0)
145145
> 1. ssl.keystore.password and ssl.truststore.password is the password set for the keystore and truststore. In this case as an example,` MyServerPassword123`
146146
> 1. ssl.key.password is the key set for the keystore and trust store. In this case as an example, `MyServerPassword123`
147-
148-
For HDI version 4.0 or 5.0
149-
150-
a. If you're setting up authentication and encryption, then the screenshot looks like
151147
152-
:::image type="content" source="./media/apache-esp-kafka-ssl-encryption-authentication/properties-file-authentication-as-required.png" alt-text="Screenshot showing how to edit Kafka-env template property in Ambari authentication as required." border="true":::
153-
154-
b. If you are setting up encryption only, then the screenshot looks like
148+
1. To Use TLS 1.3 in Kafka, add following configs to the Kafka configs in Ambari.
149+
1. `ssl.enabled.protocols=TLSv1.3`
150+
1. `ssl.protocol=TLSv1.3`
151+
152+
> [!Important]
153+
> 1. TLS 1.3 works with HDI 5.1 kafka version only.
154+
> 1. If you use TLS 1.3 at server side, you should use TLS 1.3 configs at client too.
155+
156+
1. For HDI version 4.0 or 5.0
157+
1. If you're setting up authentication and encryption, then the screenshot looks like
158+
159+
:::image type="content" source="./media/apache-esp-kafka-ssl-encryption-authentication/properties-file-authentication-as-required.png" alt-text="Screenshot showing how to edit Kafka-env template property in Ambari authentication as required." border="true":::
160+
161+
1. If you are setting up encryption only, then the screenshot looks like
155162

156-
:::image type="content" source="./media/apache-esp-kafka-ssl-encryption-authentication/properties-file-authentication-as-none.png" alt-text="Screenshot showing how to edit Kafka-env template property in Ambari authentication as none." border="true":::
163+
:::image type="content" source="./media/apache-esp-kafka-ssl-encryption-authentication/properties-file-authentication-as-none.png" alt-text="Screenshot showing how to edit Kafka-env template property in Ambari authentication as none." border="true":::
157164

158165
1. Restart all Kafka brokers.
159166

@@ -210,6 +217,11 @@ These steps are detailed in the following code snippets.
210217
ssl.truststore.location=/home/sshuser/ssl/kafka.client.truststore.jks
211218
ssl.truststore.password=MyClientPassword123
212219
```
220+
1. To Use TLS 1.3 add following configs to file `client-ssl-auth.properties`
221+
```config
222+
ssl.enabled.protocols=TLSv1.3
223+
ssl.protocol=TLSv1.3
224+
```
213225
214226
1. Start the admin client with producer and consumer options to verify that both producers and consumers are working on port 9093. Refer to [Verification](apache-kafka-ssl-encryption-authentication.md#verification) section for steps needed to verify the setup using console producer/consumer.
215227
@@ -282,7 +294,7 @@ The details of each step are given.
282294
cd ssl
283295
```
284296
285-
1. Create client store with signed cert, and import CA certificate into the keystore and truststore on client machine (hn1):
297+
1. Create client store with signed certificate, and import CA certificate into the keystore, and truststore on client machine (hn1):
286298
287299
```bash
288300
keytool -keystore kafka.client.truststore.jks -alias CARoot -import -file ca-cert -storepass "MyClientPassword123" -keypass "MyClientPassword123" -noprompt
@@ -306,6 +318,11 @@ The details of each step are given.
306318
ssl.key.password=MyClientPassword123
307319
308320
```
321+
1. To Use TLS 1.3 add following configs to file `client-ssl-auth.properties`
322+
```config
323+
ssl.enabled.protocols=TLSv1.3
324+
ssl.protocol=TLSv1.3
325+
```
309326
310327
## Verification
311328
@@ -317,7 +334,7 @@ Run these steps on the client machine.
317334
### Kafka 2.1 or above
318335
319336
> [!Note]
320-
> Below commands will work if you are either using `kafka` user or a custom user which have access to do CRUD operation.
337+
> Below commands will work if you're either using `kafka` user or a custom user which have access to do CRUD operation.
321338

322339
:::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":::
323340

@@ -327,7 +344,7 @@ Using Command Line Tool
327344

328345
1. `klist`
329346

330-
If ticket is present, then you are good to proceed. Otherwise generate a Kerberos principle and keytab using below command.
347+
If ticket is present, then you're good to proceed. Otherwise generate a Kerberos principle and keytab using below command.
331348
332349
1. `ktutil`
333350

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

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ 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/20/2024
7+
ms.date: 04/08/2024
88
---
99

10-
# Set up TLS encryption and authentication for Non ESP Apache Kafka cluster in Azure HDInsight
10+
# Set up TLS encryption and authentication for Non-ESP Apache Kafka cluster in Azure HDInsight
1111

1212
This article shows you how to set up Transport Layer Security (TLS) encryption, previously known as Secure Sockets Layer (SSL) encryption, between Apache Kafka clients and Apache Kafka brokers. It also shows you how to set up authentication of clients (sometimes referred to as two-way TLS).
1313

@@ -37,11 +37,11 @@ The summary of the broker setup process is as follows:
3737
1. Once you have all of the certificates, put the certs into the cert store.
3838
1. Go to Ambari and change the configurations.
3939

40-
Use the following detailed instructions to complete the broker setup:
41-
42-
> [!Important]
43-
> In the following code snippets wnX is an abbreviation for one of the three worker nodes and should be substituted with `wn0`, `wn1` or `wn2` as appropriate. `WorkerNode0_Name` and `HeadNode0_Name` should be substituted with the names of the respective machines.
40+
Use the following detailed instructions to complete the broker setup:
4441

42+
> [!Important]
43+
> In the following code snippets wnX is an abbreviation for one of the three worker nodes and should be substituted with `wn0`, `wn1` or `wn2` as appropriate. `WorkerNode0_Name` and `HeadNode0_Name` should be substituted with the names of the respective machines.
44+
4545
1. Perform initial setup on head node 0, which for HDInsight fills the role of the Certificate Authority (CA).
4646

4747
```bash
@@ -64,7 +64,7 @@ Use the following detailed instructions to complete the broker setup:
6464
1. SCP the certificate signing request to the CA (headnode0)
6565

6666
```bash
67-
keytool -genkey -keystore kafka.server.keystore.jks -validity 365 -storepass "MyServerPassword123" -keypass "MyServerPassword123" -dname "CN=FQDN_WORKER_NODE" -storetype pkcs12
67+
keytool -genkey -keystore kafka.server.keystore.jks -keyalg RSA -validity 365 -storepass "MyServerPassword123" -keypass "MyServerPassword123" -dname "CN=FQDN_WORKER_NODE" -ext SAN=DNS:FQDN_WORKER_NODE -storetype pkcs12
6868
keytool -keystore kafka.server.keystore.jks -certreq -file cert-file -storepass "MyServerPassword123" -keypass "MyServerPassword123"
6969
scp cert-file sshuser@HeadNode0_Name:~/ssl/wnX-cert-sign-request
7070
```
@@ -145,20 +145,29 @@ To complete the configuration modification, do the following steps:
145145
> 1. ssl.keystore.password and ssl.truststore.password is the password set for the keystore and truststore. In this case as an example, `MyServerPassword123`
146146
> 1. ssl.key.password is the key set for the keystore and trust store. In this case as an example, `MyServerPassword123`
147147
148+
1. To Use TLS 1.3 in Kafka
149+
150+
Add following configs to the kafka configs in Ambari
151+
> 1. `ssl.enabled.protocols=TLSv1.3`
152+
> 1. `ssl.protocol=TLSv1.3`
153+
>
154+
> [!Important]
155+
> 1. TLS 1.3 works with HDI 5.1 kafka version only.
156+
> 1. If you use TLS 1.3 at server side, you should use TLS 1.3 configs at client too.
148157
149-
For HDI version 4.0 or 5.0
158+
1. For HDI version 4.0 or 5.0
150159
151160
1. If you're setting up authentication and encryption, then the screenshot looks like
152161

153-
:::image type="content" source="./media/apache-kafka-ssl-encryption-authentication/editing-configuration-kafka-env-four.png" alt-text="Editing kafka-env template property in Ambari four." border="true":::
162+
:::image type="content" source="./media/apache-kafka-ssl-encryption-authentication/editing-configuration-kafka-env-four.png" alt-text="Editing kafka-env template property in Ambari four." border="true":::
154163

155-
1. If you are setting up encryption only, then the screenshot looks like
164+
1. If you're setting up encryption only, then the screenshot looks like
156165
157-
:::image type="content" source="./media/apache-kafka-ssl-encryption-authentication/editing-configuration-kafka-env-four-encryption-only.png" alt-text="Screenshot showing how to edit kafka-env template property field in Ambari for encryption only." border="true":::
166+
:::image type="content" source="./media/apache-kafka-ssl-encryption-authentication/editing-configuration-kafka-env-four-encryption-only.png" alt-text="Screenshot showing how to edit kafka-env template property field in Ambari for encryption only." border="true":::
158167
159-
160168
1. Restart all Kafka brokers.
161169
170+
162171
## Client setup (without authentication)
163172
164173
If you don't need authentication, the summary of the steps to set up only TLS encryption are:
@@ -210,9 +219,15 @@ These steps are detailed in the following code snippets.
210219
ssl.truststore.location=/home/sshuser/ssl/kafka.client.truststore.jks
211220
ssl.truststore.password=MyClientPassword123
212221
```
222+
1. To Use TLS 1.3 add following configs to file `client-ssl-auth.properties`
223+
```config
224+
ssl.enabled.protocols=TLSv1.3
225+
ssl.protocol=TLSv1.3
226+
```
213227

214228
1. Start the admin client with producer and consumer options to verify that both producers and consumers are working on port 9093. Refer to [Verification](apache-kafka-ssl-encryption-authentication.md#verification) section for steps needed to verify the setup using console producer/consumer.
215229

230+
216231
## Client setup (with authentication)
217232

218233
> [!Note]
@@ -282,7 +297,7 @@ The details of each step are given.
282297
cd ssl
283298
```
284299

285-
1. Create client store with signed cert, and import ca cert into the keystore and truststore on client machine (hn1):
300+
1. Create client store with signed cert, import CA cert into the keystore, and truststore on client machine (hn1):
286301

287302
```bash
288303
keytool -keystore kafka.client.truststore.jks -alias CARoot -import -file ca-cert -storepass "MyClientPassword123" -keypass "MyClientPassword123" -noprompt
@@ -302,6 +317,11 @@ The details of each step are given.
302317
ssl.keystore.password=MyClientPassword123
303318
ssl.key.password=MyClientPassword123
304319
```
320+
1. To Use TLS 1.3 add following configs to file `client-ssl-auth.properties`
321+
```config
322+
ssl.enabled.protocols=TLSv1.3
323+
ssl.protocol=TLSv1.3
324+
```
305325

306326
## Verification
307327

0 commit comments

Comments
 (0)