dccifd(8) DCC -- Distributed Checksum Clearinghouse dccifd(8)
dccifd - Distributed Checksum Clearinghouse Program Interface
dccifd [-VdbxANQG] [-h homedir] [-p /sock/name | lhost,lport,rhost/bits]
[-m map] [-w whiteclnt] [-U userdirs]
[-t type,[log-thold,]rej-thold]
[-g [not-]type] [-S header] [-l logdir] [-R rundir] [-T tmpdir]
[-j maxjobs] [-L ltype,facility.level]
Dccifd is a daemon built intended to connect spam filters such as SpamAs-
sasin and mail transfer agents (MTAs) other than sendmail to DCC servers.
The MTA or filter dccifd which in turn reports related checksums to the
nearest DCC server. DCCIFD then adds an X-DCC SMTP header line to the
message. The MTA is told to reject the message if it is unsolicited
bulk.
Dccifd is similar to the DCC sendmail milter interface, dccm(8) and the
DCC Procmail interface, dccproc(8). dccifd is more efficient than dc-
cproc but not restricted to use with sendmail. All three send reports of
checksums related to mail received by DCC clients and queries about the
total number of reports of particular checksums.
MTA programs use a simple ASCII protocol to send a mail message including
its SMTP envelope to the daemon. Dccifd responds with an indication of
whether the message is unsolicited bulk and an optional copy of the mes-
sage with an X-DCC header added. The protocol is described below and in
the include/dccif.h file in the DCC source. There is a sample C inter-
face routine in the dcclib/dccif.c file in the DCC source and the
dcclib.a library generated from the source. A Perl version of the inter-
face routine is in dccifd/dccif.pl. Test or demonstration programs in the
style of dccproc(8) that use those interface routines are in
dccifd/dccif-test.
Since the checksums of messages that are white listed locally by the -w
whiteclnt file are not reported to the DCC server, dccifd knows nothing
about the total recipient counts for their checksums and so cannot add X-
DCC header lines to such messages.
The list of servers that dccifd contacts is in a memory mapped file
shared by local DCC clients. The file is maintained with cdcc(8). Turn
on the daemon and put its parameters in the dcc_conf. Start the daemon
with the start-dccifd script.
OPTIONS
The following options are available:
-V displays the version of the DCC program interface.
-d enables debugging output from the DCC client library. Additional -d
options increase the number of messages. A single -d causes aborted
SMTP transactions to be logged.
-b causes the daemon to not detach itself from the controlling tty and
put itself into the background.
-x causes the daemon to try "extra hard" to contact a DCC server.
Since it is usually more important to deliver mail than to report
its checksums, dccifd normally does not delay too long while trying
to contact a DCC server. It will not try again for several seconds
after a failure.
-A adds to existing X-DCC headers in the message instead of replacing
existing headers of the brand of the current server.
-N neither adds, deletes, nor replaces existing X-DCC headers in the
message. Each message is logged, rejected, and otherwise handled
the same.
-Q only queries the DCC server about the checksums of messages instead
of reporting and querying. This is useful when dccifd is used to
filter mail that has already been reported to a DCC server by anoth-
er DCC client. This can also be useful when applying a private
white or black list to mail that has already been reported to a DCC
server. No single mail message should be reported to a DCC server
more than once per recipient, because each report will increase the
apparent "bulkness" of the message.
-G enables greylisting. A work greylist server must be named in the map
file in the DCC home directory. See dccd(8).
-W makes recipient addresses almost white-listed by default to ease
managing systems where only a minority of users want unsolicited
bulk mail to be rejected or discarded. This kludge of a feature is
useful when addresses should by default not be protected against
spam with the DCC. The idea is that the destination addresses of
participating users are listed with OK2" and non-participants are
not listed or listed with "OK".
Messages sent to target addresses that are listed in the -w
whiteclnt file with "OK" are not reported to the DCC server.
Messages sent only to target addresses that are not listed are de-
livered. The DCC server is queried and the X-DCC header is added
but the message is delivered regardless of target counts and thresh-
olds.
Target addresses listed with "OK2" in the whiteclnt file are treated
neutrally or as if they were not listed and the -W option were not
specified. Mail is delivered, rejected, or discarded to addresses
listed with "OK2" as controlled by target counts, thresholds, and
the -a value.
See also the discussion of -w.
-h homedir
overrides the default DCC home directory, which is often /var/lib/dcc.
-p /sock/name | lhost,lport,rhost/bits
overrides the default address at which programs contact dccifd. The
default is a UNIX domain socket named dccifd in the DCC home direc-
tory.
The second form specifies a local host name or IP address, a local
TCP port number, and the host names or IP addresses of computers
that can use dccifd. 127.0.0.1 or localhost are common choices for
lhost. The special string @ specifies IN_ADDRANY or all local IP ad-
dresses. 127.0.0.0/8 is a common choice for rhost/bits.
-m map
specifies a name or path of the memory mapped parameter file instead
of the default map in the DCC home directory. It should be created
with the cdcc(8) command.
-w whiteclnt
specifies an optional file containing SMTP client IP addresses, SMTP
envelope values, and header values of mail that is not spam, does
not need a X-DCC header, and whose checksums should not be reported
to the DCC server. Local whitelist env_To values are handy for
white-listing or exempting destination addresses such as Postmaster
from filtering and for blacklisting or marking addresses that should
never receive mail. Mail sent to blacklisted addresses or with oth-
er blacklisted values such as From or env_From values is reported to
the DCC server as spam or with target counts of millions.
If the pathname whiteclnt is not absolute, it is relative to the DCC
home directory. The format of the dccifd whiteclnt file is the same
as the whitelist files used by dbclean(8) and the whiteclnt file
used by dccproc(8). See dcc(8) for a description of DCC white and
blacklists. Because the contents of the whiteclnt file are used
frequently, a companion file is automatically created and main-
tained. It has the same pathname but with an added suffix of .dccw
and contains a memory mapped hash table of the main file.
A local whitelist entry ("OK") or two or more semi-white listings
("OK2") for one of the message's checksums prevents all of the mes-
sage's checksums from being reported to the DCC server and the addi-
tion of a X-DCC header line by dccifd (except for env_To checksums
or when -W is used). A local white listing entry for a checksum al-
so prevents rejecting or discarding the message based on DCC recipi-
ent counts as specified by -a and -t. Otherwise, one or more check-
sums with blacklisting entries ("MANY") cause all of the message's
checksums to be reported to the server with an addressee count of
"MANY".
If the message has a single recipient, an env_To local whiteclnt en-
try of "OK" for the checksum of its recipient address acts like any
other whiteclnt entry of "OK." When the SMTP message has more than
one recipient, the effects can be complicated. When a message has
several recipients with some but not all listed in the whiteclnt
file, dccifd tries comply with the wishes of the users who want fil-
tering as well as those who don't by silently not delivering the
message to those who want filtering (i.e. are not white-listed) and
delivering the message to don't want filtering.
Consider the -W option for implicitly or by default white-listing
env_to values.
-U userdirs
enables private white lists and log files. Each target of a message
can have a directory of log files named userdirs/addr/log where addr
is the local user or mailbox name computed by the MTA. The name of
each user's log directory must be log. If it is not absolute,
userdirs is relative to the DCC home directory. The sub-directory
prefixes for -l logdir are not honored. The directory containing
the log files must be named log and it must be writable by the dc-
cifd process. Each log directory must exist or logging for the cor-
responding is silently disabled. The files created in the log di-
rectory are owned by the UID of the dccifd process, but they have
group and other read and write permissions copied from the corre-
sponding log directory. To ensure the privacy of mail, it may be
good to make the directories readable only by owner and group, and
to use a cron script that changes the owner of each file to match
the grandparent addr directory.
There can also be a white list named userdirs/addr/whiteclnt for
each address addr. The name of the file must be whiteclnt. Any
checksum that is not white- or blacklisted by an individual ad-
dressee's white list is checked in the -w -whiteclnt list. A miss-
ing per-address whiteclnt file is the same as an empty file. Rela-
tive paths for white lists included in per-address files are re-
solved in the DCC home directory. The whiteclnt files and the addr
directories containing them must be writable by the dccifd process.
-t type,[log-thold,]rej-thold
sets logging and "spam" thresholds for checksum type. The checksum
types are IP, env_From, From, Message-ID, Received, Body, Fuz1, and
Fuz2. The string ALL sets thresholds for all types, but is unlikely
to be useful except for setting logging thresholds. The string CMN
specifies the commonly used checksums Body, Fuz1, and Fuz2. Rej-
thold and log-thold must be numbers, the string NEVER, or the string
MANY indicating millions of targets. Counts from the DCC server as
large as the threshold for any single type are taken as sufficient
evidence that the message should be logged or rejected.
Log-thold is the threshold at which messages are logged. It can be
handy to log messages at a lower threshold to find solicited bulk
mail sources such as mailing lists. If no logging threshold is set,
only rejected mail and messages with complicated combinations of
white and blacklisting are logged. Messages that reach at least one
of their rejection thresholds are logged regardless of logging
thresholds.
Rej-thold is the threshold at which messages are considered "bulk,"
and so should be rejected or discard if not white-listed. Use -a
REJECT or -a Discard to reject or discard bulk mail that is not
white-listed. Use -a IGNORE to only add X-DCC headers with the
"bulk" string.
The checksums of locally white-listed messages are not checked with
the DCC server and so only the number of targets of the current in-
stance of a white-listed message are compared against the thresh-
olds.
The default is -t ALL,NEVER, so that nothing is discarded or logged.
A common choice is -t CMN,25,50 to reject or discard mail with com-
mon bodies except as overridden by the white list of the DCC server
and local -o, -s, -g, and -w.
-g [not-]type
indicates that white-listed or OK or OK2 "counts" from the DCC serv-
er for a type of checksum are to be believed. They should be ig-
nored if prefixed with not-. Type is one of the same set of strings
as for -t. Only IP, env_From, and From are likely choices. By de-
fault all three are honored, and hence the need for not-.
-S hdr
adds to the list of substitute or locally chosen headers that are
checked with the -w whiteclnt file and sent to the DCC server. The
checksum of the last header of type hdr found in the message is
checked. Hdr can be HELO to specify the SMTP envelope HELO value.
Hdr can also be mail_host to specify the host name from the
Mail_from value in the SMTP envelope. As many as 6 different sub-
stitute headers can be specified, but only the checksum of the first
of the 6 will be sent to the DCC server.
-l logdir
specifies a directory in which files containing copies of messages
processed by dccifd are kept. All messages logged are copied to the
-l logdir directory. They can also be copied to per-user directo-
ries specified with -U. Information about other recipients of a mes-
sage is deleted from the per-user copies.
If logdir starts with D?, log files are put into subdirectories of
the form logdir/JJJ where JJJ is the current julian day. H?logdir
puts logs files into subdirectories of the form logdir/JJJ/HH where
HH is the current hour. M?logdir puts log files into subdirectories
of the form logdir/JJJ/HH/MM where MM is the current minute. See
the FILES section below concerning the contents of the files.
The directory is relative to the DCC home directory if it is not ab-
solute
-R rundir
specifies the "run" directory where the UNIX domain socket and file
containing the daemon's process ID are stored. The default value is
often /var/run/dcc.
-T tmpdir
changes the default directory for temporary files from the default.
The default is the directory specified with -l or the system default
if there -l is not used. The system default is often /tmp.
-j maxjobs
limits the number of simultaneous requests that will be processed.
-L ltype,facility.level
specifies how messages should be logged. Ltype must be error or
info to indicate which of the two types of messages are being con-
trolled. Level must be a syslog(3) level among EMERG, ALERT, CRIT,
ERR, WARNING, NOTICE, INFO, and DEBUG. Facility must be among AUTH,
AUTHPRIV, CRON, DAEMON, FTP, KERN, LPR, MAIL, NEWS USER, UUCP, and
LOCAL0 through LOCAL7. The default is equivalent to
-L info,MAIL.NOTICE -L error,MAIL.ERR
Protocol
Dccifd uses a simple ASCII protocol to receive mail messages to be
checked and to return results. For each message, the MTA must open a TCP
connection to the interface daemon, send options, envelope recipients,
and the message, receive the results, and close the TCP connection.
Each of the following lines are sent in order to the daemon. Each ends
with a newline ('\n') character.
options zero or more blank-separated strings among:
spam the message is known to be spam
body all of the headers with added X-DCC header line
and body should be returned
header the X-DCC header should be returned
client IP address of the SMTP client in a "dotted" or "coloned"
ASCII string and reverse-DNS host name. If the host name
is present, it must follow a carriage return character
('\r') after the IP address. The client IP address must be
present or non-null if the host name is.
HELO SMTP HELO value or nothing, followed by a newline charac-
ter.
sender or SMTP Mail From command value
recipients or SMTP Rcpt To values followed by the the corresponding
local user names, one pair to a line. Each optional local
user name is separated from the corresponding recipient ad-
dress by a carriage return ('\r'). A local user name can
be null if it is not known. Recipients that lack local us-
er names will lack per-user log files and will not invoke a
per-user white-list.
The last recipient-user name pair is followed by an empty line and the
headers and body of the message. The end of the body of the mail message
is signalled by the MTA half-closing the TCP connection. See
shutdown(2).
Dccifd responds with three things. First is a one character line of the
overall result advising the MTA to
A accept the message for all recipients and answer the SMTP DATA
command with a 2yz result.
G answer with a 4yz result to embargo the message for greylisting.
R reject the message and answer the DATA command with a 5yz result.
S accept the message for some recipients and so answer the DATA com-
mand with a 2yz result.
T temporary failure by the DCC system and answer with a 4yz result.
Second is a line of 'A', 'G', and 'R' characters indicating that the mes-
sage should be accepted and delivered or discarded for each corresponding
recipient. Limitations in the SMTP protocol allows only a single result
for the DATA command for all recipients that were not rejected before
body of the message was offered with the DATA command. To accept the
message for some recipients and reject it for others, the MTA must tell
the SMTP client it is accepting the message for all recipients and then
discard it for those that would reject it.
Finally, if the body or header strings in the first line of options sent
by the MTA to the daemon, then the X-DCC header line or the entire body
with the X-DCC header line follows.
/var/lib/dcc is the DCC home directory in which other files are found.
libexec/start-dccifd
is a script often used to the daemon.
dcc/dcc_conf
contains parameters used by the scripts to start DCC daemons
and cron jobs.
logdir is an optional directory specified with -l and containing
marked mail. Each file in the directory contains one mes-
sage, at least one of whose checksums reached its -t thresh-
olds or that is interesting for some other reason. Each file
starts with lines containing the date when the message was
received, the IP address of the SMTP client, and SMTP enve-
lope values. Those lines are followed by the body of the
SMTP message including its header as it was received. Only
approximately the first 32 KBytes of the body are recorded.
The checksums for the message follow the body. They are fol-
lowed by lines indicate that one of the checksums is white-
or blacklisted by the -w whiteclnt file. Each file ends with
the X-DCC header line added to the message and the disposi-
tion of the message.
map is the memory mapped file of information concerning DCC
servers in the DCC home directory.
whiteclnt contains the client white list in the format described in
dcc(8).
whiteclnt.dccw
is a memory mapped hash table of the whiteclnt file.
dccifd.pid in the -R rundir directory contains daemon's process ID.
cdcc(8), dbclean(8), dcc(8), dccd(8), dblist(8), dccm(8),
dccproc(8), dccsight(8),
Implementation of dccifd was started at Rhyolite Software in 2002. This
describes version 1.2.7.
dccifd uses -t where dccproc(8) uses -c.
Systems without setrlimit(2) and getrlimit(2) can have problems with the
default limit on the number of simultaneous jobs, the value of -j. Every
job requires four open files. These problems are usually seen with er-
rors messages that say something like
dccifd[24448]: DCC: accept() returned invalid socket
A fix is to use a smaller value for -j or to allow dccifd to open more
files.
September 14, 2003 7
Man(1) output converted with
man2html
modified for the DCC $Date 2001/04/29 03:22:18 $