You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/security/authentication-using-sasl.md
+26-26Lines changed: 26 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ Kafka uses the Java Authentication and Authorization Service ([JAAS](https://doc
36
36
37
37
Brokers may also configure JAAS using the broker configuration property `sasl.jaas.config`. The property name must be prefixed with the listener prefix including the SASL mechanism, i.e. `listener.name.{listenerName}.{saslMechanism}.sasl.jaas.config`. Only one login module may be specified in the config value. If multiple mechanisms are configured on a listener, configs must be provided for each mechanism using the listener and mechanism prefix. For example,
@@ -104,13 +104,13 @@ Kafka supports the following SASL mechanisms:
104
104
105
105
1. Configure a SASL port in server.properties, by adding at least one of SASL_PLAINTEXT or SASL_SSL to the _listeners_ parameter, which contains one or more comma-separated values:
106
106
107
-
```properties
107
+
```java-properties
108
108
listeners=SASL_PLAINTEXT://host.name:port
109
109
```
110
110
111
111
If you are only configuring a SASL port (or if you want the Kafka brokers to authenticate each other using SASL) then make sure you set the same SASL protocol for inter-broker communication:
@@ -168,7 +168,7 @@ Note: When establishing connections to brokers via SASL, clients may perform a r
168
168
169
169
4. Configure SASL port and SASL mechanisms in server.properties as described here. For example:
170
170
171
-
```properties
171
+
```java-properties
172
172
listeners=SASL_PLAINTEXT://host.name:port
173
173
security.inter.broker.protocol=SASL_PLAINTEXT
174
174
sasl.mechanism.inter.broker.protocol=GSSAPI
@@ -177,7 +177,7 @@ Note: When establishing connections to brokers via SASL, clients may perform a r
177
177
178
178
We must also configure the service name in server.properties, which should match the principal name of the kafka brokers. In the above example, principal is "kafka/kafka1.hostname.com@EXAMPLE.com", so:
179
179
180
-
```properties
180
+
```java-properties
181
181
sasl.kerberos.service.name=kafka
182
182
```
183
183
@@ -186,7 +186,7 @@ Note: When establishing connections to brokers via SASL, clients may perform a r
186
186
To configure SASL authentication on the clients:
187
187
1. Clients (producers, consumers, connect workers, etc) will authenticate to the cluster with their own principal (usually with the same name as the user running the client), so obtain or create these principals as needed. Then configure the JAAS configuration property for each client. Different clients within a JVM may run as different users by specifying different principals. The property `sasl.jaas.config` in producer.properties or consumer.properties describes how clients like producer and consumer can connect to the Kafka Broker. The following is an example configuration for a client using a keytab (recommended for long-running processes):
@@ -211,7 +211,7 @@ JAAS configuration for clients may alternatively be specified as a JVM parameter
211
211
212
212
4. Configure the following properties in producer.properties or consumer.properties:
213
213
214
-
```properties
214
+
```java-properties
215
215
security.protocol=SASL_PLAINTEXT (or SASL_SSL)
216
216
sasl.mechanism=GSSAPI
217
217
sasl.kerberos.service.name=kafka
@@ -245,7 +245,7 @@ Under the default implementation of `principal.builder.class`, the username is u
245
245
246
246
3. Configure SASL port and SASL mechanisms in server.properties as described here. For example:
247
247
248
-
```properties
248
+
```java-properties
249
249
listeners=SASL_SSL://host.name:port
250
250
security.inter.broker.protocol=SASL_SSL
251
251
sasl.mechanism.inter.broker.protocol=PLAIN
@@ -257,7 +257,7 @@ Under the default implementation of `principal.builder.class`, the username is u
257
257
To configure SASL authentication on the clients:
258
258
1. Configure the JAAS configuration property for each client in producer.properties or consumer.properties. The login module describes how the clients like producer and consumer can connect to the Kafka Broker. The following is an example configuration for a client for the PLAIN mechanism:
1. Configure the JAAS configuration property for each client in producer.properties or consumer.properties. The login module describes how the clients like producer and consumer can connect to the Kafka Broker. The following is an example configuration for a client for the SCRAM mechanisms:
@@ -365,7 +365,7 @@ JAAS configuration for clients may alternatively be specified as a JVM parameter
365
365
366
366
2. Configure the following properties in producer.properties or consumer.properties:
367
367
368
-
```properties
368
+
```java-properties
369
369
security.protocol=SASL_SSL
370
370
sasl.mechanism=SCRAM-SHA-256 (or SCRAM-SHA-512)
371
371
```
@@ -453,7 +453,7 @@ Set to a positive integer value if you wish to allow up to some number of positi
453
453
454
454
3. Configure SASL port and SASL mechanisms in server.properties as described here. For example:
455
455
456
-
```properties
456
+
```java-properties
457
457
listeners=SASL_SSL://host.name:port (or SASL_PLAINTEXT if non-production)
458
458
security.inter.broker.protocol=SASL_SSL (or SASL_PLAINTEXT if non-production)
459
459
sasl.mechanism.inter.broker.protocol=OAUTHBEARER
@@ -478,7 +478,7 @@ Set to a positive integer value if you wish to allow up to some number of positi
478
478
479
479
3. Configure SASL port and SASL mechanisms in server.properties as described here. For example:
480
480
481
-
```properties
481
+
```java-properties
482
482
listeners=SASL_SSL://host.name:port
483
483
security.inter.broker.protocol=SASL_SSL
484
484
sasl.mechanism.inter.broker.protocol=OAUTHBEARER
@@ -502,7 +502,7 @@ The OAUTHBEARER broker configuration includes:
502
502
To configure SASL authentication on the clients:
503
503
1. Configure the JAAS configuration property for each client in producer.properties or consumer.properties. The login module describes how the clients like producer and consumer can connect to the Kafka Broker. The following is an example configuration for a client for the OAUTHBEARER mechanisms:
@@ -589,7 +589,7 @@ JAAS configuration for clients may alternatively be specified as a JVM parameter
589
589
590
590
2. Configure the following properties in producer.properties or consumer.properties:
591
591
592
-
```properties
592
+
```java-properties
593
593
security.protocol=SASL_SSL (or SASL_PLAINTEXT if non-production)
594
594
sasl.mechanism=OAUTHBEARER
595
595
```
@@ -600,7 +600,7 @@ JAAS configuration for clients may alternatively be specified as a JVM parameter
600
600
To configure SASL authentication on the clients:
601
601
1. Configure the JAAS configuration property for each client in producer.properties or consumer.properties. The login module describes how the clients like producer and consumer can connect to the Kafka Broker. The following is an example configuration for a client for the OAUTHBEARER mechanisms:
@@ -610,7 +610,7 @@ JAAS configuration for clients may alternatively be specified as a JVM parameter
610
610
611
611
For example, if using the OAuth `client_credentials` grant type with a client secret to communicate with the OAuth identity provider, the configuration might look like this:
@@ -639,7 +639,7 @@ When using client assertion with dynamically-generated JWTs (recommended), the c
639
639
640
640
Alternatively, a pre-generated JWT assertion can be read from a file. This is useful when assertions are generated by an external process or secrets manager:
@@ -672,7 +672,7 @@ This selection is made at configuration time. Once a method is selected, it pers
672
672
673
673
Or, if using the OAuth `urn:ietf:params:oauth:grant-type:jwt-bearer` grant type to communicate with the OAuth identity provider, the `JwtBearerJwtRetriever` must be configured explicitly since the default retriever delegates to `ClientCredentialsJwtRetriever`:
sasl.mechanism.inter.broker.protocol=GSSAPI (or one of the other enabled mechanisms)
779
779
```
@@ -857,7 +857,7 @@ Configuring Kafka Clients:
857
857
858
858
1. Configure the JAAS configuration property for each client in producer.properties or consumer.properties. The login module describes how the clients like producer and consumer can connect to the Kafka Broker. The following is an example configuration for a client for the token authentication:
Copy file name to clipboardExpand all lines: docs/security/authorization-and-acls.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ type: docs
28
28
29
29
Kafka ships with a pluggable authorization framework, which is configured with the `authorizer.class.name` property in the server configuration. Configured implementations must extend `org.apache.kafka.server.authorizer.Authorizer`. Kafka provides a default implementation which store ACLs in the cluster metadata (KRaft metadata log). For KRaft clusters, use the following configuration on all nodes (brokers, controllers, or combined broker/controller nodes):
@@ -42,13 +42,13 @@ If a resource (R) does not have any ACLs defined, meaning that no ACL matches th
42
42
43
43
If you prefer that resources without any ACLs be accessible by all users (instead of just super users), you can change the default behavior. To do this, add the following line to your server.properties file:
44
44
45
-
```properties
45
+
```java-properties
46
46
allow.everyone.if.no.acl.found=true
47
47
```
48
48
49
49
With this setting enabled, if a resource does not have any ACLs defined, Kafka will allow access to everyone. If a resource has one or more ACLs defined, those ACL rules will be enforced as usual, regardless of the setting. One can also add super users in server.properties like the following (note that the delimiter is semicolon since SSL user names may contain comma). Default PrincipalType string "User" is case sensitive.
50
50
51
-
```properties
51
+
```java-properties
52
52
super.users=User:Bob;User:Alice
53
53
```
54
54
@@ -79,7 +79,7 @@ DEFAULT
79
79
Above rules translate distinguished name "CN=serviceuser,OU=ServiceUsers,O=Unknown,L=Unknown,ST=Unknown,C=Unknown" to "serviceuser" and "CN=adminUser,OU=Admin,O=Unknown,L=Unknown,ST=Unknown,C=Unknown" to "adminuser@admin".
80
80
For advanced use cases, one can customize the name by setting a customized PrincipalBuilder in server.properties like the following.
@@ -276,7 +276,7 @@ Note: ssl.truststore.password is technically optional but highly recommended. If
276
276
6. ssl.secure.random.implementation=SHA1PRNG
277
277
If you want to enable SSL for inter-broker communication, add the following to the server.properties file (it defaults to PLAINTEXT):
278
278
279
-
```properties
279
+
```java-properties
280
280
security.inter.broker.protocol=SSL
281
281
```
282
282
@@ -313,15 +313,15 @@ If the certificate does not show up or if there are any other error messages the
313
313
SSL is supported only for the new Kafka Producer and Consumer, the older API is not supported. The configs for SSL will be the same for both producer and consumer.
314
314
If client authentication is not required in the broker, then the following is a minimal configuration example:
Note: ssl.truststore.password is technically optional but highly recommended. If a password is not set access to the truststore is still available, but integrity checking is disabled. If client authentication is required, then a keystore must be created like in step 1 and the following must also be configured:
Copy file name to clipboardExpand all lines: docs/security/incorporating-security-features-in-a-running-cluster.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,56 +43,56 @@ When performing an incremental bounce stop the brokers cleanly via a SIGTERM. It
43
43
44
44
As an example, say we wish to encrypt both broker-client and broker-broker communication with SSL. In the first incremental bounce, an SSL port is opened on each node:
In the final bounce we secure the cluster by closing the PLAINTEXT port:
66
66
67
-
```properties
67
+
```java-properties
68
68
listeners=SSL://broker1:9092
69
69
security.inter.broker.protocol=SSL
70
70
```
71
71
72
72
Alternatively we might choose to open multiple ports so that different protocols can be used for broker-broker and broker-client communication. Say we wished to use SSL encryption throughout (i.e. for broker-broker and broker-client communication) but we'd like to add SASL authentication to the broker-client connection also. We would achieve this by opening two additional ports during the first bounce:
0 commit comments