docker-elk: Kibana SSL problem to expose
Hi,
I am trying to expose Kibana to subdomain like watchlog.example.com via Cloudflare but I don’t know why it doesn’t works.
This is what Cloudflare shows: Error 525 SSL handshake failed
Here is my docker-compose.yml
kibana:
build:
context: kibana/
args:
ELASTIC_VERSION: ${ELASTIC_VERSION}
volumes:
- ./kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml:ro,Z
# (!) CA certificate. Generate using instructions from tls/README.md.
- ./tls/kibana/elasticsearch-ca.pem:/usr/share/kibana/config/elasticsearch-ca.pem:ro,z
ports:
- "443:5601"
environment:
KIBANA_SYSTEM_PASSWORD: ${KIBANA_SYSTEM_PASSWORD:-}
networks:
- elk
depends_on:
- elasticsearch
and my kibana.yml
server.name: kibana
server.host: 0.0.0.0
elasticsearch.hosts: [ "https://elasticsearch:9200" ]
monitoring.ui.container.elasticsearch.enabled: true
## X-Pack security credentials
#
elasticsearch.username: kibana_system
elasticsearch.password: ${KIBANA_SYSTEM_PASSWORD}
##
## TLS configuration
## See instructions from README to enable.
##
elasticsearch.ssl.certificateAuthorities: [ "config/elasticsearch-ca.pem" ]
## Communications between Kibana and Elasticsearch
## see https://www.elastic.co/guide/en/kibana/current/configuring-tls.html#configuring-tls-kib-es
#
elasticsearch.ssl.certificateAuthorities: [ "config/elasticsearch-ca.pem" ]
Am I missing something ?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15
For posterity, there is now a new section inside
tls/README.mdwhich explains how to enable TLS in the Kibana server (between web browsers and Kibana), as well as a sample certificate and key which Kibana is pre-configured to use when TLS is enabled.@antoineco I tried everything from scratch and now it works (chmod 777 instead of o+rw)! Your tuto should be integrated somewhere on the documentation!
Thank you so much
yes of course, I also tried to create the “tls” folder inside the elasticsearch container (which did not exists) and chmod it to 777 but still the same error…
You can see here: https://imgur.com/WCTQl9s
Indeed, the tooling is inside the Elasticsearch container. You don’t need to execute commands on the running Elasticsearch instance though, you can simply run a temporary container on the side just to generate your certificates, then mount those certificates inside the Kibana container.
An example of this approach can be seen in tls/README.md. More specifically, the procedure is very similar to what’s described in the Elasticsearch HTTP certificate and CA PEM certificate section.
Demo
Generate the archive containing a new certificate and key:
(When prompted where to write certificates, provide the following path:
tls/kibana-https.zip. The corresponding file will be available in thetls/directory of thedocker-elkrepo, since the repo’s directory is mounted as a volume during the runtime of the container.)Unzip the certificate and key:
Move the certificate and key:
Verify that the certificate has the expected Subject Alternative Name:
Edit the Compose file to mount the certificate and key:
Edit the Kibana configuration to enable TLS:
Restart Kibana, and access it over HTTPS (you will need to ignore warnings because your browser won’t trust docker-elk’s CA):