<?xml version="1.0" encoding="utf-8"?>
<creole>
    <containers>
        <container name='web' id='15'>
            <package>eole-lemonldap-ng-pkg</package>
            <file filelist='lemonldap' name='/etc/lemonldap-ng/lemonldap-ng.ini' mkdir='True'/>
            <file filelist='lemonldap' name='/var/lib/lemonldap-ng/conf/lmConf-1.json' mkdir='True'/>
            <file filelist='lemonldap' name='/etc/default/lemonldap-ng-fastcgi-server' mkdir='True'/>
            <file filelist='lemonldap-apache' name='/etc/lemonldap-ng/portal-apache2.X.conf' mkdir='True'/>
            <file filelist='lemonldap-apache-manager' name='/etc/lemonldap-ng/manager-apache2.X.conf' mkdir='True'/>
            <file filelist='lemonldap-apache-manager' name='/etc/lemonldap-ng/handler-apache2.X.conf' mkdir='True'/>
            <service method='apache' servicelist='lemonldap-apache-manager'>manager-apache2</service>
            <service method='apache' servicelist='lemonldap-apache-manager'>handler-apache2</service>
            <service method='apache' servicelist='lemonldap-apache'>portal-apache2</service>
            <service servicelist="sllemon">lemonldap-ng-fastcgi-server</service>
        </container>
    </containers>
    <files>
        <file filelist='lemonldap-nginx' name='/etc/lemonldap-ng/portal-nginx.conf' mkdir='True'/>
        <file filelist='lemonldap-nginx-manager' name='/etc/lemonldap-ng/manager-nginx.conf' mkdir='True'/>
        <file filelist='lemonldap-nginx-manager' name='/etc/lemonldap-ng/handler-nginx.conf' mkdir='True'/>
        <file filelist='lemonldap-nginx' name='/etc/lemonldap-ng/nginx-lmlog.conf' mkdir='True'/>


        <file filelist='lemonldap-proxy-nginx' name='/etc/nginx/sites-available/lemonldap-ng-proxy-nginx' mkdir='True'/>
        <service_access service='nginx'>
            <port service_accesslist="saLemon">80</port>
            <port service_accesslist="saLemon">443</port>
        </service_access>
    </files>

    <variables>
        <family name='eole sso'>
            <variable name='local_sso_server' description='Type du serveur SSO local' hidden='True'/>
            <variable name='eolesso_adresse' description="Nom de domaine du serveur d'authentification SSO" redefine="True" exists='True' />
            <variable name='eolesso_port' redefine="True" exists='True'>
                <value>443</value>
            </variable>
        </family>
        <family name='Services'>
            <variable name='activer_sso' redefine="True" description="Activer LemonLDAP::NG">
                <value>local</value>
            </variable>
        </family>

        <family name='LemonLDAP' icon='lemon'>
            <variable name='root_web_server' type='string' description="Calcul du serveur web principal" hidden='True'/>
            <variable name='lemon_server' type='string' description="Calcul du serveur web utilisé" hidden='True'/>
            <variable name='lemon_adresse' type='domain_strict' description="Nom de domaine de base de lemonLdap"/>
            <variable name='ll_activer_manager' type='oui/non' description="Configurer LemonLDAP-NG depuis l'interface d'administration" mode="expert">
                <value>non</value>
            </variable>
            <variable name='managerWebName' type='string' description="Nom DNS du manager LemonLDAP-NG"/>
            <variable name='authWebName' type='domain_strict' description="Nom DNS du service Auth de LemonLDAP-NG"/>
            <variable name='reloadWebName' type='domain_strict' description="Nom DNS du service Reload de LemonLDAP-NG" mode="expert"/>
            <variable name='cookieDomain' type='domain_strict' description="Nom de domaine des cookies"/>

            <variable name='ldapScheme' type='string' description="Protocole LDAP à utiliser" mandatory='True'/>
            <variable name='ldapServer' type='string' description="Adresse du Serveur LDAP utilisé par LemonLDAP::NG" mandatory="True"/>
            <variable name='ldapServerPort' type='number' description="Port d'écoute du LDAP utilisé par LemonLDAP::NG" mandatory='True'>
                <value>636</value>
            </variable>
            <variable name='ldapUserBaseDN' type='string' description="Base DN des utilisateurs dans l'annuaire" mandatory='True'/>
            <variable name='ldapBindUserDN' type='string' description="Utilisateur de connexion à l'annuaire" mandatory="True"/>
            <variable name='ldapBindUserPassword' type='password' description="Mot de passe de l'utilisateur de connexion à l'annuaire" mandatory="True"/>
            <variable name="samlOrganizationName" type='string' description="Nom de l'organisation SAML" mode='expert'/>
            <variable name='lmldapverify' type='oui/non' description="Vérifier les certificats SSL du serveur LDAP">
                <value>oui</value>
            </variable>

            <variable name="lemonproc" type='number' description="Nombre de processus dédié à Lemon (équivalent au nombre de processeurs)" mandatory="True">
                <value>4</value>
            </variable>

            <variable name="lm_loglevel" type='string' description="Verbosité des journaux" mode='expert'>
                <value>info</value>
            </variable>

            <variable name="lemonAdmin" type='string' description="LemonLDAP Administrator username" mode='expert'>
                <value>admin</value>
            </variable>

            <variable name="casAttribute" description="Nom de l'attribut CAS" type="string" mode="expert" multi="True"/>
            <variable name="casLDAPAttribute" description="Attribut LDAP équivalent" type="string" mode="expert"/>

            <variable name='cas_send_logout' type='oui/non' description="Activer le logout centralisé du serveur SSO" hidden='True' exists='False'>
                <value>oui</value>
            </variable>

            <variable name='ssoCALocation' type='string' description="Chemin de l'autorité de certification (ou rien)" mode="expert"/>
            <variable name='llSkin' type='string' description="Skin utilisé par LemonLDAP::NG">
                <value>bootstrap</value>
            </variable>
            <variable name='llCheckLogins' type='oui/non' description="Permettre aux utilisateurs d'afficher l'historique de connexion">
                <value>non</value>
            </variable>
            <variable name='llResetPassword' type='oui/non' description="Permettre aux utilisateurs de réinitialiser leurs mots de passe par mail">
                <value>oui</value>
            </variable>
            <variable name='llChangePassword' type='oui/non' description="Permettre aux utilisateurs de changer leurs mots de passe depuis LemonLDAP">
                <value>oui</value>
            </variable>
            <variable name='llADPasswordMaxAge' type='number' description="Durée de vie des mots de passe (en secondes)" mode='expert'>
                <value>5184000</value>
            </variable>
            <variable name='llADPasswordExpireWarn' type='number' description="Délai avant affichage d'un message d'alerte sur l'expiration du mot de passe (en secondes)">
                <value>3456000</value>
            </variable>
            <variable name='llResetExpiredPassword' type='oui/non' description="Autoriser le renouvellement des mots de passe expirés">
                <value>oui</value>
            </variable>
            <variable name='llResetUrl' type='web_address' description="Adresse de l'application pour réinitialiser leurs mots de passe" />
            <variable name='llRegisterAccount' type='oui/non' description="Permettre aux utilisateurs de créer un compte">
                <value>oui</value>
            </variable>
            <variable name='llRegisterDB' type='string' description="Base de comptes pour l'enregistrement"/>
            <variable name='llRegisterURL' type='web_address' description="Adresse de l'application de création de compte"/>
            <variable name='llCSPTargets' type='domain' description="Domaines vers lesquels le formulaire peut renvoyer" multi='True'/>
            <!-- Variables d’appoint pour le traitement différencié module Scribe, autres modules -->
            <variable name='scribe_dn_from_realm' type='string' description='DN construit sur la base du DN' hidden='True'/>
            <variable name='scribe_ldap_bind_user_dn' type='string' description='Compte de connexion à l’annuaire pour le Sc  ribe' hidden="True"/>
            <variable name='ad_domain' type='string' description='Variable de substitution' exists='False' hidden='True'>
                <value>fake</value>
            </variable>
        </family>

        <separators>
            <separator name="AuthW">Configuration DNS</separator>
            <separator name="ldapScheme">Configuration LDAP</separator>
            <separator name="casAttribute">Configuration CAS</separator>
            <separator name="llSkin">Personnalisation de la mire SSO</separator>
        </separators>

    </variables>

    <constraints>
        <auto name='calc_val' target='local_sso_server'>
            <param>lemonldap-ng</param>
        </auto>
        <check name='valid_enum' target='activer_sso'>
            <param>['non', 'local', 'distant']</param>
        </check>
        <fill name='calc_val_first_value' target='ldapServer'>
            <param type='eole' optional='True'>ad_server_fullname</param>
            <param type='eole' optional='True'>adresse_ip_addc</param>
        </fill>
        <fill name='calc_val_first_value' target='lemon_adresse'>
            <param type='eole' optional='True' hidden='False'>web_url</param>
            <param type='eole'>nom_domaine_machine</param>
        </fill>
        <fill name='calc_val' target='cookieDomain'>
            <param type='eole'>lemon_adresse</param>
        </fill>
        <fill name='concat' target='managerWebName'>
            <param>manager.</param>
            <param type='eole'>lemon_adresse</param>
        </fill>
        <fill name='calc_val' target='eolesso_adresse'>
            <param type='eole' hidden="False">authWebName</param>
        </fill>
        <auto name='concat' target='authWebName'>
            <param>auth.</param>
            <param type='eole'>lemon_adresse</param>
        </auto>
        <fill name='concat' target='reloadWebName'>
            <param>reload.</param>
            <param type='eole'>lemon_adresse</param>
        </fill>
        <fill name='concat' target='samlOrganizationName'>
            <param>SAML</param>
            <param type='eole'>lemon_adresse</param>
        </fill>

        <condition name='disabled_if_not_in' source='eole_module'>
            <param>scribe</param>
            <target type='variable'>scribe_dn_from_realm</target>
            <target type='variable'>scribe_ldap_bind_user_dn</target>
        </condition>
        <auto name='dn_from_realm' target='scribe_dn_from_realm'>
            <param type='eole'>ad_domain</param>
        </auto>
        <auto name='concat' target='scribe_ldap_bind_user_dn'>
            <param>cn=</param>
            <param type='eole' optional='True'>sasl_ldap_reader</param>
            <param>,cn=Users,</param>
            <param type='eole' optional='True'>scribe_dn_from_realm</param>
        </auto>
        <fill name='calc_val_first_value' target='ldapBindUserDN'>
            <param type='eole' optional='True' hidden='False'>scribe_ldap_bind_user_dn</param>
            <param type='eole' optional='True' hidden='False'>ldap_reader</param>
        </fill>
        <fill name='calc_multi_condition' target='ldapBindUserPassword'>
            <param>scribe</param>
            <param type='eole' name='condition_1'>eole_module</param>
            <param name='match'>/etc/eole/private/sasl-reader.password</param>
            <param type='eole' optional='True' hidden='False' name='default_mismatch'>ldap_reader_passfile</param>
        </fill>
        <fill name='calc_val_first_value' target='ldapUserBaseDN'>
            <param type='eole' optional='True' hidden='False'>scribe_dn_from_realm</param>
            <param type='eole' optional='True' hidden='False'>ldap_base_dn</param>
        </fill>

        <check name="valid_enum" target="ldapScheme">
            <param>['ldaps','ldap']</param>
        </check>

        <check name='valid_enum' target="lm_loglevel">
            <param>['info','notice','warn','error','debug']</param>
        </check>

        <check name="valid_enum" target="llRegisterDB">
            <param>['LDAP','AD','Demo','Custom']</param>
        </check>
        <group master="casAttribute">
            <slave>casLDAPAttribute</slave>
        </group>

        <condition name='disabled_if_not_in' source='openldap_installed' fallback="True">
            <param>non</param>
            <target type='variable'>llADPasswordMaxAge</target>
            <target type='variable'>llADPasswordExpireWarn</target>
        </condition>

        <condition name='disabled_if_not_in' source='activer_sso'>
            <param>local</param>
            <target type='filelist'>lemonldap</target>
            <target type='filelist'>lemonldap-nginx</target>
            <target type='filelist'>lemonldap-proxy-nginx</target>
            <target type='filelist'>lemonldap-apache</target>
            <target type='filelist'>lemonldap-apache-manager</target>
            <target type='servicelist'>lemonldap-apache</target>
            <target type='servicelist'>lemonldap-apache-manager</target>
            <target type='servicelist'>sllemon</target>
            <target type='family'>LemonLDAP</target>
            <target type='service_accesslist'>saLemon</target>
        </condition>

        <condition name='disabled_if_in' source='ll_activer_manager'>
            <param>non</param>
            <target type='variable'>managerWebName</target>
            <target type='variable'>reloadWebName</target>
            <target type='filelist'>lemonldap-nginx-manager</target>
            <target type='filelist'>lemonldap-apache-manager</target>
            <target type='servicelist'>lemonldap-apache-manager</target>
        </condition>

        <auto name='calc_multi_condition' target='root_web_server'>
            <param>oui</param>
            <param type='eole' name='condition_1'>activer_nginx_web</param>
            <param name='match'>nginx</param>
            <param name='mismatch'>apache</param>
        </auto>

        <auto name='calc_multi_condition' target='lemon_server'>
            <param>oui</param>
            <param type='eole' name='condition_1'>mode_conteneur_actif</param>
            <param name='match'>apache_behind_proxy</param>
            <param type='eole' name='mismatch'>root_web_server</param>
        </auto>

        <condition name="disabled_if_in" source="lemon_server">
            <param>apache</param>
            <target type='filelist'>lemonldap-nginx</target>
            <target type='filelist'>lemonldap-nginx-manager</target>
            <target type='filelist'>lemonldap-proxy-nginx</target>
        </condition>

        <condition name="disabled_if_in" source="lemon_server">
            <param>apache_behind_proxy</param>
            <target type='filelist'>lemonldap-nginx</target>
            <target type='filelist'>lemonldap-nginx-manager</target>
        </condition>

        <condition name="disabled_if_in" source="lemon_server">
            <param>nginx</param>
            <target type='filelist'>lemonldap-proxy-nginx</target>
            <target type='filelist'>lemonldap-apache</target>
            <target type='servicelist'>lemonldap-apache</target>
            <target type='filelist'>lemonldap-apache-manager</target>
            <target type='servicelist'>lemonldap-apache-manager</target>
        </condition>

        <condition name='disabled_if_in' source='llRegisterAccount'>
            <param>non</param>
            <target type='variable'>llRegisterDB</target>
        </condition>
        <condition name='disabled_if_not_in' source='llRegisterDB'>
            <param>Custom</param>
            <target type='variable'>llRegisterURL</target>
        </condition>
        <condition name='disabled_if_in' source='llResetPassword'>
            <param>non</param>
            <target type='variable'>llResetUrl</target>
            <target type='variable'>llResetExpiredPassword</target>
        </condition>
        <check name='valid_enum' target='llSkin'>
            <param>['bootstrap','dark','impact','pastel']</param>
            <param name="checkval">False</param>
        </check>
    </constraints>

    <help>
        <family name='LemonLDAP'>Configuration de la solution d'authentification unique LemonLDAP::NG</family>
        <variable name='activer_sso' redefine="True">Activer le service LemonLDAP::NG sur ce serveur</variable>
        <variable name='managerWebName'>Nom DNS de l'application de gestion de LemonLDAP::NG ex:manager.example.fr</variable>
        <variable name='ll_activer_manager'>Si activer, il est possible de changer la configuration fournit par EOLE. Attention, dans ce cas, les modifications EOLE ne seront plus prise en compte.</variable>
        <variable name='ldapUserBaseDN'>DN de base de l'emplacement des utilisateurs dans l'annuaire (ex: ou=users,o=gouv,c=fr)</variable>
        <variable name='ldapBindUserDN'>DN de l'utilisateur de connexion en lecture à l'annuaire (ex: cn=reader,o=gouv,c=fr)</variable>
        <variable name='llCheckLogins'>Affiche une case à cocher sur la mire SSO qui permet a l'utilisateur de voir l'historique de connexion de son compte avant d'être redirigé vers le service demandé</variable>
        <variable name='llCSPTargets'>Liste des domaines à ajouter à la directive form-action.</variable>
    </help>
</creole>
