# SAML issue on logout

**URL:** <https://forum.opensearch.org/t/saml-issue-on-logout/5617>\
**Category:** Security\
**Tags:** troubleshoot\
**Created:** [April 15, 2021, 1:57am UTC](https://forum.opensearch.org/t/saml-issue-on-logout/5617 "2021-04-15T01:57:27Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lord\_Zetas](https://avatars.discourse-cdn.com/v4/letter/l/a587f6/32.png) [@Lord\_Zetas](https://forum.opensearch.org/u/Lord_Zetas)\
**Post date:** [April 15, 2021, 1:57am UTC](https://forum.opensearch.org/t/saml-issue-on-logout/5617/1 "2021-04-15T01:57:27Z")

</div>

Hello Community,  
I faced an issue with the SAML configuration when certificates are provided for [Request signing](https://opendistro.github.io/for-elasticsearch-docs/docs/security/configuration/saml/#request-signing).  
**Version:** Opendistro 1.12.0  
**Provider:** PingID  
**These are the configurations:**

```nohighlight
sp:
  entity_id: saml
  forceAuthn: true
  signature_private_key_filepath: '/etc/elasticsearch/certs/elasticsearch.key'

```

On the Identity Provider side I configured this SLO: [https://\<kibana\_ip\>/auth/logout](https://10.10.10.15/auth/logout) and provided the `.pem` certificate.  
On the `kibana.yml` file I’ve configured this:

```nohighlight
opendistro_security.auth.type: "saml"
server.xsrf.whitelist: ["/_opendistro/_security/saml/acs/idpinitiated", "/_opendistro/_security/saml/acs", "/_opendistro/_security/saml/logout", "/auth/logout"]

```

But I am receiving this error on the browser when I logout the user:

```json
{"statusCode":401,"error":"Unauthorized","message":"Unauthorized"}

```

This is the request of the error:

```json
https://<kibana_ip>/auth/logout?SAMLResponse=pZJBa4NAEIX%252Fiux9dd2YqEsMlKYUIU1KE3LopYzrmAhmV5wV%252BvNrTFuSHnIpzGWGN%252FO%252BBzMnODWtWtmD7d0bUmsNoZcvM1aXHKQIYwDBRaKRR6JIeFLFyGdyUiSzIiyKEpi3x45qazImfcG8nKjH3JAD44aRkCEXEQ%252BjnZyoUCoZ%252B7GM3wed%252BXHb2Yxt1k%252BrzXO%252B%252FgAhJhUORpVIBksQJU%252BS6dBOq6iSMVazqmDeEsnVBtxoe3SuJRUEofC%252FaxpA745BM4Zi3uepMaTGoBnrO6MsUE3KwAlJOa22Dy8rNcCrtrPOatuwxfysVmOW7mr%252F%252FjoQYXdmYosfpjOH39bmYA362p6CVJZQpoBclLriURnFPAEd8qhIC4z1VKcTMQ%252Bu3C8ordo6cD3ddo%252B2RG8PTY%252F3wWhUq22vNRKxfx15hSEiNJeHYcHiAnt97M%252Fot739scUX&SigAlg=http%253A%252F%252Fwww.w3.org%252F2001%252F04%252Fxmldsig-more%2523rsa-sha256&Signature=P%252Fl4yWcp7A41xdFMcGe1sE4w%252BHM24ihH6P6ZDLwkV%252Fw81kts%252FvOaA0Hw9Bdx4ZvX6EzVRrEqC1dreb30oLujteMOU97YDH%252FFgj%252FmSR9VifeIlGxmLRs2VTo1QCfPIOllq2i2SK83sds1JGP4tvSCTPI9yhBXjeVrKehMka5c05OTmoD9frf4lzeUzqyXVMuTY%252BO%252F4%252FVvXl%252Bua9YfE%252FZh7yvRElG58VcQQYWL4yp2NG5S%252BaqH%252Fyc3qWAOCfEl%252FlkUrIOjxupwHVnu3ObqFrqZ0CsiQxpQ2vc5dH9QB%252BTsEQ1sPAvxHjP4PPDOwtZKQOrZulQ1fixkeCP0478oSvp0BA%253D%253D

```

I hope this information is useful to help me solve the issue.

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [April 15, 2021, 9:48am UTC](https://forum.opensearch.org/t/saml-issue-on-logout/5617/2 "2021-04-15T09:48:24Z")

</div>

Hello @Lord_Zetas

Could you share your PingID configuration?  
Did you try to use below line in your IDP instead?

https://\<kibana\_ip\>:\<port\_number\>/\_opendistro/\_security/saml/logout

---

<div class="post-metadata">

**Author:** ![Lord\_Zetas](https://avatars.discourse-cdn.com/v4/letter/l/a587f6/32.png) [@Lord\_Zetas](https://forum.opensearch.org/u/Lord_Zetas)\
**Post date:** [April 15, 2021, 4:18pm UTC](https://forum.opensearch.org/t/saml-issue-on-logout/5617/3 "2021-04-15T16:18:38Z")

</div>

![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/f/f903a41370f6d025f13355c3ac9247ce7fde94e8.png)  
Exact same issue.

---

<div class="post-metadata">

**Author:** ![Lord\_Zetas](https://avatars.discourse-cdn.com/v4/letter/l/a587f6/32.png) [@Lord\_Zetas](https://forum.opensearch.org/u/Lord_Zetas)\
**Post date:** [April 15, 2021, 4:29pm UTC](https://forum.opensearch.org/t/saml-issue-on-logout/5617/4 "2021-04-15T16:29:29Z")

</div>

SAML SETTINGS

- ACS URLS: `https://10.10.10.15/_opendistro/_security/saml/acs`
- SIGNING CERTIFICATE: PingOne SSO Certificate for Administrators environment
- Sing Assertion & Response
- SIGNING ALGORITHM: `RSA_SHA256`
- ENCRYPTION Disabled
- ENTITY ID: saml
- SLO ENDPOINT: `https://10.10.10.15/_opendistro/_security/saml/logout` [OR] `https://10.10.10.15/auth/logout`
- SLO RESPONSE ENDPOINT: blank
- SLO BINDING: HTTP Redirect
- ASSERTION VALIDITY DURATION: 3600
- Enforce Signed Authn Request
- VERIFICATION CERTIFICATE: node-1 (elasticsearch) Valid 03-21 to 03-31

---

<div class="post-metadata">

**Author:** ![Lord\_Zetas](https://avatars.discourse-cdn.com/v4/letter/l/a587f6/32.png) [@Lord\_Zetas](https://forum.opensearch.org/u/Lord_Zetas)\
**Post date:** [April 15, 2021, 4:33pm UTC](https://forum.opensearch.org/t/saml-issue-on-logout/5617/5 "2021-04-15T16:33:14Z")

</div>

One thing I want to clarify is the fact that the same configuration in OpenDistro 1.10 is working as expected (I was not able to test it in 1.11)

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [April 15, 2021, 4:38pm UTC](https://forum.opensearch.org/t/saml-issue-on-logout/5617/6 "2021-04-15T16:38:30Z")

</div>

@Lord_Zetas thanks for that info. Have you tried 1.13?  
I had couple issues with 1.11 and 1.12 in regards to self-signed certs and openid. Maybe SAML got affected too.

Have you got any warnings/errors in Kibana/ES logs?

---

<div class="post-metadata">

**Author:** ![Lord\_Zetas](https://avatars.discourse-cdn.com/v4/letter/l/a587f6/32.png) [@Lord\_Zetas](https://forum.opensearch.org/u/Lord_Zetas)\
**Post date:** [April 15, 2021, 4:48pm UTC](https://forum.opensearch.org/t/saml-issue-on-logout/5617/8 "2021-04-15T16:48:22Z")

</div>

Pablo, thanks for the Help.  
I did not tried with that version yet.  
In kibana I don’t see warnings or errors, just the action being logged in.  
In Elastic I have only this warning:  
`[2021-04-15T16:45:20,608][WARN][c.a.o.s.h.HTTPBasicAuthenticator] [node-1] No 'Basic Authorization' header, send 401 and 'WWW-Authenticate Basic'`  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Lord\_Zetas](https://avatars.discourse-cdn.com/v4/letter/l/a587f6/32.png) [@Lord\_Zetas](https://forum.opensearch.org/u/Lord_Zetas)\
**Post date:** [April 16, 2021, 1:33pm UTC](https://forum.opensearch.org/t/saml-issue-on-logout/5617/10 "2021-04-16T13:33:34Z")

</div>

Hello Pablo,  
I am confirming that I ran into the same issue with OpenDistro 1.13:  
`{"statusCode":401,"error":"Unauthorized","message":"Unauthorized"}`  
Do you think I should raise an issue in github?

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [April 16, 2021, 4:56pm UTC](https://forum.opensearch.org/t/saml-issue-on-logout/5617/11 "2021-04-16T16:56:43Z")

</div>

Hello @Lord_Zetas

I’ve forgotten to ask. Your kibana URL doesn’t contain port number (5601). Do you run proxy in front of Kibana?

---

<div class="post-metadata">

**Author:** ![Lord\_Zetas](https://avatars.discourse-cdn.com/v4/letter/l/a587f6/32.png) [@Lord\_Zetas](https://forum.opensearch.org/u/Lord_Zetas)\
**Post date:** [April 16, 2021, 6:12pm UTC](https://forum.opensearch.org/t/saml-issue-on-logout/5617/12 "2021-04-16T18:12:18Z")

</div>

Hello Pablo,  
No, I have configured port 443 in kibana.yml and I applied this config to the server:  
`setcap 'cap_net_bind_service=+ep' /usr/share/kibana/node/bin/node`  
So, I can access it directly to 443 port through HTTPS.

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [April 17, 2021, 11:26am UTC](https://forum.opensearch.org/t/saml-issue-on-logout/5617/13 "2021-04-17T11:26:43Z")

</div>

Hello @Lord_Zetas

I’ve done further testing and got the same results. Logout is working up to 1.11 but starting from 1.12 I’m getting the same error as you.

> {“statusCode”:401,“error”:“Unauthorized”,“message”:“Unauthorized”}

In my lab I use Keycloak instead of PingID however, based on the above this is not an IDP platform issue.

---

<div class="post-metadata">

**Author:** ![orsifacundo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/orsifacundo/32/1383_2.png) [@orsifacundo](https://forum.opensearch.org/u/orsifacundo)\
**Post date:** [April 20, 2021, 11:55pm UTC](https://forum.opensearch.org/t/saml-issue-on-logout/5617/14 "2021-04-20T23:55:27Z")

</div>

Hi @pablo and @Lord_Zetas ,

I managed to get a workaround for this issue. The problem seems to be that the parameter `authInfo.sso_logout_url` comes with the SLO URL and it is taken as unauthorized (in my case and with Ping Identity IdP is in the form `https://auth.pingone.com/<tenant>/saml20/idp/slo` ).

So I changed the redirect URL that is injected on the location of the response header.

- Edit the file `/usr/share/kibana/plugins/opendistroSecurityKibana/server/auth/types/saml/routes.js`
- Go to the `path: /auth/logout` part of the code.
- Change the redirectUrl constant assignment

> const redirectUrl = authInfo.sso\_logout\_url || this.coreSetup.http.basePath.serverBasePath || ‘/’;

with for example

> const redirectUrl = `${this.coreSetup.http.basePath.serverBasePath}/app/kibana`;

- Restart Kibana.

Regards.

---

<div class="post-metadata">

**Author:** ![Hari](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/hari/32/893_2.png) [@Hari](https://forum.opensearch.org/u/Hari)\
**Post date:** [February 21, 2022, 10:18am UTC](https://forum.opensearch.org/t/saml-issue-on-logout/5617/15 "2022-02-21T10:18:23Z")

</div>

Dear community,  
CC: @Lord_Zetas@pablo

Is there any update on this issue? We are using 1.13.2 and facing the same issue.

dariommr’s issue: [SAML issue on logout (with Signing Request) · Issue #1 · opendistro-for-elasticsearch/security · GitHub](https://github.com/opendistro-for-elasticsearch/security/issues/1) is in the archived state as well.

---

<div class="post-metadata">

**Author:** ![Gsmitt](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/gsmitt/32/1718_2.png) [@Gsmitt](https://forum.opensearch.org/u/Gsmitt)\
**Post date:** [November 23, 2023, 5:26am UTC](https://forum.opensearch.org/t/saml-issue-on-logout/5617/16 "2023-11-23T05:26:27Z")

</div>

Hey @orsifacundo

I just want to say thanks, I have a instance for Wazuh-v4.5 and Opensearch-v2.11.0 using SAML  
and was unable to logoff without getting a 404 " Not found" in either one of those. I’m using Zitadel for my idp.

```auto
vi /usr/share/opensearch-dashboards/plugins/securityDashboards/server/auth/types/saml/routes.js

```

```auto
// const redirectUrl = authInfo.sso_logout_url || this.coreSetup.http.basePath.serverBasePath || '/';
        const redirectUrl = `${this.coreSetup.http.basePath.serverBasePath}/app/home`;

```

It was 4 days of my life wasted util I found this post. Thanks again 👍

---

<div class="post-metadata">

**Author:** ![orsifacundo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/orsifacundo/32/1383_2.png) [@orsifacundo](https://forum.opensearch.org/u/orsifacundo)\
**Post date:** [November 23, 2023, 1:53pm UTC](https://forum.opensearch.org/t/saml-issue-on-logout/5617/17 "2023-11-23T13:53:07Z")

</div>

Glad to see that this workaround is still helpful after some time 😁

---

<div class="post-metadata">

**Author:** ![ComBin](https://avatars.discourse-cdn.com/v4/letter/c/a88e57/32.png) [@ComBin](https://forum.opensearch.org/u/ComBin)\
**Post date:** [February 15, 2024, 8:51am UTC](https://forum.opensearch.org/t/saml-issue-on-logout/5617/18 "2024-02-15T08:51:10Z")

</div>

Has any one know related issue in github?
