Skip to content

Commit 491700f

Browse files
committed
change 'properties' identifier to 'java-properties'
1 parent 73c1d32 commit 491700f

5 files changed

Lines changed: 49 additions & 49 deletions

docs/security/authentication-using-sasl.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Kafka uses the Java Authentication and Authorization Service ([JAAS](https://doc
3636

3737
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,
3838

39-
```properties
39+
```java-properties
4040
listener.name.sasl_ssl.scram-sha-256.sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required \
4141
username="admin" \
4242
password="admin-secret";
@@ -104,13 +104,13 @@ Kafka supports the following SASL mechanisms:
104104

105105
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:
106106

107-
```properties
107+
```java-properties
108108
listeners=SASL_PLAINTEXT://host.name:port
109109
```
110110

111111
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:
112112

113-
```properties
113+
```java-properties
114114
security.inter.broker.protocol=SASL_PLAINTEXT (or SASL_SSL)
115115
```
116116

@@ -168,7 +168,7 @@ Note: When establishing connections to brokers via SASL, clients may perform a r
168168

169169
4. Configure SASL port and SASL mechanisms in server.properties as described here. For example:
170170

171-
```properties
171+
```java-properties
172172
listeners=SASL_PLAINTEXT://host.name:port
173173
security.inter.broker.protocol=SASL_PLAINTEXT
174174
sasl.mechanism.inter.broker.protocol=GSSAPI
@@ -177,7 +177,7 @@ Note: When establishing connections to brokers via SASL, clients may perform a r
177177

178178
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:
179179

180-
```properties
180+
```java-properties
181181
sasl.kerberos.service.name=kafka
182182
```
183183

@@ -186,7 +186,7 @@ Note: When establishing connections to brokers via SASL, clients may perform a r
186186
To configure SASL authentication on the clients:
187187
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):
188188

189-
```properties
189+
```java-properties
190190
sasl.jaas.config=com.sun.security.auth.module.Krb5LoginModule required \
191191
useKeyTab=true \
192192
storeKey=true \
@@ -196,7 +196,7 @@ To configure SASL authentication on the clients:
196196

197197
For command-line utilities like kafka-console-consumer or kafka-console-producer, kinit can be used along with "useTicketCache=true" as in:
198198

199-
```properties
199+
```java-properties
200200
sasl.jaas.config=com.sun.security.auth.module.Krb5LoginModule required \
201201
useTicketCache=true;
202202
```
@@ -211,7 +211,7 @@ JAAS configuration for clients may alternatively be specified as a JVM parameter
211211

212212
4. Configure the following properties in producer.properties or consumer.properties:
213213

214-
```properties
214+
```java-properties
215215
security.protocol=SASL_PLAINTEXT (or SASL_SSL)
216216
sasl.mechanism=GSSAPI
217217
sasl.kerberos.service.name=kafka
@@ -245,7 +245,7 @@ Under the default implementation of `principal.builder.class`, the username is u
245245

246246
3. Configure SASL port and SASL mechanisms in server.properties as described here. For example:
247247

248-
```properties
248+
```java-properties
249249
listeners=SASL_SSL://host.name:port
250250
security.inter.broker.protocol=SASL_SSL
251251
sasl.mechanism.inter.broker.protocol=PLAIN
@@ -257,7 +257,7 @@ Under the default implementation of `principal.builder.class`, the username is u
257257
To configure SASL authentication on the clients:
258258
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:
259259

260-
```properties
260+
```java-properties
261261
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
262262
username="alice" \
263263
password="alice-secret";
@@ -269,7 +269,7 @@ JAAS configuration for clients may alternatively be specified as a JVM parameter
269269

270270
2. Configure the following properties in producer.properties or consumer.properties:
271271

272-
```properties
272+
```java-properties
273273
security.protocol=SASL_SSL
274274
sasl.mechanism=PLAIN
275275
```
@@ -341,7 +341,7 @@ $ bin/kafka-configs.sh --bootstrap-server localhost:9092 --alter \
341341

342342
3. Configure SASL port and SASL mechanisms in server.properties as described here. For example:
343343

344-
```properties
344+
```java-properties
345345
listeners=SASL_SSL://host.name:port
346346
security.inter.broker.protocol=SASL_SSL
347347
sasl.mechanism.inter.broker.protocol=SCRAM-SHA-256 (or SCRAM-SHA-512)
@@ -353,7 +353,7 @@ $ bin/kafka-configs.sh --bootstrap-server localhost:9092 --alter \
353353
To configure SASL authentication on the clients:
354354
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:
355355

356-
```properties
356+
```java-properties
357357
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required \
358358
username="alice" \
359359
password="alice-secret";
@@ -365,7 +365,7 @@ JAAS configuration for clients may alternatively be specified as a JVM parameter
365365

366366
2. Configure the following properties in producer.properties or consumer.properties:
367367

368-
```properties
368+
```java-properties
369369
security.protocol=SASL_SSL
370370
sasl.mechanism=SCRAM-SHA-256 (or SCRAM-SHA-512)
371371
```
@@ -453,7 +453,7 @@ Set to a positive integer value if you wish to allow up to some number of positi
453453

454454
3. Configure SASL port and SASL mechanisms in server.properties as described here. For example:
455455

456-
```properties
456+
```java-properties
457457
listeners=SASL_SSL://host.name:port (or SASL_PLAINTEXT if non-production)
458458
security.inter.broker.protocol=SASL_SSL (or SASL_PLAINTEXT if non-production)
459459
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
478478

479479
3. Configure SASL port and SASL mechanisms in server.properties as described here. For example:
480480

481-
```properties
481+
```java-properties
482482
listeners=SASL_SSL://host.name:port
483483
security.inter.broker.protocol=SASL_SSL
484484
sasl.mechanism.inter.broker.protocol=OAUTHBEARER
@@ -502,7 +502,7 @@ The OAUTHBEARER broker configuration includes:
502502
To configure SASL authentication on the clients:
503503
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:
504504

505-
```properties
505+
```java-properties
506506
sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required \
507507
unsecuredLoginStringClaim_sub="alice";
508508
```
@@ -589,7 +589,7 @@ JAAS configuration for clients may alternatively be specified as a JVM parameter
589589

590590
2. Configure the following properties in producer.properties or consumer.properties:
591591

592-
```properties
592+
```java-properties
593593
security.protocol=SASL_SSL (or SASL_PLAINTEXT if non-production)
594594
sasl.mechanism=OAUTHBEARER
595595
```
@@ -600,7 +600,7 @@ JAAS configuration for clients may alternatively be specified as a JVM parameter
600600
To configure SASL authentication on the clients:
601601
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:
602602

603-
```properties
603+
```java-properties
604604
sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required ;
605605
```
606606

@@ -610,7 +610,7 @@ JAAS configuration for clients may alternatively be specified as a JVM parameter
610610

611611
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:
612612

613-
```properties
613+
```java-properties
614614
security.protocol=SASL_SSL
615615
sasl.mechanism=OAUTHBEARER
616616
sasl.oauthbearer.client.credentials.client.id=jdoe
@@ -623,7 +623,7 @@ Alternatively, the `client_credentials` grant type also supports client assertio
623623

624624
When using client assertion with dynamically-generated JWTs (recommended), the configuration might look like this:
625625

626-
```properties
626+
```java-properties
627627
security.protocol=SASL_SSL
628628
sasl.mechanism=OAUTHBEARER
629629
sasl.oauthbearer.token.endpoint.url=https://example.com/oauth2/v1/token
@@ -639,7 +639,7 @@ When using client assertion with dynamically-generated JWTs (recommended), the c
639639

640640
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:
641641

642-
```properties
642+
```java-properties
643643
security.protocol=SASL_SSL
644644
sasl.mechanism=OAUTHBEARER
645645
sasl.oauthbearer.token.endpoint.url=https://example.com/oauth2/v1/token
@@ -672,7 +672,7 @@ This selection is made at configuration time. Once a method is selected, it pers
672672

673673
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`:
674674

675-
```properties
675+
```java-properties
676676
security.protocol=SASL_SSL
677677
sasl.mechanism=OAUTHBEARER
678678
sasl.oauthbearer.jwt.retriever.class=org.apache.kafka.common.security.oauthbearer.JwtBearerJwtRetriever
@@ -767,13 +767,13 @@ Production use cases will also require writing an implementation of `org.apache.
767767

768768
2. Enable the SASL mechanisms in server.properties:
769769

770-
```properties
770+
```java-properties
771771
sasl.enabled.mechanisms=GSSAPI,PLAIN,SCRAM-SHA-256,SCRAM-SHA-512,OAUTHBEARER
772772
```
773773

774774
3. Specify the SASL security protocol and mechanism for inter-broker communication in server.properties if required:
775775

776-
```properties
776+
```java-properties
777777
security.inter.broker.protocol=SASL_PLAINTEXT (or SASL_SSL)
778778
sasl.mechanism.inter.broker.protocol=GSSAPI (or one of the other enabled mechanisms)
779779
```
@@ -857,7 +857,7 @@ Configuring Kafka Clients:
857857

858858
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:
859859

860-
```properties
860+
```java-properties
861861
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required \
862862
username="tokenID123" \
863863
password="lAYYSFmLs4bTjf+lTZ1LCHR/ZZFNA==" \

docs/security/authorization-and-acls.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type: docs
2828

2929
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):
3030

31-
```properties
31+
```java-properties
3232
authorizer.class.name=org.apache.kafka.metadata.authorizer.StandardAuthorizer
3333
```
3434

@@ -42,13 +42,13 @@ If a resource (R) does not have any ACLs defined, meaning that no ACL matches th
4242

4343
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:
4444

45-
```properties
45+
```java-properties
4646
allow.everyone.if.no.acl.found=true
4747
```
4848

4949
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.
5050

51-
```properties
51+
```java-properties
5252
super.users=User:Bob;User:Alice
5353
```
5454

@@ -79,7 +79,7 @@ DEFAULT
7979
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".
8080
For advanced use cases, one can customize the name by setting a customized PrincipalBuilder in server.properties like the following.
8181

82-
```properties
82+
```java-properties
8383
principal.builder.class=CustomizedPrincipalBuilderClass
8484
```
8585

@@ -98,7 +98,7 @@ RULE:[n:string](regexp)s/pattern/replacement/g/U
9898

9999
An example of adding a rule to properly translate user@MYDOMAIN.COM to user while also keeping the default rule in place is:
100100

101-
```properties
101+
```java-properties
102102
sasl.kerberos.principal.to.local.rules=RULE:[1:$1@$0](.*@MYDOMAIN.COM)s/@.*//,DEFAULT
103103
```
104104

docs/security/encryption-and-authentication-using-ssl.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,13 @@ $ openssl x509 -in certificate.crt -text -noout
253253

254254
If SSL is not enabled for inter-broker communication (see below for how to enable it), both PLAINTEXT and SSL ports will be necessary.
255255

256-
```properties
256+
```java-properties
257257
listeners=PLAINTEXT://host.name:port,SSL://host.name:port
258258
```
259259

260260
Following SSL configs are needed on the broker side:
261261

262-
```properties
262+
```java-properties
263263
ssl.keystore.location=/var/private/ssl/server.keystore.jks
264264
ssl.keystore.password=test1234
265265
ssl.key.password=test1234
@@ -276,7 +276,7 @@ Note: ssl.truststore.password is technically optional but highly recommended. If
276276
6. ssl.secure.random.implementation=SHA1PRNG
277277
If you want to enable SSL for inter-broker communication, add the following to the server.properties file (it defaults to PLAINTEXT):
278278

279-
```properties
279+
```java-properties
280280
security.inter.broker.protocol=SSL
281281
```
282282

@@ -313,15 +313,15 @@ If the certificate does not show up or if there are any other error messages the
313313
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.
314314
If client authentication is not required in the broker, then the following is a minimal configuration example:
315315

316-
```properties
316+
```java-properties
317317
security.protocol=SSL
318318
ssl.truststore.location=/var/private/ssl/client.truststore.jks
319319
ssl.truststore.password=test1234
320320
```
321321

322322
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:
323323

324-
```properties
324+
```java-properties
325325
ssl.keystore.location=/var/private/ssl/client.keystore.jks
326326
ssl.keystore.password=test1234
327327
ssl.key.password=test1234

docs/security/incorporating-security-features-in-a-running-cluster.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,56 +43,56 @@ When performing an incremental bounce stop the brokers cleanly via a SIGTERM. It
4343

4444
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:
4545

46-
```properties
46+
```java-properties
4747
listeners=PLAINTEXT://broker1:9091,SSL://broker1:9092
4848
```
4949

5050
We then restart the clients, changing their config to point at the newly opened, secured port:
5151

52-
```properties
52+
```java-properties
5353
bootstrap.servers = [broker1:9092,...]
5454
security.protocol = SSL
5555
...etc
5656
```
5757

5858
In the second incremental server bounce we instruct Kafka to use SSL as the broker-broker protocol (which will use the same SSL port):
5959

60-
```properties
60+
```java-properties
6161
listeners=PLAINTEXT://broker1:9091,SSL://broker1:9092
6262
security.inter.broker.protocol=SSL
6363
```
6464

6565
In the final bounce we secure the cluster by closing the PLAINTEXT port:
6666

67-
```properties
67+
```java-properties
6868
listeners=SSL://broker1:9092
6969
security.inter.broker.protocol=SSL
7070
```
7171

7272
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:
7373

74-
```properties
74+
```java-properties
7575
listeners=PLAINTEXT://broker1:9091,SSL://broker1:9092,SASL_SSL://broker1:9093
7676
```
7777

7878
We would then restart the clients, changing their config to point at the newly opened, SASL & SSL secured port:
7979

80-
```properties
80+
```java-properties
8181
bootstrap.servers = [broker1:9093,...]
8282
security.protocol = SASL_SSL
8383
...etc
8484
```
8585

8686
The second server bounce would switch the cluster to use encrypted broker-broker communication via the SSL port we previously opened on port 9092:
8787

88-
```properties
88+
```java-properties
8989
listeners=PLAINTEXT://broker1:9091,SSL://broker1:9092,SASL_SSL://broker1:9093
9090
security.inter.broker.protocol=SSL
9191
```
9292

9393
The final bounce secures the cluster by closing the PLAINTEXT port.
9494

95-
```properties
95+
```java-properties
9696
listeners=SSL://broker1:9092,SASL_SSL://broker1:9093
9797
security.inter.broker.protocol=SSL
9898
```

0 commit comments

Comments
 (0)