diff --git a/.env.example b/.env.example index 932f9ee..7a0e1f5 100644 --- a/.env.example +++ b/.env.example @@ -214,7 +214,8 @@ COLLABORA_HOME_MODE= ### Virusscanner Settings ### # IMPORTANT: If you enable antivirus, you also MUST configure the START_ADDITIONAL_SERVICES # envvar in the OpenCloud Settings above by adding 'antivirus' to the list. -# The maximum scan size the virus scanner can handle, needs adjustment in the scanner config as well. +# The maximum scan size the virus scanner can handle, needs adjustment in the scanner config as well: +# For ClamAV, set CLAMD_CONF_StreamMaxLength in antivirus/clamav.yml to the same or a higher value. # Usable common abbreviations: [KB, KiB, MB, MiB, GB, GiB, TB, TiB, PB, PiB, EB, EiB], example: 2GB. # Defaults to "100MB" #ANTIVIRUS_MAX_SCAN_SIZE= diff --git a/README.md b/README.md index a06cf6e..eb8e1c4 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ OpenCloud Compose offers a modular approach to deploying OpenCloud with several - **Full text search** with Apache Tika for content extraction and metadata analysis - **Monitoring** with metrics endpoints for observability and performance monitoring - **Radicale** integration for Calendar and Contacts +- **ClamAV** antivirus scanning with ClamAV ## Quick Start Guide @@ -223,6 +224,25 @@ This exposes the necessary ports: If you're using **Nginx Proxy Manager (NPM)**, you **should NOT** activate **"Block Common Exploits"** for the Proxy Host. Otherwise, the desktop app authentication will return **error 403 Forbidden**. +### ClamAV anti-virus + +Enable anti-virus scans for uploaded files. + +Using `-f` flags: +```bash +docker compose -f docker-compose.yml -f antivirus/clamav.yml -f traefik/opencloud.yml up -d +``` + +Or by setting in `.env`: +``` +COMPOSE_FILE=docker-compose.yml:antivirus/clamav.yml:traefik/opencloud.yml +``` + +**Important:** adjust the variable in `.env` to start the antivirus service. Add additional services separated by comma, e.g. `notifications,antivirus`: +``` +START_ADDITIONAL_SERVICES="antivirus" +``` + ## SSL Certificate Support diff --git a/antivirus/clamav.yml b/antivirus/clamav.yml new file mode 100644 index 0000000..3878fec --- /dev/null +++ b/antivirus/clamav.yml @@ -0,0 +1,31 @@ +--- +services: + opencloud: + environment: + POSTPROCESSING_STEPS: "virusscan" + STORAGE_USERS_DATA_GATEWAY_URL: "http://opencloud:9200/data" + ANTIVIRUS_MAX_SCAN_SIZE: ${ANTIVIRUS_MAX_SCAN_SIZE:-100MB} + ANTIVIRUS_INFECTED_FILE_HANDLING: abort + ANTIVIRUS_MAX_SCAN_SIZE_MODE: ${ANTIVIRUS_MAX_SCAN_SIZE_MODE:-partial} + ANTIVIRUS_WORKERS: 1 + ANTIVIRUS_CLAMAV_SOCKET: /var/run/clamav/clamd.sock + ANTIVIRUS_SCANNER_TYPE: clamav + volumes: + - clamav-socket:/var/run/clamav + clamav: + image: clamav/clamav:${CLAMAV_DOCKER_TAG:-latest} + environment: + # Accepts a number with optional K, M or G suffix. Must be greater or equal to ANTIVIRUS_MAX_SCAN_SIZE above. + # K = KiB (1024), M = MiB (1024 * 1024), G = GiB (1024 * 1024 * 1024) + CLAMD_CONF_StreamMaxLength: 100M + networks: + opencloud-net: + volumes: + - clamav-socket:/tmp + - clamav-db:/var/lib/clamav + logging: + driver: ${LOG_DRIVER:-local} + restart: always +volumes: + clamav-db: + clamav-socket: