8.2.11.2.2. Configuration / fichiers utiles

Les fichiers de configuration sont gérés par les procédures d’installation ou de mise à niveau de l’environnement VITAM. Se référer au DIN.

Les fichiers de configuration sont définis sous /vitam/conf/ingest-external.

8.2.11.2.2.1. Fichier ingest-external.conf

jettyConfig: jetty-config.xml

path: {{ vitam_folder_data }}
authentication: false
tenantFilter: true

# Directory where files should be placed for local ingest
baseUploadPath: {{ vitam_struct.upload_dir | default('/vitam/data/ingest-external/upload') }}
# Directory where successful ingested files will be moved to
successfulUploadDir: {{ vitam_struct.success_dir | default('/vitam/data/ingest-external/upload/success') }}
# Directory where failed ingested files will be moved to
failedUploadDir: {{ vitam_struct.fail_dir | default('/vitam/data/ingest-external/upload/failure') }}

# Action done to file after local ingest
# fileActionAfterUpload can be set to three different values (case insensitive) :
# - MOVE   : After upload, the local file will be moved to either success_dir or fail_dir depending on the status of the ingest towards ingest-internal
# - DELETE : After upload, the local file will be deleted if the upload succeeded
# - NONE   : After upload, nothing will be done to the local file
fileActionAfterUpload: {{ vitam_struct.upload_final_action | default('NONE') }}

### Trust X-SSL-CLIENT-CERT header for external api authentication
# Should only be enabled when accessing to vitam externals through a Reverse Proxy that does "SSL offloading"
# NGINX configuration        : proxy_set_header X-SSL-CLIENT-CERT $ssl_client_escaped_cert;
# Apache httpd configuration : RequestHeader set X-SSL-CLIENT-CERT "%{SSL_CLIENT_CERT}s"
# Important : When enabled, special care must be taken to ensure firewall rules are properly set to ensure only
#             reverse proxy can access vitam external applications through their respective port_service to avoid
#             malicious header injection.
allowSslClientHeader: {{ vitam_defaults.trust_client_certificate_header | default(false) | bool | lower }}

# this variable has containerization purposes only : must not be used in production environment
ignoreAntivirusCheck: {{ vitam_struct.ignore_antivirus_check | default(false) | bool | lower }}

Ce fichier contient un appel au shell d’antivirus (par défaut, ClamAV) ; se reporter au DIN.

Il est possible, dans le cas de fichiers SIP volumineux, d’héberger des fichiers directement dans ingest-external (valeur de la directive baseUploadPath). Ces fichiers doivent être accessibles et utilisables par le user système vitam.

Les options associées à cette fonctionnalité peuvent être paramétrées dans le fichier deployment/environment/group_vars/all/advanced/vitam_vars.yml avant installation de Vitam.

La directive fileActionAfterUpload accepte les valeurs :

  • NONE : le fichier reste
  • MOVE : déplace le fichiers vers les valeurs des directives successfulUploadDir (en cas de succès de l’ingest) et failedUploadDir (en cas de non-succès de l’ingest)
  • DELETE : le fichier est supprimé en cas de succès de l’ingest uniquement

A charge à l’exploitant de bien gérer l’espace disque de ces répertoires (il faut penser aux ingests en échecs par exemple).

Se reporter au manuel de développement pour l’appel d’API associé.

8.2.11.2.2.2. Fichier ingest-internal-client.conf

serverHost: {{ vitam.ingest_internal.host }}
serverPort: {{ vitam.ingest_internal.port_service }}

8.2.11.2.2.3. Fichier internal-security-client.conf

serverHost: {{ vitam.security_internal.host }}
serverPort: {{ vitam.security_internal.port_service }}
secure: {{ vitam.security_internal.https_enabled | bool | lower }}

8.2.11.2.2.4. Fichier format-identifiers.conf

siegfried-local:
  type: SIEGFRIED
  client: http
  host: localhost
  port: {{ siegfried.port }}
  rootPath: {{ vitam_folder_data }}/
  versionPath: {{ vitam_folder_data }}/version/folder

8.2.11.2.2.5. Fichier functional-administration-client.conf

serverHost: {{ vitam.functional_administration.host }}
serverPort: {{ vitam.functional_administration.port_service }}

8.2.11.2.2.6. Fichier scan-clamav.sh

Ce script de scan appelle l’antivirus (par défaut, clamAV ; ce paramètre est surchargeable à l’installation ; se référer au :term`DIN` pour plus de précisions) pour détecter les virus.

#!/bin/sh

##########################################################################
# Role:                                                                  #
# Scan a single file using clamav anti-virus                             #
##########################################################################
# Args:                                                                  #
# - file to scan                                                         #
##########################################################################
# Return:                                                                #
# - 0: scan OK - no virus                                                #
RET_NOTVIRUS=0
# - 1: virus found and corrected                                         #
RET_VIRUS_FOUND_FIXED=1
# - 2: virus found but not corrected                                     #
RET_VIRUS_FOUND_NOTFIXED=2
# - 3: Fatal scan not performed                                          #
RET_FAILURE=3
# stdout : names of virus found (1 per line) if virus found ;            #
#          failure description if failure                                #
# stderr : full ouput of clamav                                          #
##########################################################################

# Default return code : scan NOK
RET=3
OUTPUT_DIR=$(mktemp -d)
if [ $# -ne 1 ]; then # Argument number must be one
  echo "ERROR : $# parameter(s) provided, only one parameter is needed"
else # one argument, let's go
  if [ ! -f "$1" ];then # if the file wich will be scan is existing, keep going
    echo "ERROR : \"$1\" doesn't exit"
  else
    clamdscan -z --stream "$1" 1> ${OUTPUT_DIR}/stdout 2> ${OUTPUT_DIR}/stderr # scanning the file and store the output OUTPUT
    RET=$? # return code of clamscan

    # Always output clamscan outputs to our own stderr
    (>&2 cat ${OUTPUT_DIR}/stdout  ${OUTPUT_DIR}/stderr)

    if [ ${RET} -eq ${RET_VIRUS_FOUND_FIXED} ] ; then
      RET=2 # if virus found clamscan return 1; the script must return 2
      (>&1 cat ${OUTPUT_DIR}/stdout  | grep `basename ${1}` | cut -d ' ' -f 2) # sending the list of virus to our own stdout
    elif [ ${RET} -eq 2 ] ; then
      RET=3 # if scan not performed clamscan return 2; the script must return 3
      (>&1 cat ${OUTPUT_DIR}/stdout  | grep `basename ${1}` | cut -d ' ' -f 2-) # sending the failure reason to our own stdout
    fi

    if [ -f "${OUTPUT_DIR}/stdout" ]
    then
      rm ${OUTPUT_DIR}/stdout
    fi
    if [ -f "${OUTPUT_DIR}/stderr" ]
    then
      rm ${OUTPUT_DIR}/stderr
    fi
  fi
fi
rmdir ${OUTPUT_DIR}
exit ${RET}