Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-31045

CLONE - Clam AV (ClamWin) does not work on Windows servers with IIS or Apache

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_22_STABLE
    • Workaround:
      • edit moodle code to add the additional definition database path parameter
      • or move files around in Clam AV installation so the executable have all the files in the default start up directory
    • Testing Instructions:
      Hide

      1. install ClamWin on a Windows server
      2. enter the executable path in moodle "clam AV path (pathtoclam)" and turn on "Use clam AV on uploaded files (runclamonupload)"
      3. when upload a file the operation fails because clam AV cannot scan the file. reason stated in the original bug report

      Show
      1. install ClamWin on a Windows server 2. enter the executable path in moodle "clam AV path (pathtoclam)" and turn on "Use clam AV on uploaded files (runclamonupload)" 3. when upload a file the operation fails because clam AV cannot scan the file. reason stated in the original bug report

      Description

      I want to re-open the bug but don't know how, so submitting a new one here.

      I cannot find the "fix" information on wiki anymore as linked by a comment in the original bug report, also tried digging through different wiki versions and histories with no avail.

      Here are some forum links on these issue with workarounds, mostly involve custom code fix:
      (2005, m1.5) http://moodle.org/mod/forum/discuss.php?d=36573
      (2007, m1.7) http://moodle.org/mod/forum/discuss.php?d=62324
      (2007, m1.8) http://moodle.org/mod/forum/discuss.php?d=71744

      It is still a problem with 2.2 on Windows with ClanWin. To make moodle "Just Works", it is more friendly to add an optional setting, as suggested, in the ClamAV section of admin settings for specifying definition database location and call Clam AV differently in the code if this option is set. ClamWin has this listed in the app and is easy for admin to find (see attachment).

      It's not always possible to modifying the Clam AV installation and/or moodle code on the server for some users. Plus those steps should really not be required for admins to fix manually when Clam AV is listed in it's own admin setting section. Being part of the default moodle installation probably warrants an extra field to make Windows admins' life easier

      ---------------------- original bug report below -------------------
      As we all know Moodle supports clam antivirus. However that support only actually works for *nix servers. I tried setting up clamscan on windows with IIS and here are my findings:

      1. clamscan as installed by clamwin distribution does not work from command line since it can not find location to the database files. That location is usually defined in freshclam.conf or can be passed to the clamscan with parameter --database. clamscan contemplates configuration directory based on CONFDIR define in source code. That value is set based on the operating system. In windows build it is set explicitly to "." which means current directory.

      2. IIS sets value of the current directory for server side scripts based on the current location of the script itself.

      This means that every php file that want's to execute clamscan must have freshclam.conf in the same folder for the execution to work.

      So when moodle executes clamscan we get the message that it can not find the antivirus databases.

      The most appropriate solution for this problem would be adding additional option to the antivirus configuration where user can actually specify location of antivirus database and such option cxan later be used to be passed to clamscan with --database parameter.

      Alternative to this is having freshclam.conf in every place that some script invokes clamscan which is far too cumbersome.

        Attachments

        1. 2012-01-05_17-55-10.png
          2012-01-05_17-55-10.png
          19 kB
        2. admin.php
          110 kB
        3. ClamWin-AV-Patch-MDL-31045.zip
          213 kB
        4. ClamWin-AV-Patch-MDL-31045-v2-6-1.zip
          106 kB
        5. lib.php
          76 kB
        6. moodle.php
          109 kB
        7. security.php
          12 kB
        8. uploadlib.php
          32 kB

          Issue Links

            Activity

              People

              Assignee:
              moodle.com moodle.com
              Reporter:
              davidtang David Tang
              Participants:
              Component watchers:
              Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Ruslan Kabalin, Matteo Scaramuccia, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: