Skip to content

New Script: ClamAV LXC - #2485

Open
cisox wants to merge 3 commits into
community-scripts:mainfrom
cisox:clamav
Open

cisox wants to merge 3 commits into
community-scripts:mainfrom
cisox:clamav

Conversation

@cisox

@cisox cisox commented Oct 30, 2026

Copy link
Copy Markdown

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. It's an unprivileged Debian 13 LXC running clamd on TCP 3310, with freshclam keeping signatures updated. Mail servers, Nextcloud, Paperless-ngx and other clamd clients can use it as a network virus scanner. You can also bind-mount storage into it and scan with clamdscan.

Drafted with Claude Opus 5.5 (Claude Code, medium reasoning), then reviewed and tested by me. Details are in the AI Assistance section.

Why Debian packages instead of fetch_and_deploy_gh_release:

  • Upstream's release .deb is a bare CPack build. Everything lands in /usr/local, with no maintainer scripts, no systemd units, no clamav user and only .sample configs, and it takes ~550 MB installed. Using it would mean hand-building users, configs and units (anti-patterns 9/31).
  • Debian's clamav/clamav-daemon/clamav-freshclam provide all of that.
  • Debian keeps ClamAV current in stable through stable-updates, a standing exception to the freeze. Debian 13 ships 1.4.3, upstream's LTS line.
  • update_script follows the existing apt-cacher-ng pattern: apt_update_safe plus a package upgrade.

TCP setup:

  • debconf is preseeded (TcpOrLocal=TCP, TCPSocket=3310, TCPAddr=0.0.0.0), so the config survives package upgrades.
  • Debian's clamd is socket-activated through clamav-daemon.socket, which only listens on /run/clamav/clamd.ctl. The TCPSocket setting alone left port 3310 closed in testing.
  • A socket drop-in (ListenStream=3310) is written before the package install, so no daemon-reload is needed.
  • TCPAddr is set explicitly because without it local clamdscan fails silently (rc=2, no message).

Testing (Proxmox VE 9.2.24):

  • Ran ct/clamav.sh from this branch through the engine (unattended, default settings). It created an unprivileged Debian 13 CT (2 CPU / 3 GB / 8 GB) and every step completed.
  • clamav-daemon and clamav-freshclam are active, and clamd listens on the local socket and *:3310.
  • From another LAN host: PING → PONG, VERSION → ClamAV 1.4.3/…, INSTREAM with EICAR → Eicar-Test-Signature FOUND, clean stream → OK. Inside the CT, clamdscan on an EICAR file → FOUND.
  • update_script (running ct/clamav.sh inside the CT): Updated ClamAV → Updated successfully!.
  • TCPSocket 3310 and the socket drop-in survive apt install --reinstall clamav-daemon clamav-base. Port 3310 and both services come back after a CT reboot.
  • RAM is ~1 GB with signatures loaded. The 3 GB default leaves room for ConcurrentDatabaseReload, which briefly holds two copies of the database.

🔗 Related PR / Issue

Link: none. No existing issue or request found for ClamAV.

✅ Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughly – Changes work as expected.
  • No breaking changes – Existing functionality remains intact.
  • No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.

🏗️ arm64 Support (X in brackets)

  • arm64 supported - Tested and supported on arm64.
  • arm64 not tested - Assumed to work on arm64, but testing has not been done.
  • arm64 not supported - Confirmed upstream dependencies or binaries do not support arm64.

🖥️ Tested on (X in brackets)

  • Proxmox VE – Created on a Proxmox VE host and the app works.
  • Incus – Created on an Incus host and the app works.

Application containers run on both; tick what you actually tested. VMs and host tools are Proxmox only.


🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • ✨ New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing functionality in a way that may require updates.
  • 🆕 New script – A fully functional and tested script or script set.
  • 🌍 Website update – Changes to website-related JSON files or metadata.
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to README, AppName.md, CONTRIBUTING.md, or other docs.

🔍 Code & Security Review (X in brackets)

  • Follows CODE-AUDIT.md & CONTRIBUTING.md guidelines
  • Uses correct script structure (AppName.sh, AppName-install.sh, AppName.json)
  • No hardcoded credentials
  • No Docker / Docker Compose – The application is installed bare-metal; Docker is not used.
  • No git pull – Updates use fetch_and_deploy_gh_release, fetch_and_deploy_codeberg_release, fetch_and_deploy_gl_release, or fetch_and_deploy_from_url instead of git pull.

