Hello! I'm using elasticsearch & kibana both 7.17.1 and can't run mutual tls authentication setup where both elasticsearch server and clients authenticate each other.
I've followed official documentation on this, and it contains this instruction:
- xpack.security.http.ssl.client_authentication: "optional"
Other possible option is "required". This means that elasticsearch will require client certificate.
with "optional" setup everything works, but I believe there is NO tls client auth:
curl --cacert ca.crt https://192.168.1.100:9200
{
"name" : "elastic-1",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "rgPoHJUdSv2TY8hk0dautQ",
"version" : {
"number" : "7.17.1",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "e5acb99f822233d62d6444ce45a4543dc1c8059a",
"build_date" : "2022-02-23T22:20:54.153567231Z",
"build_snapshot" : false,
"lucene_version" : "8.11.1",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
As you see I didn't provide client certificate to curl and still request is proceed.
If i change xpack.security.http.ssl.client_authentication
to required
, curl check works as expected:
curl --cacert ca.crt https://192.168.1.100:9200
curl: (56) OpenSSL SSL_read: error:14094412:SSL routines:ssl3_read_bytes:sslv3 alert bad certificate, errno 0
curl --cacert ca.crt --cert kibana.crt --key kibana.key https://192.168.1.100:9200
{
"name" : "elastic-1",
"cluster_name" : "elasticsearch",
...
but kibana fails to connect to the elasticsearch instance. I get this
ConnectionError: socket hang up - Local: 192.168.1.101:35278, Remote: 192.168.1.100:9200
in kibana log and javax.net.ssl.SSLHandshakeException: Empty client certificate chain
in elasticsearch log. This exception also occurs if i run curl without specifying the client certificate.
I make a conclusion that kibana doesn't provide client certificate to the elasticsearch server.
my elasticsearch.yml:
xpack.security.transport.ssl.enabled: true
xpack.security.http.ssl.enabled: true
xpack.security.http.ssl.certificate: elasticsearch.crt
xpack.security.http.ssl.key: elasticsearch.key
xpack.security.http.ssl.certificate_authorities: ca.crt
xpack.security.http.ssl.client_authentication: "required"
# xpack.security.http.ssl.client_authentication: "optional"
kibana.yml:
elasticsearch.hosts: ["https://192.168.1.100:9200"]
elasticsearch.ssl.verificationMode: certificate
elasticsearch.ssl.certificate: /etc/kibana/kibana.crt
elasticsearch.ssl.key: /etc/kibana/kibana.key
elasticsearch.ssl.certificateAuthorities: [ "/etc/kibana/ca.crt" ]
What is the right way to solve this issue?