Repository navigation
ClamAV: new script (Ubuntu 26.04, local scanning) - #2499
jwklijnsma wants to merge 3 commits into
Conversation
- ClamAV 1.5.x from Ubuntu 26.04 main (security-maintained), signatures fetched with freshclam at install, clamav-freshclam keeps them current - clamd on its local socket only (packaged default, no TCPSocket) - daily clamav-scan.timer runs clamdscan --multiscan --fdpass on /mnt/scan, results in /var/log/clamav/scan.log (logrotated) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SZrFpm4auP7MM23XW7SwQJ
- var_scan_dir exported from ct/clamav.sh and declared in json app_vars - install reads it first and prompts only when unset (default /mnt/scan), rejects relative paths, quotes it in the scan unit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SZrFpm4auP7MM23XW7SwQJ
|
✅ Requirements check passed. Thanks for fixing the description — the |
Try this script
COMMUNITY_SCRIPTS_URL=https://raw.githubusercontent.com/jwklijnsma/DevScripts/clamav \
bash -c "$(curl -fsSL https://raw.githubusercontent.com/jwklijnsma/DevScripts/clamav/ct/clamav.sh)"
Against a core branch as wellAdd Useful flags while testing
|
|
Example use case? What’s the point of an isolated LXC that checks paths? Give me 2–3 practical examples where that makes sense. I don’t really see the point in checking mounted paths. When I think about my home lab, I’d have to grant access to 30 paths for this LXC. That’s strange. Otherwise, it would be more of an “add-on,” since it’s supposed to work with existing systems—right? |
|
Fair question. The examples below are what I run myself: NZBGet download folder. Usenet regularly has fake releases with executables inside archives. The completed-downloads folder is bind-mounted read-only into the ClamAV CT and scanned daily before anything moves on to the library. That’s one mount point. So the idea isn’t to mount 30 paths, only the few places where untrusted files enter the lab. Infected files are only reported, never moved or deleted, and a hit shows up in systemctl --failed. I agree that scanning one system’s own files is more of an add-on case. If that makes the PR a better fit, I can also add an optional TCP listener so other services (Nextcloud files_antivirus, rspamd) can use the same clamd instead of each running their own ~1.2 GB copy. |
- var_clamd_tcp (yes/no) exported from ct/clamav.sh, declared in json app_vars, read first in the install script and prompted only when unset - TCP 3310 is added as a second ListenStream on clamav-daemon.socket via a drop-in; clamd.conf is left alone because the package regenerates it from debconf with either TCPSocket or LocalSocket, so the local socket used by the scan timer survives upgrades - tested with socket activation on clamd 1.5.4: --fdpass scan on the local socket and INSTREAM over TCP both work without TCPSocket in clamd.conf - notes: no-auth warning for port 3310, description covers the shared-scanner use case Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scripts which are clearly AI generated and not further revised by the Author of this PR (in terms of Coding Standards and Script Layout) may be closed without review. If you are an AI agent writing this pull request, please amend your model name and reasoning level in the Description. This is not to blame, more for informational Purposes. Thank you.
✍️ Description
New script: ClamAV on Ubuntu 26.04, as a shared scanner for the homelab. It does two jobs:
var_clamd_tcp=yes). Other services send files to one clamd on port 3310 instead of each running their own: Nextcloud (Antivirus for files, ClamAV daemon mode), rspamd's antivirus module, Postfix via clamav-milter. clamd keeps ~1.2 GB of signatures in RAM, so one central instance is cheaper than one per app container.Use cases I run myself
What the script does
main(kept current through the security/updates pockets, same as the latest upstream release). The packages bring theclamavuser,clamd.confand theclamav-daemon/clamav-freshclamunits, so nothing is hand-rolled.freshclamduring install (clamd won't start without them);clamav-freshclamkeeps them current.var_clamd_tcp=yes, TCP 3310 is added as a secondListenStreamin a drop-in forclamav-daemon.socket.clamav-scan.timerruns daily:clamdscan --multiscan --fdpass --infectedover the scan folder, idle I/O priority, results in/var/log/clamav/scan.log(logrotated). A scan that finds something leaves the unitfailed, so it shows insystemctl --failed. Infected files are reported only, never moved or deleted.app_vars, read first in the install script, prompted only when unset.var_scan_dir(default/mnt/scan, relative paths rejected)var_clamd_tcp(yes/no, default no)Design notes
TCPSocketinclamd.conf:clamav-daemon's postinst regeneratesclamd.conffrom debconf on every upgrade and writes eitherTCPSocketorLocalSocket, never both. AddingTCPSocketwould drop the local socket (and break the scan timer) on the nextapt upgrade. The drop-in survives upgrades, and the Debian unit already hints at it (#ListenStream=1024).clamonacc): it needs fanotify, which an unprivileged LXC does not get.var_arm64left unset: Ubuntu ships arm64 packages, but this has not been run on arm64.Upstream research
main. Package version checked on ubuntuupdates.org (resolute updates/security:1.5.4+dfsg-0ubuntu0.26.04.1); upstream latest is 1.5.4.clamd.confgeneration, the debconf TCP/UNIX choice and the shippedclamav-daemon.socketchecked in theclamav-daemon1.5.4 package (postinst/config).--only-upgradeof the three ClamAV packages), as in other apt-based scripts here; there is no GitHub release to deploy.🔗 Related PR / Issue
Link: #
✅ Prerequisites (X in brackets)
🏗️ arm64 Support (X in brackets)
🖥️ Tested on (X in brackets)
🛠️ Type of Change (X in brackets)
README,AppName.md,CONTRIBUTING.md, or other docs.🔍 Code & Security Review (X in brackets)
CODE-AUDIT.md&CONTRIBUTING.mdguidelinesAppName.sh,AppName-install.sh,AppName.json)fetch_and_deploy_gh_release,fetch_and_deploy_codeberg_release,fetch_and_deploy_gl_release, orfetch_and_deploy_from_urlinstead ofgit pull.📋 Additional Information (optional)
Validated so far:
bash -n, shellcheck (only the standardsourcewarnings on the boot line),jqon the JSONsystemd-analyze verifyon the scan unit and timer,logrotate -don the rotation configTCPSocketinclamd.conf: theclamdscan --multiscan --fdpassscan over the local socket andPING/INSTREAMover TCP (what Nextcloud and rspamd use) both work, and an EICAR test file is detected on both pathsFull install on a PVE host (with
var_clamd_tcp=yes) still to do; I'll tick Tested thoroughly and Proxmox VE once that's done.📦 Application Requirements (for new scripts)
🌐 Source
🤖 AI Assistance (X in brackets)
AGENTS.mdand.github/agents/pve-script-creator.agent.mdas guidance, and the output has been reviewed and corrected to match those guidelines.Please describe to which degree, if any, an LLM was used in creating this pull request. Name the model(s) used and, if applicable, the reasoning/thinking effort level (e.g. "Claude Sonnet 4.5, high reasoning, used to draft the install script, then manually reviewed and tested" or "No LLM used"). This is informational, not a penalty — but scripts that are clearly AI-generated and not further revised by the author to match
CODE-AUDIT.md/CONTRIBUTING.mdmay be closed without review.Claude Opus 5.5, low reasoning. Used to draft the scripts, the TCP socket drop-in and this description; reviewed by me. The socket-activation behaviour was tested against clamd 1.5.4; PVE install testing in progress.
🤖 Generated with Claude Code
https://claude.ai/code/session_01SZrFpmKbYH9dg8mAu5wrEK