🤖 AI Assistance (X in brackets)

If you used an AI tool (GitHub Copilot, Claude, ChatGPT, etc.) to write or generate any scripts in this PR, you must confirm compliance below.
Select exactly one option.

  • No AI used – Scripts were written without AI assistance.
  • AI was used – I confirm the scripts were built using AGENTS.md and .github/agents/pve-script-creator.agent.md as 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.md may be closed without review.

Claude Opus 5.5 (Claude Code), medium reasoning. It researched upstream and Debian's packaging, drafted all three files following AGENTS.md and pve-script-creator.agent.md, and ran the tests above on my Proxmox host. During testing it found and fixed the socket-activation issue (port 3310 not opening) and the silent clamdscan failure. I reviewed the scripts and this description before submitting.


📋 Additional Information (optional)

Two checklist items are deliberately not followed:

  • fetch_and_deploy_gh_release/check_for_gh_release aren't used, because the app comes from Debian's repository. See the Description for why.
  • Updates go through apt (apt_update_safe + upgrade_packages_with_retry), not git pull or a release fetch.

interface_port is null because there's no web UI (same as gitea-runner). The JSON notes warn that clamd's TCP port has no authentication, which matches upstream's official image.


📦 Application Requirements (for new scripts)

⚠️ Do not remove this section.
It is used by automated PR validation checks.
If this PR is not a new script submission, leave the checkboxes unchecked.

Required for 🆕 New script submissions.
Pull requests that do not meet these requirements may be closed without review.

  • The application is at least 6 months old
  • The application is actively maintained
  • The application has 600+ GitHub stars
  • Official release tarballs are published
  • I understand that not all scripts will be accepted due to various reasons and criteria by the community-scripts ORG

🌐 Source

🤖 Generated with Claude Code

Debian 13 container running clamd on TCP 3310 with freshclam signature
updates, installed from Debian's packages. TCP is preseeded via debconf
and opened through a clamav-daemon.socket drop-in, since Debian's clamd
is socket-activated and otherwise only listens on its unix socket.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cisox
cisox requested a review from a team as a code owner October 30, 2026 15:08
@github-actions

Copy link
Copy Markdown
Contributor

Try this script

ct/clamav.sh, run in the Proxmox VE shell or on an Incus host:

COMMUNITY_SCRIPTS_URL=https://raw.githubusercontent.com/cisox/DevScripts/clamav \
bash -c "$(curl -fsSL https://raw.githubusercontent.com/cisox/DevScripts/clamav/ct/clamav.sh)"

COMMUNITY_SCRIPTS_URL is not optional for ct/. Fetching the ct/ script from a
branch does not tell the engine where that branch is — with bash -c "$(curl …)"
there is no file on disk for the scripts root to be derived from, so it would fall
back to upstream main and look for the install script there.

Against a core branch as well

Add COMMUNITY_SCRIPTS_CORE_URL=https://raw.githubusercontent.com/OWNER/core/BRANCH
to test an engine change at the same time. The two resolve independently.

Useful flags while testing

dev_mode=net logs every fetch with status and duration, so you can confirm the
branch is really being used. dev_mode=keep stops a failed build from deleting
the container along with the evidence.

@cisox cisox changed the title Add ClamAV LXC scripts New Script: ClamAV LXC Oct 30, 2026
@cisox

cisox commented Oct 30, 2026

Copy link
Copy Markdown
Author

Tested the command above on Proxmox VE 9.2.24 (unattended, default settings, dev_mode=net). The install script was fetched from cisox/DevScripts/clamav, the build completed, clamd and freshclam are active, and an EICAR INSTREAM over TCP 3310 returned Eicar-Test-Signature FOUND.

Comment thread install/clamav-install.sh Resolved
Comment thread json/clamav.json Resolved
cisox and others added 2 commits October 31, 2026 07:43
Co-authored-by: Sam Heinz <sam@samheinz.com>
Co-authored-by: Sam Heinz <sam@samheinz.com>
@cisox
cisox requested a review from asylumexp October 31, 2026 11:44

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants