Boas Enkler
Boas Enkler

Reputation: 12557

Using ELK Stack in Docker with docker-compose with x.pack auth failed to authenticate the user

I want to use the elk stack with docker.

for this i created a docker-compose file. Everything works fine as long as I have X-Pack deactivated.

But now I want to have a login in the kibana UI and therefore i want to use the x-pack

I defined the UserName and Passsword in the environment of the elasticsearch and also logstash.

But i always get this exceptionm

elasticsearch_1 | [2017-11-27T09:25:58,190][INFO ][o.e.x.s.a.AuthenticationService] [clEpqom] Authentication of [elastic] was terminated by realm [reserved] - failed to authenticate user [elastic]

Any hints of what i'm doing wrong? Here my docker-compose file:

version: '2'

services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch-platinum:6.0.0
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      ELASTIC_USERNAME: "elastic"
      ELASTIC_PASSWORD: "MyPw123"
      http.cors.enabled: "true"
      http.cors.allow-origin: "*"
    networks:
      - elk

  logstash:
    image: docker.elastic.co/logstash/logstash:6.0.0
    environment:
      xpack.monitoring.elasticsearch.url: "172.17.0.1:9200"
      xpack.monitoring.elasticsearch.username: "elastic"
      xpack.monitoring.elasticsearch.password: "MyPw123"
    networks:
      - elk
    depends_on:
      - elasticsearch

  kibana:
    image: docker.elastic.co/kibana/kibana:6.0.0
    ports:
      - "5601:5601"
    networks:
      - elk
    depends_on:
      - elasticsearch
networks:
  elk:
    driver: bridge

UPDATE Using the default password "changeme" does work.

Upvotes: 0

Views: 3527

Answers (1)

lvthillo
lvthillo

Reputation: 30831

You can change your elastic (admin) password in the cluster by using:

curl -u elastic -XPUT 'localhost:9200/_xpack/security/user/elastic/_password?prett‌​y' -H 'Content-Type: application/json' -d' 
{ 
    "password": "supersecret" 
}

The default password is changme.

If you really want to set your configuration in docker-compose I would recommend to look at this page. I think you can not set your elasticsearch password as environment variable for logstash (they are not in the env var list). You have to change it in config files or build your own image. (Same for Kibana I'm afraid).

Upvotes: 1

Related Questions