Good news! Mattermost does support SSO with GitLab. Using docker-compose to run GitLab on your server and joining the container to aqua will let you auth like: LDAP → GitLab → Mattermost. If you’re doing any sort of development on your server, this might solve two problems. If you’re not doing any development, this is a pretty resource intensive fix.
I reached out to Mattermost to try to buy a server license just to get the LDAP feature, but they don’t offer that, and I don’t want to get in the habit of paying licenses per user per month.
Here’s my compose configuration (copied from their docs):
version: '3.6'
services:
web:
image: 'gitlab/gitlab-ce:latest'
restart: always
hostname: 'gitlab.mydomain.com'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://gitlab.mydomain.com:MYPORT'
nginx['redirect_http_to_https'] = false
nginx['listen_port'] = MYPORT
nginx['listen_https'] = false
gitlab_rails['gitlab_shell_ssh_port'] = OTHERPORT
gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = {
'main' => {
'label' => 'LDAP',
'host' => '172.28.0.1',
'port' => 636,
'uid' => 'uid',
'encryption' => 'simple_tls',
'verify_certificates' => false,
'base' => 'dc=directory,dc=nh',
'bind_dn' => 'cn=ldapservice,dc=directory,dc=nh',
'password' => 'PASSWORD_HERE',
'active_directory' => false,
}
}
ports:
- 'MYPORT:MYPORT'
- 'OTHERPORT:22'
volumes:
- '/opt/gitlab/config:/etc/gitlab'
- '/opt/gitlab/logs:/var/log/gitlab'
- '/opt/gitlab/data:/var/opt/gitlab'
shm_size: '256m'
And then you can join the container to aqua with:
docker network connect aqua gitlab-web-1
Set up a service for gitlab to allow access to your local green network using MYPORT and OTHERPORT above.
Ensure the network was joined correctly:
docker inspect gitlab-web-1 -f "{{json .NetworkSettings.Networks }}" | jq .
Then run an ldap check:
docker exec -it gitlab-web-1 gitlab-rake "gitlab:ldap:check"
Then set up a reverse proxy using the web server app to redirect gitlab.mydomain.com
to http://127.0.0.1:MYPORT
and turn on SSL.
Follow the Mattermost’s instructions for enabling GitLab and then…
BOOM, you can now let people use Mattermost with their Nethserver username and password.
( There’s currently an issue with the Mattermost configuration for Neth, but I’ve submitted a PR for it: Set X-Forwarded headers for GitLab Auth by DerekJarvis · Pull Request #122 · NethServer/nethserver-mattermost · GitHub )