# Kibana tls certificate

**URL:** <https://discuss.elastic.co/t/kibana-tls-certificate/198421>\
**Category:** Kibana\
**Tags:** docker\
**Created:** [September 6, 2019, 12:17pm UTC](https://discuss.elastic.co/t/kibana-tls-certificate/198421 "2019-09-06T12:17:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![O.Shulha](https://avatars.discourse-cdn.com/v4/letter/o/e5b9ba/32.png) [@O.Shulha](https://discuss.elastic.co/u/O.Shulha)\
**Post date:** [September 6, 2019, 12:17pm UTC](https://discuss.elastic.co/t/kibana-tls-certificate/198421/1 "2019-09-06T12:17:07Z")

</div>

I`m trying to enable tls certification with x-pack.

docker-compose.yml

```auto
version: '2.2'

services:
  es01:
    container_name: es01
    image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
    environment:
      - node.name=es01
      - discovery.type=single-node
      - bootstrap.memory_lock=true
      - xpack.security.enabled=true
      - ELASTIC_PASSWORD=$ELASTIC_PASSWORD 
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - xpack.license.self_generated.type=basic
      - xpack.security.http.ssl.enabled=true
      - xpack.security.http.ssl.key=$CERTS_DIR/es01/es01.key
      - xpack.security.http.ssl.certificate_authorities=$CERTS_DIR/ca/ca.crt
      - xpack.security.http.ssl.certificate=$CERTS_DIR/es01/es01.crt
      - xpack.security.transport.ssl.enabled=true
      - xpack.security.transport.ssl.verification_mode=certificate 
      - xpack.security.transport.ssl.certificate_authorities=$CERTS_DIR/ca/ca.crt
      - xpack.security.transport.ssl.certificate=$CERTS_DIR/es01/es01.crt
      - xpack.security.transport.ssl.key=$CERTS_DIR/es01/es01.key
    volumes: ['data01:/usr/share/elasticsearch/data', 'certs:$CERTS_DIR']
    ports:
      - 9200:9200

  kibana:
    depends_on:
      - es01
    image: docker.elastic.co/kibana/kibana:7.2.0
    environment: 
      - xpack.security.enabled=true
    ports: 
      - 5601:5601
    volumes:
      - /home/alex/Desktop/tls/kibana.yml:/usr/share/kibana/config/kibana.yml
    extra_hosts: 
      - "es01:127.0.0.1"

volumes: {"data01", "certs"}

```

kibana.yml

```auto
server.name: kibana
server.host: "0"
elasticsearch.hosts: ["https://es01:9200"]
elasticsearch.username: "elastic"
elasticsearch.password: "pa55word"

```

create-certs.yml

```auto
version: '2.2'

services:
  create_certs:
    container_name: create_certs
    image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
    command: >
      bash -c '
        yum install -y -q -e 0 unzip;
        if [[! -f /certs/bundle.zip]]; then
          bin/elasticsearch-certutil cert --silent --pem --in config/certificates/instances.yml -out /certs/bundle.zip;
          unzip /certs/bundle.zip -d /certs; 
        fi;
        chown -R 1000:0 /certs 
      '
    user: "0"
    working_dir: /usr/share/elasticsearch
    volumes: ['certs:/certs', '.:/usr/share/elasticsearch/config/certificates']

volumes: {"certs"}

```

instances.yml

```auto
instances:
  - name: es01
    dns:
      - es01 
      - localhost
    ip:
      - 127.0.0.1

```

.env

```auto
COMPOSE_PROJECT_NAME=es
CERTS_DIR=/usr/share/elasticsearch/config/certificates
ELASTIC_PASSWORD=pa55word

```

i followed this tutorial :  
[https://www.elastic.co/guide/en/elasticsearch/reference/7.2/configuring-tls-docker.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.2/configuring-tls-docker.html)

so. elasticsearch works fine. i can reach elasticsearch on the : [https://localhost:9200](https://localhost:9200)  
and can see certificate.

But kibana container fails and give out some errors:

```auto
kibana_1 | {"type":"log","@timestamp":"2019-09-06T12:11:26Z","tags":["warning","elasticsearch","data"],"pid":1,"message":"Unable to revive connection: https://es01:9200/"}
kibana_1 | {"type":"log","@timestamp":"2019-09-06T12:11:26Z","tags":["warning","elasticsearch","data"],"pid":1,"message":"No living connections"}
kibana_1 | {"type":"log","@timestamp":"2019-09-06T12:11:26Z","tags":["license","warning","xpack"],"pid":1,"message":"License information from the X-Pack plugin could not be obtained from Elasticsearch for the [data] cluster. Error: No Living connections"}
kibana_1 | {"type":"log","@timestamp":"2019-09-06T12:11:29Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: https://es01:9200/"}
kibana_1 | {"type":"log","@timestamp":"2019-09-06T12:11:29Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"No living connections"}
kibana_1 | {"type":"log","@timestamp":"2019-09-06T12:11:30Z","tags":["reporting","browser-driver","warning"],"pid":1,"message":"Enabling the Chromium sandbox provides an additional layer of protection."}
kibana_1 | {"type":"log","@timestamp":"2019-09-06T12:11:30Z","tags":["reporting","warning"],"pid":1,"message":"Generating a random key for xpack.reporting.encryptionKey. To prevent pending reports from failing on restart, please set xpack.reporting.encryptionKey in kibana.yml"}
kibana_1 | {"type":"log","@timestamp":"2019-09-06T12:11:30Z","tags":["status","plugin:reporting@7.2.0","error"],"pid":1,"state":"red","message":"Status changed from uninitialized to red - No Living connections","prevState":"uninitialized","prevMsg":"uninitialized"}
kibana_1 | {"type":"log","@timestamp":"2019-09-06T12:11:30Z","tags":["status","plugin:security@7.2.0","error"],"pid":1,"state":"red","message":"Status changed from green to red - No Living connections","prevState":"green","prevMsg":"Ready"}
kibana_1 | {"type":"log","@timestamp":"2019-09-06T12:11:30Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: 

```

localhost:5601 works. I can get message "Kibana server is not ready yet"  
[https://localhost:5601](https://localhost:5601) is not working.

inside kibana container i can`t

```auto
curl es01:9200

```

with error

```auto
connection refused

```

`etc/hosts`  
has already all hosts.

Where is the error?  
Thank you a lot.

---

<div class="post-metadata">

**Author:** ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)\
**Post date:** [September 11, 2019, 1:44pm UTC](https://discuss.elastic.co/t/kibana-tls-certificate/198421/2 "2019-09-11T13:44:34Z")

</div>

Hey @O.Shulha,

> localhost:5601 works. I can get message "Kibana server is not ready yet"

I believe you should properly set `elasticsearch.ssl.certificateAuthorities` in `kibana.yml` as well (so that Kibana server can trust Elasticsearch self-signed certificate).

> [https://localhost:5601](https://localhost:5601) is not working.

Well, you set up TLS for Elasticsearch, but not for Kibana, it's still served through plain HTTP. See [Encrypting communications in Kibana](https://www.elastic.co/guide/en/kibana/current/configuring-tls.html) if you want to set up TLS for Kibana as well.

Best,  
Oleg

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 9, 2019, 1:55pm UTC](https://discuss.elastic.co/t/kibana-tls-certificate/198421/3 "2019-10-09T13:55:24Z")

</div>

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