Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save imShakil/c1c956283ffb9f7c451ba42ff7cb5182 to your computer and use it in GitHub Desktop.
Save imShakil/c1c956283ffb9f7c451ba42ff7cb5182 to your computer and use it in GitHub Desktop.
Creating tunnel to connect internal (VM) LDAP server in Apache Directory Studio of the local host computer

This doc will help to connect your internal(VM) LDAP server to any LDAP browser (jx explorer, Apache Directory). Basically, I have installed an application with LDAP server in my Virtual Machine (vmware). After then, I was trying to connect that internal ldap server to Apache Directory in my Host Computer. Thoug I could access application server through my browser, but could not able to make connection of the ldap server into the Apache Directory. Later I found this solution that is the port of that ldap server was not able to communicate with my host computer even after adding that port into the firewall. Actually we have to create a tunnel of the ssh server to connect that port.

LDAP server info

bind dn: cn=admin/directory manager server address: localhost/ip:port server password: password

In my case it is: bind dn: cn=directory manager server address: localhost:1636 password: password

Install openssh-server

Make sure that both side of the machine (host computer and VM) have installed the openssh-server. To install openssh server:

sudo apt install openssh-server

To check the ssh status:

sudo service ssh status

Configure SSH

We need to configure ssh config file as below:

sudo nano /etc/ssh/sshd_config

From this file remove # right before PermitRootLogin and replace *-password with yes right after PermitRootLogin

Then reload the ssh server:

sudo systemctl reload ssh

Root login

with sudo su - login as a root user. then set a root password with below command:

sudo passwd

Creating Tunnel

To create tunnel:

ssh -fNL [port to be used in ldap browser]:ldap server address:ldap server port root@internal ldap server ip address

an example:

ssh -fNL 5909:localhost:1636 root@172.16.132.129

It may asked a root password just enter the password you have created using sudo passwd. That's all.

Connecting LDAP server in Apache Directory

Select for a new connection and enter like this accroding to your own ldap server value. Please choose SSL connection if your ldap server has ssl connection.

Screenshot from 2021-07-27 16-58-18

After then enter the bind dn value and ldap server password and finish it.

Screenshot from 2021-07-27 16-58-48

Finally you should see as below if it connect succesfully.

Screenshot from 2021-07-27 16-59-08

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment