Crivaledaz / Mattermost-LDAP

This module provides an external LDAP authentication in Mattermost for the Team Edition (free).
MIT License
357 stars 71 forks source link

ALready running osixia/openldap #61

Open promehul opened 4 years ago

promehul commented 4 years ago

Hello everyone. I am running an instance of mattermost. And when i run docker ps, there is already one instance of ldap container running which is listening on port 389 as is required for this. And when I run docker-compose up -d with for Mattermost-LDAP, it shows port already in use which is the required behaviour. Screenshot from 2020-07-13 01-27-13

So my question is do I need to stop the default openldap container already running to run this?

Crivaledaz commented 4 years ago

Hi @promehul,

Firstly, I can confirm that you can run a Mattermost instance with Mattermost-LDAP and an LDAP server all in containers without problems.

Since, by default, Mattermost uses port 8065, MySQL (default database for Mattermost) uses the port 3306, Mattermost-LDAP uses port 80, PostgreSQL (default database for Oauth) uses the port 5432 and OpenLDAP uses port 389, you should not have a port conflict. However, note that port inferior to 1000 need root permission to be binded.

Unfortunately, your screenshot is cropped on the most interesting part, the port column is not complete. Nevertheless, I can see two different PostgreSQL instances : one from the alpine tag, and the other from the 9.4 tag. Your port conflict certainly comes from there.

If that is the case, you have three options :

Finally, can you specify what docker-compose or docker command do you use to run Mattermost, Mattermost-LDAP and OpenLDAP containers ?

Regards,

promehul commented 4 years ago

FOr running the mattermost server on my Azure VM, I used make run-server.

promehul commented 4 years ago

And for running Mattermost-LDAP, I first built the image using docker-compose build and then used docker-compose up -d to run it

promehul commented 4 years ago

Screenshot from 2020-07-13 15-08-06 This is the screenshot of the docker ps inside the VM @Crivaledaz

promehul commented 4 years ago

Although the default mattermost-server has both the MySQL container and postgres but inside the SQLSettings of config.json, its using Mysql as driver. WIll I need to change that too ?

promehul commented 4 years ago

Screenshot from 2020-07-13 15-11-15 I stopped the postgres 9.4 container and it solved the HOSTNAME issue but this port 443 error still persists. Any help would be appreciated.

promehul commented 4 years ago

@Crivaledaz any assisstance ?

Crivaledaz commented 4 years ago

So the conflict port is the 443 (HTTPS), but this port is not used by one of your containers. I think you have a reverse proxy which uses the port 443 of your VM and redirect HTTPS requests to the Mattermost server.

To check which process is using port 443, you can run the netstat -lptn command as root. You will see every TCP port in use on your VM and, for each, the process associated.

In your case, you can edit the Mattermost-LDAP docker-compose.yaml file and remove the line 9. By default, Mattermost-LDAP only use the port 80 (HTTP).

Beside, if the port 80 is also used, you will need to change the port binding of Mattermost-LDAP. For example, you could bind your VM port 8080 to the Oauth container port 80 by editing line 8 of the docker-compose.yaml file (- 8080:80). If you do that, do not forget to adapt the Gitlab configuration in the Mattermost config.json file by adding the port to the Oauth URL. For example : http://oauth.company.com:8080/oauth/token.php

Regards,

promehul commented 4 years ago

Upon clicking the gitlab its showing me 500 Internal Server Error (The Page isn't working). The oauth link is generated with client parameters but on the link its showing 500. Any help @Crivaledaz ?

Crivaledaz commented 4 years ago

Hi,

Can you reach the Oauth server manually ? You should reach the server browsing the following URL http://<hostname or IP>/oauth/index.php.

Normally, you will see the login form. Try to authenticate you against the form. You should get the following red message : "Congratulation you are connected ...".

If it is working, check the GitLab config in the Mattermost configuration file config.json.

Regards,