Getting 401 first time and able to login in same session in second attempt

I am implementing SSO with elastic/Kibana. and using Wso2 credential to login.

When i login first time, i see 401, below is the curl i can copy from browser.

curl 'http://server1.local:5601/api/security/oidc/callback?code=6b7b7efe-6e11-3557-af93-00be8ef62f84&state=4LY5rrjyuveeL0erJVH9hjIOiGsCTUEOMG6fdb2vB5A&session_state=446911a32e14d4ff754cb95ab4390708a2257299982e30c7b0f7fc9092e9dfe1.5Do94CoZTboiROzD_546WA'
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.7'
-H 'Accept-Language: en-US,en;q=0.9'
-H 'Cache-Control: no-cache'
-H 'Connection: keep-alive'
-H 'Pragma: no-cache'
-H 'Upgrade-Insecure-Requests: 1'
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36'
--compressed
--insecure

Second time if i click on login, i am allowed to login and i can see home page without providing user name/password, same session allowed me to login.

curl 'http://server1.local:5601/api/security/oidc/callback?code=39a99484-c52f-39fc-98c5-0d9f3dd06906&state=shckd4H0K8upFL1jSR7jjrTOYZCezYaolHxGT_2IQqA&session_state=91ae5a5ce2b392af48ce918febf1c7d79364d8f84977e4538f57a5894fe34aa9.G6_8ishplImP0ah86-U_fw'
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.7'
-H 'Accept-Language: en-US,en;q=0.9'
-H 'Cache-Control: no-cache'
-H 'Connection: keep-alive'
-H 'Cookie: sid=Fe26.273f674f475e9c98fb95a2096d53cfe116e64ae44f835937d8fc9f223f9c4395e2WJ7Of7edH-it5ghCN6KGAps924BFE311bNbuKOmCyq36ORD8G2oAvoDzGpwVYb_WAuh95cv4BZsg-dLejEmPPU28OQJHvc60GeGB0XRP_Kc8cS2UvSmtnrTGrmvXBY5xbYI519ikeYJT3Xn3X-29wpB9B-cHgAavmD4uYQ6L3q566C6wFhu_sGuWbyPH3UtWZh023CI9Jdiih2e2XQyDFCaplaa7baC88hGdBhxqWTsP4d-zG4r7qp-UdYlPTyfwI9f_vrBTsxg36CTPBj36Vdcc97fef4bf14e70cf6bdac67ea4e34f489bc80020517299991e3a094198ef3f*uRL9k1cjIXl-F0JvFETtAnHzJC03e9UqnvVEZtokSoA'
-H 'Pragma: no-cache'
-H 'Referer: http://vlmazccmockdev2.fisdev.local:5601/login?msg=UNAUTHENTICATED&next=%2F'
-H 'Upgrade-Insecure-Requests: 1'
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36'
--compressed
--insecure

Can someone please confirm what configuration i should check.

I am trying to implement SSO.

Hi Amit,

I think this post is related to Kibana, so I moved it here so you can get a better response.

Hi @amitkumar.gupta,

Are you following through this ELK SSO guide? I would take a look at the elasticsearch.yml configuration as per this section of the guide.

Let us know if that helps.

Hey, thanks for your input.

I am using guide provided by wso2 for integration..

https://apim.docs.wso2.com/en/latest/api-analytics/on-prem/elk-installation-guide/

below is the full file -

======================== Elasticsearch Configuration =========================

NOTE: Elasticsearch comes with reasonable defaults for most settings.

Before you set out to tweak and tune the configuration, make sure you

understand what are you trying to accomplish and the consequences.

The primary way of configuring a node is via this file. This template lists

the most important settings you may want to configure for a production cluster.

Please consult the documentation for further information on configuration options:

Elasticsearch Guide | Elastic

---------------------------------- Cluster -----------------------------------

Use a descriptive name for your cluster:

#cluster.name: my-application

