Add the module clamav for the virus scan of uploads #73

Merged
kevinheyer merged 1 commit from module-clamav into main 2026-11-25 07:06:45 +01:00
Member

Refs #72

Neues Modul clamav für den Virenscan von Uploads: clamd aus Debian lauscht nur auf dem Unix-Socket /run/clamav/clamd.ctl (Modus 0660, Gruppe clamav), freshclam hält die Signaturen aktuell, clamdscan ist für Prüfungen von Hand dabei. Einstellungen clamav_max_size (Standard 100 MB), clamav_max_scan_time (120 s) und clamav_alert_encrypted (Standard no).

Gemessen: etwa 1 GB Arbeitsspeicher im Betrieb, 1,9 GB für eine Minute beim Neuladen der Signaturen (3,6 Millionen Signaturen). Das ERP-Team hatte 1,2 bis 1,5 GB geschätzt – der Spitzenwert liegt höher. Die Guides und der Katalog sagen: 2 GB mehr, als die App braucht. Bei 512 MiB hat der Kernel clamd beim Laden beendet.

Auffällig: clamdscan 1.4.6 meldet OK mit Exitcode 0 für eine Datei über dem Größenlimit, obwohl clamd mit INSTREAM size limit exceeded. ERROR antwortet. Die Guides weisen Apps an, die Antwort selbst zu lesen und nur …OK als sauber zu werten.

Geprüft: tools/check-modules.sh clamav grün (Smoke-Test mit PING, EICAR und sauberem Stream über den Socket, zweiter Lauf changed=1, Entfernen ohne Reste); von Hand im Dev-Container mit 3 GiB: 60 MB mit den Standardwerten geprüft, 120 MB abgelehnt, nach clamav_max_size=200 und update geprüft; verschlüsseltes ZIP standardmäßig OK, mit clamav_alert_encrypted=yes ein Fund; ein Benutzer ohne die Gruppe kommt nicht an den Socket; tools/lint.sh grün. Nicht geprüft: VM-Image mit dem Modul (Image-Build/Boot-Test in der CI), Betrieb über mehrere Tage und das Verhalten beim Neuladen der Signaturen unter Last, eine App, die das Modul tatsächlich nutzt (das ERP).

Refs #72 Neues Modul `clamav` für den Virenscan von Uploads: `clamd` aus Debian lauscht nur auf dem Unix-Socket `/run/clamav/clamd.ctl` (Modus 0660, Gruppe `clamav`), `freshclam` hält die Signaturen aktuell, `clamdscan` ist für Prüfungen von Hand dabei. Einstellungen `clamav_max_size` (Standard 100 MB), `clamav_max_scan_time` (120 s) und `clamav_alert_encrypted` (Standard `no`). **Gemessen:** etwa 1 GB Arbeitsspeicher im Betrieb, 1,9 GB für eine Minute beim Neuladen der Signaturen (3,6 Millionen Signaturen). Das ERP-Team hatte 1,2 bis 1,5 GB geschätzt – der Spitzenwert liegt höher. Die Guides und der Katalog sagen: 2 GB mehr, als die App braucht. Bei 512 MiB hat der Kernel `clamd` beim Laden beendet. **Auffällig:** `clamdscan` 1.4.6 meldet `OK` mit Exitcode 0 für eine Datei über dem Größenlimit, obwohl `clamd` mit `INSTREAM size limit exceeded. ERROR` antwortet. Die Guides weisen Apps an, die Antwort selbst zu lesen und nur `…OK` als sauber zu werten. Geprüft: `tools/check-modules.sh clamav` grün (Smoke-Test mit PING, EICAR und sauberem Stream über den Socket, zweiter Lauf `changed=1`, Entfernen ohne Reste); von Hand im Dev-Container mit 3 GiB: 60 MB mit den Standardwerten geprüft, 120 MB abgelehnt, nach `clamav_max_size=200` und `update` geprüft; verschlüsseltes ZIP standardmäßig `OK`, mit `clamav_alert_encrypted=yes` ein Fund; ein Benutzer ohne die Gruppe kommt nicht an den Socket; `tools/lint.sh` grün. Nicht geprüft: VM-Image mit dem Modul (Image-Build/Boot-Test in der CI), Betrieb über mehrere Tage und das Verhalten beim Neuladen der Signaturen unter Last, eine App, die das Modul tatsächlich nutzt (das ERP).
Add the module clamav for the virus scan of uploads
All checks were successful
/ lint (pull_request) Successful in 15s
/ lint (push) Successful in 15s
c22269e2e4
An app that takes files can scan them without setting up ClamAV itself:
clamd from Debian listens on the Unix socket /run/clamav/clamd.ctl only
(mode 0660, group clamav; the app's user joins the group), freshclam keeps
the signatures current, clamdscan is there for checks by hand.

Settings in /etc/iac/settings.env: clamav_max_size (MB, default 100 –
StreamMaxLength, MaxFileSize and MaxScanSize together, Debian has 25),
clamav_max_scan_time (seconds, default 120) and clamav_alert_encrypted
(default no: an encrypted archive is not a finding). A drop-in sandboxes
clamd (systemd-analyze security 3.5). The first install waits up to 15
minutes for the signatures, because the units only start with them.

Memory, measured with 3.6 million signatures: about 1 GB in use, 1.9 GB
for a minute while clamd reloads new signatures. The guides and the
catalog say: 2 GB more than the app. In a container with 512 MiB the
kernel killed clamd while it loaded.

clamdscan 1.4.6 prints OK and exits 0 for a file over the size limit
although clamd answered "size limit exceeded. ERROR"; the guides tell apps
to read the reply themselves.

Tested: tools/check-modules.sh clamav (smoke test with PING, EICAR and a
clean stream through the socket, second run idempotent, removal leaves
nothing); by hand in a dev container with 3 GiB: 60 MB scanned with the
defaults, 120 MB refused, 120 MB scanned after clamav_max_size=200, an
encrypted zip is OK by default and found with clamav_alert_encrypted=yes,
a user outside the group cannot connect; tools/lint.sh green.

Refs #72
Sign in to join this conversation.
No description provided.