The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Apache::ProxyScan - proxy module to integrate content scanners

SYNOPSIS

  # httpd.conf 
  # example for clamav
  PerlTransHandler  Apache::ProxyScan
  PerlSetVar        ProxyScanScanner "/usr/local/bin/clamav.pl"
  PerlSetVar        ProxyScanTempDir /var/cache/virus/dl/
  PerlSetEnv        SCAN_TMP       /var/cache/virus/av/

DESCRIPTION

This module provides the integration of any commandline virus scanning tool into the proxy chain of apache. It works better than cgi solutions because this module uses libwww-perl as it's web client, feeding the response back into the Apache API request_rec structure. For this reason there are no troubles with authentication nor cookie sites.

`PerlHandler' will only be invoked if the request is a proxy request, otherwise, your normal server configuration will handle the request. The normal server configuration will also handle the CONNECT requests if defined for this.

I tested it with clamav, sophos, rav and mcafee.

PARAMETERS

This module is configured with PerlSetVar and PerlSetEnv.

ProxyScanScanner

This is the command executed to scan the downloaded file before delivering. We use standard executables, normally perl.

The only parameter given to the executable is the temporary filename of the file to be tested.

The script must return 0 if the file is clean and tested und the file must not be deleted. If the return code ist not 0 and the file still exists, we assume that the call of the scanner wrapper failed. The file is not deliverd. If the return code ist not 0 and the file is deleted, then the Handler returns the standard output of the wrapper script.

ProxyScanTempDir

This is the directory where LWP::UserAgent downloads the requested files. Make sure that it provides enough space for you surf load.

  PerlSetVar        ProxyScanTempDir /var/cache/virus/dl/

Often the scanner itself have another place where to store their temporary files. Make sure that it provides enough space, too.

PerlSetEnv

The scripts starting the scan processes try to set the path for the temporary files created by the scanner itself.

  PerlSetEnv        SCAN_TMP       /var/cache/virus/av/

EXAMPLES

I need more example configuration for other scanner products. If a file is infected, the scanner should delete it.

In Apache-ProxyScan-X.XX/eg/ are wrapper scripts for several virus scanner. Change

TODO

I need tests and examples for the integration of other content scanner products, free and non free. (Kaspersky, Trendmicro, AntiVir)

SUPPORT

The latest version of this module can be found at CPAN and at http://trancentral.org/code/Apache::ProxyScan/. Send questions and suggestions directly to the author (see below).

SEE ALSO

mod_perl(3), Apache(3), LWP::UserAgent(3)

AUTHOR

Oliver Paukstadt <cpan@trancentral.org>

Based on Apache::ProxyPassThrough from Bjoern Hansen and Doug MacEachern

COPYRIGHT

Copyright (c) 2002-2003 Oliver Paukstadt. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

FORTUNE

DA FORCE COMING DOWN WITH MAYHEM LOOKING AT MY WATCH TIME 3.A.M.