Kibana 6.5.3 null cert chain

Hello everyone.

I have an elastic cluster in 6.2.4, with the x-pack plugin, a licence, and full ssl required (http, transports)
A kibana is also installed and is authenticated with signed certificates

I am trying to install the latest version 6.5.3.
Everything works fine for Elastic, but no way to connect Kibana with ssl verification.

When I try to access kibana i get :
{"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred"}

Kibana logs :

{"type":"log","@timestamp":"2018-12-18T16:16:42Z","tags":["info","authentication"],"pid":11074,"message":"Authentication attempt failed: No Living connections"}
{"type":"error","@timestamp":"2018-12-18T16:16:41Z","tags":[],"pid":11074,"level":"error","error":{"message":"No Living connections","name":"Error","stack":"Error: No Living connections\n    at sendReqWithConnection (/usr/share/kibana/node_modules/elasticsearch/src/lib/transport.js:226:15)\n    at next (/usr/share/kibana/node_modules/elasticsearch/src/lib/connection_pool.js:214:7)\n    at _combinedTickCallback (internal/process/next_tick.js:132:7)\n    at process._tickDomainCallback (internal/process/next_tick.js:219:9)"},"url":{"protocol":null,"slashes":null,"auth":null,"host":null,"port":null,"hostname":null,"hash":null,"search":"","query":{},"pathname":"/app/infra","path":"/app/infra","href":"/app/infra"},"message":"No Living connections"}
{"type":"response","@timestamp":"2018-12-18T16:16:41Z","tags":[],"pid":11074,"method":"get","statusCode":500,"req":{"url":"/app/infra","method":"get","headers":{"host":"node-01","user-agent":"Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 20000523 Firefox/52.0","accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","accept-language":"en-US,en;q=0.5","accept-encoding":"gzip, deflate, br","connection":"keep-alive","upgrade-insecure-requests":"1","cache-control":"max-age=0"},"remoteAddress":"","userAgent":""},"res":{"statusCode":500,"responseTime":26,"contentLength":9},"message":"GET /app/infra 500 26ms - 9.0B"}

Elastic logs:

[2018-12-18T17:19:55,408][WARN ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [node-01] caught exception while handling client http traffic, closing connection [id: 0x8426cb88, L: ! R:/]
io.netty.handler.codec.DecoderException: null cert chain
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode( ~[netty-codec-4.1.30.Final.jar:4.1.30.Final]
Caused by: null cert chain
        at ~[?:?]
        at ~[?:?]
        at ~[?:?]
        at ~[?:?]
        at ~[?:?]
        at ~[?:?]
        at ~[?:?]
        at$ ~[?:?]
        at$ ~[?:?]
        at Method) ~[?:1.8.0_181]
        at$ ~[?:?]
        at io.netty.handler.ssl.SslHandler.runDelegatedTasks( ~[netty-handler-4.1.30.Final.jar:4.1.30.Final]
        at io.netty.handler.ssl.SslHandler.unwrap( ~[netty-handler-4.1.30.Final.jar:4.1.30.Final]
        at io.netty.handler.ssl.SslHandler.decodeJdkCompatible( ~[netty-handler-4.1.30.Final.jar:4.1.30.Final]
        at io.netty.handler.ssl.SslHandler.decode( ~[netty-handler-4.1.30.Final.jar:4.1.30.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection( ~[netty-codec-4.1.30.Final.jar:4.1.30.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode( ~[netty-codec-4.1.30.Final.jar:4.1.30.Final]
        ... 15 more

I can curl, using my certs :

curl --user kibana:password --cacert /etc/kibana/ssl/ca/ca.crt --cert /etc/kibana/ssl/kibana/kibana.crt --key /etc/kibana/ssl/kibana/kibana.key https://node-01:9200/_cat/nodes 3 64 3 0.92 0.70 0.54 mdi * node-01

In Kibana config :

server.ssl.enabled: true
server.ssl.certificate: /etc/kibana/ssl/kibana/kibana.crt
server.ssl.key: /etc/kibana/ssl/kibana/kibana.key

elasticsearch.ssl.certificate: /etc/kibana/ssl/kibana/kibana.crt
elasticsearch.ssl.key: /etc/kibana/ssl/kibana/kibana.key

elasticsearch.ssl.certificateAuthorities: ["/etc/kibana/ssl/ca/ca.crt" ]

elasticsearch.ssl.verificationMode: full

In Elastic config : true required certificate /etc/elasticsearch/ssl/elasticsearch/elastic.key /etc/elasticsearch/ssl/elasticsearch/elastic.crt ["/etc/elasticsearch/ssl/ca/ca.crt"] true required /etc/elasticsearch/ssl/elasticsearch/elastic.key /etc/elasticsearch/ssl/elasticsearch/elastic.crt ["/etc/elasticsearch/ssl/ca/ca.crt"]

If I disable and set it to optional or none, kibana is working correctly. But i don't want to disable it.

It's strange as I am using the same certificates from before and the curl is working with thoses certs..

Do you have any idea how to fix this ?

Thank you very much.

@Larry_Gregory/ @Brandon_Kobel - our security people can help here when they get some time.


1 Like

Hey @totsugeki, 6.4 introduced a change in behavior when Kibana send it's certificates for certain ES connections. provides some context for what you're experiencing, and as of 6.5 you can use the elasticsearch.ssl.alwaysPresentCertificate: true setting in your kibana.yml to always present the certificates to ES; however, care should be used when setting this as if you're using the PKI realm in ES to authenticate users, in certain configurations this can lead to requests from your end-user being authenticated as the internal Kibana system user.

1 Like

Than you @Brandon_Kobel.

I missed this change in behavior (where could I have read about this ?)
So if I understand correctly :

If we set required in elasticsearch, it is impossible to use kibana without elasticsearch.ssl.alwaysPresentCertificate: true because elasticsearch is expecting a client certificat.

in certain configurations this can lead to requests from your end-user being authenticated as the internal Kibana system user.

Do you have more informations about this ?
What are the security implication ?

Thank you very much !

Do you have more informations about this ?
What are the security implication?

This is only an issue when using the PKI Realm in Elasticsearch, and the certificate which Kibana presents to Elasticsearch is used to authenticate the Kibana server's internal user. There are two types of requests which Kibana makes to Elasticsearch, those which it intends to make as Kibana server's internal user (by default the kibana user`), and those that it proxies to Elasticsearch on behalf of the end-user which we intend to make using the end-users credentials. On these proxied requests, if we're presenting the certificate and the end-user's certificates, we have to have the realms in Elasticsearch ordered in a specific way so that the end-users credentials take precedent over the certificate, or else we risk these proxied requests being executing on behalf of the Kibana server internal user.

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