Zum Hauptinhalt springen

Mattermost

Dieser Leitfaden erklärt, wie man die Einzelanmeldung (SSO) zwischen SmartLink und Mattermost konfiguriert. Mattermost unterstützt sowohl SAML2 als auch OpenID Connect in den Professional- und Enterprise-Editionen.

Voraussetzungen​

  • Mattermost Version 5.0+ (SAML2) oder 5.35+ (OpenID Connect)
  • Mattermost Professional oder Enterprise Edition
  • Systemadministratorzugriff auf Mattermost
  • Anwendung in SmartLink konfiguriert

Konfiguration mit OpenID Connect (Empfohlen)​

1. Anwendung erstellen​

  1. Melden Sie sich als Administrator bei SmartLink an
  2. Gehen Sie zu Anwendungen → Hinzufügen
  3. Erstellen Sie eine neue Anwendung:
    • Name: Mattermost
    • URL: https://mattermost.example.com
    • Beschreibung: Team-Messaging-Plattform
    • Symbol: Wählen Sie das Mattermost-Symbol aus

2. OpenID Connect konfigurieren​

  1. Im Tab Authentifizierung
  2. Wählen Sie OpenID Connect
  3. Notieren Sie die Informationen:
    • Client-ID: mattermost-xxxxxx
    • Client-Geheimnis: secret-xxxxxx
    • Issuer-URL: https://votre-smartlink.link.vaultys.org
    • App-ID: [appid] (eindeutige Kennung der Anwendung in SmartLink)

3. Erlaubte Umleitungs-URLs​

Fügen Sie hinzu in Erlaubte Umleitungs-URLs:

https://mattermost.example.com/signup/openid/complete
https://mattermost.example.com/login/openid/complete

4. Erforderliche Bereiche​

  • openid
  • Profil
  • E-Mail
  • Gruppen (optional, für die Teamsynchronisierung)

Konfiguration in Mattermost​

1. Über das Systemkonsolen-Interface​

  1. Melden Sie sich als Systemadministrator an
  2. Gehen Sie zu Systemkonsole → Authentifizierung → OpenID Connect
  3. Aktivieren Sie OpenID Connect-Authentifizierung aktivieren

2. Konfiguration der Parameter​

Konfigurieren Sie die folgenden Felder:

  • OpenID Connect-Dienstanbieter auswählen: Benutzerdefiniert
  • Schaltflächenname: SmartLink SSO
  • Schaltflächenfarbe: #0066CC
  • Entdeckungs-Endpunkt: https://votre-smartlink.link.vaultys.org/api/oidc/[appid]/.well-known/openid-configuration
  • Client-ID: mattermost-xxxxxx
  • Client-Geheimnis: secret-xxxxxx

3. Erweiterte Konfiguration (optional)​

Wenn die automatische Entdeckung nicht funktioniert, konfigurieren Sie manuell:

  • Autorisierungs-Endpunkt: https://votre-smartlink.link.vaultys.org/api/oidc/[appid]/authorize
  • Token-Endpunkt: https://votre-smartlink.link.vaultys.org/api/oidc/[appid]/token
  • Benutzer-API-Endpunkt: https://votre-smartlink.link.vaultys.org/api/oidc/[appid]/userinfo

4. Attributzuordnung​

  • ID-Attribut: sub
  • Benutzername-Attribut: E-Mail
  • E-Mail-Attribut: E-Mail
  • Vorname-Attribut: given_name
  • Nachname-Attribut: family_name
  • Spitzname-Attribut: Spitzname
  • Position-Attribut: Titel
  • Sprach-Attribut: locale
  • Bild-Attribut: Bild

Konfiguration über config.json​

Für eine Konfiguration über eine Datei:

{
"GitLabSettings": {
"Enable": true,
"Secret": "",
"Id": "",
"Scope": "",
"AuthEndpoint": "",
"TokenEndpoint": "",
"UserApiEndpoint": "",
"DiscoveryEndpoint": "https://votre-smartlink.link.vaultys.org/api/oidc/[appid]/.well-known/openid-configuration",
"ButtonText": "SmartLink SSO",
"ButtonColor": "#0066CC"
},
"OpenIdSettings": {
"Enable": true,
"Secret": "secret-xxxxxx",
"Id": "mattermost-xxxxxx",
"Scope": "openid profile email groups",
"AuthEndpoint": "https://votre-smartlink.link.vaultys.org/api/oidc/[appid]/authorize",
"TokenEndpoint": "https://votre-smartlink.link.vaultys.org/api/oidc/[appid]/token",
"UserApiEndpoint": "https://votre-smartlink.link.vaultys.org/api/oidc/[appid]/userinfo",
"DiscoveryEndpoint": "https://votre-smartlink.link.vaultys.org/api/oidc/[appid]/.well-known/openid-configuration",
"ButtonText": "SmartLink SSO",
"ButtonColor": "#0066CC"
}
}

Konfiguration mit SAML2​

