Skip to content

Commit 2a62d06

Browse files
committed
distinguish between the two ways to enable SASL
1 parent 8001180 commit 2a62d06

File tree

1 file changed

+148
-18
lines changed

1 file changed

+148
-18
lines changed

modules/manage/partials/authentication.adoc

Lines changed: 148 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -455,33 +455,67 @@ 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 distinct methods for enabling SASL authentication. Choose ONE method based on your requirements.
459+
460+
[IMPORTANT]
461+
====
462+
*Do not mix configuration methods*
463+
464+
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.
465+
====
459466

460467
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.
461468

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-
+
469+
==== Method 1: Global authentication (recommended)
470+
471+
Use this method if you want SASL authentication on all Kafka listeners and prefer simpler configuration.
472+
473+
*Behavior:*
474+
475+
* Enables SASL authentication on ALL Kafka API listeners automatically
476+
* Implicitly enables authorization (`kafka_enable_authorization` is set to `true`)
477+
* No `redpanda.yaml` changes required
478+
* No cluster restart required
479+
480+
*Command:*
481+
468482
[source,bash]
469483
----
470484
rpk cluster config set enable_sasl true
471485
----
472486

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:
487+
[WARNING]
488+
====
489+
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.
490+
====
491+
492+
==== Method 2: Per-listener authentication (advanced)
493+
494+
Use this method if you need different authentication methods on different listeners or want explicit control.
495+
496+
*Behavior:*
497+
498+
* Requires explicit configuration in `redpanda.yaml` for each listener
499+
* Requires explicit authorization enablement
500+
* Requires cluster restart to apply changes
501+
502+
*Steps:*
503+
504+
1. Enable authorization explicitly:
478505
+
479506
[source,bash]
480507
----
481508
rpk cluster config set kafka_enable_authorization true
482509
----
483510

484-
2. Define the authentication method for each listener. See <<Authentication for the Kafka API>> and <<Authentication for the HTTP APIs>>.
511+
2. Configure authentication method for each listener in `redpanda.yaml`. See <<Authentication for the Kafka API>>.
512+
513+
3. Restart the cluster.
514+
515+
[WARNING]
516+
====
517+
When using this method, do NOT set `enable_sasl: true`. The per-listener configuration and explicit `kafka_enable_authorization` handle authentication and authorization separately.
518+
====
485519

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

510544
==== Enable SASL
511545

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-
514546
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>>.]
515547

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.]
548+
ifndef::env-kubernetes[]
549+
How you enable SASL depends on which <<enable-sasl-authentication, authentication method>> you chose:
517550

518-
ifndef::env-kubernetes[If you <<enable-sasl-authentication, enabled authentication with `kafka_enable_authorization=true`>>, you must enable SASL for the Kafka listeners.]
551+
*If you used Method 1* (`enable_sasl: true`): SASL is already enabled on all Kafka listeners automatically. Skip this section.
552+
553+
*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.
519554

520-
ifndef::env-kubernetes[]
521555
In `redpanda.yaml`, enter:
522556

523557
[,yaml,lines=6]
@@ -1901,6 +1935,102 @@ redpanda:
19011935
----
19021936
endif::[]
19031937

1938+
== Troubleshooting authentication
1939+
1940+
=== Schema Registry 403 Forbidden errors
1941+
1942+
If clients receive error code 50302 or 403 when registering or fetching schemas, the internal `schema_registry_internal` role may be incomplete.
1943+
1944+
*Symptoms:*
1945+
1946+
Clients see:
1947+
1948+
[source,json]
1949+
----
1950+
{
1951+
"error_code": 50302,
1952+
"message": "broker_not_available"
1953+
}
1954+
----
1955+
1956+
Redpanda logs show:
1957+
1958+
[source,log]
1959+
----
1960+
WARN Failed to create ACLs for type {ephemeral user} name {__schema_registry}
1961+
ERROR Schema registry failed to initialize: broker_not_available
1962+
----
1963+
1964+
*Cause:*
1965+
1966+
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.
1967+
1968+
*Diagnosis:*
1969+
1970+
Check if the internal role is complete:
1971+
1972+
[source,bash]
1973+
----
1974+
rpk security role describe schema_registry_internal
1975+
----
1976+
1977+
*Expected output (complete role - 8 ACLs):*
1978+
1979+
[source,text]
1980+
----
1981+
PRINCIPAL RESOURCE-TYPE RESOURCE-NAME OPERATION PERMISSION
1982+
RedpandaRole:schema_registry_internal CLUSTER kafka-cluster DESCRIBE ALLOW
1983+
RedpandaRole:schema_registry_internal CLUSTER kafka-cluster IDEMPOTENT_WRITE ALLOW
1984+
RedpandaRole:schema_registry_internal TOPIC _schemas READ ALLOW
1985+
RedpandaRole:schema_registry_internal TOPIC _schemas WRITE ALLOW
1986+
RedpandaRole:schema_registry_internal TOPIC _schemas CREATE ALLOW
1987+
RedpandaRole:schema_registry_internal TOPIC _schemas DESCRIBE ALLOW
1988+
RedpandaRole:schema_registry_internal GROUP __schema_id_counter READ ALLOW
1989+
RedpandaRole:schema_registry_internal GROUP schema-registry READ ALLOW
1990+
----
1991+
1992+
If you see fewer than 8 ACLs, the role is incomplete. Also check that the `__schema_registry` user is listed under PRINCIPALS.
1993+
1994+
*Resolution:*
1995+
1996+
Add missing permissions:
1997+
1998+
[source,bash]
1999+
----
2000+
# Add CLUSTER permission
2001+
rpk security acl create \
2002+
--allow-role RedpandaRole:schema_registry_internal \
2003+
--operation idempotent-write \
2004+
--cluster
2005+
2006+
# Add TOPIC permissions
2007+
rpk security acl create \
2008+
--allow-role RedpandaRole:schema_registry_internal \
2009+
--operation read,write,describe,create \
2010+
--topic _schemas
2011+
2012+
# Add GROUP permissions
2013+
rpk security acl create \
2014+
--allow-role RedpandaRole:schema_registry_internal \
2015+
--operation read \
2016+
--group __schema_id_counter,schema-registry
2017+
2018+
# Assign the ephemeral user to the role
2019+
rpk security role assign schema_registry_internal \
2020+
--principal User:__schema_registry
2021+
2022+
# Restart to reinitialize
2023+
systemctl restart redpanda
2024+
----
2025+
2026+
Verify the fix by checking the role again and testing schema registration.
2027+
2028+
*Prevention:*
2029+
2030+
* Only enable `schema_registry_enable_authorization` when the cluster is stable
2031+
* Avoid enabling during cluster restarts or controller failovers
2032+
* Verify role completeness after enabling Schema Registry authorization
2033+
19042034
== Generate security report
19052035

19062036
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)