You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2026/09/11 17:58:29 UTC
(pulsar) 01/01: [fix][test] Configure original authentication for TLS and SASL proxy tests
This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch lh-improve-openid-proxy-auth
in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit b34b397a24c7c9069e553b822c2b8a4d0c1af40d
Author: Lari Hotari <lh...@apache.org>
AuthorDate: Fri Sep 11 20:58:14 2026 +0300
[fix][test] Configure original authentication for TLS and SASL proxy tests
---
conf/broker.conf | 2 ++
conf/standalone.conf | 2 ++
deployment/terraform-ansible/templates/broker.conf | 2 ++
.../pulsar/broker/authentication/ProxySaslAuthenticationTest.java | 2 ++
.../src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java | 4 +++-
.../pulsar/proxy/server/ProxyAuthenticatedProducerConsumerTest.java | 2 ++
6 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/conf/broker.conf b/conf/broker.conf
index c80559fe3be8..2fa57137c138 100644
--- a/conf/broker.conf
+++ b/conf/broker.conf
@@ -857,6 +857,8 @@ proxyRoles=
# else it just accepts the originalPrincipal and authorizes it (if required).
# For TLS client-certificate authentication through a proxy, set false:
# the broker's TLS connection carries the proxy certificate, not the client certificate.
+# Also set false for SASL authentication through a proxy: the client-proxy handshake
+# cannot be replayed as a separate client-broker handshake.
authenticateOriginalAuthData=true
# Tls cert refresh duration in seconds. Set 0 to disable the background rotation check, so the
diff --git a/conf/standalone.conf b/conf/standalone.conf
index 44fa2792579c..168cd6d33bf8 100644
--- a/conf/standalone.conf
+++ b/conf/standalone.conf
@@ -705,6 +705,8 @@ proxyRoles=
# else it just accepts the originalPrincipal and authorizes it (if required).
# For TLS client-certificate authentication through a proxy, set false:
# the broker's TLS connection carries the proxy certificate, not the client certificate.
+# Also set false for SASL authentication through a proxy: the client-proxy handshake
+# cannot be replayed as a separate client-broker handshake.
authenticateOriginalAuthData=true
# Enable authentication
diff --git a/deployment/terraform-ansible/templates/broker.conf b/deployment/terraform-ansible/templates/broker.conf
index 58a467927735..8e32e48143bf 100644
--- a/deployment/terraform-ansible/templates/broker.conf
+++ b/deployment/terraform-ansible/templates/broker.conf
@@ -439,6 +439,8 @@ proxyRoles=
# else it just accepts the originalPrincipal and authorizes it (if required).
# For TLS client-certificate authentication through a proxy, set false:
# the broker's TLS connection carries the proxy certificate, not the client certificate.
+# Also set false for SASL authentication through a proxy: the client-proxy handshake
+# cannot be replayed as a separate client-broker handshake.
authenticateOriginalAuthData=true
# Deprecated - Use webServicePortTls and brokerServicePortTls instead
diff --git a/pulsar-broker-auth-sasl/src/test/java/org/apache/pulsar/broker/authentication/ProxySaslAuthenticationTest.java b/pulsar-broker-auth-sasl/src/test/java/org/apache/pulsar/broker/authentication/ProxySaslAuthenticationTest.java
index 4197cc723114..5dd55727167f 100644
--- a/pulsar-broker-auth-sasl/src/test/java/org/apache/pulsar/broker/authentication/ProxySaslAuthenticationTest.java
+++ b/pulsar-broker-auth-sasl/src/test/java/org/apache/pulsar/broker/authentication/ProxySaslAuthenticationTest.java
@@ -179,6 +179,8 @@ public class ProxySaslAuthenticationTest extends ProducerConsumerBase {
isTcpLookup = true;
conf.setAdvertisedAddress(localHostname);
conf.setAuthenticationEnabled(true);
+ // The client SASL handshake terminates at the proxy, which forwards the original principal.
+ conf.setAuthenticateOriginalAuthData(false);
conf.setSaslJaasClientAllowedIds(".*" + localHostname + ".*");
conf.setSaslJaasServerSectionName("PulsarBroker");
brokerSecretKeyFile = File.createTempFile("saslRoleTokenSignerSecret", ".key");
diff --git a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
index 7ee6c9118c7b..8a729ab5138c 100644
--- a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
+++ b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
@@ -2221,7 +2221,9 @@ public class ServiceConfiguration implements PulsarConfiguration {
doc = "If this flag is set then the broker authenticates the original Auth data"
+ " else it just accepts the originalPrincipal and authorizes it (if required)."
+ " Set false for TLS client-certificate authentication through a proxy, since the broker"
- + " receives the proxy certificate rather than the client certificate.")
+ + " receives the proxy certificate rather than the client certificate."
+ + " Also set false for SASL authentication through a proxy, since the client-proxy handshake"
+ + " cannot be replayed as a separate client-broker handshake.")
private boolean authenticateOriginalAuthData = true;
@FieldContext(
diff --git a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyAuthenticatedProducerConsumerTest.java b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyAuthenticatedProducerConsumerTest.java
index f740dd16ff81..9c2fed3ed459 100644
--- a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyAuthenticatedProducerConsumerTest.java
+++ b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyAuthenticatedProducerConsumerTest.java
@@ -85,6 +85,8 @@ public class ProxyAuthenticatedProducerConsumerTest extends ProducerConsumerBase
// enable tls and auth&auth at broker
conf.setAuthenticationEnabled(true);
+ // TLS client certificates are authenticated by the proxy, which forwards the original principal.
+ conf.setAuthenticateOriginalAuthData(false);
conf.setAuthorizationEnabled(true);
conf.setBrokerServicePortTls(Optional.of(0));