+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 21
Virtual Learning Platforms Thread, Moodle 2.0.x: LDAPCapture and SMBWebClient (aka Windows Web Share Client) in Technical; Spent the morning working on both the 'Windows Web Share Client' block (to use it's proper name) and 'LDAPCapture' auth ...
  1. #1
    Marci's Avatar
    Join Date
    Jun 2008
    Location
    Wakefield, West Yorkshire
    Posts
    896
    Thank Post
    84
    Thanked 235 Times in 194 Posts
    Rep Power
    82

    Cool Moodle 2.0.x: LDAPCapture and SMBWebClient (aka Windows Web Share Client)

    Spent the morning working on both the 'Windows Web Share Client' block (to use it's proper name) and 'LDAPCapture' auth plugin to get them working in Moodle2.0.x

    LDAPCapture - http://www.minimotoscene.co.uk/marci...re_moodle2.zip
    Windows Web Share Client - http://www.minimotoscene.co.uk/marci...nt_moodle2.zip

    Both tested as working on clean install of Moodle 2.0.3, with PHP5.2.17 on FreeBSD8.2-RELEASE

    Note: I am not the maintainer of either of these, and as such these should be considered unofficial modified versions. Should the author (*waves at Guy*) have any objections to these being posted here, drop me a line and I'll remove them immediately.

    Also note, I haven't tested these on PHP5.3.x / Moodle 2.1 - if anyone does so, can you let me know the outcome...?

  2. 3 Thanks to Marci:

    cyberrant (2nd July 2012), GrumbleDook (10th August 2011), philwaud (25th June 2011)

  3. #2

    Join Date
    Jul 2010
    Location
    Wakefield
    Posts
    87
    Thank Post
    3
    Thanked 11 Times in 11 Posts
    Rep Power
    10

    Nice work!

    Good work Marci!

    Does that mean we are upgrading soon? :-)

    Phil

    Quote Originally Posted by Marci View Post
    Spent the morning working on both the 'Windows Web Share Client' block (to use it's proper name) and 'LDAPCapture' auth plugin to get them working in Moodle2.0.x

    LDAPCapture - http://www.minimotoscene.co.uk/marci...re_moodle2.zip
    Windows Web Share Client - http://www.minimotoscene.co.uk/marci...nt_moodle2.zip

    Both tested as working on clean install of Moodle 2.0.3, with PHP5.2.17 on FreeBSD8.2-RELEASE

    Note: I am not the maintainer of either of these, and as such these should be considered unofficial modified versions. Should the author (*waves at Guy*) have any objections to these being posted here, drop me a line and I'll remove them immediately.

    Also note, I haven't tested these on PHP5.3.x / Moodle 2.1 - if anyone does so, can you let me know the outcome...?

  4. #3
    Marci's Avatar
    Join Date
    Jun 2008
    Location
    Wakefield, West Yorkshire
    Posts
    896
    Thank Post
    84
    Thanked 235 Times in 194 Posts
    Rep Power
    82
    1) not up to me when/if...
    2) depends if slt sticking with moodle...
    3) depends if *shhhhhh*...
    4) still not done MIS block or Facility2Moodle block, so no, not yet...

  5. Thanks to Marci from:

    philwaud (25th June 2011)

  6. #4

    Join Date
    Jul 2010
    Location
    Wakefield
    Posts
    87
    Thank Post
    3
    Thanked 11 Times in 11 Posts
    Rep Power
    10
    Great news anyway, is it php5.3 compatible - I know you asked for testers but Im guessing you have intended it to work?

    Phil

  7. #5
    Marci's Avatar
    Join Date
    Jun 2008
    Location
    Wakefield, West Yorkshire
    Posts
    896
    Thank Post
    84
    Thanked 235 Times in 194 Posts
    Rep Power
    82
    Not a clue at the moment... don't have a 5.3 testing server on which to debug.

  8. #6


    Join Date
    Dec 2005
    Location
    In the server room, with the lead pipe.
    Posts
    4,684
    Thank Post
    279
    Thanked 784 Times in 611 Posts
    Rep Power
    224
    There's a newer version of libencryption.php available here: Ultra Secure 2-Way PHP Encryption Algorithm - ActionScript.org Forums

    But it's still not a nice encryption module.

  9. Thanks to pete from:

    Marci (16th July 2011)

  10. #7
    Marci's Avatar
    Join Date
    Jun 2008
    Location
    Wakefield, West Yorkshire
    Posts
    896
    Thank Post
    84
    Thanked 235 Times in 194 Posts
    Rep Power
    82
    I'll have a look at that at somepoint and see how well it plays with the rest of the block... at the moment the main issue to resolve is smbwebclient not being able to download files with spaces in the filename, which appears to be an issue with one of the preg_replace statements...

  11. #8

    Join Date
    Mar 2009
    Location
    wakefield
    Posts
    15
    Thank Post
    1
    Thanked 2 Times in 2 Posts
    Rep Power
    12
    Hi Marci

    I have no objections to them being hosted here - many thanks for your work on them.
    I had already done work on both of these plugins but just hadn't released them yet.
    Please let me know if you have any fixes in future and then it saves us both from re-inventing the wheel!
    I think you have my email address but if not you can find my contact details on Citricity Ltd 2011
    If you can send me your email address I'll try to keep you up to date with any work I do on the plugins.

    BTW - it turns out that the windows share web client white space issue with folders and files is an issue with people running the block on a Moodle hosted on a windows server.
    Linux / BSD servers should not have been affected by the white space issue. I have fixed this in the latest releases.

    The "official" versions are available for download from:

    Citricity Ltd 2011

    Citricity Ltd 2011

    Both these plugins have been successfully tested on a linux install in a college today.

  12. Thanks to brudinie from:

    Marci (10th August 2011)

  13. #9
    Butters's Avatar
    Join Date
    Jun 2008
    Location
    London
    Posts
    534
    Thank Post
    15
    Thanked 51 Times in 45 Posts
    Rep Power
    60
    Do these plugins work with externally hosted Moodle sites?

  14. #10
    Marci's Avatar
    Join Date
    Jun 2008
    Location
    Wakefield, West Yorkshire
    Posts
    896
    Thank Post
    84
    Thanked 235 Times in 194 Posts
    Rep Power
    82
    Only if you can set up a vpn between your webserver and your school site...

    @brudinie - cheers d00d... will pull my files down and bash a redirect back to yours tomorrow. Which reminds me, I must remember to update the Moodle.org Fac-2-Moodle download location over to yonder new employer's servers too on Monday!
    Last edited by Marci; 10th August 2011 at 05:16 PM.

  15. #11

    Join Date
    Mar 2009
    Location
    wakefield
    Posts
    15
    Thank Post
    1
    Thanked 2 Times in 2 Posts
    Rep Power
    12
    pete - you are correct, its not the best.
    That's why I've replaced it with an implementation of AES in the latest Moodle 2 version ;-)

  16. #12


    Join Date
    Dec 2005
    Location
    In the server room, with the lead pipe.
    Posts
    4,684
    Thank Post
    279
    Thanked 784 Times in 611 Posts
    Rep Power
    224
    Does the ClamAV integration actually work for anyone in smbwebclient?

    Here, it doesn't seem to work. I can successfully upload an eicar test file that ClamAV will detect on the CLI and I get nothing in the clamav log.

  17. #13
    Marci's Avatar
    Join Date
    Jun 2008
    Location
    Wakefield, West Yorkshire
    Posts
    896
    Thank Post
    84
    Thanked 235 Times in 194 Posts
    Rep Power
    82
    Pete - in your config_smb_web_client file, what do you have for the $smb_cfg->cfgAntivirus entry? Whatever is in there becomes the name of the function called, and the function is entitled ClamAV so config must state ClamAV case sensitively. ie: ClamAV should work, whereas clamav won't work...

    Specifically, here's the code used on new file uploads:
    Code:
    $smb_cfg->cfgAntivirus = 'ClamAV';
    Code:
    function NewFileAction ()
    {
        if ($_FILES['file']['tmp_name'] <> '') {
            $this->parent = $this->path;
            $this->name = $_FILES['file']['name'];
            if ($this->cfgAntivirus) {
                $fn = $this->cfgAntivirus;
                $infected = $this->$fn($_FILES['file']['tmp_name']);
            }
            if (! $infected) {
                $this->UploadFile($_FILES['file']['tmp_name']);
                $this->Debug('new file "'.$this->name);
            }
        }
        if ($this->status <> '') $this->ErrorMessage($this->status);
        header('Location: '.$this->FromPath('.'));
        exit;
    }
    
    function ClamAV ($file)
    {
        $out = preg_split('/\n/',`clamscan $file`);
        if (preg_match('/^'.$file.': (.*) FOUND$/', $out[0], $regs)) {
            $this->status = 'VIRUS: '.$regs[1];
            return true;
        } else {
            return false;
        }
    }
    Last edited by Marci; 28th February 2012 at 11:09 AM.

  18. Thanks to Marci from:

    pete (28th February 2012)

  19. #14
    Marci's Avatar
    Join Date
    Jun 2008
    Location
    Wakefield, West Yorkshire
    Posts
    896
    Thank Post
    84
    Thanked 235 Times in 194 Posts
    Rep Power
    82
    Righty - can confirm it works fine for me and reports virii correctly, however, for it to do so I had to make a slight change... in class_smbwebclient.php, comment out the current ClamAV function, and replace it as follows then give it another try:

    Code:
    /* function ClamAV ($file)
    {
        $out = preg_split('/\n/',`clamscan $file`);
        if (preg_match('/^'.$file.': (.*) FOUND$/', $out[0], $regs)) {
            $this->status = 'VIRUS: '.$regs[1];
            return true;
        } else {
            return false;
        }
    } */
    
    function ClamAV($file)
    {
        $out = preg_split('/\n/',`clamscan $file`);
        if (strpos($out[0],'FOUND')){
            $this->status = 'VIRUS DETECTED: '.$out[0];
            return true;
        } else {
            return false;
        }
    }
    For some reason the preg_match statement was throwing an invalid modifier, or simply didn't detect the FOUND string.

    ALSO, for info, smb_web_client only checks the FIRST line of the response from 'clamscan $file', so if at CLI this comes back with anything other than '/path/file: verdict' then the file's scan results won't actually be seen by smb_web_client, and it'll say all is fine, even tho on the 5th line of clamscan's response it may state that a virus is found.

    Really the function needs modifying to iterate thru each line of $out and look for a line whose beginning matches $file and take the array pointer for that line instead of always using $out[0] incase of out-of-date DBs etc.
    Last edited by Marci; 28th February 2012 at 12:22 PM.

  20. Thanks to Marci from:

    pete (28th February 2012)

  21. #15


    Join Date
    Dec 2005
    Location
    In the server room, with the lead pipe.
    Posts
    4,684
    Thank Post
    279
    Thanked 784 Times in 611 Posts
    Rep Power
    224
    Sorry, got sidetracked on another issue. Our config looks good and the code (when called in a separate .php file can be made to work against clamscan and clamdscan).

    We found the regex issue too. (Hacky fix for iterating at the bottom)

    The problem is a default distro install of ClamAV will often (unless you're repackaging the engine frequently yourself) dump 13 lines of whining about your ClamAV engine being out of date.

    A better solution would be to call clamdscan (since it's already running as a daemon) because it's much, much faster (.05 of a second vs 4 seconds) i.e:

    Code:
    pete@moodle:~$ time clamscan test2.txt 
    LibClamAV Warning: ***********************************************************
    LibClamAV Warning: ***  This version of the ClamAV engine is outdated.     ***
    LibClamAV Warning: *** DON'T PANIC! Read http://www.clamav.net/support/faq ***
    <snip> LibClamAV Whining</snip>
    LibClamAV Warning: ***********************************************************
    test2.txt: Eicar-Test-Signature FOUND
    
    ----------- SCAN SUMMARY -----------
    Known viruses: 1151693
    Engine version: 0.96.5
    Scanned directories: 0
    Scanned files: 1
    Infected files: 1
    Data scanned: 0.00 MB
    Data read: 0.00 MB (ratio 0.00:1)
    Time: 4.936 sec (0 m 4 s)
    
    real	0m4.965s
    user	0m4.730s
    sys	0m0.210s
    vs
    Code:
    pete@moodle:~$ time clamdscan test2.txt 
    /home/pete/test2.txt: Eicar-Test-Signature FOUND
    
    ----------- SCAN SUMMARY -----------
    Infected files: 1
    Time: 0.000 sec (0 m 0 s)
    
    real	0m0.004s
    user	0m0.010s
    sys	0m0.000s
    Hacky fix that properly iterates, but needs some TLC and debug code removed

    Code:
    function ClamAV ($file)
    {
        $out = preg_split('/\n/',`clamscan $file`);
            error_log("Starting - Scanning file:".$file, 0);
            error_log("Starting - Preg Split result:".$out[0], 0);
            
        if (preg_match('/FOUND/s', $out[0], $regs)) {
            $this->status = 'VIRUS: '.$regs[0];
                    error_log("Found Virus!", 0);
                    
            return true;
        } else {
            error_log("No Virus Found.", 0);
            return false;
        }
    }
    Last edited by pete; 28th February 2012 at 01:18 PM.

  22. Thanks to pete from:

    Marci (28th February 2012)

SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Windows Share Web Client Help
    By alunmjones in forum Virtual Learning Platforms
    Replies: 40
    Last Post: 30th June 2011, 05:58 PM
  2. Windows Share Web Client and Moodle 1.9
    By wesleyw in forum Virtual Learning Platforms
    Replies: 16
    Last Post: 20th June 2011, 10:35 AM
  3. Moodle - windows web client (smb)
    By _techie_ in forum Virtual Learning Platforms
    Replies: 7
    Last Post: 5th November 2010, 09:15 AM
  4. Moodle Windows Share Web Client
    By itgeek in forum Virtual Learning Platforms
    Replies: 5
    Last Post: 16th September 2010, 11:48 AM
  5. Moodle & Windows Share Web Client
    By clodhopper in forum Virtual Learning Platforms
    Replies: 1
    Last Post: 12th March 2009, 10:43 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •