How to set passwords for built-in users with docker-compose setup

Hi @ikakavas,

thank you for your reply!

I added the environment variable XPACK_SECURITY_ENABLED: "true" to the kibana service and gave it the initial password kibanachangeme (for testing purposes I set it directly in the compose file).

I also set an initial password elastic for the elastic user itself in the compose files of the three nodes. Next up I started the nodes (not kibana). After the cluster has formed I changed the password of the kibana user via the Change Password API as you suggested like so:

curl -XPOST -H "Content-Type: application/json" http://192.168.2.120:9200/_security/user/kibana/_password -d "{ \"password\": \"kibanachangeme\" }"

After this request succeeded I start kibana. As I can see from the logs, kibana can connect to the cluster - great!

But when I access kibana via the browser it still prompts me for the basic auth from elasticsearch and does not show the usual kibana forms login. What's still missing?

Below are the updated services:

services:
  es-mdi:
    container_name: lxelk01-es-mdi
    image: elasticsearch:7.3.0
    ports:
      - "9200:9200"
      - "9300:9300"
    networks:
      - elk
    volumes:
      - es-mdi-volume:/usr/share/elasticsearch
    environment:
      cluster.name: my-cluster
      node.name: lxelk01-es-mdi
      network.host: 0.0.0.0
      network.publish_host: 192.168.2.120
      http.port: 9200
      transport.port: 9300
      bootstrap.memory_lock: "true"
      node.master: "true"
      node.data: "true"
      node.ingest: "true"
      node.ml: "false"
      xpack.ml.enabled: "false"
      discovery.seed_hosts: 192.168.2.120:9300,192.168.2.121:9300,192.168.2.122:9300
      cluster.initial_master_nodes: 192.168.2.120:9300,192.168.2.121:9300,192.168.2.122:9300
      xpack.monitoring.enabled: "true"
      xpack.monitoring.collection.enabled: "true"
      ES_JAVA_OPTS: "-Xms16g -Xmx16g"
      xpack.security.enabled: "true"
      ELASTIC_PASSWORD: "elastic"
      xpack.license.self_generated.type: "trial"
    ulimits:
      memlock: -1
      #noproc: 65536
      nofile: 65536
      fsize: -1
      as: -1
    restart: unless-stopped

  kibana:
    container_name: lxelk01-kibana
    image: kibana:7.3.0
    ports:
      - "5601:5601"
    networks:
      - elk
    volumes:
      - kibana-volume:/usr/share/kibana
    depends_on:
      - es-coord
    ulimits:
      memlock: -1
      #noproc: 65536
      nofile: 65536
      fsize: -1
      as: -1
    environment:
      SERVER_PORT: 5601
      SERVER_NAME: kibana.lxelk01.de
      ELASTICSEARCH_HOSTS: "http://192.168.2.120:9201/"
      XPACK_MONITORING_ENABLED: "true"
      XPACK_MONITORING_COLLECTION_ENABLED: "true"
      XPACK_SECURITY_ENABLED: "true"
      ELASTICSEARCH_USERNAME: "kibana"
      ELASTICSEARCH_PASSWORD: "kibanachangeme"
    restart: unless-stopped

I would appreciate it if you could take another look on my issue. Thanks in advance!