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
To enable authentication in your Redpanda cluster, you have the following options, depending on your requirements for SASL authentication and authorization.
458
+
Redpanda provides two methods for enabling SASL authentication.
459
+
460
+
*Why two methods?*
461
+
462
+
* *Method 1* (`enable_sasl`) is the original approach, maintained for backwards compatibility. It applies SASL globally to all Kafka listeners with a single command.
463
+
* *Method 2* (per-listener configuration) is the newer, more flexible approach that allows you to configure different authentication methods on different listeners.
464
+
465
+
*Which method should I use?*
466
+
467
+
* **For new clusters:** Use *Method 2* (per-listener configuration). This gives you the flexibility to configure authentication per listener, which is useful for mixed environments where some listeners are internal (no auth required) and others are external (auth required).
468
+
* **For existing clusters using `enable_sasl`:** Continue using *Method 1* if it meets your needs. Only migrate to Method 2 if you need per-listener authentication control.
469
+
* **For uniform authentication:** If you know all your Kafka listeners will use SASL authentication, *Method 1* is simpler and doesn't require a restart.
470
+
471
+
[IMPORTANT]
472
+
====
473
+
*Do not mix configuration methods*
474
+
475
+
Using both `enable_sasl` and `kafka_enable_authorization` + `authentication_method` together can lead to configuration inconsistencies and initialization failures. Choose one approach and use it consistently.
476
+
====
459
477
460
478
NOTE: You must <<create-superusers, create at least one superuser>> before enabling authentication. Enabling authentication without a superuser can result in being locked out of the cluster.
461
479
462
-
- Enable SASL authentication for all Kafka listeners:
463
-
+
464
-
Use this method if you haven't already enabled authentication and you want to apply SASL authentication to all Kafka listeners. This approach does not require you to restart the cluster.
465
-
+
466
-
NOTE: This command implicitly enables authorization. If you want to disable authorization, you can use the `kafka_enable_authorization` cluster configuration property.
467
-
+
480
+
==== Method 1: Global authentication (backwards compatible)
481
+
482
+
This method applies SASL authentication to all Kafka API listeners with a single command.
483
+
484
+
*When to use:*
485
+
486
+
* All Kafka listeners will use SASL authentication
487
+
* You prefer simpler configuration
488
+
* You want to avoid a cluster restart
489
+
490
+
*Tradeoffs:*
491
+
492
+
* ✅ Simple: One command enables authentication on all listeners
493
+
* ✅ No restart required
494
+
* ✅ No `redpanda.yaml` changes needed
495
+
* ❌ Cannot configure different authentication methods per listener
496
+
* ❌ All listeners must use the same authentication method
497
+
498
+
*Command:*
499
+
468
500
[source,bash]
469
501
----
470
502
rpk cluster config set enable_sasl true
471
503
----
472
504
473
-
- Explicitly enable authorization and define authentication method per listener:
474
-
+
475
-
Choose this method if you require specific control over the authentication method for each Kafka listener, or if you need to enable authorization explicitly. This option requires a cluster restart.
476
-
+
477
-
1. Enable authorization:
505
+
This command:
506
+
507
+
* Enables SASL authentication on ALL Kafka API listeners
508
+
* Implicitly enables authorization (`kafka_enable_authorization` is set to `true`)
509
+
510
+
[WARNING]
511
+
====
512
+
When using this method, do NOT additionally set `kafka_enable_authorization: true` or add `authentication_method: sasl` to `redpanda.yaml`. The `enable_sasl` setting handles both automatically.
513
+
====
514
+
515
+
==== Method 2: Per-listener authentication (recommended for new clusters)
516
+
517
+
This method allows you to configure authentication per listener, giving you flexibility to have different authentication methods on different listeners.
518
+
519
+
*When to use:*
520
+
521
+
* You need different authentication methods on different listeners (for example, SASL for external, none for internal)
522
+
* You're setting up a new cluster
523
+
* You want explicit control over which listeners have authentication enabled
524
+
525
+
*Tradeoffs:*
526
+
527
+
* ✅ Flexible: Configure authentication per listener
528
+
* ✅ Explicit: Clear configuration in `redpanda.yaml` for each listener
529
+
* ✅ Can mix authentication methods (some listeners with auth, some without)
530
+
* ❌ Requires configuration in `redpanda.yaml` for each listener
531
+
* ❌ Requires cluster restart to apply changes
532
+
533
+
*Steps:*
534
+
535
+
1. Enable authorization explicitly:
478
536
+
479
537
[source,bash]
480
538
----
481
539
rpk cluster config set kafka_enable_authorization true
482
540
----
483
541
484
-
2. Define the authentication method for each listener. See <<Authentication for the Kafka API>> and <<Authentication for the HTTP APIs>>.
542
+
2. Configure authentication method for each listener in `redpanda.yaml`:
543
+
+
544
+
[source,yaml]
545
+
----
546
+
redpanda:
547
+
kafka_api:
548
+
- address: 0.0.0.0
549
+
port: 9092
550
+
name: internal
551
+
authentication_method: none # No authentication for internal traffic
552
+
- address: 0.0.0.0
553
+
port: 9093
554
+
name: external
555
+
authentication_method: sasl # SASL for external traffic
556
+
----
557
+
+
558
+
See <<Authentication for the Kafka API>> for more details.
559
+
560
+
3. Restart the cluster to apply the configuration changes.
561
+
562
+
[WARNING]
563
+
====
564
+
When using this method, do NOT set `enable_sasl: true`. The per-listener configuration and explicit `kafka_enable_authorization` handle authentication and authorization separately.
565
+
====
485
566
486
567
For detailed information about these and other cluster configurations, see xref:manage:cluster-maintenance/cluster-property-configuration.adoc[].
487
568
endif::[]
@@ -509,15 +590,15 @@ NOTE: Redpanda provides an option to configure different SASL authentication mec
509
590
510
591
==== Enable SASL
511
592
512
-
To enable SASL authentication for the Kafka API, set the xref:reference:properties/broker-properties.adoc#kafka_api_auth_method[`authentication_method`] broker property of the Kafka listeners to `sasl`.
513
-
514
593
ifdef::env-kubernetes[The Redpanda Helm chart sets the xref:reference:properties/broker-properties.adoc#kafka_api_auth_method[`authentication_method`] broker property to `sasl` for all Kafka listeners by default when you <<enable-authentication, enable authentication>>.]
515
594
516
-
ifndef::env-kubernetes[If you <<enable-sasl-authentication, enabled authentication with `enable_sasl=true`>>, Redpanda implicitly sets xref:reference:properties/broker-properties.adoc#kafka_api_auth_method[`authentication_method`] to `sasl` for the Kafka listeners.]
595
+
ifndef::env-kubernetes[]
596
+
How you enable SASL depends on which <<enable-sasl-authentication, authentication method>> you chose:
517
597
518
-
ifndef::env-kubernetes[If you <<enable-sasl-authentication, enabled authentication with `kafka_enable_authorization=true`>>, you must enable SASL for the Kafka listeners.]
598
+
*If you used Method 1* (`enable_sasl: true`): SASL is already enabled on all Kafka listeners automatically. Skip this section.
599
+
600
+
*If you used Method 2* (per-listener): Set the xref:reference:properties/broker-properties.adoc#kafka_api_auth_method[`authentication_method`] broker property to `sasl` for the Kafka listeners that require authentication.
519
601
520
-
ifndef::env-kubernetes[]
521
602
In `redpanda.yaml`, enter:
522
603
523
604
[,yaml,lines=6]
@@ -1901,6 +1982,102 @@ redpanda:
1901
1982
----
1902
1983
endif::[]
1903
1984
1985
+
== Troubleshooting authentication
1986
+
1987
+
=== Schema Registry 403 Forbidden errors
1988
+
1989
+
If clients receive error code 50302 or 403 when registering or fetching schemas, the internal `schema_registry_internal` role may be incomplete.
1990
+
1991
+
*Symptoms:*
1992
+
1993
+
Clients see:
1994
+
1995
+
[source,json]
1996
+
----
1997
+
{
1998
+
"error_code": 50302,
1999
+
"message": "broker_not_available"
2000
+
}
2001
+
----
2002
+
2003
+
Redpanda logs show:
2004
+
2005
+
[source,log]
2006
+
----
2007
+
WARN Failed to create ACLs for type {ephemeral user} name {__schema_registry}
2008
+
ERROR Schema registry failed to initialize: broker_not_available
2009
+
----
2010
+
2011
+
*Cause:*
2012
+
2013
+
When `schema_registry_enable_authorization` is enabled during cluster instability (controller election, restart, heavy load), ACL creation for the internal role may fail partway through, leaving an incomplete role that persists across restarts.
2014
+
2015
+
*Diagnosis:*
2016
+
2017
+
Check if the internal role is complete:
2018
+
2019
+
[source,bash]
2020
+
----
2021
+
rpk security role describe schema_registry_internal
2022
+
----
2023
+
2024
+
*Expected output (complete role - 8 ACLs):*
2025
+
2026
+
[source,text]
2027
+
----
2028
+
PRINCIPAL RESOURCE-TYPE RESOURCE-NAME OPERATION PERMISSION
rpk security role assign schema_registry_internal \
2067
+
--principal User:__schema_registry
2068
+
2069
+
# Restart to reinitialize
2070
+
systemctl restart redpanda
2071
+
----
2072
+
2073
+
Verify the fix by checking the role again and testing schema registration.
2074
+
2075
+
*Prevention:*
2076
+
2077
+
* Only enable `schema_registry_enable_authorization` when the cluster is stable
2078
+
* Avoid enabling during cluster restarts or controller failovers
2079
+
* Verify role completeness after enabling Schema Registry authorization
2080
+
1904
2081
== Generate security report
1905
2082
1906
2083
Use the link:/api/doc/admin/operation/operation-get_security_report[`/v1/security/report`] endpoint to generate a comprehensive security report for your cluster. This endpoint provides detailed information about current TLS configuration, authentication methods, authorization status, and security alerts across all Redpanda interfaces (Kafka, RPC, Admin, Schema Registry, HTTP Proxy).
0 commit comments