| clamsmtpd(8) | System Manager's Manual | clamsmtpd(8) |
NAME¶
clamsmtpd—an SMTP
server for scanning viruses via clamd
SYNOPSIS¶
clamsmtpd |
[-dlevel][-fconfigfile][-ppidfile] |
clamsmtpd |
-v |
DESCRIPTION¶
clamsmtpdis an SMTP filter that allows you
to check for viruses using the ClamAVanti-virus software. It accepts SMTP
connections and forwards the SMTP commandsand responses to another SMTP
server.
The DATA email body is intercepted and scanned before forwarding. By default emailwith viruses are dropped silently and logged without any additional action taken.
clamsmtpdaims to be lightweight and simple
rather than have a myriad of options. The optionsit does have are configured
by editing theclamsmtpd.conf(5)file. See the man page
forclamsmtpd.conf(5)for more info on the default location
of the configuration file.
OPTIONS¶
Previous versions had more options. These still work for now but have equivalents inclamsmtpd.conf(5)and are not documented here. The options are as follows.
-d- Don't detach from the console and run as a daemon. In addition thelevelargument specifies what level of error messages to display. 0 beingthe least, 4 the most.
-f- configfilespecifies an alternate location for
the
clamsmtpdconfiguration file. Seeclamsmtpd.conf(5)for more details on where the configuration file is located by default. -p- pidfilespecifies a location for the a process id
file to be written to. This filecontains the process id
of
clamsmtpdand can be used to stop the daemon. -v- Prints the clamsmtp version number and exits.
LOGGING¶
clamsmtpdlogs
tosyslogdby default under the 'mail' facility. You can
also output logs to the consoleusing
the-doption.
LOOPBACK FEATURE¶
In some cases it's advantageous to consolidate the virus scanning
and filteringfor several mail servers on one
machine.clamsmtpdallows this by providing a loopback
feature to connect back to the IP that anSMTP connection comes in from.
To use this feature specify only a port number (no IP address) for
theOutAddresssetting in the configuration file. This
will causeclamsmtpdto pass the email back to the
said port on the incoming IP address.
Make sure theMaxConnectionssetting is set high enough to handle the mail from all the servers without refusingconnections.
TRANSPARENT PROXY FEATURE¶
A transparent proxy is a configuration on a gateway that routes
certain types oftraffic through a proxy server without any changes on the
client computers.clamsmtpdhas support for
transparent proxying of SMTP traffic by enabling
theTransparentProxysetting. This type of setup usually
involves firewall rules which redirect traffic
toclamsmtpdand the setup varies from OS to OS. The
SMTP traffic will be forwarded to it'soriginal destination after being
scanned.
When doing transparent proxying for outgoing email it's probably a good idea toturn on bounce notifications using theAction:bouncesetting. Also note that some features (such as SSL/TLS) will not be availablewhen going through the transparent proxy.
Make sure that theMaxConnectionssetting is
set high enough for your transparent proxying.
Becauseclamsmtpdis not being used as a filter inside
a queue, which usually throttles the amountof email going through, this
setting may need to be higher than usual.
VIRUS ACTIONS¶
Using theVirusActionoption you can run a script or program whenever a virus is found. This maybe handy in certain circumstances but it has several drawbacks. For one, theperformance of the virus filtering will take a hit, perhaps DOS'ing yourmachine under heavy load. Secondly as with running any program there aresecurity implications to be considered.
Please consider the above carefully before implementing a virus action.
The script is run without its output being logged, or return value beingchecked. Because of this you should test it thoroughly. Make sure it runswithout problems under the user thatclamsmtpd(8)is being run as.
Various environment variables will be present when your script is run. Youmay need to escape them properly before use in your favorite scriptinglanguage. Failure to do this could lead to a REMOTE COMPROMISE of yourmachine.
- CLIENT
- The network address of the SMTP client connected.
- When theQuarantineoption is enabled, this specifies the file that the virus was saved to.
- RECIPIENTS
- The email addresses of the email recipients. These are specified one perline, in standard address format.
- REMOTE
- If
clamsmtpdis being used to filter email between SMTP servers, then this is theIP address of the original client. In order for this information to be present(a) the SMTP client (sending server) must an send an XFORWARD command and (b)the SMTP server (receiving server) must accept that XFORWARD command withouterror. - REMOTE_HELO
- If
clamsmtpdis being used to filter email between SMTP servers, then this is theHELO/EHLO banner of the original client. In order for this information to be present(a) the SMTP client (sending server) must an send an XFORWARD command and (b)the SMTP server (receiving server) must accept that XFORWARD command withouterror. - SENDER
- The email address for the sender of the email.
- SERVER
- The network address of the SMTP server we're connected to.
- TMPDIR
- The path to the temp directory in use. This is the same as theTempDirectoryoption.
- VIRUS
- The name of the virus found.
SECURITY¶
There's no reason to run this daemon as root. It is meant as a filter and shouldlisten on a high TCP port. It's probably a good idea to run it using the sameuser as theclamd(8)daemon. This way the temporary files it writes are accessible toclamd(8)
Care should be taken with the directory
thatclamsmtpdwrites its temporary files to. In order
to be secure, it should not be a worldwriteable location. Specify the
directory using theTempDirectorysetting.
When using theVirusActionoption make sure you understand the security issues involved. Unescapedenvironment variables can lead to execution of arbitrary shell commandson your machine.
If runningclamsmtpdon a publicly
accessible IP address or without a firewall please be sure tounderstand all
the possible security issues. This is especially true if theloopback feature
is used (see above).
SEE ALSO¶
AUTHOR¶
Stef Walter⟨stef@memberwebs.com⟩
| September, 2004 | clamsmtp |