Moodle and Clam AV

Moodle and Clam AV

by Jon Witts -
Number of replies: 8
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I have Moodle 1.5.2 running on a Windows Server 2003 box with MySQL, PHP and IIS running. All seems to be fine with Moodle itself, however I noticed the option to have Moodle automatically scan uploaded files for viruses with Clam AV.

I have downloaded and installed the Windows version of CLAM AV on my web server and it appears to be running fine on the server however when I upload a file to moodle I get an email saying:

Clam AV has failed to run.  The return error message was There was an unknown error with clam.. Here is the output from Clam:

This happens with every file upload and I never get an output from Clam, has anyone else run into this problem?

Is there something I am missing with the path to Clam in moodle settings?

I changed the default install of Clam from C:\Program Files\CLAM AV to C:\Clamwin as moodle was appearing to have problems with the space in the default directory structure..

Average of ratings: -
In reply to Jon Witts

Re: Moodle and Clam AV

by Martín Langhoff -
Hmmm! I don't think we've ever ran it on Windows. I suspect you are a bit of a pioneer there. It's a good idea to install it on a path without spaces, as you've done, but past that point... I'm lost.

Make sure you point the path to the command line clamscan utility (clamscan.exe?). Try testing the utility in the command line, passing it a file to scan as an argument.
In reply to Martín Langhoff

Re: Moodle and Clam AV

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
OK,

Moodle is definitely pointing to the right path, however when I run clamwin from the command line I get some strange errors. I have posted to ClamWin's forums so hopefully they will have some help for me. I will post back here and let you all know how I get on, if I can get it running on Windows it would be great and probably help many other people too.
In reply to Jon Witts

Re: Moodle and Clam AV

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I think I might be a few steps closer to getting this working, I have found another port of ClamAV that utilises the dll's from Cygwin, allowing ClamAV to run much the same as it does in *unix systems. I have to test this further and have a test file that behaves a virus, so if moodle refuses to upload this then all is well!

I will let people know how I get on, as it would be very useful for all windows users to be able to intergrate anti virus protecion into moodle..
In reply to Jon Witts

Re: Moodle and Clam AV

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
OK, I believe I have got it working!

I downloaded the Cgywin port of clamAV (clamav-devel.exe) from http://sosdg.org/clamav-win32/index.php and carried out a standard install.

Then I configured my moodle installation to run ClamAV on upload; path to Clam "C:\clamav-devel\bin\clamdscan.exe" (no quotation marks!) and left the quarantine directory empty, and told it to treat files as OK on Clam failure.

Then I downloaded the anti-virus test files from http://www.eicar.org/anti_virus_test_file.htm and tried to upload the the zip file to my moodle installation. Moodle did not upload the file!! approve

AGGHH!

Maybe not! sad Looked like it worked the first time but it is now uploading the files!!
In reply to Jon Witts

Re: Moodle and Clam AV

by Monika Sawicka -
Clam-devel works fine, but new ClamWin not. sad
In reply to Monika Sawicka

Re: Moodle and Clam AV

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Monika,

Did you get Clam-devel to work correctly? I thought I had, but I was wrong. If you did can you share your settings with us please. I would love to get Anti-Virus functionality into a M$ install of Moodle.

I left my search for this at the point when I thought I would have to give the default IIS user account access to my server's command prompt... A bit of a security risk I think you would agree....
In reply to Jon Witts

Re: Moodle and Clam AV

by Monika Sawicka -
Hi Jon,

Yes, I got Clam-devil to work correctly. When ClamWin came I was getting an error message that my Clam-devil doesn't work in 100%. So I installed ClamWIn and at the beginning it wasn't work well, but today finally I got it working!

Of course I can share my setting about Clam-Devil, but I suggest to try ClamWIn. It's very easy to install (http://www.clamwin.com/). Only three things you have to do:
1. Set all privileges for Internet Guest for Windows/Temp folder
2. Update pathtoclam
log in as admin to moodle->Configuration->Variables
and set pathtoclam to C:/Progra~1/ClamWin/bin/clamscan.exe
3. In file lib/upload.lib in function clam_scan_file change line
$cmd = $CFG->pathtoclam .' '. $fullpath ." 2>&1";
to
$cmd = $CFG->pathtoclam .' --database="C:\Documents and Settings\All Users\.clamwin\db" --recursive '. $fullpath ." 2>&1";

It works for me. I hope for you it will work as well.

Best regards,

Monika

PS If you get any problems, please let me know.