qmail-vscan

Section: User Commands (1)
Index Return to Main Contents
 

NAME

qmail-vscan - test message for virus  

SYNOPSIS

Can be invoked by qmail-qfilter or qmail-local.

qmail-vscan [-hrcf] [-m message] [-s /path/to/socket ] [ -e /path/to/program ]

 

DESCRIPTION

If the environment variable QMAILVSCAN is set and equal to "1", qmail-vscan will test the message on stdin for viruses. stdin must be a seekable file.

qmail-vscan can talk directly to clamav or trophie/sophie engines, or can invoke an external program to do the scanning.

qmail-vscan can pass a file descriptor to the scan engine to reduce disk IO.

-h
Adds a X-Virus header to the message if a virus is detected. The value of the field is the virus name returned by the scan engine. An existing header is removed.

-r
Reject the message if a virus is detected.

-f
Use file descriptor passing.

-c
Use clamav style communications with the socket.

-m message
If rejected, the string message is used in the SMTP reject response. Default is the standard qmail reject response, "554 mail server permanently rejected message (#5.3.0)". If message is prefixed with env:, the rest of the string is treated as the name of an environment variable that contains the reject response.

-s /path/to/socket
The socket used to communicate with the scan engine. If not supplied, the default value is /var/run/trophie.

-e /path/to/program
The program is executed with an argument which is the name of the temporary file that holds the message, or if -f has been specified, with the argument "-". If the program returns non-zero, the message is classified as a virus. The program may optionally write the name of the virus to stdout.

The text of the reject message will undergo variable substitution before being sent to the client. Variable substitution is performed where a $ is followed by a variable name. A variable name is composed of up to 32 uppercase alphanumeric characters and is optionally enclosed in curly braces.

If not overridden by an environment variable, the following variables names are handled internally:

ME The contents of the file control/me

DATE The current date. If the variable DATEFMT is found in the environment, the value will be used by strftime(1) in formatting the value of DATE, otherwise the RFC2822 date format will be used.

PID The current process ID.

RANDOM A random number.

SECONDS Unix epoch.

VIRUS The name of the virus returned by the scan engine.

 

USAGE

With qmail-qfilter:

#!/bin/bash

export VMSG='Message rejected; $VIRUS detected (#5.3.0)'
/path/to/qmail-qfilter \
        /path/to/qmail-vscan -f -r -m env:VMSG -s /var/run/clamav/clamd.sock
        

As a delivery instruction for qmail-local:


|/path/to/qmail-vscan -h -c -s /var/run/clamav/clamd.sock > /dev/null


 

Index

NAME
SYNOPSIS
DESCRIPTION
USAGE

This document was created by man2html, using the manual pages.
Time: 09:36:57 GMT, May 04, 2005