mod_clamav  0.14rc2
About: mod_clamav is a ProFTPD module using ClamAV to enable immediate virus scanning of newly uploaded files.
  Fossies Dox: mod_clamav-0.14rc2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Loading...
Searching...
No Matches
mod_clamav Documentation

Some Fossies usage hints in advance:

  1. To see the Doxygen generated documentation please click on one of the items in the steelblue colored "quick index" bar above or use the side panel at the left which displays a hierarchical tree-like index structure and is adjustable in width.
  2. If you want to search for something by keyword rather than browse for it you can use the client side search facility (using Javascript and DHTML) that provides live searching, i.e. the search results are presented and adapted as you type in the Search input field at the top right.
  3. Doxygen doesn't incorporate all member files but just a definable subset (basically the main project source code files that are written in a supported language). So to search and browse all member files you may visit the Fossies mod_clamav-0.14rc2.tar.gz contents page and use the Fossies standard member browsing features (also with source code highlighting and additionally with optional code folding).
README.md

ProFTPD module mod_clamav

The mod_clamav module is designed to prevent the upload of viruses, trojans, and many more questionable items from even being uploaded.

Additional information may be found at the following URL:

http://www.thrallingpenguin.com/resources/mod_clamav.htm

Author

Please contact Joseph Benden (joe at thrallingpenguin.com) with any questions, concerns, or suggesstions regarding this module.

Directives

  • ClamAV
  • ClamFailsafe
  • ClamServer
  • ClamPort
  • ClamStream
  • ClamMinSize
  • ClamMaxSize

  • ClamAV
  • syntax: ClamAV on
  • default: none
  • context: all
  • module: mod_clamav
  • compatibility: 1.3.2

The ClamAV directive will configure if the Mod_Clamav's virus scanning and virus removal features are active. If no ClamAV directive is configured, then the module will do no virus scanning.

  • ClamFailsafe
  • syntax: ClamFailsafe boolean
  • default: false
  • context: all
  • module: mod_clamav
  • compatibility: 0.13rc2

The ClamFailsafe directive will configure if Mod_Clamav's inability to scan a file, for any reason, will cause the failure of the file to upload. If no ClamFailsafe directive is configured, then the module will accept files that may not have been completely scanned by Clamd.

  • ClamServer
  • syntax: ClamServer hostname/ip
  • default: none
  • context: server config,virtualhost,global,directory
  • module: mod_clamav
  • compatibility: 0.6 of mod_clamav

The ClamServer directive will configure the hostname/IP address used to connect to the Clamd daemon process. If no ClamServer directive is configured, then the module will do no TCP Clamd scanning.

Please see the ClamStream directive if using a different host for Clamd than the ProFTPd server.

  • ClamPort
  • syntax: ClamPort integer
  • default: 3310
  • context: server config,virtualhost,global,directory
  • module: mod_clamav
  • compatibility: 0.6 of mod_clamav

The ClamPort directive will configure the TCP port used to connect to the Clamd daemon process. If no ClamPort directive is configured, then the module will use the Clamd default TCP port of 3310.

  • ClamStream
  • syntax: ClamStream boolean
  • default: off
  • context: server config,virtualhost,global,directory
  • module: mod_clamav
  • compatibility: 0.13rc3

The ClamStream directive will enable the streaming of the uploaded file contents to the Clamd server using the INSTREAM protocol. This directive should be used when the Clamd server is on a different host than the ProFTPd server. If no ClamStream directive is configured, then the module will use the SCAN Clamd protocol.

  • ClamMinSize
  • syntax: ClamMinSize integer [units]
  • default: 0
  • context: server config,virtualhost,global,directory
  • module: mod_clamav
  • compatibility: 0.10 of mod_clamav

The ClamMinSize directive will configure the minimum file size for scanning. If the file size is smaller than this value, then the module will do no scanning.

The given integer (may be an unsigned long) is the number of bytes for the directive, and is followed by a units specifier of (case-insensitive) "Gb" (Gigabytes), "Mb" (Megabytes), "Kb" (Kilobytes), or "B" (Bytes). The given integer of bytes is multiplied by the appropriate factor. A value of zero (0) disables this directive.

  • ClamMaxSize
  • syntax: ClamMaxSize integer [units]
  • default: 0
  • context: server config,virtualhost,global,directory
  • module: mod_clamav
  • compatibility: 0.10 of mod_clamav

The ClamMaxSize directive will configure the maximum file size for scanning. If the file size is larger than this value, then the module will do no scanning.

The given integer (may be an unsigned long) is the number of bytes for the directive, and is followed by a units specifier of (case-insensitive) "Gb" (Gigabytes), "Mb" (Megabytes), "Kb" (Kilobytes), or "B" (Bytes). The given integer of bytes is multiplied by the appropriate factor. A value of zero (0) disables this directive.

Installation

To install mod_clamav, copy the mod_clamav.[ch] files into:

proftpd-dir/contrib/

after unpacking the proftpd source code. For including mod_clamav as a statically linked module:

./configure --with-modules=mod_clamav

To build mod_clamav as a DSO module

./configure --enable-dso --with-shared=mod_clamav

Then follow the usual steps:

make
make install

For those with an existing ProFTPD installation, you can use the prxs tool to add mod_clamav, as a DSO module, to your existing serverL

prxs -c -i -d mod_clamav.c

Example Configuration

Tip: Enable HiddenStore for virus scanning to take place in the background.

<IfModule mod_clamav.c>
   ClamAV on
   ClamServer localhost
   ClamPort 3310
</IfModule>

Running the unit-tests

It is important to run the unit-tests when contributing enhancements or bug fixes to mod_clamav. In this section, we will cover all important dependencies to run the basic unit-tests of both the mod_clamav module and general ProFTPD specific tests.

Please be certain to include one or more working unit-tests with your patch or merge request, for mod_clamav. Doing so will dramatically improve the time-to-accept your patch or merge request.

Prerequisites

Dependencies

  • Perl (a complete working Perl environment), with the following modules installed and working: ** Getopt::Long ** Test::Unit ** Test::Harness
  • ProFTPD source tree. ** mod_clamav module must be present in source tree. ** Ensure source tree compiles completely before attempting to run unit-tests.
  • ClamAV scanner daemon (called: Clamd) ** Must NOT be running whilst unit-testing ** Local system TCP ports for both ClamAV scanner and ProFTPD must successfully allocate and not be firewalled. If you run in to connection error issues whilst testing, this may be the cause for the unit-tests to fail.

Patching the ProFTPD unit-test framework

$ cd /path/to/proftpd/source
$ patch -p0 < /path/to/mod_clamav/source/001-add-mod_clamav-to-tests.patch

Running ProFTPD Unit-Tests

mod_clamav specific unit-tests

$ cd /path/to/proftpd/source
$ cd tests

Then run one of the following commands. The first one will output simple information to quickly determine if any of the tests fail; where as the second one outputs verbose debugging information.

$ sudo perl t/modules/mod_clamav.t

OR

$ sudo env TEST_VERBOSE=1 perl t/modules/mod_clamav.t

ProFTPD module specific unit-tests

$ cd /path/to/proftpd/source
$ cd tests
$ sudo perl tests.pl --file-pattern '^t\/modules\/'

All ProFTPD unit-tests

$ cd /path/to/proftpd/source
$ make check