# How to configure ldap on elasticsearch

**URL:** https://discuss.elastic.co/t/how-to-configure-ldap-on-elasticsearch/194530
**Category:** Elasticsearch
**Tags:** elastic-stack-security
**Created:** [August 9, 2019, 2:52am UTC](https://discuss.elastic.co/t/how-to-configure-ldap-on-elasticsearch/194530 "2019-08-09T02:52:27Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![madhukarneelaiahgari](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@madhukarneelaiahgari](https://discuss.elastic.co/u/madhukarneelaiahgari)
#### Post date: [August 9, 2019, 2:52am UTC](https://discuss.elastic.co/t/how-to-configure-ldap-on-elasticsearch/194530/1 "2019-08-09T02:52:27Z")

</div>

Hello Team,

I'm trying to configure ldap on xpack enabled elasticsearch cluster. Below is my docker compose file to deploy the stack . I couldn't find any documents how to do this. Also is there a way that i can pass all these ldap settings as environment variable while deploying the stack. I'm here to find how do i configure ldap settings on elasticsearch nodes.

```auto

version: "3.4"
 
networks:
  net:
    driver: overlay
    attachable: true

volumes:
  elastic_data01:
    driver: netapp
    driver_opts:
      size: 50G
  elastic_data02:
    driver: netapp
    driver_opts:
      size: 50G

services:
  elasticsearch01:
    image: elasticsearch:7.2.0
    networks:
      - net
    volumes:
      - elastic_data01:/usr/share/elasticsearch/data    
    environment:
      - ES_JAVA_OPTS=-Xms512m -Xmx512m
      - xpack.security.enabled=true
      - xpack.license.self_generated.type=basic
      - cluster.name=docker-cluster
      - http.cors.enabled=true
      - http.cors.allow-origin=*
      - ELASTIC_PASSWORD=xxx
      - cluster.initial_master_nodes=elasticsearch01,elasticsearch02
      - node.name=elasticsearch01
      - discovery.seed_hosts=elasticsearch02
      - xpack.security.transport.ssl.enabled=true
      - xpack.security.transport.ssl.verification_mode=certificate 
      -xpack.security.transport.ssl.certificate_authorities=/usr/share/elasticsearch/config/certs/ca/ca.crt
      - xpack.security.transport.ssl.certificate=/usr/share/elasticsearch/config/certs/elasticsearch01/elasticsearch01.crt
      - xpack.security.transport.ssl.key=/usr/share/elasticsearch/config/certs/elasticsearch01/elasticsearch01.key
    deploy:
      mode: replicated
      replicas: 1 

  elasticsearch02:
    image: elasticsearch:7.2.0
    networks:
      - net
    volumes:
      - elastic_data02:/usr/share/elasticsearch/data
    environment:
      - ES_JAVA_OPTS=-Xms512m -Xmx512m
      - xpack.security.enabled=true
      - xpack.license.self_generated.type=basic
      - cluster.name=docker-cluster
      - http.cors.enabled=true
      - http.cors.allow-origin=*
      - ELASTIC_PASSWORD=xxx
      - cluster.initial_master_nodes=elasticsearch01,elasticsearch02
      - node.name=elasticsearch02
      - discovery.seed_hosts=elasticsearch01
      - xpack.security.transport.ssl.enabled=true
      - xpack.security.transport.ssl.verification_mode=certificate 
      - xpack.security.transport.ssl.certificate_authorities=/usr/share/elasticsearch/config/certs/ca/ca.crt
      - xpack.security.transport.ssl.certificate=/usr/share/elasticsearch/config/certs/elasticsearch02/elasticsearch02.crt
      - xpack.security.transport.ssl.key=/usr/share/elasticsearch/config/certs/elasticsearch02/elasticsearch02.key
      - xpack.security.authc.realms.ldap.enabled
    deploy:
      mode: replicated
      replicas: 1

  kibana:
    image: kibana:7.2.0
    ports:
      - "5601:5601"
    networks:
      - net
    environment:
      - xpack.monitoring.ui.container.elasticsearch.enabled=true
      - ELASTICSEARCH_USERNAME=elastic
      - ELASTICSEARCH_PASSWORD=xxx
      - ELASTICSEARCH_HOSTS=["http://elasticsearch01:9200/","http://elasticsearch02:9200/"]
    deploy:
      mode: replicated
      replicas: 1
 
  logstash:
    image: logstash:7.2.0
    ports:
      - "9201:9201"
      - "12201:12201/udp"
    networks:
      - net
    environment:
      - xpack.monitoring.enabled=true
      - xpack.monitoring.elasticsearch.hosts=["http://elasticsearch01:9200/","http://elasticsearch02:9200/"]
      - xpack.monitoring.elasticsearch.url=["http://elasticsearch01:9200/","http://elasticsearch02:9200/"]
      - xpack.monitoring.elasticsearch.username=elastic
      - xpack.monitoring.elasticsearch.password=XXXX
    deploy:
      mode: replicated
      replicas: 1

```

```auto
xpack:
  security:
    authc:
      realms:
        active_directory:
          xxx:
            order: 0 
            domain_name: xxx
            url: ldap://xxx.com
            bind_dn: xxx

```

---

<div class="post-metadata">

### Author: ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)
#### Post date: [August 9, 2019, 6:58am UTC](https://discuss.elastic.co/t/how-to-configure-ldap-on-elasticsearch/194530/2 "2019-08-09T06:58:25Z")

</div>

Hi,

Have you seen our docker docs [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html) and [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/configuring-tls-docker.html) ? These contain examples on how to pass the settings or how to bind mount an `elasticsearch.yml`

---

<div class="post-metadata">

### Author: ![madhukarneelaiahgari](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@madhukarneelaiahgari](https://discuss.elastic.co/u/madhukarneelaiahgari)
#### Post date: [August 9, 2019, 6:38pm UTC](https://discuss.elastic.co/t/how-to-configure-ldap-on-elasticsearch/194530/4 "2019-08-09T18:38:11Z")

</div>

Below is my elasticserach.yml file with configurations

```auto
cluster.name: "docker-cluster"
network.host: 0.0.0.0
xpack: 
  security: 
    authc: 
      realms: 
        active_directory: 
          xxx: 
            domain_name: xxx.xxx.net
            order: 0
            url: "ldap://xxx.xxx.net"

```

When I try using my AD acc to login , i'm seeing below error:

{"type": "server", "timestamp": "2019-08-09T18:34:34,764+0000", "level": "WARN", "component": "o.e.x.s.a.AuthenticationService", "cluster.name": "docker-cluster", "node.name": "elasticsearch01", "cluster.uuid": "1JE9z-OiQnqX2CpU3So2YQ", "node.id": "PCw\_\_y7qQJePgGCeZxwQ1w", "message": "Authentication failed using realms [reserved/reserved,file/default\_file,native/default\_native]. Realms [active\_directory/xxx] were skipped because they are not permitted on the current license" } I have basic license enabled on the systems

---

<div class="post-metadata">

### Author: ![madhukarneelaiahgari](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@madhukarneelaiahgari](https://discuss.elastic.co/u/madhukarneelaiahgari)
#### Post date: [August 9, 2019, 8:33pm UTC](https://discuss.elastic.co/t/how-to-configure-ldap-on-elasticsearch/194530/5 "2019-08-09T20:33:29Z")

</div>

Here's the latest update:

I'm able to integrate AD with elasicsearch only with licence mode " **TRIAL**" licence `*NOT` with " **BASIC**".  
When I read your docs, it was mentioned as basic license should support ldap/ad. Please correct me if i'm wrong.

---

<div class="post-metadata">

### Author: ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)
#### Post date: [August 11, 2019, 4:32pm UTC](https://discuss.elastic.co/t/how-to-configure-ldap-on-elasticsearch/194530/6 "2019-08-11T16:32:43Z")

</div>

No this is not correct, ldap and ad authentication is **not** available with a basic license, see [Subscriptions | Elastic Stack Products & Support | Elastic](https://www.elastic.co/subscriptions) and [Security for Elasticsearch is now free | Elastic Blog](https://www.elastic.co/blog/security-for-elasticsearch-is-now-free)

> When I read your docs, it was mentioned as basic license should support ldap/ad. Please correct me if i'm wrong.

If you point us to that part of the documentation, we will make sure it gets corrected.

---

<div class="post-metadata">

### Author: ![madhukarneelaiahgari](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@madhukarneelaiahgari](https://discuss.elastic.co/u/madhukarneelaiahgari)
#### Post date: [August 12, 2019, 2:49pm UTC](https://discuss.elastic.co/t/how-to-configure-ldap-on-elasticsearch/194530/7 "2019-08-12T14:49:30Z")

</div>

from here:

 ![41%20AM](https://us1.discourse-cdn.com/elastic/original/3X/f/c/fcd35e3f170cd27d1521fce73a76bb041e385596.png)

---

<div class="post-metadata">

### Author: ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)
#### Post date: [August 12, 2019, 2:52pm UTC](https://discuss.elastic.co/t/how-to-configure-ldap-on-elasticsearch/194530/8 "2019-08-12T14:52:01Z")

</div>

As you can see , the line with `LDAP, PKI*, Active Directory authentication` in it is _greyed out_ in the `Basic` and `Open Source` columns which means it is not available.

---

<div class="post-metadata">

### Author: ![madhukarneelaiahgari](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@madhukarneelaiahgari](https://discuss.elastic.co/u/madhukarneelaiahgari)
#### Post date: [August 12, 2019, 2:54pm UTC](https://discuss.elastic.co/t/how-to-configure-ldap-on-elasticsearch/194530/9 "2019-08-12T14:54:02Z")

</div>

😃 its hard to notice that . Thanks anyways.

---

<div class="post-metadata">

### Author: ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)
#### Post date: [August 12, 2019, 2:55pm UTC](https://discuss.elastic.co/t/how-to-configure-ldap-on-elasticsearch/194530/10 "2019-08-12T14:55:49Z")

</div>

I'll leave a comment with your feedback with the team that is responsible for our website, thanks for your feedback !

---

<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: [September 9, 2019, 2:55pm UTC](https://discuss.elastic.co/t/how-to-configure-ldap-on-elasticsearch/194530/11 "2019-09-09T14:55:53Z")

</div>

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