Skip to content

Error occurs when configure client auth #8872

Closed

Description

@Jennifer88huang-zz

To Reproduce
From @evfurman:

I got authentication configured on the brokers.

<html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <title>Error 401 Authentication required</title> </head> <body><h2>HTTP ERROR 401 Authentication required</h2> <table> <tr><th>URI:</th><td>/admin/v2/brokers/health</td></tr> <tr><th>STATUS:</th><td>401</td></tr> <tr><th>MESSAGE:</th><td>Authentication required</td></tr> <tr><th>SERVLET:</th><td>org.glassfish.jersey.servlet.ServletContainer-3051e0b2</td></tr> </table> <hr><a href="https://eclipse.org/jetty">Powered by Jetty:// 9.4.33.v20201020</a><hr/> </body> </html>

However, when I try to produce with the pulsar-perf client, I get the following error:

22:30:33.866 [pulsar-client-io-2-1] INFO  org.apache.pulsar.client.impl.ConnectionPool - [[id: 0x1327459b, L:/10.3.22.138:59344 - R:pulsar-pluster-01.qa.corp.mparticle.com/10.3.22.230:6651]] Connected to server
22:30:33.883 [pulsar-client-io-2-1] WARN  org.apache.pulsar.client.impl.ClientCnx - [id: 0x1327459b, L:/10.3.22.138:59344 - R:pulsar-pluster-01.qa.corp.mparticle.com/10.3.22.230:6651] Received error from server: Unable to authenticate
22:30:33.883 [pulsar-client-io-2-1] WARN  org.apache.pulsar.client.impl.ClientCnx - [id: 0x1327459b, L:/10.3.22.138:59344 - R:pulsar-pluster-01.qa.corp.mparticle.com/10.3.22.230:6651] Received unknown request id from server: -1
22:30:33.884 [pulsar-client-io-2-1] INFO  org.apache.pulsar.client.impl.ClientCnx - [id: 0x1327459b, L:/10.3.22.138:59344 ! R:pulsar-pluster-01.qa.corp.mparticle.com/10.3.22.230:6651] Disconnected

The client.conf is:

webServiceUrl=https://pulsar-pluster-01.qa.corp.mparticle.com:8443/
brokerServiceUrl=pulsar+ssl://pulsar-pluster-01.qa.corp.mparticle.com:6651/
authPlugin=org.apache.pulsar.client.impl.auth.AuthenticationKeyStoreTls
authParams=keyStoreType:JKS,keyStorePath:/opt/pulsar/tls/keystore.jks,keyStorePassword:XXXXXXXXXXXX
tlsAllowInsecureConnection=false
tlsEnableHostnameVerification=false
useKeyStoreTls=true
tlsTrustStoreType=PEM
tlsTrustStorePath=/opt/pulsar/tls/truststore.jks
tlsTrustStorePassword=XXXXXXXXXXXXX
useTls=true

Activity

  1. added
    type/bug
    on Dec 9, 2020
  2. Jennifer88huang-zz commented on Dec 9, 2020

    @Jennifer88huang-zz
    ContributorAuthor

    Workaround from @sijie : try to configure authParam as JSON string.

  3. changed the title [-]Error occurs when configure auth[/-] [+]Error occurs when configure client auth[/+] on Dec 9, 2020
  4. evfurman commented on Dec 9, 2020

    @evfurman

    When converting the authParams to JSON, the error disappears.

    authParams={"keyStoreType":"JKS","keyStorePath":"/opt/pulsar/tls/keystore.jks","keyStorePassword":"XXXXXXXXXXX"}

    However, it seems we are still unable to authenticate.

    16:03:27.855 [main] INFO  org.apache.pulsar.testclient.PerformanceProducer - Dumping latency stats to perf-producer-1607529807855.hgrm
    16:03:27.857 [pulsar-perf-producer-exec-1-1] INFO  org.apache.pulsar.testclient.PerformanceProducer - Started performance test thread 0
    16:03:28.891 [pulsar-perf-producer-exec-1-1] INFO  org.apache.pulsar.testclient.PerformanceProducer - Adding 1 publishers on topic persistent://public/default/test-partitioned-perftool
    16:03:29.333 [pulsar-client-io-2-1] INFO  org.apache.pulsar.client.impl.ConnectionPool - [[id: 0x673e3f02, L:/10.3.22.138:42828 - R:pulsar-pluster-01.example.com/10.3.22.230:6651]] Connected to server
    16:03:29.527 [pulsar-client-io-2-1] WARN  org.apache.pulsar.client.impl.ClientCnx - [id: 0x673e3f02, L:/10.3.22.138:42828 - R:pulsar-pluster-01.example.com/10.3.22.230:6651] Received error from server: Unable to authenticate
    16:03:29.528 [pulsar-client-io-2-1] WARN  org.apache.pulsar.client.impl.ClientCnx - [id: 0x673e3f02, L:/10.3.22.138:42828 - R:pulsar-pluster-01.example.com/10.3.22.230:6651] Received unknown request id from server: -1
    16:03:29.530 [pulsar-client-io-2-1] INFO  org.apache.pulsar.client.impl.ClientCnx - [id: 0x673e3f02, L:/10.3.22.138:42828 ! R:pulsar-pluster-01.example.com/10.3.22.230:6651] Disconnected
    
  5. Jennifer88huang-zz commented on Dec 10, 2020

    @Jennifer88huang-zz
    ContributorAuthor

    @evfurman Thanks for your feedback. I've refined the "brokerClientAuthenticationParameters" as json type as well to configure the client auth.
    Have you met issues in configuring other auth, for example, token auth?

  6. Jennifer88huang-zz commented on Dec 10, 2020

    @Jennifer88huang-zz
    ContributorAuthor

    @sijie Except in TLS keystore, in Token auth, JWT, Athenz, Keberos, brokerClientAuthenticationParameters is used. Shall we change all of them as JSON string?

  7. added a commit that references this issue on Dec 11, 2020
    cdbbf4a
  8. Jennifer88huang-zz commented on Feb 5, 2021

    @Jennifer88huang-zz
    ContributorAuthor

    @RobertIndie In #9313, do you mean that since 2.8.0, brokerClientAuthenticationParameters supports JSON format for TLS keystore, JWT, Athenz, Keberos?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

type/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions