# Unable to connect nginx with ldap users to access elasticsearch indexes

**URL:** <https://discuss.elastic.co/t/unable-to-connect-nginx-with-ldap-users-to-access-elasticsearch-indexes/92484>\
**Category:** Elasticsearch\
**Created:** [July 10, 2017, 1:49pm UTC](https://discuss.elastic.co/t/unable-to-connect-nginx-with-ldap-users-to-access-elasticsearch-indexes/92484 "2017-07-10T13:49:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![karampuri](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@karampuri](https://discuss.elastic.co/u/karampuri)\
**Post date:** [July 10, 2017, 1:49pm UTC](https://discuss.elastic.co/t/unable-to-connect-nginx-with-ldap-users-to-access-elasticsearch-indexes/92484/1 "2017-07-10T13:49:25Z")

</div>

Hello Team,

I installed nginx-auth-ldap module in my nginx server.I able to authenticate ldap users to access elasticsearch indexes.  
Here is the scenario that I am trying to achieve.

I have two roles configured in my LDAP.  
Level1 - Users under this role should have access to only perticular indexes.  
Level2 - Users under this role should have access to all the indexes.

how to specify above permissions in my nginx.conf file  
nginx.conf file as follows

events {  
worker\_connections 1024;  
}

http {  
ldap\_server LDAP1 {  
url "ldap://xxx.xxx.x.xxx/cn=xx,ou=yy,dc=test,dc=com?uid?sub?(objectClass=posixAccount)";  
binddn "cn=xx,dc=test,dc=com";  
binddn\_passwd "xx";  
group\_attribute uid;  
group\_attribute\_is\_dn on;  
require valid\_user;

}  
upstream elasticsearch {  
ip\_hash;  
server xxx.xxx.x.xxxx;  
}  
server {  
listen 80;  
auth\_ldap "Please enter your ldap credentials";  
auth\_ldap\_servers LDAP1;

location /{  
root html;  
index index.html index.htm;  
if ($request\_method ~\* "^(DELETE)$") {  
return 403;  
}

proxy\_pass [http://elasticsearch](http://elasticsearch);  
include /usr/local/nginx/conf/fastcgi\_params;  
}  
}  
}

Please suggest me where I am going wrong.

Thanks,  
xxxxx

---

<div class="post-metadata">

**Author:** ![karampuri](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@karampuri](https://discuss.elastic.co/u/karampuri)\
**Post date:** [July 12, 2017, 10:27am UTC](https://discuss.elastic.co/t/unable-to-connect-nginx-with-ldap-users-to-access-elasticsearch-indexes/92484/2 "2017-07-12T10:27:40Z")

</div>

Hello Team,

please suggest me if you have any updates on my issue.

Thanks,  
karampuri

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 12, 2017, 10:55am UTC](https://discuss.elastic.co/t/unable-to-connect-nginx-with-ldap-users-to-access-elasticsearch-indexes/92484/3 "2017-07-12T10:55:10Z")

</div>

I believe it's more a nginx question than an elasticsearch one. Probably the reason you are not getting answer.

By the way we do support ldap in xpack (commercial).

---

<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:** [August 9, 2017, 10:55am UTC](https://discuss.elastic.co/t/unable-to-connect-nginx-with-ldap-users-to-access-elasticsearch-indexes/92484/4 "2017-08-09T10:55:38Z")

</div>

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