Version info -
Elasticsearch version: - 7.0.1
Server OS version: - Centos 7.7
Kibana version (if relevant): - 7.0.1
Describe the issue:
Is the kibana-openid integration (Kibana OIDC Quick Start | Security for Elasticsearch | Search Guard) supported on IPv6 env?
I am running ELK (with searchguard) and keycloak in IPv6 environment. So my keycloak server’s well-known url is accessed as https://[ <{ipv6-addr}>]:/auth/realms//.well-known/openid-configuration.
With searchguard basic auth, kibana works fine.
But when I enable openid-authentication, I see such errors in kibana logs -
{“type”:“log”,“@timestamp”:“2020-05-06T12:54:56Z”,“tags”:[“error”,“searchguard”],“pid”:30774,“message”:“An error occurred while enabling session management: Error: Failed when trying to obtain the endpoints from your IdP”}
{“type”:“log”,“@timestamp”:“2020-05-06T12:54:56Z”,“tags”:[“status”,“plugin:searchguard@7.0.1-35.1.0”,“error”],“pid”:30774,“state”:“red”,“message”:“Status changed from yellow to red - An error occurred during initialisation, please check the logs.”,“prevState”:“yellow”,“prevMsg”:“‘searchguard.cookie.secure’ is set to false, cookies are transmitted over unsecure HTTP connection. Consider using HTTPS and set this key to ‘true’”}
After browsing through the code, I noticed in file /usr/share/kibana/plugins/searchguard/lib/auth/types/openid/OpenId.js ,in the method setupRoutes, Wreck.get was not responding with the response and so it is failing with above error.
const {response, payload} = await Wreck.get(this.config.get(‘searchguard.openid.connect_url’));
I added a line in the catch section to display the caught error. I saw this errror -
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: { Error: getaddrinfo ENOTFOUND [2a00:8a00:6000:d094::15] [2a00:8a00:6000:d094::15]:31073
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: errno: 'ENOTFOUND',
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: code: 'ENOTFOUND',
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: syscall: 'getaddrinfo',
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: hostname: '[2a00:8a00:6000:d094::15]',
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: host: '[2a00:8a00:6000:d094::15]',
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: port: 31073,
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: trace:
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: [ { method: 'GET',
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: url:
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: 'https://[2a00:8a00:6000:d094:0:0:0:15]:31073/auth/realms/elk/.well-known/openid-configuration' } ],
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: isBoom: true,
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: isServer: true,
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: data: null,
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: output:
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: { statusCode: 502,
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: payload:
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: { message:
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: 'Client request error: getaddrinfo ENOTFOUND [2a00:8a00:6000:d094::15] [2a00:8a00:6000:d094::15]:31073',
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: statusCode: 502,
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: error: 'Bad Gateway' },
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: headers: {} },
May 06 12:40:01 vm-10-75-47-82 kibana[13287]: reformat: [Function] }
It seems this library is unable to reach the address. Can you pls help with what configurations would be needed for IPv6?
Expected behavior: Kibana to seamlessly work with openid (keycloak) integration. It works fine for me on IPv4 env.
Provide configuration:
kibana/config/kibana.yml:
server.host: “2a00:8a00:6000:d094:0:0:0:15”
elasticsearch.hosts: “https://[2a00:8a00:6000:d094:0:0:0:15]:30932”
elasticsearch.username: “admin”
elasticsearch.password: “admin”
searchguard.auth.type: “openid”
searchguard.openid.connect_url: “https://[2a00:8a00:6000:d094:0:0:0:15]:31073/auth/realms/elk/.well-known/openid-configuration”
searchguard.openid.client_id: “elk-kibana”
searchguard.openid.client_secret: “fcf9f6b2-42d2-485d-ab78-551bee693a79”
searchguard.openid.header: “Authorization”
searchguard.openid.base_redirect_url: “https://[2a00:8a00:6000:d094:0.0.0:15]:5601”
searchguard.openid.root_ca: “/etc/kibana/keycloak-root-ca.pem”