[clamav-users] Run script on file scanned but no virus found
Kris Deugau
kdeugau at vianet.ca
Thu Nov 2 19:42:35 UTC 2017
Chris Johnson wrote:
> I have on access scanning configured and we successfully run a script
> when a virus is found. This script allows us to make a log that the
> file was scanned and a virus found. However we'd also like to run a
> script to make a log when the file has been scanned and no virus has
> been found
>
> there are 2 goals (and I accept there may be a different way of
> achieving these.)
>
> 1) Script are too fast
> The files we're scanning get uploaded through a web form
> On access scanning checks the file once uploaded
You might do better to just integrate a call to clamdscan (note, not
clamscan, which loads the virus DB on each call) with your upload script
rather than rely on on-access scanning. You're already more or less in
control of when and where files actually get written to your local
filesystem, where on-access scanning is usually intended for situations
more like the conventional AV usage in Windows where files accessed by
many processes with many origins all need to be scanned.
> We put a 1 second pause in before checking for the (deleted) file and
> this now works. However the file might take longer than 1 second to
> scan if its big or the server is busy.
If scan speed is a concern, maybe something AJAXy to send feedback on
the state of the upload (eg "Uploading", "Scanning", "OK"/"Virus found")
rather than just stalling the main script while the scan runs.
-kgd
More information about the clamav-users
mailing list