92 lines
3.6 KiB
Markdown
92 lines
3.6 KiB
Markdown
Hier ist die zusammengefasste Dokumentation für dein Setup. Diese Datei kannst du dir als Backup oder Spickzettel abspeichern.
|
|
|
|
---
|
|
|
|
# Nextcloud OIDC Installation & Keycloak Setup
|
|
|
|
Diese Anleitung dokumentiert die erfolgreiche Konfiguration von Nextcloud (im Podman-Container) mit Keycloak als Identitätsanbieter (SSO) auf einem N100-System unter Proxmox.
|
|
|
|
## 1. Keycloak Konfiguration
|
|
|
|
In der Keycloak-Admin-Konsole wurde ein Client für Nextcloud erstellt.
|
|
|
|
* **Client-ID:** `nextcloud`
|
|
* **Root-URL:** `[https://nextcloud.ghostnet.selfhost.eu](https://nextcloud.ghostnet.selfhost.eu)`
|
|
* **Valid Redirect URIs:**
|
|
* `[https://nextcloud.ghostnet.selfhost.eu/apps/user_oidc/code](https://nextcloud.ghostnet.selfhost.eu/apps/user_oidc/code)`
|
|
* `[https://nextcloud.ghostnet.selfhost.eu/index.php/apps/user_oidc/code](https://nextcloud.ghostnet.selfhost.eu/index.php/apps/user_oidc/code)`
|
|
|
|
|
|
* **Backchannel Logout URL:** `[https://nextcloud.ghostnet.selfhost.eu/apps/user_oidc/backchannel-logout/](https://nextcloud.ghostnet.selfhost.eu/apps/user_oidc/backchannel-logout/)`
|
|
|
|
---
|
|
|
|
## 2. Nextcloud OIDC App Einstellungen
|
|
|
|
Innerhalb von Nextcloud wurde die App **"OpenID Connect" (`user_oidc`)** installiert und wie folgt konfiguriert:
|
|
|
|
* **Identifier:** `Keycloak`
|
|
* **Discovery Endpoint:** `[https://auth.ghostnet.selfhost.eu/realms/Ghost.net/.well-known/openid-configuration](https://auth.ghostnet.selfhost.eu/realms/Ghost.net/.well-known/openid-configuration)`
|
|
* **User-ID Mapping:** `preferred_username`
|
|
* **Display Name Mapping:** `name`
|
|
* **Email Mapping:** `email`
|
|
|
|
---
|
|
|
|
## 3. Erzwingen des Keycloak-Logins (CLI)
|
|
|
|
Um das Standard-Login-Formular zu deaktivieren und eine automatische Weiterleitung zu Keycloak zu erzwingen, wurden folgende Befehle im Nextcloud-LXC ausgeführt:
|
|
|
|
```bash
|
|
# 1. Den automatischen Redirect aktivieren
|
|
podman exec -u www-data nextcloud-app php occ config:app:set user_oidc auto_redirect --value="1"
|
|
|
|
# 2. Den Standard-Login ausblenden
|
|
podman exec -u www-data nextcloud-app php occ config:app:set user_oidc hide_default_login --value="1"
|
|
|
|
# 3. Den primären OIDC-Provider festlegen
|
|
podman exec -u www-data nextcloud-app php occ config:app:set user_oidc setup_provider --value="Keycloak"
|
|
|
|
# 4. Mehrere Backends deaktivieren (Zwingt zum Redirect)
|
|
podman exec -u www-data nextcloud-app php occ config:app:set user_oidc allow_multiple_user_backends --value="0"
|
|
|
|
# 5. Container neu starten, um Cache zu leeren
|
|
podman restart nextcloud-app
|
|
|
|
```
|
|
|
|
---
|
|
|
|
## 4. Sicherheits-Einstellungen (config.php)
|
|
|
|
Um sicherzustellen, dass Nextcloud den Login-Prozess nicht unterbricht, wurde folgender Parameter in der `config/config.php` gesetzt:
|
|
|
|
```php
|
|
'allow_user_to_login_with_apps' => false,
|
|
|
|
```
|
|
|
|
*(Diesen Wert haben wir via OCC-Befehl gesetzt: `podman exec -u www-data nextcloud-app php occ config:system:set allow_user_to_login_with_apps --value=false --type=bool`)*
|
|
|
|
---
|
|
|
|
## 5. Notfall-Login (Bypass)
|
|
|
|
Sollte Keycloak nicht erreichbar sein oder die OIDC-Konfiguration Probleme bereiten, kann der Standard-Login (lokaler Admin) jederzeit über folgende URL erzwungen werden:
|
|
|
|
**URL:** `[https://nextcloud.ghostnet.selfhost.eu/login?direct=1](https://nextcloud.ghostnet.selfhost.eu/login?direct=1)`
|
|
|
|
---
|
|
|
|
## 6. Wartung & Fehlerbehebung
|
|
|
|
Falls Änderungen an den Providern vorgenommen werden müssen, kann die aktuelle Konfiguration wie folgt ausgelesen werden:
|
|
|
|
* **Provider-Liste anzeigen:**
|
|
`podman exec -u www-data nextcloud-app php occ user_oidc:providers`
|
|
* **App-Konfiguration prüfen:**
|
|
`podman exec -u www-data nextcloud-app php occ config:app:get user_oidc`
|
|
|
|
---
|
|
|
|
**Status:** ✅ Läuft produktiv auf Proxmox/Podman. |