------------------------------------ Node ------------------------------------

Use a descriptive name for the node:

#node.name: node-1

Add custom attributes to the node:

#node.attr.rack: r1

----------------------------------- Paths ------------------------------------

Path to directory where to store the data (separate multiple locations by comma):

#path.data: /path/to/data

Path to log files:

#path.logs: /path/to/logs

----------------------------------- Memory -----------------------------------

Lock the memory on startup:

#bootstrap.memory_lock: true

Make sure that the heap size is set to about half the memory available

on the system and that the owner of the process is allowed to use this

limit.

Elasticsearch performs poorly when the system is swapping the memory.

---------------------------------- Network -----------------------------------

By default Elasticsearch is only accessible on localhost. Set a different

address here to expose this node on the network:

#network.host: 192.168.0.1

By default Elasticsearch listens for HTTP traffic on the first free port it

finds starting at 9200. Set a specific HTTP port here:

#http.port: 9200

For more information, consult the network module documentation.

--------------------------------- Discovery ----------------------------------

Pass an initial list of hosts to perform discovery when this node is started:

The default list of hosts is ["127.0.0.1", "[::1]"]

#discovery.seed_hosts: ["host1", "host2"]

Bootstrap the cluster using an initial set of master-eligible nodes:

#cluster.initial_master_nodes: ["node-1", "node-2"]

For more information, consult the discovery and cluster formation module documentation.

--------------------------------- Readiness ----------------------------------

Enable an unauthenticated TCP readiness endpoint on localhost

#readiness.port: 9399

---------------------------------- Various -----------------------------------

Allow wildcard deletion of indices:

#action.destructive_requires_name: false

#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------

The following settings, TLS certificates, and keys have been automatically

generated to configure Elasticsearch security features on 08-02-2023 07:34:15

--------------------------------------------------------------------------------

Enable security features

#xpack.security.autoconfiguration.enabled: true
xpack.security.enabled: true
#xpack.security.authc.api_key.enabled: true
xpack.security.enrollment.enabled: false
xpack.security.authc.token.enabled: true

Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents

xpack.security.http.ssl:
enabled: false
keystore.path: certs/http.p12

Enable encryption and mutual authentication between cluster nodes

xpack.security.transport.ssl:
enabled: false
verification_mode: certificate
keystore.path: certs/transport.p12
truststore.path: certs/transport.p12

Create a new cluster with the current node only

Additional nodes can still join the cluster later

cluster.initial_master_nodes: ["server2"]

Allow HTTP API connections from anywhere

Connections are encrypted and require user authentication

http.host: 0.0.0.0

Allow other nodes to join the cluster from anywhere

Connections are encrypted and mutually authenticated

#transport.host: 0.0.0.0
ingest.geoip.downloader.enabled: false

xpack.security.authc.realms.oidc.oidc1:
order: 1
rp.client_id: "a3xWuyoswA8rQsjbmghsz6LJyfoa"
rp.response_type: code
rp.redirect_uri: "http://server2.local:5601/api/security/oidc/callback"
op.issuer: "https://server1.local:9443/oauth2/token"
rp.requested_scopes: profile
#op.issuer: "https://server1.local:9443/oauth2/token"
op.authorization_endpoint: "https://vlmazccmockdev1.fisdev.local:9443/oauth2/authorize"
op.token_endpoint: "https://server1.local:9443/oauth2/token"
op.jwkset_path: "https://server1.local:9443/oauth2/jwks"
op.endsession_endpoint: "https://server1.local:9443/oidc/logout"
op.userinfo_endpoint: "https://server1.local:9443/oauth2/userinfo"
rp.post_logout_redirect_uri: "http://server2.local:5601/security/logged_out"
claims.principal: sub
claims.groups: groups
ssl.verification_mode: none
claims.name: name
claims.mail: email
#----------------------- END SECURITY AUTO CONFIGURATION -------------------------

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.