Externer Non-UCS IdP

Liebes Univention-Forum,

zunächst möchte ich vorausschicken, das mir schmerzlich bewusst ist, dass der folgende Vorgang von Univention nicht offiziell unterstützt wird.
Den Professional Service von Univention zu nutzen würde leider das Budget des Projekts sprengen, daher versuche ich es nun über das Forum.

Neben der verwendeten Methode bin ich auch offen für Alternativ-Lösungen.

Die verwendeten URLs wurden verändert - sie sind frei erfunden.

Wir möchten einen UCS@School-Server verwenden, um weitere Dienste für die Schüler anzubieten.

Dazu muss der Univention-Server aber etwas tun, das er normalerweise nicht tut: Einen anderen Identity Provider verwenden - nämlich einen Moodle-Server, der ein simplesamlphp-Modul installiert hat.
Dort sind alle Identitäten bereits vorhanden und zwar nicht nur die lokalen Accounts, sondern auch weitere, die per SSO registriert wurden (Microsoft, Google oder Portal digitale Schule).

Daher wollen wir die simplesamlphp von UCS dazu nutzen, diesen externen IdP zur Authentifizierung zu nutzen.
Die Anlage der Accounts in UCS findet vom Moodle-Server aus über die Kelvin-API statt (das funktioniert schon)

Wenn ich nun die SSO-Authentifizierung teste:
https://ucs.company.at/simplesamlphp/module.php/core/authenticate.php

erhalte ich diese Fehlermeldung:

Nicht abgefangene Code-Exception

Eine nicht abgefangene Code-Exception ist aufgetreten.

SimpleSAML_Error_Error: UNHANDLEDEXCEPTION

Backtrace:
1 www/_include.php:17 (SimpleSAML_exception_handler)
0 [builtin] (N/A)
Caused by: SimpleSAML_Error_Exception: Could not find the metadata of an IdP with entity ID 'https://srv.moodle.org/simplesaml/saml2/idp/metadata.php'
Backtrace:
6 modules/saml/lib/Auth/Source/SP.php:131 (sspmod_saml_Auth_Source_SP::getIdPMetadata)
5 modules/saml/lib/Auth/Source/SP.php:324 (sspmod_saml_Auth_Source_SP::startSSO)
4 modules/saml/lib/Auth/Source/SP.php:427 (sspmod_saml_Auth_Source_SP::authenticate)
3 lib/SimpleSAML/Auth/Source.php:194 (SimpleSAML_Auth_Source::initLogin)
2 lib/SimpleSAML/Auth/Simple.php:161 (SimpleSAML\Auth\Simple::login)
1 modules/core/www/authenticate.php:36 (require)
0 www/module.php:135 (N/A)

Das ist insofern eine verwirrende Fehlermeldung, da sich die Metadaten vom Moodle-Server herunterladen lassen, wenn man die URL im Browser eingibt. (wie gesagt: die URLs wurden verändert)

Ich bin für alle Ideen offen.

Im folgenden findet ihr noch die authsources.php und die saml20-idp-hosted.php

LG,
Roland.

authsources.php

<?php
$config = array(
    'moodle' => array(
                'saml:SP',
                'entityID' => NULL,
                'idp' => 'https://srv.moodle.org/simplesaml/saml2/idp/metadata.php',
                'discoURL' => 'https://srv.moodle.org/simplesaml/saml2/idp/metadata.php',
                'debug'                 => TRUE,
                'enable_tls'            => TRUE,
                'authproc' => array(
                        50 => array(
                                'class' => 'ldap:AttributeAddFromLDAP',
                                'ldap.hostname' => 'ldap://ucs.company.at:7389',
                                'ldap.username' => 'uid=sys-idp-user,cn=users,dc=company,dc=at',
                                'ldap.password' => 'secret',
                                'ldap.product' => 'OpenLDAP',
                                'ldap.basedn' => 'dc=company,dc=at',
                                'ldap.search.enable' => FALSE,
                                'attributes' => array('uid', 'cn', 'sn', 'givenName', 'sambaSID', 'nextcloudEnabled', 'mailPrimaryAddress', 'memberOf', 'displayName', 'enabledServiceProviderIdentifier'),
                                'search.filter' => 'uid=%username%',
                        ),
                ),
                'privatekey' => '/etc/simplesamlphp/ucs-sso.company.at-idp-certificate.key',
                'certificate' => '/etc/simplesamlphp/ucs-sso.company.at-idp-certificate.crt',
                'redirect.sign' => TRUE,
                'redirect.validate' => TRUE,
                'sign.authnrequest' => TRUE,
        ),
);
$config['univention-negotiate'] = array(
        'negotiate:Negotiate',
        'keytab' => '/etc/simplesamlphp.keytab',
        'fallback' => 'univention-ldap',
    'attributes' => array('uid', 'mailPrimaryAddress', 'memberOf', 'enabledServiceProviderIdentifier'),
    'hostname' => 'ldap://ucs.company.at:7389',
    'base' => 'dc=company,dc=at',
    'adminUser' => 'uid=sys-idp-user,cn=users,dc=company,dc=at',
    'adminPassword' => 'secret',
);

saml20-idp-hosted.php

<?php
$metadata['https://srv.moodle.org/simplesaml/saml2/idp/metadata.php'] = array (
    'SingleSignOnService' => 'https://srv.moodle.org/simplesaml/saml2/idp/SSOService.php',
    'SingleLogoutService' => 'https://srv.moodle.org/simplesaml/saml2/idp/SingleLogoutService.php',
    'sign.authnrequest' => TRUE,
    'redirect.sign' => TRUE,
    'keys' =>
    array (
            0 =>
            array (
                'encryption' => false,
                'signing' => true,
                'type' => 'X509Certificate',
                'X509Certificate' =>
                'MIIFQTCCA [...] 52yG2nn/n77Y8=',
      ),
    ),
  );
Mastodon