# Use Yunohost LDAP from server containers

**URL:** https://forum.yunohost.org/t/use-yunohost-ldap-from-server-containers/27075
**Category:** Advanced use case
**Tags:** english
**Created:** [November 8, 2023, 1:01pm UTC](https://forum.yunohost.org/t/use-yunohost-ldap-from-server-containers/27075 "2023-11-08T13:01:47Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![pihomeserver](https://forum.yunohost.org/user_avatar/forum.yunohost.org/pihomeserver/32/6923_2.png) [@pihomeserver](https://forum.yunohost.org/u/pihomeserver)
#### Post date: [November 8, 2023, 1:01pm UTC](https://forum.yunohost.org/t/use-yunohost-ldap-from-server-containers/27075/1 "2023-11-08T13:01:47Z")

</div>

Hi

I would like to use the YH LDAP as a LDAP server for some containerized app. I can perfom ldapsearch from the host machine SSH as expected. But from the shell within a container i can’t reach it  
I tried with FQDN, ip, gateway IP, extra host, etc. I tried to add “slapd: ALL : ALL” in hosts.allow (at least to test) but i can’t reach the ldap from any container

Any idea how i could do that ?

Thanks

---

<div class="post-metadata">

### Author: ![Mamie](https://forum.yunohost.org/user_avatar/forum.yunohost.org/mamie/32/1245_2.png) [@Mamie](https://forum.yunohost.org/u/Mamie)
#### Post date: [November 8, 2023, 1:45pm UTC](https://forum.yunohost.org/t/use-yunohost-ldap-from-server-containers/27075/2 "2023-11-08T13:45:54Z")

</div>

Could you please put the output of `sudo ss -tulnp | grep slapd` ?  
In my case, it listen on port 389 only for requests from 127.0.0.1, but on port 636 from anywhere.

I know nothing about slapd but it can give some hints.

---

<div class="post-metadata">

### Author: ![tituspijean](https://forum.yunohost.org/user_avatar/forum.yunohost.org/tituspijean/32/3584_2.png) [@tituspijean](https://forum.yunohost.org/u/tituspijean)
#### Post date: [November 8, 2023, 4:09pm UTC](https://forum.yunohost.org/t/use-yunohost-ldap-from-server-containers/27075/3 "2023-11-08T16:09:29Z")

</div>

Slapd is configured to only listen to `localhost`, you need to tweak its configuration to allow other networks.

> <https://github.com/YunoHost/yunohost/blob/dev/conf/slapd/ldap.conf>

The file is at `/etc/ldap/ldap.conf`, edit its URI accordingly (cf. `man ldap.conf`) and restart slapd service.

---

<div class="post-metadata">

### Author: ![pihomeserver](https://forum.yunohost.org/user_avatar/forum.yunohost.org/pihomeserver/32/6923_2.png) [@pihomeserver](https://forum.yunohost.org/u/pihomeserver)
#### Post date: [July 31, 2024, 10:51am UTC](https://forum.yunohost.org/t/use-yunohost-ldap-from-server-containers/27075/4 "2024-07-31T10:51:50Z")

</div>

Outch i missed the reply ! I will try that after the bookworm upgrade completion !

---

<div class="post-metadata">

### Author: ![tituspijean](https://forum.yunohost.org/user_avatar/forum.yunohost.org/tituspijean/32/3584_2.png) [@tituspijean](https://forum.yunohost.org/u/tituspijean)
#### Post date: [July 31, 2024, 4:20pm UTC](https://forum.yunohost.org/t/use-yunohost-ldap-from-server-containers/27075/5 "2024-07-31T16:20:09Z")

</div>

Check the status of the file after the upgrade, I believe some tweaks have been done recently on that part.

---

<div class="post-metadata">

### Author: ![pihomeserver](https://forum.yunohost.org/user_avatar/forum.yunohost.org/pihomeserver/32/6923_2.png) [@pihomeserver](https://forum.yunohost.org/u/pihomeserver)
#### Post date: [August 7, 2024, 9:51am UTC](https://forum.yunohost.org/t/use-yunohost-ldap-from-server-containers/27075/6 "2024-08-07T09:51:56Z")

</div>

So now that bookworm is up and running on my VPS i tested the connection to the LDAP  
I have changed the file `/etc/default/slapd` to allow connection from docker and it works … but as said in the post below it will lock the server on the next reboot due to the startup sequence. I have to find another solution like redirect the outgoing flow from my container to the localhost 389 port

> [@\[solved\] Use Yunohost as a LDAP server (connect other machines to it)](https://forum.yunohost.org/t/solved-use-yunohost-as-a-ldap-server-connect-other-machines-to-it/2865/12):
>
> Just be careful not to mess with ldap, this is central part of Yunohost machine. from my experience: I wanted to be clever and allow the docker containers to connect to Idap. So I added in the line ldap://172.17.0.1:389/ instead of commenting. It worked but later I had a hard time. At the next reboot, as the docker interface is mounted after ldap is up, the ldap service was failing and I was locked out of the system (needed direct access to the machine to connect as root)… Finally I just co…
