Skip to content

Commit fddd76a

Browse files
authored
Merge pull request #133 from dkarv/antivirus
Add ClamAV
2 parents 6e40d2d + 6d0454d commit fddd76a

3 files changed

Lines changed: 53 additions & 1 deletion

File tree

.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ COLLABORA_HOME_MODE=
214214
### Virusscanner Settings ###
215215
# IMPORTANT: If you enable antivirus, you also MUST configure the START_ADDITIONAL_SERVICES
216216
# envvar in the OpenCloud Settings above by adding 'antivirus' to the list.
217-
# The maximum scan size the virus scanner can handle, needs adjustment in the scanner config as well.
217+
# The maximum scan size the virus scanner can handle, needs adjustment in the scanner config as well:
218+
# For ClamAV, set CLAMD_CONF_StreamMaxLength in antivirus/clamav.yml to the same or a higher value.
218219
# Usable common abbreviations: [KB, KiB, MB, MiB, GB, GiB, TB, TiB, PB, PiB, EB, EiB], example: 2GB.
219220
# Defaults to "100MB"
220221
#ANTIVIRUS_MAX_SCAN_SIZE=

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ OpenCloud Compose offers a modular approach to deploying OpenCloud with several
1616
- **Full text search** with Apache Tika for content extraction and metadata analysis
1717
- **Monitoring** with metrics endpoints for observability and performance monitoring
1818
- **Radicale** integration for Calendar and Contacts
19+
- **ClamAV** antivirus scanning with ClamAV
1920

2021
## Quick Start Guide
2122

@@ -223,6 +224,25 @@ This exposes the necessary ports:
223224
If you're using **Nginx Proxy Manager (NPM)**, you **should NOT** activate **"Block Common Exploits"** for the Proxy Host.
224225
Otherwise, the desktop app authentication will return **error 403 Forbidden**.
225226

227+
### ClamAV anti-virus
228+
229+
Enable anti-virus scans for uploaded files.
230+
231+
Using `-f` flags:
232+
```bash
233+
docker compose -f docker-compose.yml -f antivirus/clamav.yml -f traefik/opencloud.yml up -d
234+
```
235+
236+
Or by setting in `.env`:
237+
```
238+
COMPOSE_FILE=docker-compose.yml:antivirus/clamav.yml:traefik/opencloud.yml
239+
```
240+
241+
**Important:** adjust the variable in `.env` to start the antivirus service. Add additional services separated by comma, e.g. `notifications,antivirus`:
242+
```
243+
START_ADDITIONAL_SERVICES="antivirus"
244+
```
245+
226246

227247
## SSL Certificate Support
228248

antivirus/clamav.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
services:
3+
opencloud:
4+
environment:
5+
POSTPROCESSING_STEPS: "virusscan"
6+
STORAGE_USERS_DATA_GATEWAY_URL: "http://opencloud:9200/data"
7+
ANTIVIRUS_MAX_SCAN_SIZE: ${ANTIVIRUS_MAX_SCAN_SIZE:-100MB}
8+
ANTIVIRUS_INFECTED_FILE_HANDLING: abort
9+
ANTIVIRUS_MAX_SCAN_SIZE_MODE: ${ANTIVIRUS_MAX_SCAN_SIZE_MODE:-partial}
10+
ANTIVIRUS_WORKERS: 1
11+
ANTIVIRUS_CLAMAV_SOCKET: /var/run/clamav/clamd.sock
12+
ANTIVIRUS_SCANNER_TYPE: clamav
13+
volumes:
14+
- clamav-socket:/var/run/clamav
15+
clamav:
16+
image: clamav/clamav:${CLAMAV_DOCKER_TAG:-latest}
17+
environment:
18+
# Accepts a number with optional K, M or G suffix. Must be greater or equal to ANTIVIRUS_MAX_SCAN_SIZE above.
19+
# K = KiB (1024), M = MiB (1024 * 1024), G = GiB (1024 * 1024 * 1024)
20+
CLAMD_CONF_StreamMaxLength: 100M
21+
networks:
22+
opencloud-net:
23+
volumes:
24+
- clamav-socket:/tmp
25+
- clamav-db:/var/lib/clamav
26+
logging:
27+
driver: ${LOG_DRIVER:-local}
28+
restart: always
29+
volumes:
30+
clamav-db:
31+
clamav-socket:

0 commit comments

Comments
 (0)