.\" Copyright (c) 2008 by Rhyolite Software, LLC
.\"
.\" This agreement is not applicable to any entity which sells anti-spam
.\" solutions to others or provides an anti-spam solution as part of a
.\" security solution sold to other entities, or to a private network
.\" which employs the DCC or uses data provided by operation of the DCC
.\" but does not provide corresponding data to other users.
.\"
.\" Permission to use, copy, modify, and distribute this software without
.\" changes for any purpose with or without fee is hereby granted, provided
.\" that the above copyright notice and this permission notice appear in all
.\" copies and any distributed versions or copies are either unchanged
.\" or not called anything similar to "DCC" or "Distributed Checksum
.\" Clearinghouse".
.\"
.\" Parties not eligible to receive a license under this agreement can
.\" obtain a commercial license to use DCC by contacting Rhyolite Software
.\" at sales@rhyolite.com.
.\"
.\" A commercial license would be for Distributed Checksum and Reputation
.\" Clearinghouse software.  That software includes additional features.  This
.\" free license for Distributed ChecksumClearinghouse Software does not in any
.\" way grant permision to use Distributed Checksum and Reputation Clearinghouse
.\" software
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND RHYOLITE SOFTWARE, LLC DISCLAIMS ALL
.\" WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RHYOLITE SOFTWARE, LLC
.\" BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\"
.\" Rhyolite Software DCC 1.3.103-1.58 $Revision$
.\"
.Dd February 26, 2009
.ds volume-ds-DCC Distributed Checksum Clearinghouse
.Dt dbclean 8 DCC
.Os " "
.Sh NAME
.Nm dbclean
.Nd Clean Distributed Checksum Clearinghouse Database
.Sh SYNOPSIS
.Bk -words
.Nm dbclean
.Op Fl dfFNPSVq
.Op Fl i Ar id
.Oo
.Fl a Xo
.Sm off
.Op Ar server-addr
.Op Ar ,port
.Xc
.Sm on
.Oc
.Op Fl h Ar homedir
.br
.Op Fl G Ar on
.Op Fl R Ar mode
.Op Fl s Ar hash-size
.Op Fl e Ar seconds
.Op Fl E Ar spamsecs
.br
.Op Fl L Ar ltype,facility.level
.Ek
.Sh DESCRIPTION
.Nm Dbclean
creates empty, rebuilds corrupted, and deletes or expires old reports
of checksums from DCC databases.
It should be installed where it will be found with the path
given the DCC server daemon when the daemon needs to expand the hash table.
See
.Xr dccd 8 .
It should also be run by
.Xr cron 8
approximately daily.
.Pp
If the hash table in the database has been damaged,
.Nm
tries to repair the database.
.Pp
The contents of the
.Pa whitelist
file are built into the DCC server's database.
Changes to the whitelist are not effective until dbclean is run
to expire reports.
White or blacklists can also be used by DCC clients,
and generally work better there.
.Ss OPTIONS
The following options are available:
.Bl -tag -width xxx
.It Fl d
enables debugging output.
Additional
.Fl d
options increase the number of messages.
.It Fl F
uses write() instead of mmap() in some cases to modify the DCC
database.
This works better on some versions of Solaris provided the entire DCC
database fits in RAM and provided the file system has not been tuned
for the large, random accesses of a DCC database.
It is the default on Solaris.
.It Fl f
turns off
.Fl F .
.It Fl N
creates a new, empty database.
There must not be an existing database and the DCC server,
.Xr dccd 8 ,
must not be running.
.It Fl P
expires old checksums from a database using the
.Fl e and
.Fl E
values from the preceding use of
.Nm dbclean .
.Fl P
cannot be used with
.Fl e
or
.Fl E .
Note also that using
.Fl P
differs from not using
.Fl e
or
.Fl E ,
because in the absence of all four, their default values are used.
.It Fl S
says that
the DCC server,
.Xr dccd 8 ,
is not running and so
.Nm
should run stand-alone and not try to tell the DCC server about
changes to the database.
.Fl i
is not needed when
.Fl S
is present.
.It Fl V
displays the version of the DCC database cleaner.
.It Fl q
quiets the announcement of results at the end.
.It Fl i Ar id
specifies the DCC ID recognized by the local DCC server as its own.
This ID allows the DCC server to recognize commands from
.Nm
to stop using the database while it is being cleaned.
.It Fl a Xo
.Sm off
.Op Ar server-addr
.Op Ar ,port
.Xc
.Sm on
is commonly used to specify a UDP port or IP address of the local
server other than the default.
.It Fl h Ar homedir
overrides the default DCC home directory,
.Pa @prefix@ .
.It Fl G Ar on
cleans a greylist database.
.It Fl R Ar mode
repairs a database or does a quick cleaning.
.Ar Mode
must be one of the following:
.Bl -tag -width quick -compact
.It Em bad
to repair a broken database.
.It Em quick
for a quick, superficial cleaning during the day.
.It Em hash
to rebuild a hash not sent to disk before the system was recently restarted.
.It Em cron
for the nightly cleaning by the
.Xr cron 8
job
.Pa @libexecdir@/cron-dccd
.It Em del
to finish processing a delete command received by
.Xr dccd 8 .
.El
.It Fl s Ar hash-size
specifies a size for the hash table.
By default the hash table is rebuilt to be approximately 80% full based
on an estimate of the number of distinct checksums in the main file.
.It Fl e Ar seconds
specifies that reports older than
.Ar seconds
and with totals below 10 targets should be deleted.
Reports older than
.Ar seconds
of checksums that have been reported more recently
are summarized in the database.
The default value is 1DAY or the value of
.Fl E ,
whichever is smaller.
The 1 day default is reduced if the system does not appear to have
enough RAM to hold the database.
The minimum is 1 hour.
.Ar Seconds
can also be
.Ar NEVER
or a number of hours, days, or weeks followed by
.Ar HOURS ,
.Ar H ,
.Ar DAYS ,
.Ar D ,
.Ar WEEKS
or
.Ar W .
.Pp
DCC servers that are not very busy and are
isolated or do not receive "floods" of checksums
from busy servers should use longer values
to increase their chances of recognizing bulk mail.
.It Fl E Ar spamsecs
changes the expiration of checksums with more than 10 targets
from the default of 30DAYS or the explicit value of
.Fl e ,
whichever is larger.
The default is reduced if the system does not have enough RAM
to hold the database.
.Ar Spamsecs
can also be
.Ar NEVER
or a number of hours, days, or weeks followed by
.Ar HOURS ,
.Ar H ,
.Ar DAYS ,
.Ar D ,
.Ar WEEKS
or
.Ar W .
.It Fl L Ar ltype,facility.level
specifies how messages should be logged.
.Ar Ltype
must be
.Ar error ,
.Ar info ,
or
.Ar off
to indicate which of the two types of messages are being controlled or
to turn off all
.Xr syslog 3
messages from
.Nm .
.Ar Level
must be a
.Xr syslog 3
level among
.Ar EMERG ,
.Ar ALERT ,
.Ar CRIT , ERR ,
.Ar WARNING ,
.Ar NOTICE ,
.Ar INFO ,
and
.Ar DEBUG .
.Ar Facility
must be among
.Ar AUTH ,
.Ar AUTHPRIV ,
.Ar CRON ,
.Ar DAEMON ,
.Ar FTP ,
.Ar KERN ,
.Ar LPR ,
.Ar MAIL ,
.Ar NEWS ,
.Ar USER ,
.Ar UUCP ,
and
.Ar LOCAL0
through
.Ar LOCAL7 .
The default is equivalent to
.Dl Fl L Ar info,MAIL.NOTICE  Fl L Ar error,MAIL.ERR
.El
.Pp
.Nm
exits 0 on success,
and > 0 if an error occurs.
.Sh FILES
.Bl -tag -width grey_db.hash -compact
.It Pa @prefix@
is the DCC home directory containing data and control files.
.It Pa dcc_db
is the main file containing mail checksums.
.It Pa dcc_db.hash
mail checksum database hash table.
.It Pa grey_db
is the database of greylist checksums.
.It Pa grey_db.hash
is the greylist database hash table.
.It Pa dcc_db-new , dcc_db-new.hash , grey_db-new , grey_db-new.hash
new database and hash files until they are renamed.
.It Pa dcc_db-old , grey_db-old
previous database files.
.It Pa ids
list of IDs and passwords, as described in
.Xr dccd 8 .
.It Pa whitelist
contains the DCC server whitelist in
the format described in
.Xr dcc 8 .
.It Pa grey_whitelist
contains the greylist server whitelist.
.El
.Sh SEE ALSO
.Xr cdcc 8 ,
.Xr cron 8 ,
.Xr dcc 8 ,
.Xr dccd 8 ,
.Xr dblist 8 ,
.Xr dccifd 8 ,
.Xr dccm 8 ,
.Xr dccproc 8 .
.Sh HISTORY
Implementation of
.Nm
was started at Rhyolite Software, in 2000.
This document describes version 1.3.103.
