Skip to content

Commit 08de78d

Browse files
committed
distinguish between the two ways to enable SASL
1 parent 8001180 commit 08de78d

File tree

1 file changed

+195
-18
lines changed

1 file changed

+195
-18
lines changed

modules/manage/partials/authentication.adoc

Lines changed: 195 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -455,33 +455,114 @@ rpk cluster config edit
455455

456456
=== Enable SASL authentication
457457

458-
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+
====
459477

460478
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.
461479

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+
468500
[source,bash]
469501
----
470502
rpk cluster config set enable_sasl true
471503
----
472504

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:
478536
+
479537
[source,bash]
480538
----
481539
rpk cluster config set kafka_enable_authorization true
482540
----
483541

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+
====
485566

486567
For detailed information about these and other cluster configurations, see xref:manage:cluster-maintenance/cluster-property-configuration.adoc[].
487568
endif::[]
@@ -509,15 +590,15 @@ NOTE: Redpanda provides an option to configure different SASL authentication mec
509590

510591
==== Enable SASL
511592

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-
514593
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>>.]
515594

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:
517597

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.
519601

520-
ifndef::env-kubernetes[]
521602
In `redpanda.yaml`, enter:
522603

523604
[,yaml,lines=6]
@@ -1901,6 +1982,102 @@ redpanda:
19011982
----
19021983
endif::[]
19031984

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
2029+
RedpandaRole:schema_registry_internal CLUSTER kafka-cluster DESCRIBE ALLOW
2030+
RedpandaRole:schema_registry_internal CLUSTER kafka-cluster IDEMPOTENT_WRITE ALLOW
2031+
RedpandaRole:schema_registry_internal TOPIC _schemas READ ALLOW
2032+
RedpandaRole:schema_registry_internal TOPIC _schemas WRITE ALLOW
2033+
RedpandaRole:schema_registry_internal TOPIC _schemas CREATE ALLOW
2034+
RedpandaRole:schema_registry_internal TOPIC _schemas DESCRIBE ALLOW
2035+
RedpandaRole:schema_registry_internal GROUP __schema_id_counter READ ALLOW
2036+
RedpandaRole:schema_registry_internal GROUP schema-registry READ ALLOW
2037+
----
2038+
2039+
If you see fewer than 8 ACLs, the role is incomplete. Also check that the `__schema_registry` user is listed under PRINCIPALS.
2040+
2041+
*Resolution:*
2042+
2043+
Add missing permissions:
2044+
2045+
[source,bash]
2046+
----
2047+
# Add CLUSTER permission
2048+
rpk security acl create \
2049+
--allow-role RedpandaRole:schema_registry_internal \
2050+
--operation idempotent-write \
2051+
--cluster
2052+
2053+
# Add TOPIC permissions
2054+
rpk security acl create \
2055+
--allow-role RedpandaRole:schema_registry_internal \
2056+
--operation read,write,describe,create \
2057+
--topic _schemas
2058+
2059+
# Add GROUP permissions
2060+
rpk security acl create \
2061+
--allow-role RedpandaRole:schema_registry_internal \
2062+
--operation read \
2063+
--group __schema_id_counter,schema-registry
2064+
2065+
# Assign the ephemeral user to the role
2066+
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+
19042081
== Generate security report
19052082

19062083
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

Comments
 (0)