Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
2.12.0
Describe the issue:
I configured the SAML Authentication for my Opensearch Dashboards in the Azure. If I type my Opensearch URL in the browser I can login successfully, but If I try to access the Opensearch Dashboards using the icon in the My Apps I receive the following error:
This is what I see in the browser:
{"statusCode":500,"error":"Internal Server Error","message":"Internal Error"}
This is what I see in the dashboards host logs:
{"type":"log","@timestamp":"2024-04-25T17:48:25Z","tags":["error","plugins","securityDashboards"],"pid":25304,"message":"SAML IDP initiated authentication workflow failed: Error: failed to get token"}
{"type":"error","@timestamp":"2024-04-25T17:48:25Z","tags":[],"pid":25304,"level":"error","error":{"message":"Internal Server Error","name":"Error","stack":"Error: Internal Server Error\n at HapiResponseAdapter.toError (/usr/share/opensearch-dashboards/src/core/server/http/router/response_adapter.js:127:19)\n at HapiResponseAdapter.toHapiResponse (/usr/share/opensearch-dashboards/src/core/server/http/router/response_adapter.js:83:19)\n at HapiResponseAdapter.handle (/usr/share/opensearch-dashboards/src/core/server/http/router/response_adapter.js:79:17)\n at Router.handle (/usr/share/opensearch-dashboards/src/core/server/http/router/router.js:175:34)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (internal/process/task_queues.js:95:5)\n at handler (/usr/share/opensearch-dashboards/src/core/server/http/router/router.js:140:50)\n at exports.Manager.execute (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/toolkit.js:60:28)\n at Object.internals.handler (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/handler.js:46:20)\n at exports.execute (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/handler.js:31:20)\n at Request._lifecycle (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:371:32)\n at Request._execute (/usr/share/opensearch-dashboards/node_modules/@hapi/hapi/lib/request.js:281:9)"},"url":"http://opensearch-dashboards-v1.<mycompany>.com/_opendistro/_security/saml/acs/idpinitiated","message":"Internal Server Error"}
{"type":"response","@timestamp":"2024-04-25T17:48:25Z","tags":[],"pid":25304,"method":"post","statusCode":500,"req":{"url":"/_opendistro/_security/saml/acs/idpinitiated","method":"post","headers":{"host":"opensearch-dashboards-v1.<mycompany>.com","accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","sec-fetch-site":"cross-site","accept-language":"en-GB,en-US;q=0.9,en;q=0.8","accept-encoding":"gzip, deflate, br","sec-fetch-mode":"navigate","content-type":"application/x-www-form-urlencoded","origin":"https://login.microsoftonline.com","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15","referer":"https://login.microsoftonline.com/","content-length":"7569","connection":"keep-alive","sec-fetch-dest":"document"},"remoteAddress":"172.20.6.64","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15","referer":"https://login.microsoftonline.com/"},"res":{"statusCode":500,"responseTime":185,"contentLength":9},"message":"POST /_opendistro/_security/saml/acs/idpinitiated 500 185ms - 9.0B"}
{"type":"response","@timestamp":"2024-04-25T17:48:25Z","tags":[],"pid":25304,"method":"get","statusCode":302,"req":{"url":"/","method":"get","headers":{"user-agent":"ELB-HealthChecker/2.0","host":"172.20.7.180:443","connection":"close","accept":"*/*","accept-encoding":"*"},"remoteAddress":"172.20.7.180","userAgent":"ELB-HealthChecker/2.0"},"res":{"statusCode":302,"responseTime":1,"contentLength":9},"message":"GET / 302 1ms - 9.0B"}
Configuration:
This is my opensearch-security/config.yml configuration:
saml_auth_domain:
http_enabled: true
transport_enabled: false
order: 1
http_authenticator:
type: saml
challenge: true
config:
idp:
metadata_url: "https://login.microsoftonline.com/<id>/federationmetadata/2007-06/federationmetadata.xml?appid=<appid>"
entity_id: "https://sts.windows.net/<id>/"
sp:
entity_id: "https://opensearch-dashboards-v1.<mycompany>.com"
kibana_url: "https://opensearch-dashboards-v1.<mycompany>.com"
roles_key: "http://schemas.microsoft.com/ws/2008/06/identity/claims/role"
exchange_key: "<key>"
authentication_backend:
type: noop
This is my opensearch_dashboards.yml configuration:
server.host: "0.0.0.0"
opensearch.hosts: https://opensearch-v1.<mycompany>.com:9200
opensearch.ssl.verificationMode: none
opensearch.username: admin
opensearch.password: mypassword
# opensearch.requestHeadersAllowlist: ["securitytenant","Authorization"]
opensearch.requestHeadersWhitelist: [authorization, securitytenant, WWW-Authenticate]
# Enable OpenID/saml authentication
opensearch_security.auth.type: "saml"
opensearch_security.multitenancy.enabled: true
opensearch_security.multitenancy.tenants.preferred: [Private, Global]
opensearch_security.readonly_mode.roles: [kibana_read_only, readall, opensearch_dashboards_read_only]
#opensearch_security.readonly_mode.roles: [opensearch_dashboards_read_only]
# Use this setting if you are running opensearch-dashboards without https
opensearch_security.cookie.secure: false
# PLAT-1119 extend timeout to 12 hours (43200000ms)
opensearch_security.cookie.ttl: 43200000
opensearch_security.session.ttl: 43200000
server.xsrf.allowlist: ["/_opensearch/_security/saml/acs/idpinitiated", "/_opensearch/_security/saml/acs", "/_opensearch/_security/saml/logout", "/_opendistro/_security/saml/acs/idpinitiated", "/_opendistro/_security/saml/acs", "/_opendistro/_security/saml/logout", "/_plugins/_security/saml/acs/idpinitiated", "/_plugins/_security/saml/acs", "/_plugins/_security/saml/logout"]
server.maxPayloadBytes: 5242880
#logging.root.level: debug
#logging.verbose: true
Relevant Logs or Screenshots: