<?xml version="1.0" encoding="utf-8"?>

<creole>

    <files>
        <service servicelist='clamav'>clamav-freshclam</service>
        <!--<service servicelist='clamav'>clamav-daemon</service>-->
        <service servicelist='force_clamav'>clamav-daemon</service>
        <file filelist='force_clamav' name='/etc/clamav/clamd.conf'/>
        <file filelist='clamav' name='/etc/clamav/freshclam.conf'/>
        <file filelist='clam_container' name='/etc/sudoers.d/clamav' source="clamav.sudoers" mode="0440" rm='True'/>
        <file filelist='clam_folder' name='/etc/eole/avscan.d/generic.yaml' source='avscan-folders.yaml' mkdir='True' rm='True'/>
        <file filelist='clamav' name='/etc/eole/clamd-reload.cnf' rm='True'/>
        <file filelist='clamav' name='/etc/eole/apparmor.local.d/usr.sbin.clamd' source='clamd.apparmor.conf'/>
        <file filelist='clamav' name='/etc/apparmor.d/local/usr.bin.freshclam' source="freshclam.apparmor.conf"/>
    </files>

    <containers>
        <container name='mail'>
            <!-- le conteneur 'mail' est présent sur tous les modules #8702 & #9213 -->
            <package instance_mode='when_no_container'>eole-antivirus-pkg</package>
            <package instance_mode='when_container'>eole-antivirus-container-pkg</package>
            <service servicelist='clamav_mail'>clamav-daemon</service>
        </container>

    </containers>

    <variables>
        <family name='services'>
            <variable name='activer_clam' type='oui/non' description="Activer l'anti-virus ClamAV">
                <value>oui</value>
            </variable>
        </family>
        <family name='clamav' icon='shield'>
            <variable name='activer_scandir' type='oui/non' description='Ajouter des répertoires à analyser automatiquement ?'>
                <value>non</value>
            </variable>

            <!-- Analyse de répertoires -->
            <variable name='clam_scan_dir' type='string' description='Répertoire à analyser' multi='True'/>
            <variable name='clam_scan_recurs' type='oui/non' description='Analyse récursive ?' hidden='True'>
                <value>oui</value>
            </variable>
            <variable name='clam_scan_when' type='string' description="Périodicité de l'analyse (Lancement tous les ...)">
                <value>jours</value>
            </variable>
            <variable name='clam_scan_hour' type='string' description="Heure du lancement (format HH:MM)">
                <value>1:00</value>
            </variable>
            <variable name='clam_scan_min' type='number' description="Minute du lancement">
                <value>10</value>
            </variable>
            <variable name='clam_scan_week_day' type='string' description="Jour du lancement">
                <value>samedi</value>
            </variable>
            <variable name='clam_scan_monthday' type='number' description="Numéro du jour du lancement dans le mois">
                <value>1</value>
            </variable>
            <variable name='clam_scan_when_custom' type='string' description="Configuration brute format CRONTAB" mandatory='True'/>

            <variable name='clam_max_file_size' type='number' description='Taille maximale pour un fichier à analyser (en Mo)' mode='expert'>
                <value>10</value>
            </variable>
            <variable name='clam_max_scan_size' type='number' description='Quantité de données maximale à analyser pour une archive (en Mo)' mode='expert'>
                <value>50</value>
            </variable>
            <variable name='clam_max_recursion' type='number' description='Profondeur maximale pour l’analyse des archives' mode='expert'>
                <value>16</value>
            </variable>
            <variable name='clam_max_directory_recursion' type='number' description="Profondeur maximale pour l’analyse des répertoires" mode='expert'>
                <value>15</value>
            </variable>
            <variable name='clam_max_files' type='number' description='Nombre maximal de fichiers à analyser dans une archive' mode='expert'>
                <value>5000</value>
            </variable>
            <variable name='clam_exit_on_oom' type='yes/no' description='Arrêter le démon en cas de surcharge mémoire' mode='expert'>
                <value>no</value>
            </variable>
            <variable name='clam_detect_pua' type='yes/no' description='Détection des applications indésirables' mode='expert'>
                <value>no</value>
            </variable>
            <variable name='clam_scan_elf' type='yes/no' description='Analyse du contenu des fichiers ELF' mode='expert'>
                <value>no</value>
            </variable>
            <variable name='clam_scan_pdf' type='yes/no' description='Analyse du contenu des fichiers PDF' mode='expert'>
                <value>yes</value>
            </variable>
            <variable name='clam_scan_mail' type='yes/no' description='Analyse des fichiers courriels' mode='expert'>
                <value>no</value>
            </variable>
            <variable name='clam_broken_exe' type='yes/no' description='Détection des fichiers exécutables corrompus' mode='expert'>
                <value>no</value>
            </variable>
            <variable name='clam_dns_database_info' type='domain' description='Nom de domaine du serveur DNS de mise à jour' mode='expert'>
                <value>current.cvd.clamav.net</value>
            </variable>
            <variable name='clam_forcer_mirror_database' type='oui/non' description='Forcer un serveur de mise à jour freshclam' mode='expert'>
                <value>non</value>
            </variable>
            <variable name='clam_mirror_database' type='domain' description='Nom de domaine du serveur de mise à jour' mode='expert' multi='True' mandatory='True'/>
            <variable name='clam_mirror_type' type='string' description='Type du miroir' mode='expert' mandatory='True'>
                <value>DatabaseMirror</value>
            </variable>
            <variable name='clam_iana' type='hostname_strict' description='Code IANA pour la mise à jour de la base de signature' mode='expert'>
                <value>fr</value>
            </variable>
            <variable name='clam_max_attempts' type='number' description='Nombre de tentatives de mise à jour par miroir' mode='expert'>
                <value>5</value>
            </variable>
            <variable name='clam_receive_timeout' type='number' description='Délai avant abandon de lecture de la base de données distante' mode='expert'>
                <value>300</value>
            </variable>
            <variable name='clam_connect_timeout' type='number' description='Délai avant abandon de connexion à la base de données distante' mode='expert'>
                <value>300</value>
            </variable>
            <variable name='clam_checks' type='number' description='Nombre de mises à jour quotidiennes' mode='expert'>
                <value>24</value>
            </variable>
            <variable name='clam_forcer_daemon' type='oui/non' description="Forcer l'activation du démon clam sur le serveur" mode='expert'>
                <value>non</value>
            </variable>
       </family>
       <separators>
           <separator name='activer_scandir'>Analyse anti-virus</separator>
           <separator name='clam_max_file_size'>ClamAV</separator>
           <separator name='clam_dns_database_info'>Freshclam</separator>
           <separator name='clam_forcer_daemon'>Services utilisant ClamAV</separator>
       </separators>
    </variables>

    <constraints>
        <condition name='disabled_if_in' source='activer_clam'>
            <param>non</param>
            <target type='family'>clamav</target>
            <target type='filelist'>clamav</target>
            <target type='filelist'>clam_container</target>
            <target type='servicelist'>clamav</target>
        </condition>
        <condition name='disabled_if_in' source='activer_clam'>
            <param>non</param>
            <target type='servicelist'>force_clamav</target>
            <target type='filelist'>force_clamav</target>
        </condition>
        <condition name='disabled_if_in' source='clam_forcer_daemon'>
            <param>non</param>
            <target type='servicelist'>force_clamav</target>
            <target type='filelist'>force_clamav</target>
        </condition>
        <condition name='disabled_if_in' source='clam_forcer_mirror_database'>
            <param>non</param>
            <target>clam_mirror_database</target>
            <target>clam_mirror_type</target>
        </condition>
        <group master='clam_mirror_database'>
            <slave>clam_mirror_type</slave>
        </group>
        <check name='valid_enum' target='clam_mirror_type'>
            <param>['DatabaseMirror', 'PrivateMirror']</param>
        </check>
        <condition name='disabled_if_in' source='clam_forcer_mirror_database'>
            <param>oui</param>
            <target>clam_iana</target>
        </condition>
        <condition name='disabled_if_in' source='mode_conteneur_actif'>
            <param>non</param>
            <target type='filelist'>clam_container</target>
        </condition>
        <condition name='disabled_if_in' source='mode_conteneur_actif'>
            <param>oui</param>
            <target>clam_forcer_daemon</target>
        </condition>

        <condition name='disabled_if_in' source='activer_scandir'>
            <param>non</param>
            <target type='variable'>clam_scan_dir</target>
            <target type='variable'>clam_scan_when</target>
            <target type='variable'>clam_scan_when_custom</target>
            <target type='variable'>clam_scan_hour</target>
            <target type='variable'>clam_scan_min</target>
            <target type='variable'>clam_scan_week_day</target>
            <target type='variable'>clam_scan_monthday</target>
            <target type='filelist'>clam_folder</target>
        </condition>

        <group master='clam_scan_dir'>
            <slave>clam_scan_recurs</slave>
            <slave>clam_scan_when</slave>
            <slave>clam_scan_hour</slave>
            <slave>clam_scan_min</slave>
            <slave>clam_scan_week_day</slave>
            <slave>clam_scan_when_custom</slave>
            <slave>clam_scan_monthday</slave>
        </group>

        <check name='valid_enum' target='clam_scan_week_day'>
            <param>['lundi','mardi','mercredi','jeudi', 'vendredi', 'samedi', 'dimanche']</param>
        </check>

        <check name='valid_enum' target='clam_scan_when'>
            <param>['heures','jours', 'semaines', 'mois', 'personnalisé']</param>
        </check>
        <check name='valid_regexp' target='clam_scan_when_custom'>
            <param>^\s*((((\*/[0-9]+)|([0-9]+-[0-9]+/[0-9]+)|([0-9]+-[0-9]+)|([0-9]+(,[0-9]+)*)|(\*))(\s+(((\*/[0-9]+)|([0-9]+-[0-9]+/[0-9]+)|([0-9]+-[0-9]+)|([0-9]+(,[0-9]+)*)|(\*)))){4})|(@(reboot)|(yearly)|(annually)|(monthly)|(weekly)|(daily)|(midnight)|(hourly)))$</param>
            <param name='err_msg'>La programmation ne respecte pas le format accepté par cron</param>
        </check>

        <!-- Manage Custom mode for antivirus analyse config -->
        <condition name='disabled_if_in' source='clam_scan_when'>
            <param>personnalisé</param>
            <target>clam_scan_hour</target>
            <target>clam_scan_min</target>
            <target>clam_scan_week_day</target>
            <target>clam_scan_monthday</target>
        </condition>

        <!-- Manage "evry hour mode" -->
        <condition name='disabled_if_in' source='clam_scan_when'>
            <param>heures</param>
            <target>clam_scan_hour</target>
            <target>clam_scan_week_day</target>
            <target>clam_scan_monthday</target>
            <target>clam_scan_when_custom</target>
        </condition>

        <!-- Manage "evry day mode" -->
        <condition name='disabled_if_in' source='clam_scan_when'>
            <param>jours</param>
            <target>clam_scan_week_day</target>
            <target>clam_scan_min</target>
            <target>clam_scan_monthday</target>
            <target>clam_scan_when_custom</target>
        </condition>

        <!-- Manage "evry week mode" -->
        <condition name='disabled_if_in' source='clam_scan_when'>
            <param>semaines</param>
            <target>clam_scan_min</target>
            <target>clam_scan_monthday</target>
            <target>clam_scan_when_custom</target>
        </condition>

        <!-- Manage "evry month mode" -->
        <condition name='disabled_if_in' source='clam_scan_when'>
            <param>mois</param>
            <target>clam_scan_week_day</target>
            <target>clam_scan_min</target>
            <target>clam_scan_when_custom</target>
        </condition>

    </constraints>

    <help>
        <variable name='activer_clam'>ClamAV est un logiciel anti-virus pour Unix</variable>
        <variable name='clam_scan_elf'>ELF (Executable and Linkable Format) est un format de fichier binaire utilisé pour l'enregistrement de code compilé</variable>
        <variable name='clam_forcer_daemon'>Permet d'activer le service ClamAV même s'il n'y a pas de analyse temps réel activé</variable>
        <variable name='clam_scan_dir'>Chemin du répertoire a analysener</variable>
        <variable name='clam_scan_when'>Périodicité du analyse anti-virus (horaire, quotidien, hebdomadaire, mensuel, personnalisée)</variable>
        <variable name='clam_scan_hour'>Heure de début de analyse anti-virus au format H:MM</variable>
        <variable name='clam_scan_min'>Minute de début des analyses horaires</variable>
        <variable name='clam_scan_week_day'>Quel jour de la semaine l'analyse anti-virus doit être lancée</variable>
        <variable name='clam_scan_monthday'>Quel jour du mois l'analyse anti-virus doit être lancée</variable>
        <variable name='clam_scan_when_custom'>Configuration crontab brute (attention si la configuration n'est pas valide la ligne ne sera pas écrite)</variable>
        <variable name='clam_mirror_type'>Détermine le protocole utilisé pour se connecter au miroir : PrivateMirror utilise HTTP alors que DatabaseMirror utilise HTTPS</variable>
    </help>

</creole>
<!-- vim: ts=4 sw=4 expandtab
-->
