LTspicer-ClamAV-Scanner 1.9.4

XF 2.2 / 2.3 LTspicer-ClamAV-Scanner 1.9.4

Add-on xenforo 2

Ressources et modules complémentaires pour XenForo 2

Styles xenforo 2

Styles / Thèmes et apparence pour xenforo 2

Templates xenforo 2

Codes pour modifier les templates sur xenforo 2

Section Premium

Add-on et Styles pour membre Premium
  • ⚠️ Section Premium. Réserver aux Membres Premium ⚠️
LTspicer-ClamAV-Scanner 1.9.4

XF 2.2 / 2.3 LTspicer-ClamAV-Scanner 1.9.4

Catégorie Catégorie Add-Ons
Titre du sujet Titre du sujet LTspicer-ClamAV-Scanner 1.9.4
Auteur de la discussion Auteur de la discussion laurent68
Date de début Date de début
Réponses Réponses 0
Affichages Affichages 4
Réaction Réaction 0
Dernier message par Dernier message par laurent68

laurent68

Fondateur

Staff
fondateur
Réputation: 100%
Discussions
5 120
Messages
13 418
Solutions
85
J'aime
8 169
Points
198
LTspicer's ClamAV Scanner add-on

The LTspicer-ClamAV-Scanner add-on holds new attachments until a local ClamAV daemon has scanned them.

It supports XenForo 2.2 and 2.3 and was developed against XenForo 2.2.19 and 2.3.6.

History :

Out of necessity, I wrote an antivirus add-on for my forum (https://www.ltspiceusers.ch), since Jazzaaf is no longer maintaining his xenAntiVirus add-on.
But I don't want to keep this from you. I'm sure some of you could really use it ;)
... and it is much faster than Jazzaaf's add-on!

Features :
  • Scans attachments in a XenForo background job using ClamAV's INSTREAM protocol.
  • Keeps attachments pending or blocked if scanning fails or ClamAV reports an infection.
  • Provides an ACP scan report with filters, retry, manual release, re-block and attachment deletion.
  • Shows clamd reachability, loaded signature database version and age in the ACP report, with a configurable stale warning threshold (48 hours by default).
  • Lets administrators exclude file extensions, user groups, forums and choose whether to scan private conversation attachments.
  • Emails selected members when ClamAV detects an infected upload.
  • Adds a direct link to the related public forum post or thread in infection emails and the ACP report; private conversation attachments are not linked.
  • Offers a permission-controlled account report showing each member only their own attachments.
  • Shows a status marker on pending, infected, scan-error and manually blocked attachments.
Install clamAV :
Code:
#Install clamAV (Debian, Ubuntu etc.):
#=====================================
sudo apt update
sudo apt install -y clamav clamav-daemon clamav-freshclam clamdscan

#Start service:
#==============
sudo systemctl enable --now clamav-freshclam

#Test:
#=====
sudo systemctl status clamav-freshclam

#First update:
#=============
sudo systemctl stop clamav-freshclam
sudo freshclam
sudo systemctl start clamav-freshclam

#Start Daemon:
#=============
sudo systemctl enable --now clamav-daemon
# And test it:
sudo systemctl status clamav-daemon

####################################

Limits:
=======
 For a XenForo upload limit of 350 MB, use settings like these. Edit existing active directives, or add a directive if it is absent; avoid leaving multiple active definitions of the same setting:

sudo nano /etc/clamav/clamd.conf:

MaxFileSize 360M
StreamMaxLength 360M
MaxScanSize 1G
AlertExceedsMax yes

MaxFileSize and StreamMaxLength are set slightly above the upload cap. MaxScanSize limits the total amount of data ClamAV scans inside archives and other containers; 1G is an example cap, not a universal value. Higher limits can use more server resources. AlertExceedsMax yes makes ClamAV report files that exceed scanning limits as detections instead of silently skipping them.

Restart clamd after changing its configuration:

sudo systemctl restart clamav-daemon
# And show the state ^^
sudo systemctl status clamav-daemon

Install the add-on :

1. Install clamAV on the server (see above).
2. Extract the release ZIP and copy the contents of the upload/ directory into the XenForo installation root.
3. In the Admin CP, open Add-ons and install LTspicer ClamAV Scanner.
4. Visit Setup → Options → LTspicer ClamAV scanning and configure the settings.

The add-on's default socket value is unix:///run/clamav/clamd.ctl (Debian/Ubuntu default). Set the ACP option to the exact LocalSocket path shown by your daemon configuration. A Unix socket is recommended for a local daemon. Make sure the PHP worker user can access the socket; use a suitable group or socket permissions rather than exposing the socket to every local user. Set StreamMaxLength high enough for your largest XenForo attachment.

Test it :

Then, in a test forum, upload the standard harmless EICAR test file as a .txt attachment (make sure .txt is allowed in XenForo). Do not rename it to .jpg or .png: XenForo validates image content before the add-on or ClamAV scan runs. Confirm that the ACP report shows the file as infected and that XenForo blocks it.
.rar, .zip, .pdf etc is also ok.
Remove the test attachment after verifying the workflow.

Configure the settings of the add-on :

Open Setup → Options → LTspicer ClamAV scanning :

- clamd socket address: use the daemon's LocalSocket path. The prefilled path is a common Debian/Ubuntu default; verify it on your server. TCP is also supported with a value such as tcp://127.0.0.1:3310.
- Timeout: maximum connection and response time. The default is 30 seconds; raise it if large files or archives regularly exceed that time on your server.
- Excluded extensions, user groups, and forums: choose what should skip scanning. Image files are scanned by default; excluding image extensions reduces coverage.
- Scan private conversation attachments: turn this off if private message attachments should not be scanned.
- Alert recipients: search for and select the members who should receive infection emails.

Configure and start ClamAV, verify socket access, and make sure XenForo's background jobs are running before accepting uploads. Background jobs process scans and retry requests. Attachments stay unavailable while a scan is pending or has an error; retry the scan after fixing the cause of an error.

Reports and permissions :

- The global report is in the ACP under Content → ClamAV report.
- Retry scan queues another scan. Members can retry their own attachments in the error state from their account report; administrators can queue all scan errors in bulk from the ACP.
- Block attachment manually blocks a clean attachment
- Release attachment makes an infected or manually blocked attachment available again. Use it only after reviewing the file.
- Re-block attachment blocks a manually released attachment again.
- Delete attachment opens XenForo's confirmation page and permanently deletes the selected attachment.
- Remove from report removes a clean scan result without deleting the XenForo attachment. The attachment no longer has a scan report entry.
- Members with the report permission can also remove their own clean entries from their account report; the attachments remain available.
- Remove all clean entries opens a confirmation page before removing every clean scan report entry. The attachments themselves are kept.
- To show a member's own report in the account menu, grant View my ClamAV scan report in Groups & permissions → User group permissions → General permissions.

German phrases :
- The release contains English master phrases. To add German translations, import language-Deutsch-LTspicer-ClamAVScanner.xml in Appearance → Languages → Import and apply it to the existing German language.

Uninstall :
- Uninstall the add-on from the ACP. The add-on removes its scan-status table; XenForo attachments are not deleted by uninstalling the add-on.

Postscriptum :
- Be sure to also read the README on GitHub. It's often more up-to-date than the instructions here! https://github.com/ltspicer/ClamAV-Scanner-for-XenForo-attachements

permission.webp


acp_report.webp


user_panel.webp


Télécharger V1.9.4 :
 
Retour
Haut Bas