1. SAML2 konfigurieren​

  1. In der Mattermost-Anwendung
  2. Tab Authentifizierung → SAML2
  3. Konfigurieren Sie:
    • Entitäts-ID: https://mattermost.example.com
    • ACS-URL: https://mattermost.example.com/login/sso/saml
    • Format NameID: emailAddress oder persistent

2. Metadaten herunterladen​

  • IdP-Metadaten: https://votre-smartlink.link.vaultys.org/api/saml2/[appid]/metadata
  • URL SSO: https://votre-smartlink.link.vaultys.org/api/saml2/[appid]/sso
  • URL SLO: https://votre-smartlink.link.vaultys.org/api/saml2/[appid]/slo
  • X.509-Zertifikat: Von SmartLink herunterladen

Konfiguration in Mattermost​

1. Über Systemkonsole​

  1. Systemkonsole → Authentifizierung → SAML 2.0
  2. Aktivieren Sie Anmeldung mit SAML 2.0 aktivieren

2. Konfiguration der SAML-Parameter​

  • Identitätsanbieter-Metadaten-URL: https://votre-smartlink.link.vaultys.org/api/saml2/[appid]/metadata

Oder manuelle Konfiguration:

  • SAML SSO-URL: https://votre-smartlink.link.vaultys.org/api/saml2/[appid]/sso
  • Identitätsanbieter-Issuer-URL: https://votre-smartlink.link.vaultys.org
  • Öffentlicher Zertifikat des Identitätsanbieters: Fügen Sie das X.509-Zertifikat ein

3. Konfiguration des Dienstanbieters​

  • Dienstanbieter-Identifier: https://mattermost.example.com
  • Signatur überprüfen: true
  • Verschlüsselung aktivieren: false

4. Zuordnung der SAML-Attribute​

  • E-Mail-Attribut: E-Mail
  • Benutzername-Attribut: Benutzername
  • ID-Attribut: uid
  • Vorname-Attribut: Vorname
  • Nachname-Attribut: Nachname
  • Spitzname-Attribut: Spitzname
  • Position-Attribut: Titel
  • Sprach-Attribut: Bevorzugte Sprache
  • Anmeldeschaltflächentext: Mit SmartLink anmelden

Synchronisierung von Teams und Kanälen​

Konfiguration von SCIM-Gruppen​

Um Teams automatisch zu synchronisieren:

  1. Systemkonsole → Gruppen
  2. Aktivieren Sie AD/LDAP-Gruppensynchronisierung aktivieren
  3. Konfigurieren Sie das Gruppenmapping:
{
"GroupSettings": {
"EnableCustomUserGroups": true,
"EnableSyncWithLdap": true,
"EnableSyncWithSaml": true
}
}

Automatisches Zuordnen von Teams​

{
"TeamSettings": {
"EnableOpenIDConnectGroupSync": true,
"GroupsField": "groups",
"TeamMapping": {
"smartlink-dev": "Entwicklungsteam",
"smartlink-marketing": "Marketingteam",
"smartlink-support": "Supportteam"
}
}
}

Automatische Kanalerstellung​

Skript zur automatischen Erstellung von Kanälen basierend auf Gruppen:

#!/bin/bash
# Kanäle für jede Gruppe erstellen

mmctl auth login https://mattermost.example.com \
--name production \
--username admin \
--password-file password.txt

# Teams erstellen
mmctl team create --name development --display-name "Entwicklung"
mmctl team create --name marketing --display-name "Marketing"

# Kanäle erstellen
mmctl channel create --team development --name backend --display-name "Backend"
mmctl channel create --team development --name frontend --display-name "Frontend"
mmctl channel create --team marketing --name campaigns --display-name "Kampagnen"

Docker-Konfiguration​

Docker Compose mit OpenID Connect​

version: '3.8'

services:
mattermost:
image: mattermost/mattermost-enterprise-edition:latest
container_name: mattermost
restart: unless-stopped
environment:
# Datenbank
- MM_SQLSETTINGS_DRIVERNAME=postgres
- MM_SQLSETTINGS_DATASOURCE=postgres://mattermost:mattermost@db:5432/mattermost?sslmode=disable

# OpenID Connect
- MM_OPENIDSETTINGS_ENABLE=true
- MM_OPENIDSETTINGS_ID=mattermost-xxxxxx
- MM_OPENIDSETTINGS_SECRET=secret-xxxxxx
- MM_OPENIDSETTINGS_DISCOVERYENDPOINT=https://votre-smartlink.link.vaultys.org/api/oidc/[appid]/.well-known/openid-configuration
- MM_OPENIDSETTINGS_BUTTONTEXT=SmartLink SSO
- MM_OPENIDSETTINGS_BUTTONCOLOR=#0066CC

# Website-URL
- MM_SERVICESETTINGS_SITEURL=https://mattermost.example.com

# Dateispeicher
- MM_FILESETTINGS_DIRECTORY=/mattermost/data/

volumes:
- ./data:/mattermost/data
- ./config:/mattermost/config
- ./logs:/mattermost/logs
- ./plugins:/mattermost/plugins
ports:
- "8065:8065"
depends_on:
- db

db:
image: postgres:13-alpine
restart: unless-stopped
environment:
- POSTGRES_USER=mattermost
- POSTGRES_PASSWORD=mattermost
- POSTGRES_DB=mattermost
volumes:
- postgres_data:/var/lib/postgresql/data

volumes:
postgres_data:

Berechtigungsverwaltung​

Systemrollen​

Konfiguration des Rollen-Mappings:

{
"OpenIdSettings": {
"AdminAttribute": "is_admin",
"AdminAttributeValue": "true",
"SystemAdminRoles": ["smartlink-admins"],
"TeamAdminRoles": ["smartlink-team-leads"]
}
}

Benutzerdefinierte Berechtigungsschemata​

{
"Roles": {
"channel_user": {
"permissions": [
"create_post",
"add_reaction",
"remove_reaction",
"upload_file"
]
},
"team_admin": {
"permissions": [
"manage_team",
"add_user_to_team",
"remove_user_from_team",
"manage_channel_roles"
]
}
}
}

Konfigurationstest​

1. Verbindungstest​

# Test über API
curl -X POST https://mattermost.example.com/api/v4/users/login \
-H "Content-Type: application/json" \
-d '{"login_id":"user@example.com","password":"password"}'

2. Test mit mmctl​

# Installation von mmctl
brew install mmctl # macOS
# oder
wget https://releases.mattermost.com/mmctl/v7.8.0/linux_amd64.tar

# Anmeldung
mmctl auth login https://mattermost.example.com

# Überprüfung
mmctl user list
mmctl team list
mmctl channel list development

3. Webhook-Tests​

# Eingehenden Webhook erstellen
WEBHOOK_URL=$(mmctl webhook create-incoming \
--team development \
--channel general \
--display-name "SmartLink Integration")

# Testnachricht senden
curl -X POST $WEBHOOK_URL \
-H "Content-Type: application/json" \
-d '{"text": "Test SSO integration"}'

Fehlerbehebung​

Fehler "Ungültige Anmeldeinformationen"​

Lösung:

  1. Überprüfen Sie die Mattermost-Logs:
    docker logs mattermost 2>&1 | grep -i auth
  2. Testen Sie die OpenID-Entdeckung:
    curl https://votre-smartlink.link.vaultys.org/api/oidc/[appid]/.well-known/openid-configuration

Fehler "SAML-Anmeldung war nicht erfolgreich"​

Lösung:

  1. Überprüfen Sie das X.509-Zertifikat
  2. Testen Sie mit saml-tracer (Browsererweiterung)
  3. Überprüfen Sie die Logs:
    tail -f /opt/mattermost/logs/mattermost.log | grep SAML

Teams werden nicht synchronisiert​

Lösung:

{
"OpenIdSettings": {
"GroupsClaim": "groups",
"EnableGroupSync": true,
"GroupsField": "groups"
}
}

Fehler "Benutzer ist nicht autorisiert"​

Lösung:

  1. Stellen Sie sicher, dass der Benutzer in SmartLink der Anwendung zugewiesen ist
  2. Überprüfen Sie die Berechtigungen in Mattermost:
    mmctl user search user@example.com
    mmctl permissions show-role system_user

Sicherheit​

Empfohlene Konfiguration​

{
"ServiceSettings": {
"EnableInsecureOutgoingConnections": false,
"EnableLocalMode": false,
"SessionLengthWebInDays": 7,
"SessionLengthMobileInDays": 30,
"SessionCacheInMinutes": 10,
"WebsocketSecurePort": 443,
"TLSMinVer": "1.2"
},
"PasswordSettings": {
"MinimumLength": 10,
"Lowercase": true,
"Number": true,
"Uppercase": true,
"Symbol": true
}
}

Audit und Compliance​

{
"ComplianceSettings": {
"Enable": true,
"Directory": "/mattermost/compliance/",
"EnableDaily": true
},
"LogSettings": {
"EnableConsole": true,
"ConsoleLevel": "INFO",
"EnableFile": true,
"FileLevel": "INFO",
"FileLocation": "/mattermost/logs/"
}
}

Fortgeschrittene Integrationen​

Bots und Anwendungen​

# Python-Bot für Mattermost
from mattermostdriver import Driver

driver = Driver({
'url': 'https://mattermost.example.com',
'token': 'bot-token-xxxxxx',
'scheme': 'https',
'port': 443
})

driver.login()

# Nachricht senden
driver.posts.create_post({
'channel_id': 'channel-id',
'message': 'Hallo von SmartLink SSO!'
})

Integration mit GitLab​

{
"PluginSettings": {
"Plugins": {
"com.github.manland.mattermost-plugin-gitlab": {
"gitlaburl": "https://gitlab.example.com",
"gitlaboauthclientid": "gitlab-oauth-id",
"gitlaboauthclientsecret": "gitlab-oauth-secret"
}
}
}
}

Ressourcen​