# HG changeset patch # User Peter Gervai # Date 1236689398 -3600 # Node ID c7f6b056b673360ceb58585b32fa1e7b8bbdd1b6 First import of vendor version diff -r 000000000000 -r c7f6b056b673 .config --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.config Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,6 @@ +./Makefile ./Makefile.inc ./Makefile.inc2 ./cdcc/Makefile ./cgi-bin/Makefile ./cgi-bin/chgpasswd ./cgi-bin/common ./cgi-bin/edit-whiteclnt ./cgi-bin/list-log ./cgi-bin/list-msg ./cgi-bin/webuser-notify ./dbclean/Makefile ./dblist/Makefile ./dccd/Makefile ./dccd/dump-clients/Makefile ./dccifd/Makefile ./dccifd/dccif-test/Makefile ./dccifd/dccif.pl ./dcclib/Makefile ./dccm/Makefile ./dccproc/Makefile ./dccsight/Makefile ./dns-helper/Makefile ./gmake.inc ./homedir/Makefile ./homedir/dcc_conf ./include/kludge.h ./misc/Makefile ./misc/cron-dccd ./misc/crontab ./misc/dcc-stats-collect ./misc/dcc-stats-graph ./misc/dcc-stats-init ./misc/dcc.m4 ./misc/fetch-testmsg-whitelist ./misc/fetchblack ./misc/fetchids ./misc/list-clients ./misc/newwebuser ./misc/rcDCC ./misc/start-dccd ./misc/start-dccifd ./misc/start-dccm ./misc/start-grey ./misc/stats-get ./misc/stop-dccd ./misc/uninstalldcc ./misc/updatedcc ./rrd-combine/Makefile ./srvrlib/Makefile ./thrlib/Makefile ./cdcc.8 ./dbclean.8 ./dblist.8 ./dcc.8 ./dccd.8 ./dccifd.8 ./dccm.8 ./dccproc.8 ./dccsight.8 ./FAQ.html ./INSTALL.html ./cdcc.html ./dbclean.html ./dblist.html ./dcc.html ./dccd.html ./dccifd.html ./dccm.html ./dccproc.html ./dccsight.html +config.log +confdefs.h +config.cache +config.status +ck2ip diff -r 000000000000 -r c7f6b056b673 .manifest --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.manifest Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,43 @@ +.config +CHANGES +FAQ.html.in +INSTALL.html.in +LICENSE +Makefile.in +Makefile.inc.in +Makefile.inc2.in +RESTRICTIONS +cdcc.0 +cdcc.8.in +cdcc.html.in +configure +dbclean.0 +dbclean.8.in +dbclean.html.in +dblist.0 +dblist.8.in +dblist.html.in +dcc.0 +dcc.8.in +dcc.html.in +dcc.ide +dccd.0 +dccd.8.in +dccd.html.in +dccifd.0 +dccifd.8.in +dccifd.html.in +dccm.0 +dccm.8.in +dccm.html.in +dccproc.0 +dccproc.8.in +dccproc.html.in +dccsight.0 +dccsight.8.in +dccsight.html.in +gmake.inc.in +win32.mak +win32.makinc1 +win32.makinc2 +.manifest diff -r 000000000000 -r c7f6b056b673 CHANGES --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CHANGES Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,2254 @@ +Changes to the Distributed Checksum Clearinghouse source. + + 2009/02/26 02:52:46 Rhyolite Software DCC 1.3.103-1.295 $Revision$ + +1.3.103 + Quiet RedHat versus Debian error message from rcDCC reported by Ken Rea. + Deal with corrupt /var/dcc/map reported by Steve Martin instead of + calling abort(). + Fix error in libexec/fetch-testmsg-whitelist reported by Horst Scheuermann + and William Taylor. + Tweak ./configure and makefiles to try to avoid the mysterious, + unreproducable linking problem reported by John Levine. + Fix bug with `./configure --with-max-log-size=0` reported by + Valentin Schmid. + `./configure --with-max-log-size=KB` now also applies to dccproc log files. + Generate man pages with /var/dcc and other directories replaced by + local ./configure choices. This is intended to help the FreeBSD + package and similar redistributions. + +1.3.102 + Fix build error reported by Steve Martin in dnsbl.c on MacOS X and other + systems without a resolver library found by ./configure. + +1.3.101 + Fix inconsistent declaration of grey_on in dccd/dump-clients/dump-clients.c + reported by Bobby Rose. + +1.3.100 + Support groups of DNS blacklists that can be independently enabled + in per-user whiteclnt files. + Follow Petar Bogdanovic's suggestion to make ./configure assume that + `su -` and the default file ownership on NetBSD should be like FreeBSD + Another tweak to reduce spurious DCC Reputations for 127.0.0.1. + Dccifd in query mode assumes one recipient and so always generates an + X-DCC header. + Tweak proof of concept per-user whitelist cgi scripts in cgi-bin. + Improve long term client request rate computation to improve how public + DCC servers handle too active clients. + Count anonymous clients ignored by `dccd -uFOREVER` among `cdcc stats` + "bad IDs" to more easily detect local clients that lack client-IDs + and passwords. + `misc/hackmc -M` now reports mail rejected with the sendmail + FEATURE(`badmx') to the DCC with counts of "MANY" + +1.3.99 + Fix typo in Makefile.inc for NetBSD and OSF1 reported by Petar Bogdanovic. + +1.3.98 + Change the DCC server to not sign responses to anonymous clients with + the client's sequence numbers in protocol version 9. + Add `dccd -T wlist` and `cdcc "trace wlist on"` to help find failures + by clients to whitelist IP addresses and other checksums + in /var/dcc/whitelist. + Let whitelisting by the MTA, DCC server, or other whiteclnt lines override + "option spam-trap-accept" and "option spam-trap-reject" whiteclnt + lines as suggested by Horst Scheuermann. + Finally document in the man pages parameters including %CIP that can be + used in dccifd and dccm rejection messages. + +1.3.97 + Fix "pthread_mutex_lock(cwf): Invalid argument; fatal error" reported + by Steve Martin. + +1.3.96 + Add `cdcc "clock check" to help detect broken clocks at DCC servers. + Fix intermittent complaints about whiteclnt.dccw reported by Gary Mills. + `cdcc clients` now indicates clients that have pegged a server's + anti-DoS delays. + +1.3.95 + Stop rare "fcntl(F_SETLKW F_WRLCK info -1): Bad file descriptor" complaints + when dccm and dccifd start. + +1.3.94 + Fix core new dump in version 1.3.93 of dccm with aborted mail messages. + +1.3.93 + Make the default value for the `dccm -j` and `dccifd -j` job limit + as large as possible. This makes -j settings unnecessary. + Dccproc and cdcc time out after about 1 minute when the /var/dcc/map + file is not unlocked. + Add "option spam-trap-accept" and "option spam-trap-reject" to + whiteclnt files. I think these are the best way to build + DCC spam traps. + +1.3.92 + Improve the hash function used in the DCC server database. + Replace -Bno-envelope for dccm, dccproc, and dccifd with + -Bno-client and -Bno-mail_host for Tony Del Porto. It seems that + Spamhaus' PBL should generally not be applied to SMTP envelope + Mail_From domain names to avoid rejecting mail received through an + ISP smart-host but with sender domain name hosted on a dynamically + assigned IP address. The now undocumented -Bno-envelope implies + -Bno-client and -Bno-mail_host. + Fix the @configsuffix@ mechanism in homedir/Makefile.in as suggested + by Craig Green. + Switch to -lpthread threads on FreeBSD starting with 6.2 because of + recent problems with libc_r threads. + Dccproc should not require a "option DNSBL-on" line in /var/dcc/whiteclnt + to pay attention to DNSBL hits. The -B settings on the dccproc + command line are sufficient to show that the user wants DNSBL checking. + Fix bug in compression of DCC Reputation reports. + +1.3.91 + Fix mechanism that should prevent dccd from starting dbclean for a quick + cleaning about the time the cron job runs. + Let DNSBL target addresses be CIDR blocks to improve the use of Spamhaus' + lists. + Fix DNSBL bug that caused false positives reported by Ray Gardener. + Tweak homedire/Makefile.in for the gento folks. + Fix recent compiling bug with Borland on WIN32 reported by Tommy Barberis. + +1.3.90 + Fix updatedcc problem reported by Chris Magnuson. + Updatedcc failed after shutting down the localhost DCC server and + finding no working server and when the environment variable + DCC_UPDATEDCC_FAST is not set to "yes". The easiest work-around + is to add the public DCC servers to the local /var/dcc/map file + with `cdcc "add dcc1.dcc-servers.net RTT+1000 ms"` Besides working + around the updatedcc problem, that uses the public DCC servers + as backups for the local server. + +1.3.89 + Repair compile problem on Solaris + +1.3.88 + Repair rate limiting on dccd syslog complaints. + Relax dccd load sharing enough to prevent spurious timeouts by + keepalive timers and some troubles with flood connections. + +1.3.87 + Add `./configure --enable-64-bits` to compile 64-bit DCC server code + for Solaris or Linux PowerPC. If you are using dccm, you will + need to build a 64-bit sendmail milter library. + Fix complaint from `cdcc "new map"` about the new file being empty. + Fix bug in `./configure --with-installroot=DIR` and `make install` + reported by Pavel Urban. + Fix at least some causes of "continue not asking Greylist" complaints + from dccm and dccifd. + Make dbclean on Linux systems with lots of RAM even closer to -F. + +1.3.86 + Disable automatic 64-bit compilation for Solaris again + +1.3.85 + Fix Redhat Enterprise 5.1 build bugs in 1.3.84 reported by Mark Thomas. + Fix old glitch in building for 64-bit Solaris systems. + +1.3.84 + Allow very large DCC database hash tables, including that used + for greylisting. + Add `./configure --with-configsuffix=.str` to improve FreeBSD port. + Add `rcDCC -m {dccd|dccm|...}` to improve FreeBSD port. + Add magic comments to rcDCC to make it work with SUSE insserv. + +1.3.83 + Deal with build problem on FreeBSD 7.0 reported by Craig Green. + Keep client IP addresses as old as 7 days in /var/dcc/dccd_clients + and /var/dcc/grey_clients + +1.3.82 + Fix automagic upgrade of old /var/dcc/map files reported by James Carlson + and Earl Killian. The bug was new with 1.3.81. + +1.3.81 + improve SMTP status messages from dccm and dccifd + improve dbclean handling of less frequent spam + do something like `dbclean -F` on systems that lack mmap(MAP_NOSYNC). + This should help recent versions of Linux that thrash themselves + much as Solaris always has. + perhaps fix the "Deadlock situation detected/avoided" messages long + but infrequently seen on Solaris. + fix a bug reported by Edward Toton in the mechanism that works around a + missing cron-dccd cron job. + fix problem in cron-dccd reported by Dean Maluski when a greylist server + is running but no DCC server. + +1.3.80 + fix bug with `dccm -t` log thresholds reported by Bart Dumon + +1.3.79 + remove -t arg. for dbclean + change lines in log files for DNSBL hits to include IP address from + the DNSBL + probe a DNSBL only once for several -B results with distinct SMTP + 4yz or 5yz rejection messages + reduce dccifd memory on some Linux systems by 4 MByte + do not use set-UID privileges outside the ./configure --homedir=DIR + directory + fix bug in 1.3.78 in sizing the window for large (>100 MByte) greylist + databases found by Tomasz Potega + +1.3.78 + Fix failure to reduce default dbclean expirations when working around + a missing cron-dccd cron job. + +1.3.77 + Improve dccd load limiting, including while catching up on flooding. + +1.3.76 + Add yet more system log tracing with `dccd -d` for the determination of + memory limits. + Tweak duplicate flooded report detection. + +1.3.75 + Fix false duplicate detection of flooded checksums introduced in + version 1.3.74. + Make the rep-total default threshold be 20, matching the documentation. + +1.3.74 + Repair rate limiting of dccd system log messages. + Another fix for detecting duplicate bulk mail reports. + +1.3.73 + Correct count of reputation hits. + +1.3.72 + Fix holes in the detection of duplicate flooded reports. + Fix quick database cleaning to not run dbclean 2 hours or less before + the usual cron cleaning. + Fix bug in counting DCC operations by the free DCC servers. + +1.3.71 + Fix confusion in daily log messages between incoming and outgoing + flood error messages. + +1.3.70 + /var/dcc/libexec/dcc-stats-graph no longer combines RRD files to + generate a graph. Instead the new /var/dcc/rrd-combine should be used + to generate a combined file that is then graphed. + Fix dccproc to report mail to the DCC server that DCC Reputations has + marked as spam. + Remove SOCKS flooding input bug that I added in 1.3.67. + Fix a failure by DCC Reputation servers to fail to detect flooded + duplicate reports. + +1.3.69 + Fix embarrassing build bug in 1.3.68 reported by Chris Pollock. + +1.3.68 + Enhance /var/dcc/libexec/list-clients + Increase flooding listen() queue to try to deal with connection timeouts. + dccifd should pay attention to thresholds in /var/dcc/whiteclnt + Fix new fix for reputation report counting. + +1.3.67 + Occassionally run a quick dbclean on the server database when the database + gets too big. + Report "connection refused" flooding problems in `cdcc "flood stats ..."` + `cdcc stats` on DCC Reputation servers report the number of client + reputation hits. + updatedcc -K does not try to download more than once per week. + -K is assumed if stdin is not a tty. Some installations seem to + have cron jobs that run updatedcc several times per day. + SOCKS flooding only doubles instead of quadruples the backoff or delay + before retrying connections. + Add more tracing of flood state changes to try to find the stickiness + with Solaris. + +1.3.66 + Fix SOCKS flood crash introduced in 1.3.65 and reported by Tomasz Potega. + +1.3.65 + Another tweak to the negotiation of DCC Reputations. + Restore recently lost logging of flooding error messages. + Fix missing reset of keepalive timer. + Include flooding position in `cdcc "flood stats ..."` + Fix rm and rmdir complaints from cron-dccd on Solaris reported + by Mark Thomas. + SUBMIT whiteclnt entries now also turn off DCC Reputation checking. + There are better ways to turn off mail from a local SMTP client + DCC Reputations. + Fix looping whitelisted flooded report bug reported by John L. + This bug might be related to crashes complaining + "ifp->ibuf_len=-111; fatal error" + +1.3.64 + Make ./configure and so updatedcc complaints about bad memory sizes + warnings instead of fatal errors. + +1.3.63 + Correct error in `cdcc "flood list"` announced negotiation of DCC + Reputations. + +1.3.62 + Let "option threshold type,val" lines in whiteclnt file accept "all" + and "cmn" for "type" as with `dccproc -c` and `dccm -t` and `dccifd -t`. + Use yet another scheme in updatedcc to detect download failures that + won't force unneeded downloads. + Fix dccifd man page about the location of the socket as suggested by + Carl Byington. + Fix several rare or potential bugs related to broken TCP connections with + DCC flooding including one that has caused a core dump. + +1.3.61 + Fix problems with Sun Studio 12 compilers reported by Rob McMahon. + `updatedcc -K` or cron mode is silent when things go ok, + or at least less chatty. + +1.3.60 + Fix confusion in flooding connection accounting. + Work around new Fedore Core 6 gcc Fortify buffer over-non-flow bug + reported by Joseph Breu by reducing the size of server-to-server + messages by 1 byte. + Reduce the number of socket() and bind() system calls in dccm and dccifd. + Close unused sockets in dccm and dccifd after bursts of mail such + as dictionary attacks. + Prevent complaints during flooding from between commercial and free + versions about bad protocol versions. + +1.3.59 + Fix crashing in dccifd reported by John M. Crawford. + Fix problem in flooding server-ID assertions. + +1.3.58 + Fix bug in recent versions of `/var/dcc/libexec/dcc-stats-graph -d` + reported by Kevin W. Gagel. + Deal with multiple A RR answers from DNSBLs such as Spamhaus' ZEN + for dccifd, dccproc, and dccm -B. + Turn off a "close(socket): Connection reset by peer" message from + dccifd in proxy mode when postfix gets anxious and closes early. + +1.3.57 + Fix bug in libexec/fetchblack adding a local blacklist file + reported by Krzysztof Snopek. + Make the system host name be the default value of `dccifd -D` + so that local user name for per-user logs and whiteclnt files + is "user" given SMTP recipient address "user@host.example.com" + on the system named user.host.example. + Support wildcards so that `dccifd '-D*example.com'` will take + "user" as the local name for per-user logs and whiteclnt files + vien SMTP recipient address user@host.exaple.com. + Fix bug in version 1.3.56 of dbclean in computing the hash table size + when upgrading from 1.3.42 reported by Domenico Diacono. + +1,3,56 + Dccd continues parsing /var/dcc/blacklist after a bad line instead + of stopping. + Change dcc-stats-graph to not use --alt-y-mrtg with rrdtool version 1.2. + Do not save dccd client list when running with -Gon. + Dccd continues to inflate queue wait for 5 minutes after flooding + resumes so that the database will be good for clients. + Add -K to updatedcc for "cron mode" to not install code, restart daemons, + or otherwise disturb things by installing the same version. + Improve server queue delay measurement when the system is too slow + to keep up with incoming floods. + Do not use MAXHOSTNAMELEN for domain name lengths because on Linux + it is only 64 bytes. This implies a new version of the /var/dcc/map + file. Old versions of the file are automatically upgraded, but that + implies problems if you install old versions of the DCC client + programs. + Dccm, dccifd, and dccproc delete all old X-DCC headers instead of only + those with the same brand name as the current DCC server to fix + problem reported by Frank Tegtmeyer. + Fix unrecognized data /var/dcc/dccd_clients message. + Improve DCC server hash table size estimation to help servers with + 1 GByte or less or more than 3 GByte of RAM. + Fix "flooding not stopped before ADMN DB UNLOCK" problem reported by + Tomasz Potega. + dcc-stats-graph no longer labels "Spam Ratio" graphs with '%' because + recent versions of rrdtool graph no longer understand "--units %%" + +1.3.55 + Dccd falls back on foreground DNS resolution of flooding peer names + when fork() fails, perhaps because of a lack of swap space. + Fix structure alignment bug introduced in 1.3.51/2.3.51 and seen in + Solaris on SPARC CPUs using `gcc -O` reported by Stephan Schulz. + +1.3.54 + Fix bug in proof-of-concept CGI script "LogOut/In" button introduced in + 1.3.48 on Apache without mod_unique_id. + Fix new bug in proof-of-concept list-log CGI script reported by + Krzysztof Snopek. It seems that in Solaris`ls -f` does not work on + a list of files. + Make `dccd -F` the default on Solaris to speed up the DCC server there. + +1.3.53 + More speed for dbclean on FreeBSD. + Fix recent damage to `dccproc -a` and dccproc -f`. + Fix -B "name too long" problem reported by Daniel Gehriger and + Giulio Cervera. + Fix bogus mail rejection by dccifd in proxy mode reported by + Daniel Gehriger. + Reduce BIND timeout for each lookup to whatever remains of the + -Bset:url-secs=X limit. + +1.3.52 + Fix bug in updatedcc found and diagnosed by Asgeir. + Speed up dbclean on FreeBSD. + +1.3.51 + Fix recently added bug with greylisting in dccifd reported by + Daniel Gehriger. + Fix database corruption bug in `dccd -F` added in version 1.3.49. + Fix bugs in queue delay reported by DCC servers to anonymous clients. + This change is important for the public DCC servers. + What the nightly cron job, /var/dcc/libexec/cron-dccd, to try to + restart dccd if it is not running but is turned on. + Include anonymous client queue delay in `cdcc stats` queue delay report. + Close hole that allowed deleting or adding hosts in /var/dcc/maps. + Reduce minimum default reduced dbclean expiriation durations to + 1 hour and 1 day from 2 hours and 2 days to help systems with + 1 GByte or less RAM. + Change cgi-bin/webuser-notify to use sendmail and include a + "Precedence: bulk" header so that the vacation program won't + respond to the CGI cron script's mail messages. + Change cgi-bin/webuser-notify to handle per-user log subdirectories + generated by "option log-subdirectory-*" in whiteclnt files. + +1.3.50 + Fix client random selection of public DCC servers. + /var/dcc/blacklist also affects flooding peers. + +1.3.49 + Change dbclean to use a dccd optimization and be faster on FreeBSD + systems that have less that 4 GByte of RAM. + Set the GID of dccifd, dccm, and dccproc log files and subdirectory + to be the same as the parent directory if running as root and + if necessary. + Possibly fix pthread_mutex_lock(user_log) bug on MaxOS X reported by + Steve Martin. + +1.3.48 + Turn off automatic generation of 64-bit DCC servers. + +1.3.47 + Remove support for external filters as part of the fix for the + thundering herd problem in `dccm -B` reported by Gary Mills. + Check NS IP addresses in DNS blacklists (DNSBLs) before MX IP addresses + for dccproc, dccifd, and dccm -B. + Fix `dccm -tsubstitute...` problem reported by Ludger Bolmerg-Berliner + Try to compile for 64-bit pointers on Solaris to use more than 2 GBytes + if available. + Significantly improve speed on large FreeBSD DCC servers. + Make dbclean automatic -e/-E adjustments much more stable to + significantly help DCC servers on Mondays and Tuesdays. + Fix bad Body and missing Fuz1 and Fuz2 checksums for dccifd and dccm + when previous messages had bad MIME encapsulation reported by + Gary Mills and Harel Tassa. + +1.3.46 + Do not greylist mail from SMTP submission clients marked by + "submit IP" lines in /var/dcc/whiteclnt. + Stop race with idle DNSBL helper processes. + More adjustments to help deal with large databases. + Deal with ./configure problem with BIND resolver on some versions + of Linux reported by Daniel Gehriger. + Change header checksums to ignore all instead of only some occurrences + characters matching [<>'"] + Dccm uses SMFIP_RCPT_REJ in sendmail 8.14 to detect dictionary attacks + and adjust the DCC Reputation of attackers. + Fix a very rare infinite loop in the MIME decoding code in DCC clients. + Add "option log-subdirectory-{day,hour,minute}" to whiteclnt files + to create per-user log files in subdirectories like the subdirectories + used for /var/dcc/log with dccm, dccifd, and dccproc -l. + Detect too-small file size resource limits in dccd and dbclean. + Compile with -D_FILE_OFFSET_BITS=64 on Linux as suggested by + Dmitry Konovalov. + Compile with -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 as advised by + James Carlson. + Add dccm and dccifd -Bset:maxjobs=X + Suppress ENOENT errors from recvmsg() on Tru64-UNIX observed by + Alberto D'Ambrosio. + Fix printf(null) crash in dccifd acting as a proxy for CommuniGate + reported by Charles Chappell. + +1.3.45 + Fix memory leak in dccm and dccifd when DNSBLs (-B) are used. + Improve performance on current UNIX-like systems that have madvise() + with large DCC server databases. + Mention the "incompatible whitelists" message in the FAQ. + +1.3.44 + Remove some quoting in homedir/Makefile to try to work around Linux + "improvements." + +1.3.43 + Make "option forced-discard-nok" in /var/dcc/whiteclnt the default for + dccm as well as dccifd in proxy mode. + Add whiteclnt type of IP address entry "submit". + It is intended to be applied to the IP addresses of SMTP submission + clients such as web browsers that cannot tolerate 4yz temporary + rejections of mail, but that cannot be trusted to not send spam. + Let body and reputation checksum thresholds be set in the global and + per-user whiteclnt files. "Never" is a valid threshold and turns + off rejections for a checksum. + Overhaul proof of concept per-user whiteclnt CGI scripts to handle + per-user checksum thresholds. + Rationalize /var/dcc/libexec/dcc-stats-graph -tTITLE + Fix bugs with -eNEVER and -Enever in dbclean. + Add "submit" to "mx" and "mxdcc" values for IP addresses whiteclnt files + to mark SMTP clients that are submitting new messages and that + do not understand 4yz rejections for individual recipients. + Fix dccifd crash on bogus long recipient names diagnosed by Tomasz Potega. + /var/dcc/libexec/fetchblack is not as noisy when the sources of the + public DCC server blacklist are down for long periods. + Limit the database window to less than 2 GBytes on all 32-bit systems + including Solaris. Previous versions assumed that Solaris would + do the right thing if it allowed large files. + Fix bugs in the "skipping asking DCC server" mechanism that made it + too forgiving. + Remove the `dccd -t` thresholds in favor of simple constants. + Dccm, dccifd, and dccproc now emit X-DCC headers for locally white- + and blacklisted messages even when no DCC server responds. + Automatically compensate for incompatibility in newer versions of + rrdtool. + Prefer poll() to select() on Linux. + Increase the computed limit on `dccm -j` by not dedicating two FDs + to each thread for per-user log files but instead doing some locking. + +1.3.42 + Correct wrong count of `cdcc "clients -i 10.11.12.13"` + Change rcDCC.in back to allow the use of /var/run for PID files. + +1.3.41 + Finally fix ancient missing quote in start-dccm. + +1.3.40 + Make bad password-IDs in /var/dcc/flod a serious error that is reported + even when tracing is off. + Fix missing ';;' in libexec/logger as suggested by James Carlson. + Restore `start-dccm -c` that was removed from version 1.3.39 with the + mistaken idea that -c was not in use. + Fix bug counting clients of public DCC servers introduced in 1.3.39. + Adding -d to DCCD_ARGS or GREY_DCCD_ARGS causes dccd to say how it + determines the size of available memory. + Deal with sysctl(HW_PHYSMEM) on amd64 FreeBSD 6.* need for an 8-byte value + without breaking sysctl(HW_PHYSMEM) on FreeBSD 5.* that demands a + 4-byte value. + Allow databases larger than 3 GBytes on 64-bit systems. + +1.3.39 + Fix bug that caused `cdcc "clients -V"` to sometimes report version + numbers of '?'. + Change dccd to prefer recycling an old, almost idle client rate-limiting + block instead of the oldest block. + Modify /var/dcc/libexec/list-clients based on a suggestion from Chris Myers. + +1.3.38 + Add `cdcc "clients x.y.z.w/p"` + +1.3.37 + Fix problems in /var/dcc/libexec/list-clients and with `cdcc clients` + with IPv6 addresses reported by Vincent Schonau. + +1.3.36 + Fix bad ./configure check to see if `xargs` needs and can use -r + reported by Mark Thomas. + +1.3.35 + Fix dccm crash reported by John Doherty. + +1.3.34 + Fix bug in `make install` on Solaris introduced in 1.3.33. + +1.3.33 + Work around change to `sort` collating sequence in Fedore Cort 5 reported + by Jakob Hirsch. + +1.3.32 + Fix dccd crash as suggested by Wolfgang Breyha. + Do not try to stat() missing whiteclnt files more often than once every + 5 seconds. This should significantly reduce the number of stat() + system calls on busy systems using dccifd and SpamAssassin. + Fix some problems with determining the mail sender through MX forwarders + for second and subsequent mail messages in an SMTP session. + Recognize some more qmail variations of Received headers for obtaining + IP addresses. + Add `cdcc "clients -V"`. + Optionally in dccm and by default in dccifd in proxy mode temporarily + reject SMTP recipients that might be forced to have spam discarded + instead of rejected because it must be delivered to other + recipients. + +1.3.31 + Mention /var/dcc/libexec/uninstalldcc in the installation instructions. + Change dccm and dccifd per-user log message for mail that is now being + accepted after being temporarily rejected for some other recipient + to "accept after greylist embargo" from "accept", as requested by + Spike Ilacqua. + Fix failure to reset "continue not asking" counter problem reported + by Breno Moiana. + Reduce default value of `dbclean -e` from 2 days to 1. + Modify error messages to try to find some clues about the Solaris + "deadlock avoided" problem. + +1.3.30 + Fix leak in dccd blacklist. + Change client-server protocol so that `cdcc clients` gets more than + 16 bits of NOP counts. + updatedcc and fetchblack try two FTP and HTTP servers. + do not use stdio to parse whiteclnt files to deal with Solaris' + 255 limit on stdio file descriptors. + add /var/dcc/libexec/uninstalldcc + +1.3.29 + Fix dblist.c compiling problem in 1.3.28 on some versions of + Linux reported by Thomas Schwanhaeuser and Nigel Horne. + +1.3.28 + Turn off use of futimes() on Linux to resolve bug diagnosed by + Wolfgang Breyha. + Fix two locking problems dccm and dccifd that might cause the crashes + reported by Gary Mills. + Reduce dccifd and dccm thread stack size. + Fix bug that kept some DCC Reputations from being compressed in + the database. + Change the default DCC Reputation rejection message to the equivalent of + -r '%s bad reputation; see http://commercial-dcc.rhyolite.com/cgi-bin/reps.cgi?tgt=%s' + +1.3.27 + Fix an odd case where flooding connections between DCC servers were + not being shut down. I think it only happened when a firewall + or something else systematically filtered TCP FINs. + Use setresgid() for setegid() on HP-UX to fix problem reported by + Giacomo Fazio. + +1.3.26 + Compression reputation reports from the same week instead of from + the same half day. This significantly reduces the size of the + database on systems using DCC Reputations. + Restore the flood rate limiting based on TCP windows, but now just + ignore the bogus EAGAIN complaints from some versions of Solaris. + Fix server whitelists broken in 1.3.21. + +1.3.25 + Fix dccproc crash when given a bogus env_From value diagnosed by + Jeff Mincy. + Fix greylist triple checksum in dccm and dccifd log files. + Fix the default expiration of DCC Reputation checksums at 30 days and + 2 days unaffected by the system's amount of RAM. + Expire FUZ1 checksums in reports that also have FUZ2 checksums. This + significantly reduces the size of the DCC server database. + Remove new flood output rate limit using SO_SNDBUF because it causes some + versions of Solaris to generate persistent EAGAIN errors for send(). + Fix at least some of the dccifd memory leak reported by Chris Mikkelson. + It may be the same as the leak reported by Gunther Richter. + Limit worst case DCC client delays exclusive of delays caused by waiting + for DNS blacklists or external filters are limited to about 16 seconds. + +1.3.24 + Dccproc starts dccifd after 500 uses at least as fast as 0.1/second. + With luck SpamAssassin will notice and switch to dccifd. + Look for libsmutil.a in /usr/lib on Linx for old RedHat + as suggested by Jason Balicki. + Fix X-DCC header misplaced by dccproc reported by James McNutt. + +1.3.23 + Fix bug in dccm, dccproc, and dccifd that tripled effective DCC target + counts on messages being retransmitted after greylisting. I + introduced this bug in version 1.3.21, which was released 3 days ago. + +1.3.22 + Fix "POSSIBLE ATTACK" complaint from sendmail about trailing '\n' + on headers added by dccm reported by Paul Ganci. + +1.3.21 + Add a crude cache or database to the proof-of-concept scripts in + cgi-bin/common to speed them up on large log directories. + The goal is to handle log directories with 40,000 files within a + second or two. The caches files are built incrementally. + Invert the sort order of list-log in cgi scripts. + This change to cgi-bin/common should be upward compatible because + it is controlled by additional parameters to the Perl functions. + Complain about contradictory or ignored entries in whitelists, including + "from" checksums that are normally ignored in server whitelists. + Fix dccd craziness with gre (or any) interfaces with the same IP addresses + as other interfaces observed Craig Green. + Fix infinite loop in dccproc triggered by a To: header of more than + 20480 bytes and with a '\n' character in byte #20478 observed by + James McNutt. + Ignore a few failures by select() apparently caused by SOCKS libraries. + Increase default DNSBL timeouts to -Bset:msg-secs=40 and -BURL-secs=11 + +1.3.20 + Fix dbclean expiration of reputation checksums + +1.3.19 + Changed the midnight dccm and dccifd system log message to disclose + spam passed from whiteclnt-listed MX servers. + MX servers should now be listed in /var/dcc/whiteclnt with lines like: + mx ip 10.2.3.4 + mx ip 10.5.6.0/28 + mxdcc ip 10.7.8.9 + "MX" marks the IP address of one of your mail systems that should + be ignored in initial Received: headers and when reported by + sendmail to dccm. "MXDCC" marks IP addresss of your mail systems + that run DCC clients and that will have already reported mail + to the DCC. Continue using "OK" whitelist entries for mail systems + that you trust to never send or forward unsolicited bulk email. + Allow custom DNS blacklist SMTP rejection messages. See + -Bset:rej-msg=X in the dccifd and dccm man pages. + +1.3.18 + Fix `dccm -aIGNORE` crash reported by Juergen Georgi. + Fix detection of duplicates reputation reports. + Initial support for "mx ip" entries in whiteclnt files. + Fix compression by dccd of delayed reputation reports. + +1.3.17 + People have broken wget by changing the old "--non-verbose" to + "--no-verbose". That would have ok, except they do not understand + what they were doing enough to support the old form. Reportedly + "-nv" works on both versions. + `cdcc stats` on DCC Reputation servers includes an additional line + about reputation results. + Adjust logged reason when spam is ignored after greylist as suggested + by Spike Ilacqua. + Replace `dccproc -R` with `dccproc -r N` (Of course, `dccproc -R` + is still recognized.) + +1.3.16 + Fix bug introduced in 1.3.15 that caused greylist retransmissions + to be counted by the DCC server as separate messages contributing + to the "bulkness" of a message. + If /var/dcc/log is neither readable nor searchable by 'other', then + create log files with the same 'group' permissions as the directory + instead of the old default of 600. This allows the application of + cgi scripts to the main whiteclnt and log files. + `dccd -T ALL` no longer works. It never made much sense and continues + to cause confusion. + Dccifd in proxy mode no longer requires blanks after colons in SMTP + commands. Problem reported by Martin Pala. + Fix dccifd proxy mode crash on mail messages without bodies reported + by Martin Pala. + Complain about bad host name and other errors in whiteclnt files + every 30 minutes instead of every 5 minutes. + Allow whiteclnt files to be read-only with a new locking scheme. + Use Milter.macros.eom in sendmail 8.13 so that the ${dcc_isspam}, and + ${dcc_notspam}, ${dcc_userdir} macros can be set by sendmail.cf + rules that examin headers. This might also allow some hack_mc + settings to be used with delay_checks. + As suggested with discussions with Martin Pala, the thresholds for + quick flooding among servers are now non-linear. + +1.3.15 + When "option MTA-first" in a dccm and dccifd whiteclnt file, determinations + of (not) spam by the MTA are consulted first and so can be overidden + by the whiteclnt files. This allows individual users to override a + sendmail access.db file. + Correct the SMTP rejection message in per-user log files for dccm and + dccifd, especially when dccifd is acting as a proxy. + Fix bug reported by James Carlson that kept./configure from turning + on SOCKS. + +1.3.14 + Keep dccd flooding threshold at or above 10. + +1.3.13 + Make default maximum server memory size 2000 MByte on all except IRIX + and Solaris. + Fix bug in 1.3.12 that causes dccd flooding thresholds to be 0 if + dccd is started by hand or without a dccm rejection threshold. + +1.3.12 + Fix packaging error in 1.3.11. + +1.3.11 + Dccproc should complain if the -w whiteclnt file is bad. + misc/dcc.m4 can add a sendmail.cf rule that assigns a single + whiteclnt file and log directory to mail forwarded to another system. + With that the cgi-bin scripts can be used to control dccm for + mail forwarded to another system with a single web user. + +1.3.10 + Delete "message" checksum in greylist database when spam causes + an embargo to be restored. This fixes some counts after a + greylist whitelisting has been revoked. + Make the default owner and group for files be root:wheel on FreeBSD + As always, use the DCC_OWN and DCC_GRP environment variables with + `make install` or updatedcc -e to override those defaults. + +1.3.9 + Dccifd and dccproc treat the bogus SMTP client IP address of 0.0.0.0 + from SpamAssassin as if it were absent, which allows it to look in + in Received headers. + Add "rcvd-nxt" option to the dccifd MTA protocol to parse later + Received: headers. + +1.3.8 + Repair greylisting broken in 1.3.7. + +1.3.7 + Log files now say "Restore #x" instead of "Embargo #x" when a greylist + embargo is restored because the message is spam. + Don't use -a with `fetch` in updatedcc, fetchblack, and + fetch testmsg-whitelist because it does not know when to stop trying + to reach a dead FTP server. + Add "any" to dccm, dccifd, and dccproc -B DNSBL result address as + suggested by Giulio Cervera. + +1.3.6 + Try to deal with UNIX kernel problems cause bogus failures of mmap(). + Fix bug related to --disable-dccifd reported by Krzysztof Snopek. + Stop relying on `su - -c` to start daemons as requested by Dean Hollister. + Fix server-ID mapping in /var/dcc/flod to use the first relevant mapping + as the documentation says instead of the last one. + Fix recent bug in cron-dccd that stopped emptying client per-user log + directories. + +1.3.5 + Untangle `dccd -a` as well as local host name and IPv4 vs. IPv6 options + in /var/dcc/flod + Fix automatic /var/tmp/map file upgrading for Windows. + Actually c:\\program files\dcc\map + Improve dccd work-around for missing /var/dcc/libexec/cron-dccd cron job + on memory-short DCC servers. This still not a substitute for the + cron job. *USE THE CRON JOB*. + Repair dccifd and dccm midnight log entry bug reported + by Christopher Bodenstein. + Fix recent bug in cron-dccd that stopped emptying /var/dcc/log. + +1.3.4 + Fix another dccm, dccifd, and dccproc bug related to bogus long + URLs from a core dump on Spike Ilacqua's system. + Fix installroot homedir/Makefile as suggested by Pavel Urban and Paul Ganci. + Add `cdcc "src x.y.z.w" to help DCC clients navigate firewalls. + This change requires a change in the format of the /var/dcc/map file. + However, the DCC clients should all automatically and invisibly + upgrade old files. + Fix `dccd -a` bug reported by John Levine.` + +1.3.3 + Work around bogus use of "::" in line 184 of /usr/share/mk/bsd.lib.mk" + in ancient FreeBSD as reported by Lento Yip. + +1.3.2 + Improve logging of failures by external filters. + Fix new use of pstat_getstatic() on HP-UX to obtain physical memory size. + +1.3.1 + Allow dccproc, dccm, and dccifd to use an external filter. See the + ./configure --with-xfltr=FILE --with-xfltr-cflags=opt and + --with-xfltr-ldflags=opt, the discussion of -X in the man pages, + and the toy filter in thrlib/xfltr_sample.c. + See also /var/dcc/dcc_conf-new + Automatically decrease the number of DNS blacklist helper processes for + dccm and dccifd when fewer are needed. + Use pstat_getstatic() on HP-UX to determine the size of physical memory. + Dccifd refuses to run on HP-UX 11.00 to keep SpamAssassin from stalling + while dccifd cannot hear. + +1.3.0 + New license. + cron-dccd tells dbclean -6 if needed. + Treat EHOSTUNREACH or "No route to host" like ECONNREFUSED in DCC + clients and do not complain about every instance. + Deal better with DCC servers with floppy multi-homing such as behind + some NAT boxes. + Deal more gracefully with Linux systems without IPv6 support but + with `cdcc "IPv6 on"`. + Fix crash in dccm, dccifd, and dccproc while computing FUZ2 checksum on + URLs with very long host names in HTML mail messages. + Fix dccifd missing SMTP reply code in dccifd rejections in proxy mode. + `dccifd -ddd` logs SMTP transactions in proxy mode. + Dccifd man page has example -o configuration for use as a Postfix + before-queue filter. + Restart dccm and dccifd after core dumps. + +1.2.74 + Make clients prefer real IPv6 address to embedded or mapped IPv4 + addresses. + +1.2.73 + Fix crash in dccsight as suggested by Vincent Schonau. + Fix handling of log files for senders without reverse DNS in + cgi-bin/common as suggested by Vincent Schonau. + Add IPv4 and IPv6 o-opts to /var/dcc/flod lines to deal with the change + in the default from "YES" to "NO" in the FreeBSD ipv6_ipv4mapping + +1.2.72 + Do not make DNS blacklist checks if the MTA already knows the message + is or is not spam. + Add -lresolv to $LIBS for Mac OS X Darwin as suggested by Joel Brogniart. + Change DNS blacklist checking to check MX servers as well. + Add -B settings to control which DNS blacklists are used for the envelope + or body, and whether MX servers should be checked. + SIGUSR1 causes dccm and dccifd to send their statistics to the system log. + Use getaddrinfo() and getnameinfo() when getipnodebyname() and + getipnodebyaddr() are not available. This might make IPv6 work + on Linux systems. + Note that to make dccd listen to IPv6, -6 must be added to DCCD_ARGS + and GREY_DCCD_ARGS in /var/dcc/dcc_conf. This requirement has long + been present to defend against systems that only pretend to + understand IPv6. Perhaps it is time to remove it. + Add `dccifd -o` to use a subset of ESMTP so that dccifd can be used + as a "before-queue" filter or SMTP proxy by Postifx. + Probably fix a rare dccm and dccifd crash. + +1.2.71 + Fix stray greylist queries reported by Vincent Schonau. + Fix conflict between checking DCC and greylist servers on Linux + reported by Vincent Schonau. + +1.2.70 + Turn on IP TOS bits for DCC server-to-server flooding. + Add -B to dccproc, dccm, and dccifd to consult DNS blacklists. + This feature and greylisting are valuable supplements + to DCC target counting. However, greylisting is generally + significantly better where greylisting can be used. Most + dccproc and many dccifd installations cannot use greylisting. + +1.2.69 + Add `misc/hackmc -r` like -R but to reject instead of discard bad + relay attempts. + Fix bogus X-DCC header added after a fatal problem with the DCC server + as suggested by Harald Daeubler. + Release a single tarball equivalent to the old dcc-dccd-*.tar.Z that + contained the DCC server and all clients. + +1.2.68 + Fix counting of blacklisted DCC clients by dccd. + +1.2.67 + Remove bonehead optimization in dccd of /var/dcc/blacklist in 1.2.66. + Deal with stdargs in gcc 3.4 on AMD 64-bit systems that do not allow + a va_list arg to be passed to two different subfunctions, but + without breaking things on the many systems that lack va_copy(). + +1.2.66 + Overhaul dccd rate-limiting. Instead of imposing a penalty time + on overactive clients, simply rate-limit them. + Reduce limit on dccd error messages about clients from 2/second to + 0.1/second. + +1.2.65 + Fix accounting of NOPs from blacklisted clients. + Fix race that caused "??" server-IDs in X-DCC headers. + Do not count requests from blacklisted clients against the rate limits + as suggested by Sven Willenberger. + +1.2.64 + Correct ">XXXX clients" from `cdcc stats` + Removed redundant declarations of mapfile_nm and rl_anon as + suggested by Andreas Jochens. + +1.2.63 + Possibly fix dccm crash reported by Ludger Bolmerg. + +1.2.62 + Fix bug in `dccd -a10.2.3.4` diagnosed by John Levine. + +1.2.61 + Fix file descriptor leak in getifaddrs() replacement. + +1.2.60 + Fix bug reported by John Levine on systems such as BSD/OS 4.3 + without getifaddrs() introduced in 1.2.59 with tracking changes + in network interfaces. + +1.2.59 + Fix broken `dccd -G0` reported and diagnosed by Chris Mikkelson. + Track changes in network interfaces on most modern flavors of UNIX + as suggested by James Carlson. + Fix two MIME decoding bugs as suggested by George Schlossnagle. + Treat '>' as a blank instead of punctuation for FUZ2 checksums. + Don't re-use va_list in stdargs functions to work around a characteristic + of gcc for AMD 64 bit systems. gcc 64-bit stdargs + reportedly passes va_list by reference instead of by value. + Fix date labels in graphs generated by dcc-stats-graph as suggested by + Kevin Gagel. + +1.2.58 + Work around new bug in FreeBSD 4.10 mechanism to disconnect UDP + sockets reported by Daniel V Klein. The symptom of the bug is + that DCC servers appear down to clients running on FreeBSD 4.10 + +1.2.57 + Invoke WSACleanup() after using WSAStartup() on Windows systems + as suggested by Carl Stehle. + +1.2.56 + Fix /var/dcc/ids delay= extension. + +1.2.55 + Add `./configure --with-max-db-mem=X` to limit the size of the + database window. + Extend /var/dcc/ids format to allow authenticated clients to be delayed + as `dccd -U` delays anonymous clients. + Add `./configure --with-kludge=FILE`. + +1.2.54 + Fix problem with flooding among greylist servers using `dccd -Gweak-IP` + reported by Valentin Chopov. + +1.2.53 + Restore `dccsight -G grey-cksum` because the proof-of-concept CGI + scripts use it. + On OS X, use owner and group of daemon:daemon for programs and use + dccmaninstall in `make install` as suggested by Jason Schwarz. + +1.2.52 + Fix problem in start-dccm and start-dccifd with Solaris /bin/sh + reported by Gary Mills + Work around bug in OpenBSD HTONL() and NTOHL() reported by Jeff Drinkert. + Change wlist to rebuild the .dccw hash table unless given -Q. + +1.2.51 + Fix cause of "packet length 44 too small" complaints by DCC servers. + With an empty mail body and no useful headers, DCC clients were + sending empty requests to DCC servers. + Add `cdcc "debug TTL=x"` to help find firewalls that filter DCC requests. + Use shared libmilter.so in dccm as suggested by James Carlson. + Fix Body checksum when MIME boundary crosses buffer boundary from + Richard Lyons. + Stop crash in dccm reported by Krzysztof Snopek. + Deprecate misc/dccdnsbl.m4 and change misc/hackmc to work with + FEATURE(dnsbl) and FEATURE(endnsbl) in modern sendmail. + Make it compile on Mac OS X and DragonFly FreeBSD. + Reduce the size of greylisting databases. + Separate DCC query mode for dccm and dccifd from greylist query mode. + Add `dccd -G weak-IP` to whitelist not only a {sender,target,IP address} + after passing the greylist embargo, but anything from the IP address. + Use this facility with caution; it might be a bad idea. + + The last change requires that all greylist clients and servers + be upgraded simultaneously. + +1.2.50 + Fix `dccifd lhost,lport,rhost/bits` on systems that have IPv6. + Change homedir/make-dcc_conf to track changes in + `./configure --with-rundir=x --libexecdir=y` + as suggested by Josef T. Burger. This change will not be effective + until upgrading from 1.2.50 to later versions. + Deal with tiny FD_SETSIZE reported by Christian Becker. + Fix dccifd, dccm, and dccproc core-dump caused by missing whiteclnt file + reported by Henrik Edlund. + +1.2.49 + Fix infinite loop in computing DCC clients computing checksums of + large, deeply nested MIME messages reported by Clive Cleland. + +1.2.48 + Add "option dcc-off" and "option dcc-on" to per-user whitelist files + as suggested by Spike Ilacqua. + Make /var/dcc/libexec/fetch-testmsg-whitelist deal with cron processes + that set $PATH without /usr/local/bin + +1.2.46 + Fix infinite packet flood from DCC clients including dccproc observed + by Benji Spencer, Clive Cleland, and Andrew Kent. I introduced + this serious bug with the WIN32 changes in 1.2.33. + Fix "option greylist-off" bug introduced in 1.2.39 and reported by + Spike Ilacqua. + Defend dccd against too many clients. + +1.2.45 + Fix dccd database "window" size computation bug that chose 3 GBytes + on systems with less than 512 MByte. + Fix `cdcc "stats all"` to use the right host name from Leandro Santi. + Increase `dccd -R` default rate limits for all anonymous clients + and for individual authenticated clients.. + updatedcc understands -V x.y.z unless no old version x.y.z is available. + +1.2.44 + Fix bug in dbclean -e and -E default reductions that made them 50% less + instead of more conservative compared to 1.2.39. + Speed up dbclean on systems with mmap(MAP_ANON). + Clean some uninitialize variable complaints from purify reported by + Praveen Nimmagadda. + Minor adjustments to deal with Solaris's VM system. + +1.2.43 + Fix typo in -e and -E default reductions. + +1.2.42 + More adjustments to deal with Solaris's VM system. + Use all except 384 MByte of physical memory on systems with more than + 768 MByte. On systems with 768 MByte or less, use half. + Tweak WIN32 makefiles. + +1.2.41 + Restore TZ in update/misc after setting it to GMT to keep the + Solaris FTP from going crazy. + +1.2.40 + Include win32.makin2 that was missing from 1.2.39. + Do not respond to clients when the database is broken to ensure that + they switch to another server. + Add missing "option greylist-on" support to cgi-bin/edit-whiteclnt + Remove DCC_PROTO_HOMEDIR support for building RPM or other packages + and add `./configure --installroot=DIR` + Adjust threshold for `dbclean -F` to keep Solaris systems from spending + hours in dbclean. + Add `dbclean -f` to turn off default `dbclean -F` on Solaris for + installations where the file system has been tuned for the + large, randomly accessed file that is a DCC database. + +1.2.39 + Suppress syslog messages from cdcc noted by Krzysztof Snopek. + Suppress complaints about madvise(MADV_WILLNEED). + Tweak WIN32 porting aids. + +1.2.38 + Turn off the use of madvise(MADV_WILLNEED) on systems such as BSD/OS + that claim to have it but don't. + -Gweak did not in 1.2.37 work as reported by Valentin Chopov. + +1.2.37 + Tweak WIN32 #ifdefs. + Change -G for dccm and dccifd to require -Gon. Add kludges in + start-dccm and start-dccifd to convert the old -G to -Gon. + Add "-G noIP" and '-G IPmask/xx' to ignore all or part of the SMTP + client IP address in the greylist triple. + `dblist -G` no longer works. Use `dbclist -Gon` + Fix bug where dbclean increased the number of reasons to stop flooding + by 1 and then decreased it by 2 reported by Bernard Gardner. + Use madvise(WILLNEED) for database buffers on systems with plenty + of RAM as suggested by Robert Milkowski. + Adjust scripts including /var/dcc/libexec/start-dccd to deal with + POSIX compliance of `expr` in FreeBSD 5.1. + Change FUZ2 checksum to know about Polish. + +1.2.36 + Fix updatedcc for systems that have only make in $PATH but where + it is really gmake. + +1.2.35 + Turn off the use of poll() instead of select() on Linux systems. + +1.2.34 + Fix bugs in the ./configure mechanisms to use poll() instead of + select() on FreeBSD reported by Valentin Chopov. + +1.2.33 + Adjust default dbclean expirations based on available RAM and + the size of the database. + Make dcclib, cdcc, and dccproc build for WIN32 with Borland C++ 5.02 + or FreeCommandLineTools.exe. The former can use the dcc.ide file + and the latter can use win32.mak. + Fix use of SO_LINGER on Solaris. + More changes to ease compiling cdcc for WIN32. + Possibly fix dccd amnesia about flooding peers. + Use poll() instead of select() on FreeBSD. + Fix updatedcc to use gmake if ./configure insisted. + Entirely remove "--prefix" from ./configure to stop people from + mistakenly assuming that ./configure is what the Free Software + Foundation dictates it should be. + Change /var/dcc/libexec/start-dccd to stop dbclean when dccd starts + and so prevent a deadlock between dbclean and dccd. + Fix problem with updatedcc on systems with only gmake reported by + James Carlson. + Fix problem with large greylist whitelist files reported by John Levine. + Reduce number of write() system calls per operation in dccifd. + +1.2.32 + Fix corruption of `dccm -U` directory introduced in 1.2.31 and + reported by Spike Ilacqua. + +1.2.31 + Make all dccd databases "big." If you have not previously used + `./configure --enable-big-db` then when version 1.2.31 of + dccd is started, it will run dbclean to rebuild the database. + This will make the hash table about 9% bigger and so 9% slower. + Make the "ms" units optional for RTT adjustments in `cdcc add` or + `cdcc load` as suggested by Hernan A. Perez Masci. + Add ${dcc_userdir} sendmail.cf macro as suggested by Valentin Chopov. + This lets you use the full power of sendmail.cf rewrite rules + to control per-user whitelist and log directories. See the + dccm man page. + Make `dbclean -F` the default on Solaris systems with plenty of RAM + and automatically turn it off when there is not enough RAM to hold + the entire database. + +1.2.30 + Let `dccd -C` take arguments for dbclean, so that the following line + in dcc_conf works: + DCCD_ARGS="'-C$DCC_LIBEXEC/dbclean -F'" + Make pthread_detach() failures in dccifd non-fatal. + Add mechanism to cgi-bin/list-msg to whitelist-for-greylisting + (sender,IP-address,recipient) checksums. This mechanism + requires that the 1.2.30 versions of dccd and dccsight be + installed. + Change dccifd to record the message headers in the log file even when + the MTA fails to provide the message body. + +1.2.29 + FUZ2 checksums character entity references in URLs in HTML. + Insert checksums of greylist triples of whitelisted messages + into the greylist database. + If greylisting is turned on, then include greylist checksums in dccm and + dccifd log files even for whitelisted and blacklist messages. + Dccm and dccifd log some messages that are whitelisted for greylisting + or otherwise not currently embargoed but were in the past. + Change whiteclnt "log all-grey" and "log no-grey" options to + "option greylist-log-off" and "option greylist-log-on". + (Of course the old strings continue to work.) + Add whiteclnt option "option greylist-off" and "option greylist-on" + to control greylisting for greylistig for an individual user. + Note mail in SMTP transactions that involve other users for which + greylisting has not been turned off can still temporarily rejected. + Add "option log-all" log everything for an individual user. + The proof-of-concept CGI scripts handle the new whiteclnt options. + Fix false "many" from dccproc when switching DCC servers reported by + Rutger ter Borg. + Remove 1.2.28 change in the dccd "xx MByte window" message that + displayed the minimum of the physical file size and the mmap() window + size. The message now contains the mmap() window size.. + Fix `dccd -FG,` core dump reported by Aleksander Dzierzanowski. + Make "skip asking" in `cdcc info` output a comment as suggested by + Gunther Heintzen. + Speed up flooding among greylist servers. + +1.2.28 + Reduce the number of msync() system calls, significantly speeding up + dbclean and dccd on FreeBSD. + Fix "window" size computation for dccd and dbclean on systems with + more than 4 GByte of RAM. + Adjust flooding threshold for greylist dccd. + Changed the dccifd man page to say that dccifd looks at the first + Received: header for the sender's IP address if was not provided + by the dccifd client. + Remove the recommendation for whitelisting the Habeas Mark from the + sample dcc_conf file. + Detect bogus -G args reported by Aleksander Dzierzanowski. + +1.2.27 + Use fsync() and msync() on /var/dcc/flod.map in dccd to try to + get Linux to send the file to the disk. + Use setsockopt(SO_LINGER) to speed shutdown on FreeBSD. + +1.2.26 + Fix `dccd -F`. Adding -F to DBCLEAN_ARGS in /var/dcc/dcc_conf on + Solaris systems with enough RAM to hold most of the database + can make dbclean twice as fast and reduces its effects on other + processes. Addcing -F to DCCD_ARGS might have similar effects. + The use of MAP_NOSYNC on systems that support it including FreeBSD + reduces the effects of dccd on other processes. + +1.2.25 + Fiddle with /var/dcc/libexec/dcc-stats-graph. + Add `dccd -F` like `dbclean -F` + +1.2.24 + Generate /var/dcc/dcc_conf-new whether it is needed or not. + Add `dbclean -F` to work around Solaris performance bugs with large + files and mmap(). + Add `dccd -Gweak` to not require a retransmission of the same message + to end a greylist embargo. + Add option "no-reject" to the dccifd-MTA protocol to be similar to + `dccm -aIGNORE` for greylisting while ignoring DCC results. + +1.2.22 + Fix stray hostnames reported in dccifd log file headers observed by + Chris Mikkelson. + Fix empty dccm syslog complaints seen on Solaris. + Fix core-dump with bogus hostname in whiteclnt file observed by + Joe Ilacqua. + Updatedcc starts to shut down dccd early to avoid problems restarting + it on slow systems at the end. + +1.2.21 + Fix dbclean every 20 seconds possibly observed by Kelsey Cummings. + Stop frequent running of dbclean from dccd to clean up greylisting records. + +1.2.20 + Fix cdcc core dump with non-existent /var/dcc/map files. + Change updatedcc to not use "set -e" because some versions of + bash have tantrums if you unset a variable that is not set. + +1.2.19 + Fix "too many CIDR blocks" problem reported by John Doherty. + +1.2.18 + Fix infinite loop in dccm reported by Gary Mills. This error might + also have caused dccm to crash. It should affect dccd as well + as the DCC client programs. I introduced it in version 1.2.15. + +1.2.17 + Fix IP whitelist entries in DCC server databases broken in 1.2.15 and + 1.2.16. + +1.2.16 + Fix bug in libexec/updatedcc with blanks in CFLAGS reported by + Aaron Paetznick. This only fix uses of updatedcc after + 1.2.16 has been installed. + +1.2.15 + Ensure the mtime of /var/dcc/whiteclnt.dccw files changes to stop + endless reparsing on some Linux systems. + Resolve inconsistency in dccproc whitelist vs. -t many noted by + Dawn Endico by making whitelisting always produce an exit code of 0. + Put absolute path on cdcc in misc/stats-get as pointed out by + Kevin Gagel. + Make dccm and dccifd log file size configurable as suggested by + Furlan Campos. + Fix bug reported by Jim Carroll that kept mail from being rejected + when first sent to a spam. + Allow large CIDR blocks to be white- or blacklisted in whiteclnt files. + Fix dccifd -p bug reported by Christopher Bodenstein. + Fix "continue not asking greylist" log message that should be + "continue not asking DCC" reported by Jorg Bielak. + Fix ./configure script in dccproc tarball that was creating a bogus + RUNDIR value for dccifd. + Add `./configure --with-max-log-size=KB` as requested by Furlan Campos. + The proof of concept CGI scripts now + deal with per-user logs for user that receive enough spam that their + log directories have 20,000 entries. + support the per-user greylist log options for whiteclnt files + described in the dcc man page near the description of "include" + support locking of per-user whiteclnt files with a line of + "#webuser locked" + Fix output file data corruption bug reported by Chris Mikkelson. + Change default dccm greylist SMTP status code as suggested by Gary Mills. + +1.2.14 + Adjust homedir/make-dcc_conf for Solaris as suggested by Gary Mills. + +1.2.13 + Tweak libexec/updatedcc for Solaris. + +1.2.12 + Report checksums in greylist embargoed mail to a DCC server while + waiting for the embargo to expire. + Recognize more than 1 GByte of RAM on Solaris systems. + Fix bug in stats-get not counting queries pointed out by Yury Razbegin. + Change the default greylist -G "white" value from 30 to 63 days. + dccm and dccifd now include the greylist triple checksum in per-user + log files. + Fix bugs in dccifd C interface routine pointed out by Stephen Misel. + Fix dccd whitelist bug observed by Gary Mills. + Fix bug in 1.2.8 through 1.2.11 that stops flooding of brand new + reports of bulk mail that is not spam. + Automatically generate /var/dcc/dcc_conf-new from existing dcc_conf + to aid installation of greylisting. + +1.2.11 + Resume looking for native sendmail milter libraries on more than + FreeBSD. + +1.2.10 + Fix some compiler warnings on Solaris. + Fix "only 256 open files allowed" message from dccid on Solaris + reported by Turgut Kalfaoglu. + Use poll() instead of select() in dccifd if possible. + Fix error in libexec/start-dccd reported by Valentin Chopov. + Look for native sendmail milter and install man pages on + recent versions of NetBSD as suggested by Josef T. Burger. + +1.2.9 + Turn off database hash debugging accidentally turned on in 1.2.8. + +1.2.8 + Fix serious bug in resolving DCC server host names by dccm and dccifd. + Add "temporary" to default greylist rejection messages. + Fix greylisting of null messages. + Add misc/fetch-testmsg-whitelist + Improve compression/suppression of flooded checksums to reduce the + database size and bandwidth requirements 10-50% for DCC servers that + see fewer than 20K DCC ops/day. Tests have produced conflicting + results. The full effects are not seen unless flooding peers + install this version. + +1.2.7 + Fix greylist flooding problem reported by Valentin Chopov. + Add whitelists to greylist servers as requested by Bobby Rose. + Change `dccm -r` to also set the greylist rejection message and to + optionally interpolate the queue-ID and SMTP client IP address + as requested by Gary Mills. + Fix 1.2.x bug that treated all flooded checksums to a new database + as stale until a local checksum has been added and dbclean run. + +1.2.6 + Complete the fix for "badly signed NOP response" in the DCC server. + To be effective, the public DCC servers will need to use + version 1.2.6. + +1.2.5 + Fix "badly signed NOP response" bug diagnosed by Philipp Buehler and + Thorsten Janssen. + Turn off connect() on DCC client UDP sockets for Linux 5.2. + Use sysconf() on Solaris and Linux and sysctl() on BSD systems to + estimate the size of physical memory. This may reduce the need + for `./configure --with-db-memory=X` + Add `./configure --with-DCC-MD5` to use the MD5 code in the DCC source + instead of any local library. + Fix dblcean "repairing" the database because "was [it] not closed cleanly." + +1.2.4 + Fix core dump in creating X-DCC header as suggested by James Carlson. + Fix dccif.c for `./configure --disable-IPv6` and stats-get for + deleting /dev/null when interrupted as suggested by Yury Razbegin. + +1.2.3 + Fix leak in greylist server. + Improve some obscure error messages from dccd. + Address IPv6 problem on RedHat 5.2 reported by Darren Nickerson. + Check /proc/meminfo on Linux for hints on real memory size to + work around the Linux mmap() bugs and resulting dccd performance + problems as suggested by Dave Lugo. + +1.2.2 + Avoid `chown` in start-dccm and start-dccd. + Fix stop-dccd as noted by Michael Ghens. + Add greylist installation instructions to INSTALL.html and INSTALL.txt. + +1.2.1 + Fix typo in default map.txt noted by Michael Ghens. + Fix undetected hash table size overflow noted by Leandro Santi. + Fix "BRAND" error in start-dccd. + Fix inflation of target counts on greylisted messages. + Dccd is off in the default dcc_conf. + Reduce default greylist embargo to 4.5 minutes. + +1.2.0 + Many changes to support a form of Greylisting. + See http://projects.puremagic.com/greylisting/ + and the dccd and dccm man pages. Greylisting is probably not + ready for prime time in 1.2.0. + Change flod.map file format to allow `cdcc "flood stats 123"` to say + "not connected since" as suggested by by James Carlson. + Fix bogus "overwriting existing entry" error message noted by + Dallas Engelken. + As suggested by Leandro Santi, prevent false alarms about bogus packets + received by DCC clients. + Improve 24-hour averaging of client operations by dccd. + Fixes to dccd/rl.c from Leandro Santi. + +1.1.45 + Fix error in sample homedir/map.txt file. + Fix problem in starting flooding. + Fix error in misc/dcc-stats-init. + +1.1.44 + Fix core dump observed by Stephen Misel. + Suppress error message from rcDCC and start-dccm when dccm is not + installed as noted by Kevin Gagel. + +1.1.43 + Fix core dump reported by James Carlson. + +1.1.42 + Fix dbclean progress reporting bug noted by Vladimir Samoilov. + Improve misc/na-spam to catch another kind of quote leader. + Drop anonymous requests that would be delayed by more than the maximum + possible RTT. + Add application layer keepalives to flooding. + +1.1.41 + Sort IP addresses in `cdcc rtt`. + Improve response of the client code to broken servers. + +1.1.40 + Adjust client failure "fail_more()" backoff mechanism. + Add commas to misc/dcc.m4 as suggesed by Spike Ilacqua. + +1.1.39 + Fix missing changes to dcc.m4. + +1.1.38 + Fix `make install` file ownership as noted by Gary Mills. + +1.1.37 + Deal with certain obfuscating URLs. This change includes some + URLs in Fuz2 checksums and removes parts of some URLs from Fuz1 + checksums. This should reduce much of the need for the dubious + many hex FUZ2: 00000000 00000000 00000000 00000000 + whiteclnt entry. + Decode RFC 822 and MIME entity headers to control quoted-printable + and base64 decoding instead of the previous adaptive algorithm. + This also involves decoding nested MIME multipart messages. + A side effect of this is to change the checksums computed for + some mail. + Use poll() on Solaris to avoid failures from select() on large FDs. + Smuggle the Mail_From value to dccm with a ${dcc_mail_host} macro + so the mail_host checksum is valid despite sendmail smart relays. + This requires rebuilding sendmail.cf with the new dcc.m4. + Move part of the server-failing timer into /var/dcc/map so that + dccproc processes can share it. + Fix dccifd bug in handling detecting the end of headers reported + by Tim Clymo. + Fix `dccd -u` which was almost entirely broken. Extend `dccd -u` + to inflate the delay for busy anonymous clients. + Make server selection more stable despite network problems. + Fix some cases of false alarms of database corruption by dbclean. + This fix is important where dbclean complains about `repairing` the + database. + Clear dccd queue delay when the server is idle. This should help + dccd on BSD/OS after dbclean runs. + Avoid `chown` and `chgrp` with `configure --disable-sys-inst`. + Add `dccproc -x exitcode` as suggested by Paul Wright. + `cdcc clients` displays counts of NOPs to catch misconfigured firewalls + at clients. + +1.1.36 + Add optional DCCM_ENABLE and DCCD_ENABLE to /var/dcc/dcc_conf + Look for libmilter.a where it is in some versions of Linux. + Add "eval" to start-dccd, start-dccm, and start-dccifd when + not using a separate UID to allow quoted blanks in + `dccm -r "rejection messages"`. + +1.1.35 + Deal with name space pollution in Solaris as suggested by Isaac Saldana. + +1.1.34 + Fix libexec/dcc-stats-collect and libexec/stats-get as noted + by Valentin Chopov. + Adjust FUZ2 length thresholds to catch more HTML obfuscated spam. + Reduce some stalling of dccd on BSD/OS when dbclean starts. + Resolve conflict between start-dccifd and dccifd by making the default + location for the dccifd PID file the same as for the dccm file + Fix dccifd to remove stray X-DCC headers. + Fix start-dccifd to pay attention to DCCIFD_ARGS in dcc-conf. + +1.1.33 + Fix rare core-dump in dccd that more frequently corrupts the database. + Do not loop forever as the result of some database corruption. + Turn off by default dccd blacklist event tracing. + Increase the limit on the size of white-listed CIDR blocks from /24 to + /20 or 1024 IP addresses. Every IP address whether specified + separately or with a CIDR block requires a separate entry in a + client DCC whitelist hash table. The hash table is limited to + about 80K entries. + Add '-T' to misc/hackmc to trust or white-list mail authenticated + by SMTP AUTH or START TLS. + Server blacklisting suppresses "bad client or server-ID" error messages. + add /var/dcc/libexec/stats-get produce server statistics as noted by + Daniel Klein. + +1.1.32 + Do not count MIME content-type image bytes when deciding whether + to generate FUZ2 checksums. + Unlink dccm and dccifd PID files before trying to (re)create them. + Dccm watches milter "contexts" more closely for corruption. + Add an optional count to `cdcc clients`. + Dbclean tries harder to restore dccd flooding. + Initialize wtgts in dccproc as noted by Leandro Santi. + +1.1.31 + Fix core dump in ckfuz1.c noted by Gary Mills. + +1.1.30 + Allow blanks in MIME boundaries. + Possibly fix compiler "initialization type mismatch" warnings noted by + Gary Mills. + +1.1.29 + Fix dccm core dump in ckfuz1.c noted by Sven Willenberger. + +1.1.28 + Fix dccm core dump in dcc_ck_body0() noted by Valentin Chopov. + +1.1.27 + Add to HTML character references known by the Fuz2 checksums. + +1.1.25 + Notice "Content-Type: text/html" headers to pay attention to HTML + even in mail without tags. + Tweak the Fuz2 checksum to ignore some Microsoft delivery notifications. + Adjust Fuz1 checksum to be more consistent on URLs. + Fix date bug reported by Krzysztof Snopek in `cdcc clients`. + Include an indication that the client was blacklisted in `cdcc clients`. + Change MIME decoding somewhat as suggested by Leandro Santi. + Fix bug in dccd client blacklist. + Add `dccm -g not-all`. + +1.1.24 + Add `cdcc "clients -s"` to sort by the number of requests. + Add /var/dcc/blacklist of blocks of IP addresses refused by dccd. + Remove -lpthread from $(DPADD) in dccm and dccifd Makefiles for Solaris + with gmake to try to deal with problem observed by Krzysztof Snopek. + +1.1.23 + Fix handling of & in the middle of words in HTML. + Change dccifd to respond with DCCIF_RESULT_REJECT or 'R' when + queried about spam. + Fix typo in detection of non-compiler on SunOS. + Add `./configure --disable-dccifd` as suggested by Krzysztof Snopek. + +1.1.22 + Fix inconsistencies in fuzzy checksums computed by dccm and dccproc. + More ./configure script changes to try to deal with problems on + a Solaris system with GCC and some undetermined oddities. + +1.1.21 + Suppress repeated messages about unauthorized server IDs of peers. + Install cdcc, dccproc, and so forth in $HOME/bin by default + if /usr/local/bin is not writable and $HOME/bin exists. + Fix infinite loop in decoding invalid HTML character references. + +1.1.20 + Fuzzy checksums ignore all text before initial MIME boundary and + after terminal MIME boundary. + Add support for Spanish thanks to Leandro Santi. + Shuffle hostname resolving code to try to fix what may be a race + in the Linux pthread_create() as discovered by Karl Grindley. + Reduce default value of `dbclean -e` from 7 to 2 days. Mail that does + not reach the local bulk threshold within 2 days is probably not + spam and if it is, it will almost certainly reach a bulk threshold + at some other server in the network. + +1.1.19 + fix missing env_From handling in dccifd/dccif.pl observed + by Nathan Neulinger + set mode of dccifd socket to 0666 as suggested by Nathan Neulinger + +1.1.18 + fix `dccproc -c` logging bug noted by Brad Volz. + fix ./configure to pick UID and GUID out of `id` with --disable-sys-inst + multiply the `dccd -u` delay by 4 when flooding is off or broken to + steer clients away from DCC servers without working links. + radically reduce the number of wsync() calls to speed systems with + lame mmap() support including BSD/OS 4.2. + fix setting of file descriptor limit in dccm and dccifd as noted + by Gary Mills + change configure script to deal with change in gmake version string + discovered by Aaron Paetznick + +1.1.17 + add DCC interface daemon, dccifd, similar to dccm for SpamAssassin and + Perl filters and MTAs other than sendmail. This is only an initial + release soliciting comments about its interface. Its interface + may change in 1.1.18. The new lines of homdir/dcc_conf must be + added to /var/dcc/dcc_conf to turn it on. + `dccm -a IGNORE` says "would have rejected" in the log messages + for Sven Willenberger + generate sample client-ID password for localhost server in /var/dcc/ids + and /var/dcc/map + dccd only complains about unknown server-IDs when "IDS" tracing is + turned on. + DCC clients check for new server DNS records every other hour + instead of every hour + compute the same Base64 result for 32-character lines with or without '\r' + close unlikely, theoretical per-user log file FD leak in dccm. + dccproc passes header lines (including continuations) longer than + 20 KBytes + fix bugs in misc/newwebuser as noted by Furlan Campos. + dccm deletes all X-DCC headers of the right brand name to foil + tricky spammers. + dccproc defaults the -T tmpdir to the -l logdir + +1.1.16 + fix long HELO values in dccm from Leandro Santi. + fix /var/dcc ownership installation bugs noted by John Reames. + let count of clients seen within 24 hours be more than 1000. + change misc/na-spam, the news.admin.net-abuse.sightings gateway script + to use dccproc log files instead of generating its own. + don't allow ':' in DCC server "brandnames". + recover misplaced change to misc/dcc.m4 to fix need to use + FEATURE(`delay_checks') + fix apparently harmless quoting error in dcc.m4 + fix `cdcc "flood stats all"` when the server's peers are not ordered + by their IDs. + decode Base64 with invalidly long lines. + +1.1.15 + change graph generating shell scripts, including making the + database size RRA use "MIN" instead of "MAX". A shell script + that can convert existing RRDs is available. + make `misc/hackmc -O` apply to all uses of the sendmail access DB + instead of only the envelope Mail_From value. + +1.1.14 + tweak graph generating shell scripts. + add `cdcc "flood stats all"` and `cdcc "flood stats clear all"` + +1.1.13 + tweak graph generating shell scripts including fixes from Jack Bates. + adjust autoconf mechanism to try to deal with systems with inet_ntop() + but without IPv6. + +1.1.12 + move dccd statistics to the flod.map so they're preserved despite + restarting dccd. + add shell scripts to generate RRD graphs. + make rate-limits run-time parameters for `dccd -R`. + +1.1.11 + fix dccm bugs with handling a non-responsive server. + change misc/hackmc to modify sendmail.cf to reject unauthorized relay + attempts with a temporary failure when they are supposed to be sent + to the DCC but dccm is not running. This prevents leaking relay + relay spam. You must use the new hackmc script to install this + change in sendmail.cf. + remove "# whitelisted" from `cdcc stats` output to give more room + for totals. + prevent empty dccproc log files as noted by Krzysztof Snopek. + even fatal errors should cause dccproc to exit with 0 to avoid + rejecting mail, as noted by Krzysztof Snopek. + When server hostnames have common IP addresses, prefer the server + with the non-anonymous client-ID, noted by Krzysztof Snopek. + +1.1.10 + try to deal with truncated per-user dccm logs on Solaris. + reduce threshold at which Fuz2 checksums are computed to capture + more spam. + force the use of gcc on Solaris. + try not to wait for the syslog console messages to resolve a dccm + crash on Solaris. + +1.1.9 + make `cdcc "flood list"` unpriviledged, but disclose only server-IDs + to strangers. + +1.1.8 + fix "invalid database address" problems on SPARC systems with + ./configure ----enable-big-db + %-encode quotes in URLs generated by the CGI scripts. + fix `cdcc "id=X"` for X>65535. + increase path length limit to 24. + add `dblist -I server-ID`. + +1.1.7 + fix man page installation on AIX. + work around connect() bugs on AIX41 and OpenUNIX. + +1.1.6 + fix encoding of quote characters in the CGI scripts + look for sendmail 8.12.1 libsm.a that is required by that version of + the Milter code. + make the configure script again find the FreeBSD MD5 library. + +1.1.5 + fix bugs in white-list links in the CGI scripts. + increase 8-hop flooding path limit to 16. + changes from Mark Moraes to compile dccproc under Cygwin on Windows 2000 + the DCC source compiles on OpenUNIX 8.0.1 thanks to Larry Rosenman. + reduce the chances of duplicate or missing entries in the list + from `cdcc clients` as suggested by Dave Lugo. + add `dblist -C` to limit the listing to reports with specified checksums + as suggested by Sam Leffler. + `dccm -r "4xx ..." now produces a proper SMTP "temporary failure". + deal with /usr/include/md5.h that seems to be RedHat 7.3 but that does + not compile by itself. + +1.1.4 + fix dccproc and dccm tarballs broken in 1.1.3. + +1.1.3 + add a "VERSION:" string to the start of dccm and dccproc log files. + fix memory leak in dccm observed by Gary Mills. + fix core-dump in dccd with unreadable /var/dcc/flod noted by Sam Leffler. + add prototype CGI scripts for per-user white lists. + rate limit and improve log messages about read-only whiteclnt files. + allow null passwords for server-IDs in /var/dcc/ids that are used only + as markers so that no DCC server is accidentally started with the + password "unknown" + install initial /var/dcc/map file using dcc.dcc-servers.net + install empty server database as suggested by Andrew Macpherson. + create /var/dcc/log during installation. + adjust the `dccd -u` default to minimize rejecting DCC queries from + nearby anonymous clients. + convert upper to lower case in dccm per-user white list directories as + suggested by Andrew Macpherson. + allow null passwords as place-keepers in /var/dcc/ids. + rebuild gmake .d depend files when include/dcc_config.h changes so + that bad things don't happen when a header file disappears and + the configuration changes to match. + fix "log-del" option in /var/dcc/flod to log checksum delete requests. + add "del" and "no-log-del" options to /var/dcc/flod lines. + change the defaults for flooding delete requests to log them ("log-del"), + not send them ("no-del" among o-opts) and + reject them ("no-del" among i-opts). + change misc/hackmc to be usable in typical Makefiles that generate + .mc files. It now feeds a single set of .mc files to m4 + to produce a single .cf file on stdout instead of a set of .mc files. + It also no longer includes ../m4/cf.m4 + use native sendmail milter libraries on FreeBSD 4.6 + IDs in /var/dcc/ids can be placeholders without passwords + +1.1.2 + fix `dccm -W`. + the recipient mailbox resolved by sendmail can be used as an white list + value by dccm. This simplifies white-listing when the system + has more than one name. + +1.1.1. + add -follow to cron-dccd in case user log directories are beyond + symbolic links. + fix "resource temporarily unavailable" message from dccproc + reported by Henrik Lewander. + fix `dccm -W` problem in 1.1.0 reported by Mark Motley. + +1.1.0 + "substitute" whitelist header entries must start with the name of + the header. This is incompatible with previous versions. + remove `dccm -a REJECT_ONLY` + add per-user whitelists and logs to dccm. See `dccm -U`. Use the + DCCM_USERDIRS variable in the new homedir/dcc_conf file to turn on. + To generate per-user log files without leaking informatio about + Bcc addresses, the format of all log files has changed slightly. + Look for "bulk" in the X-DCC line instead of the final "targets" line. + add `dccproc -E` to add dccm log file style envelope lines to log files. + fix cleaning of hourly DCC log files as suggested by Gary Mills. + X-DCC header lines contain the string "bulk" when the message is bulky. + add the "mail_host" as a possible "subsitute header" for dccm. + several of the mailing lists in the sample white list now require that + dccproc or dccm use `-S sender` or dccm use `-S mail_host`. + This removes hostnames from the sample whitelist, because they + can take a long time to resolve or fail to resolve. + change env_To: lines in dccm log files to include the sendmail "mailer" + and address. Also add the resolved "mail_addr" and "mail_host" + to dccm log files. + allow common dccproc white list files owned by the DCC user to be in + subdirectories of the DCC home directory instead of only the + DCC home directory. + use Rgethostbyname() in clients only when `cdcc SOCKS on` is sent + and in the server only for flooding peers that are flagged with + "SOCKS" in /var/dcc/flod. + use gethostid() and hash the local host name instead of gethostbyname() + to generate the DCC client host ID + consider an entire report of checksums obsolete if the fuzziest checksum + is obsolete for dbclean or flooding. This reduces the database + size and flooding bandwidth by another factor of 2. + fix `./configure --mandir=/tmp/foo` to put the man pages into + /tmp/foo/man8/dccm.8 and similar places on other systems instead + of /tmp/foo8/dccm.8 as suggested by Michael Grant. + add `configure --disable-sys-install` to simplify and make a non-system + installation (e.g. by a user with a shell account) safer (no suid). + stop frequent complaints about bad flooding passwords in most cases. + +1.0.53 + fix bug in fuzzy checksums that was not handling long Base64 lines. + increase the thresholds for computing the Body and Fuz2 checksums + and decrease the threshold for the Fuz1 checksum. + limit work-around for broken Linux threads that need signals delivered + to the process group to Linux systems to avoid breaking dccm + on Solaris 2.6 systems. + add `cdccc "flood stats ID". Part of this involves a change + to format of the flod.map file. It will be automatically rebuilt. + fix `cdcc clients` and `cdcc stats` operations to do better with more + than 64 active clients. + fix core-dump in dccd found by James Carlson. + use Rgethostbyname() when SOCKS is configured. + fix private (not owned by the dcc user) whitelist files for dccproc. + notice and report missing incoming flood connections. + detect and complain about duplicate definitions in /var/dcc/ids + +1.0.52 + fix bug in dbclean that was inflating instead of compressing some + reports. + fix spurious emergency execution of dbclean by dccd. + deal with missing h_nerr and h_errlist[] in Solaris 2.6 as + suggested by Gary Mills. + fix use of old $DCCM_RUNDIR in rcDCC as suggested by Gary Mills. + fix extra blank in dcc.m4 as suggested by Gary Mills. + generate dcc.m4 with the local choice for /var/dcc/run with configure. + use dcc_inet_ntop() on systems that do not understand IPv6 to fix + a problem on Solaris 2.6 discovered by Gary Mills. + +1.0.51 + fix man pages on FreeBSD. + fix file descriptor leak in dccd when using SOCKS. + `cdcc "flood check"` forces dccd to re-resolve hostnames for flooding + peers that are failing. + +1.0.50 + Improve automatic dbclean-ing by dccd. + +1.0.49 + Check the log directory for dccproc and dccm after changing to the + home directory. + +1.0.48 + Split old records in the database so they compress better. + Reduce bandwidth required for flooding by summarizing checksum counts. + Fix configure in the partial packages, dcc-dccm-*.tar.Z and + dcc-dccproc-*.tar.Z + Fix `dccd -K no-IP`. + Fix error messages for `dccproc -c type,thold` and add "never" as in + `dccproc -c all,never` + Fix yet another bug in dcc_mkstemp(). + Add "NEVER" to -c for dccproc and -t for dccm. + Enhance `dccm -l logdir` and `dccproc -l logdir` to scatter log files + among directories for systems dealing with more than 500,000 + mail messages per day. + Dccm log files are now named "tmp.XXXXXX" until it is known that they + are needed and they are renamed to msg.XXXXXX or they are deleted. + +1.0.47 + Make "-n brand" optional for dccd. + decode Base64 before computing checksums. + remove `cdcc pck` and `cdcc delck body` operations. + add configure parameter --with-bad-locks to deal with Solaris mmap() + vs. fcntl() locking problems. + Dccm and dccproc shold keep only the last of several locally specified + header checksums. + Because people have been confused by env_To checksums being ignored + in server whitelists, they are now reported as errors. + +1.0.46 + Fix garbage in dccm log file names. + When run as root, dbclean avoids changing the owner of the database files. + Add logging to dccproc in the style of dccm. + Accept hex checksums to allow whitelisting message bodies, and especially + "empty" bodies contianing more than 1 KBytes generated by + Outlook Express. + Improve compression of old entries in the database. + Add checking of "substitute" headers. See -S in the dccm and dccproc + man pages. + +1.0.45 + Repair incoming flood duplicate detection broken in 1.0.44. + +1.0.44 + Dccd now tries to fix the database when it starts + dccd also marks the database potentially inconsistent while it + is running and until it stops cleanly. Graceless shutdowns + are now detected and the database is automatically checked with + `dbclean -R` before dccd resumes operation. + Add Fuz2 checksums to the default lists along with Fuz1 and Body + By default, dccd does not keep non-body checksums in the database. + The previous behavior can be restored with -Kall. + Double the maximum size of the database's hash table + Teach dccd to run dbclean to expire checksums so things work even + if the cron job doesn't + Misc/hackmc -D adds a local rule to reject mail from SMPT clients + without reverse DNS to the DCC + Suppress messages from dccd for EINVAL the second connect(). + This is lame, but both FreeBSD and Linux answer the second connect() + on a non-blocking socket after an ICMP Unreachable or timeout + with EINVAL. + Speed up dbclean for large databases + It is only about 2.5 times faster on linux 2.2.14-5.0 + Large systems handling more than 200,000 messages/day should + use --with-db-memory=500000000 or whatever is the appropriate number. + This change combined with the -K changes mentioned above produce + an overall speed-up of about 10 times for busy, not large systems. + Add configure parameter --enable-big-db to support server databases + with up to 2 billion instead of 16 million entries in the hash table + Fix problem with env_To white-listing reported by Mark Motley + Add -H to dccproc to emit only the header + Fix dccd to pass -L parameters to dbclean so that log messages from + automatic invocations of dbclean are not lost + + +1.0.43 + add prototype Fuz2 fuzzy body checksum and remove the subject checksum + See INSTALL.{html,txt} about DCC_RPT_SUBJECT if you want to + restore Subject checksums in in you DCC clients. + fix SOCKS connection and re-connection of flood stream. + add -c thresholds to dccproc and make its exit code indicate whether + they are exceeded. This should eliminate common needs to parse + the output of dccproc. + fix dccd iflod_send_pos() core-dump seen during very high network losses + to flooding peer. + deal with Linux bug in not allowing connect() after a previous + connect() to 127.1. + fix dccm core-dump on some platforms when whitelist hostnames fail to + resolve. + deal with Linux `bash` vs. `su` + handle duplicate local interfaces on Linux + make `cdcd "flood rewind"` require a remote server-ID + +1.0.42 + fix dccm crash while dealing with white list. + +1.0.41 + fix bug introduced in 1.0.37 that broke `cdcc add` + include truncated getifaddrs() for systems that do not have it to improve + the default behavior of dccd with multihoming. + fixes for syntax errors in misc/{rcDCC,stop-dccd} from Michael Ghens + make `dccm -W` less confusing. + change hackmc to report mail with bogus DNS senders to the DCC + +1.0.40 + fix for syntax error in /var/dcc/libexec/cron-dccd from Dave Lugo + deal with slow dccd response to dbclean + +1.0.39 + keep dccd from going crazy with a crazy value for -q + +1.0.38 + fix dccd core dump with Dave Lugo's help. + improve dccd host name resolving helper process. + improve misc/na-spam. + `cdcc 'stats clear'` now also clears the list of clients seen by dccd. + add a path of server-IDs to flooded checksum reports. + increase the number of checksums recognized by the server. + fix pthread error on SunOS and possibly AIX. + use absolute path for `cdcc` in /var/dcc/libexec/stop-dccd as suggested + by Sam Leffler. + improve fuzzy ignoring of MIME multipart boundaries. + + +1.0.37 + deal with lack of -s in SunOS `logger`. + dccd now has a helper process to wait for slow DNS servers to resolve + the names of flooding peers. + Deleting and restarting the DCC server's database now causes dccd to + ask peers to re-flood their checksums. This new feature required + changing the flooding protocol. DCC servers using the new protocol + talk to servers using the old protocol after the old servers start + their streams or with an explicit tag in the /var/dcc/flod file. + `sendmail -bs` is used by some mail user agents such as pine. In such + cases the sendmail milter interface gives filters such as dccm a null + pointer to what should be an IP address and a pointer to the + string "localhost". Dccm now acts as if such mail arrived from + IP address 127.1. This makes the common white list entry + "ok IP localhost" effective for such mail. Note that dccm deletes + X-DCC header lines with its own brand from white listed messages, + because they would otherwise be wrong and a potential vulnerability + to bad guys. + Fix `dccproc -o ofile` to include the X-DCC header in ofile. If this fix + is a problem, see `dccproc -C` + add /var/dcc/libexec/na-spam and ng-spam to gather spam from + news.admin.net-abuse.sightings + fix start-dccd, start-dccm, and cron-dccd to support multiple dccd + daemons in separate home directories. + +1.0.36 + support for OSF1. + handle msync() with only two parameters in old BSD/OS. + try to fix rare core-dump in dccm whitelist parsing. + fix error in misc/dccdnsbl.m4 noted by Michael Ghens. + fix autoconf errors for SunOS noted by Sam Leffler + add "log-del" option to /var/dcc/flod file + fix recent damage to DCC{D,M}_ARGS in start_dcc{d,m} + +1.0.35 + add DCC_LOG_FACILITY to dcc_conf as suggested by Sam Leffler. + You must install the new homedir/dcc_conf with your parameters + to use it. + fix recently introduced bug that kept dccd from automatically + running dbclean to expand the database. + document the output of the dblist program in its man page. + `configure --with-rundir` can be used to override the use of /var/run/dcc + for the PIDs of DCC daemons, sockets, and so forth. + `configure --with-uid=dcc` creates Makefiles and scripts to install + and start DCC programs as the user "dcc" + + +1.0.34 + support for IRIX + fix bug in setting libexecdir for configure + change `cdcc stats` to show cumulative report counts + increase maximum number of flooding peers from 16 to 32 + and make it a compile-time parameter + change $UID in misc/start-dcc{d,m} to the avoid reserved variable in + RedHat 6.2 as suggested by Michael Ghens + fix bug in cron-dccd found by Michael Ghens and Dave Lugo + remove mechanism for configuring the DCC home directory by setting + an environment variable before invoking `make` + change the default value of the -u anon-delay parameter for dccd to 0. + add "flood list" operation to `cdcc` + look for sendmail for dccm in a FreeBSD "ports" package + +1.0.33 + support for HPUX thanks to Richard Rauenzahn. + check against "$USER" instead of "root" in start-dccm and start-dccd + as suggested by Luke Crawford. + make the server rate limits configurable at compile-time. + +1.0.32 + fix bug in local white lists that ignored changes in the count field + by default, start-dccm no longer tells dccm to reject based on + message-ID checksums + fix recently introduced bug that kept flooding off after the + hash table needs to be expanded. + +1.0.31 + add SOCKS support. + dccproc only logs errors unless given -d. This should fix problems + in some mail systems using dccproc caused by network problems. + fix permissions bugs related to using private map files + the dcc_notspam sendmail macro used by dccm with -o must be non-empty + to be considered "set". + +1.0.30 + fix man page installation on OpenBSD. + fix bug in starting incoming floods on systems with IPv6 interfaces + but without what DCC recognizes as IPv6 support such as OpenBSD. + deal with systems such as OpenBSD with lame mmap() support. + speed up recognition of changes in the /var/dcc/flod file. + use DCCM_REJECT_AT in /var/dcc/dcc_conf to also set the default + flooding threshold used by dccd when it is started by + /var/dcc/libexec/start-dccd + add configure switches to not build dccm and the server + `dccd -u` turns off `cdcc stats` from anonymous systems to avoid telling + strangers how many mail messages a small DCC server has seen. + +1.0.29 + fix start-dccd to deal better with non-standard DCC home directories. + dccproc is now like dccm and treats a missing Message-ID header. + as if it were present and with a null value. + do the right thing for DCC servers running on platforms where + gethostname() fails completely on a short buffer instead of + giving a prefix of the hostname. + detect and quit on null hostname from gethostname(). + +1.0.28 + improve the handling of an already running daemon in by misc/start-dccd + support mapping of ranges of server IDs when flooding reports + yet more changes to deal with quoted-printable. These changes + generally cause the fuz1 checksum to differ. + remove need for FEATURE(delay_checks) when reporting sendmail access_db + hits to DCC server + change body checksum to ignore '>' in "\n>From" because the '>' is + often added for old UNIX MUAs. + improve response of dccproc to 20KByte or larger To: headers. + make `cdcc "file map2; load map2.txt"` act the same as + `printf "file map2\nload map2.txt" | cdcc` + dccm now treats a missing Message-ID header as if it existed but with + a null value. + +1.0.27 + change example scripts to deal with `expr` exiting with 1 and stopping + them on Solaris + fix client IDs larger than 65535 + detect and complain server IDs offered to `cdcc` as client IDs + +1.0.26 + if dccm is already installed, try to build it even if the sendmail + milter library is not available to prevent silent failures to + install new versions of dccm. + +1.0.25 + fix confusion if a quoted-printable sequence overlaps a buffer boundary. + do not give up on remote servers if a local server responds with + an ICMP unreachable error. + +1.0.24 + minimize interpreting '=' in a URL as quoted-printable to make dccproc + and dccm compute the same fuzzy checksums more often. + +1.0.23 + fix confusion in dccproc about whether an initial line of a message + that starts with blanks is a continuation of the last header line + +1.0.22 + fix infinite loop and packet spew from dccproc when the clock jumps + backward or jumps forward more than 1000 seconds. + fix syslog process name on Solaris and AIX + `dccproc -R` picks IP address out of standard Received: lines + fix bugs in decoding quoted printable with broken soft ends of lines + +1.0.21 + repair DCC server whitelist broken in 1.0.20 + +1.0.20 + support for Solaris + describe ways to connect spam traps to the DCC in INSTALL.html + move parameters from start-dccd, start-dccm, and cron-dccd to a common file + add misc/rcDCC start-up script for Solaris and Linux + fix byte-order bug in flood header server ID which requires changing + the flood protocol. To flood to version 1.0.19 or older versions + of dccd, specifiy version 4 in the flod file line. + removed locking file /var/dcc/map.lock + change handling of spam sent simultaneously to white-listed and unlisted + targets. See the discussion of the new "REJECT_ONLY" action in the + dccm man page. + +1.0.19 + improve `cdcc stats` flood formatting + fix `cdcc "host domain.com; stats all"` + change dccproc to use the value of the Return-Path: header for the + envelope-From checksum if the header is present and -f is not used. + fix `dbclean -S -N` when the whitelist is empty + add rough support for NetBSD. + mention dccd in the INSTALL file. + fix for parsing "-L error,LOCAL1.ERR" from Vincent Schonau + +1.0.18 + add "clients -n" to cdcc + add -C to dccproc + +1.0.17 + add dccsight + +1.0.16 + try again to deal with getifaddrs() without freeifaddrs(). + fix bug introduced in 1.0.15 that causes dccproc to require + a white-list + fix corruption of /var/dcc/map when dccproc is run with stderr not + open and when the DCC server first fails to answer. + +1.0.15 + make the sendmail {dcc_isspam} and {dcc_notspam} macros consistently + override what dccm and the DCC server determine + +1.0.14 + deal with systems that have getifaddrs() but not freeifaddrs(). + fix bogus response from server when a duplicate request from an + anonymous client arrives before the original request has been + scheduled to be answered. + fix obscure double-trip bug in threaded client library. + accept "rpt-ok" as well as "rpt_ok" in the ids file. + fix /var/dcc/flod option scanning bug by dccd. + 'dccd -u 999999' turns off access by anonymous or unauthenticated clients. + add -W to dccm to cause only explicitly listed targets to be protected + by the DCC + add a "reject" server-ID translation target in the flods file to + not send or receive the reports of some servers. + +1.0.13 + add RTT adjustment to cdcc load and add operations to allow a client + to prefer servers despite worse RTT's + +1.0.12 + in dccm count two intead of one open file for each active job against + the system imposed limit on open files for automatically setting + the value of -j for dccm and for automatically changing the soft + resource limit. + use the GNU autoconfig install script instead of `install -d` to create + $(HOMEDIR)/libexec because GNU autoconfig does not detect install + programs that do not understand -d + rate limit complaints by dccd about unrecognized server IDs + +1.0.11 + dccm tolerates null sender IP addres and hostname from `sendmail -bs` + from sendmail 8.11.3 but perhaps not from 8.12. + change -p for dccd and dbclean to -a to allow specification of entire + server addresses. + by default, dccd listens on separate UDP sockets so that clients receive + responses from the same IP address to which they send requests. + +1.0.10 + fix "bogus oflod complaint length 0" nonsense from server + `cdcc stats` counts the clients seen in the last 24 hours, but + `cdcc clients` displays all that fit in the cdcc buffer even if + older than 24 hours + the `configure` script looks at `make -v` to guess whether to generate + gmake or make makefiles + include list of common "dictionary attack" user names among the sample + homedir files + +1.0.9 + body checksums ignore effects of quoted-printable encoding + deal with versions of gmake that do not understand ?= + improve "clients" request of cdcc + +1.0.8 + fix rate limiting bugs in the server + fix local env-To whitelist + +1.0.7 + fix locking bug when client whitelist file cannot be opened + use `install -c` to not delete misc scripts + fix server flood stalls when there are many stale or whitelisted + reports + +1.0.6 + fix bug in alternate dccm argv[0] in start-dccm + fix bug in noticing changes to included white lists + +1.0.5 + install cron-dccd, start-dccd, and start-dccm in $(HOMEDIR)/libexec + +1.0.4 + fix server core-dump for repeated invalid admin. opcodes while + tracing is enabled. + add "clients" request to `cdcc` + add "stats all" request to `cdc + add homedir/start-dccm.sh + /var/run/dccm.pid and /var/run/dccm depend on argv[0] + white-lists can use "include pathname" + dccm -o overrides -s + dccm -o and -s have default values + move /var/run/dccm and /var/run/dccm.pid to the directory /var/run/dcc + and change the sendmail "feature" file misc/dcc.m4 to match + +1.0.3 + improve flood ID mapping + remove need to explicitly build before `make install` diff -r 000000000000 -r c7f6b056b673 FAQ.html.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FAQ.html.in Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,1384 @@ + + + + + DCC FAQ + + + + + +

Distributed Checksum Clearinghouse (DCC) Frequently Answered Questions

+ +

+Current versions +of this list can be found among the +http://www.rhyolite.com/dcc/ +web pages and their mirror +at +http://www.dcc-servers.net/dcc/. + + +

+ +

+


+ +
+ +
+What is the Distributed Checksum Clearinghouse or DCC? +
+The DCC or Distributed Checksum Clearinghouse is an anti-spam content filter +that runs on a variety of +operating systems. +The idea of the DCC is that if mail recipients could compare +the mail they receive, they could recognize unsolicited bulk mail. +A DCC server totals reports of "fuzzy" checksums of +messages from clients and answers queries about the total counts +for checksums of mail messages. +

+See the main DCC man page as well as the +DCC web page +and its mirror. + + +

+Is the DCC source free +
+The non-commercial Distributed Checksum Clearinghouse source carries a +license +that is free only to organizations that do not sell filtering devices or +services except to their own users and that participate in the global +DCC network. +ISPs that use DCC to filter mail for their +own users are intended to be covered by the free license. +You can redistribute unchanged copies of the free source, but you may not +redistribute modified, "fixed," or "improved" versions of the source +or binaries. +You also can't call it your own or blame anyone for the results of using it. +

+Organizations that do not qualify for the free license are welcome to +inquire about licenses for the commercial version by email to +sales@rhyolite.com +or via the +form. +The commercial version supports +DCC +Reputations. +

+Please note that organizations that do not qualify for the free DCC license +have never been allowed to use the public DCC servers. + + +

+Where can I get DCC source? +
+The official DCC source repositories are at +www.rhyolite.com/dcc/ +and +http://www.dcc-servers.net/dcc/. +

+Please do not try to use ancient versions of DCC software dating from early +2005 and redistributed by third parties including some Linux packagers. +Those versions do not detect bulk mail as well as more recent versions. +Installations using those old versions also have problems using the +public DCC servers that often make it necessary to add their IP addresses +to the blacklist that protects the public DCC servers. +Even worse, all known Linux redistributions of DCC software have been +changed in ways that break things, including the +libexec/updatedcc shell script that could +otherwise be used to fetch, configure, compile, install, and restart +a current version. +

+When installing DCC software, please consider the installation instructions +in the +INSTALL.html file included with +the source or in the +on line source trees. + + +

+Where can I get DCC RPMs, packages or other binary forms? +
+There are no official distributions of DCC binaries, +whether simple a.out files, RPM Package Manager (RPM) packages, +or BSD style ports or packages (pkg). +There are many unofficial sources of DCC binaries, including +Linux RPMs and BSD style packages. +

+As of 2008, the FreeBSD packages are not too far out of date and +include a working version of the +libexec/updatedcc shell script that +fetches, configures, compiles, installs, and restarts +a current version. +

+As far as known in 2008, all DCC RPMs offered by Linux distributors +are based on DCC software from 2005 and should not be used. + + +

+Do the fuzzy checksums ignore personalizations? +
+Yes, they ignore many personalizations and +hash busters. + + +

+How much bandwidth, disk space, and computing does the DCC require? +
+The UDP packets used by a DCC client to obtain the checksum totals +from a DCC server for a mail message generally use less bandwidth than +the DNS queries required to receive the same message. +A DCC client needs very little disk space. +

+Bulk messages are usually logged by DCC clients. +On systems receiving a lot of mail, the mechanisms for automatically +creating new log directories every minute, day, or hour +can keep any single log directory from becoming too large. +See the dccm +and +dccproc +man pages. +

+About 1.4 GBytes/day are exchanged between each pair of DCC servers. +Each server has 3 or 4 peers. +The resulting database is about 3 GBytes with the default expiration +parameters.. +However, while dbclean is deleting old checksums, +there are three copies of the database. +The DCC clients and server do not need many CPU cycles, +but the daily executions of dbclean +on a system with a DCC server +require a computer with at least 2 or 3 GBytes of RAM. +In 2006, +a DCC server prefers 4 GBytes of RAM and can use 6 GBytes. +12 to 18 GBytes of disk space are also needed. +

+DCC servers used by clients handling 100,000 or more messages per day +need to be larger. +Each additional 100,000 messages/day need about 100 MBytes of disk space +and system memory, given the default expiration used by +dbclean. + + +

Do I need to run a DCC server? +
+A mail system that processes fewer than 100,000 mail messages per day +uses less of its own bandwidth and the bandwidth of other DCC servers +by using the public +DCC servers. +Each mail message needs a DCC transaction that requires +about 100 bytes, and so 100,000 mail messages/day imply about 10 +MBytes/day of DCC client-server traffic. Each DCC server needs to +exchange "floods" or streams of checksms with 4 other servers. Each +flood is currently about 1.4 GBytes/day for a current total of about +3 GBytes/day. +

+When normally installed by the included Makefiles, DCC clients are +configured to use the +public DCC servers +without any additional configuration except opening firewalls to port UDP 6277. +

+Mail systems that process more than 100,000 mail messages per day +need local DCC servers connected to the global network of DCC servers. +The public DCC servers include denial of service defenses which +ignore requests in excess of about 240,000 per day per client. +

+It is wrong to resell the CPU cycles, network bandwidth, +disk space, and, most important, human system administration work of the +public DCC servers. +Vendors of "anti-spam appliances" or similar +that do not steal from the operators +of the public DCC servers have always run their own DCC servers. + + +

+What happens to my mail if the DCC break? +
+When in doubt or trouble, the DCC clients including +dccproc and dccm +deliver mail. They wait only a little while for a DCC server +to answer before giving up. They then avoid asking a server for a while +to avoid slowing down mail. +

+If the DCC sendmail interface or milter program, dccm, crashes, +the default parameters in misc/dcc.m4 +for the sendmail.cf Xdcc line +tell sendmail to wait only about 30 seconds before +giving up and delivering the mail. +

+The DCC client code keeps track of the speeds of the +servers it knows about, and uses the fastest or closest. +Every hour or so it re-resolves A records +and checks the speeds of the servers it +is not using. When the current server stops working or gets significantly +slower, the client code switches to a better server. + + +

+How do I mark spam without rejecting it? +
+Unless given thresholds at which to reject mail, +dccm +and +dccproc do not reject mail. +When dccm is given a threshold by setting DCCM_REJECT_AT in +dcc_conf in the DCC home directory, +DCCM_ARGS can also be set to "-a IGNORE +so that spam is marked but not rejected. + + +

+Why doesn't the man command find the man pages? +
+The nroff source, formated nroff output, and HTML versions of the +man pages are in the top-level source directory. +Formatted or nroff source is installed by default somewhere in /usr/local/man +depending on the target system. +It may be necessary to add /usr/local/man to the MANPATH environment variable. +Even with that, SunOS 5.7 sometimes has trouble finding them unless +man -F is used. + + +

+Must sendmail be used with DCC? +
+While the sendmail milter interface, dccm +and the DCC program interface or dccifd +are the most efficient ways to report and check DCC checksums, +dccproc is also commonly used. + + +

+Can the DCC be used with smtpd? +
+Yes, dccproc can be used with Obtuse's smtpd. +Dave Lugo has contributed a shell script to the +smtpd-sd project +which can be used to do DCC checking prior to the end of the SMTP +DATA command. + + +

+Can the DCC be used with Exim? +
+There are comments about using Dccproc with +Exim +in the +DCC mailing list archives +including these messages: + +

+However, those mailing list messages talked about using +dccproc before +dccifd was available. +Dccproc is suitable only for low mail volumes. + + +

+Can the DCC be used with SpamAssassin or other spam filters? +
+The DCC can be used with +SpamAssassin as +well as other spam and virus filters. +Note that it is more efficient to arrange to use a DCC client daemon +such as dccm to mark passing mail and check +X-DCC header lines in the filter than to start and run +dccproc on each message. +

+Some commercial virus and spam filters include DCC clients that +query public DCC servers or DCC servers operated by the filter vendor +and that "flood" or exchange bulk mail checksums with public servers. +Reputable manufacturers of such devices operate their own DCC servers +connected to global network of DCC servers instead of stealing and then +selling the CPU cycles, network bandwidth, disk space, and, most important, +human system administration efforts of the public DCC servers. + +

+How long must SpamAssassin or an MTA wait for DCC results? +
+DCC clients including dccproc, dccifd, and dccm can wait as long as +about 16 seconds for an answer from a DCC server. +Except when an anonymous client triggers the progressive delays that are +among the defenses against denial of service attacks in the public DCC servers, +delays are almost always less than 10 seconds. +Delays for DNS blacklists +(see dccifd -B) +are additional. + + +

+How can the DCC be used with mail user agents? +
Dccproc can be used with any mail user +agent that can check mail headers. +For example, WD Baseley sent a +note +to the DCC +mailing list +on how to configure Eudora to +act on X-DCC header lines. +

+Bharat Mediratta has developed DeepSix for people using mail user agents +on UNIX boxes connected remote servers such as corporate Exchange servers. +See his +project on Sourceforge +as well as his +announcement +in the DCC mailing list. + + +

+Must I have the root password to use DCC? +
+No, the procmail or sendmail .forward DCC user program, +dccproc +can be installed in an individual ~/bin directory. +Then cdcc +can create a private map file used with +dccproc -h dir +or +dccproc -m dir/map. +

+Also see the DCC installation +instructions. + + +

+Why don't the public DCC servers work? Do I need a client-ID? +
+The public DCC servers accept requests from clients using the +anonymous client-ID. +Incorrectly configured firewalls often cause problems. +Traceroute can be used to send UDP packets to test for interfering firewalls. +See the answer to the firewall question. +

+After firewalls, the most common cause of problems while trying to +use the public DCC servers is sending too many requests. +The DCC server daemon, dccd, includes +defenses against denial of service or DoS attacks. +Those defenses include progressively delaying responses +and eventually ignoring requests. +The ancient version of the DCC client software included in some +Linux redistributions tries so hard to reach the fastest server +that it can trigger those DoS defenses. + +

+Which ports do I need to open in my firewall? +
+DCC traffic is like DNS traffic. You should treat port 6277 +like port 53. +Allow outgoing packets to distant UDP port 6277 and incoming packets +from distant UDP port 6277. +

+If the command `cdcc info` says no DCC servers are answering, +you may need to adjust your firewall. +Also consider the other reasons why the +public DCC servers can ignore requests. +

+If you run a DCC server, open incoming connections to local TCP port 6277 +from your flooding peers, +and outgoing connections to TCP port 6277 on your flooding peers. +Also open UDP port 6277 to IP address 192.188.61.3 for the DCC server status +web page. +

+See also the discussion of Cisco ACLs at +http://www.dcc-servers.net/dcc/firewall.html. + +

+Why does the dccd database +grow without bound? +
Dbclean should be run every night when the +system is least busy +with the misc/cron-dccd script. +An entry like misc/crontab should be put into +the crontab file for the user that runs dccd. + + +

+The dccd database is corrupt. What should I do? +
Dbclean -R +will usually repair a broken +DCC server database. +However, +if your server is "flooding" or exchanging checksums with other servers, +it is often quicker to stop the DCC server, +delete the +@prefix@/dcc_db and +@prefix@/dcc_db.hash files +and restart dccd with the +libexec/start-dccd script. +When dccd starts, it will notice that the database has been purged +and ask its flooding peers to rewind and retransmit their checksums of +bulk mail. + + +

+How can I stop the log directories from overflowing? +
+Global dccm +or dccifd +logging can be entirely +disabled by setting DCCM_LOGDIR="" or DCCIFD_LOGDIR="" in the +dcc_conf file in the DCC home directory. +Logging for individual users can be disabled by not creating or deleting +thir log directories. +However, this not only disables logging of rejected mail, but also logging +of mail that suffered system failures. +

+To delete old log files, run the +misc/cron-dccd script +daily with an entry like misc/crontab +in the crontab file for the user that runs dccd +or dccd. +The DBCLEAN_LOGDAYS parameter in the +dcc_conf file in the DCC home directory +specifies the age of old log files. + + +

+Why do my DCC clients including +cdcc and dccproc +complain about "Resource temporarily unavailable"? +
+Perhaps your operating system has bugs in its implementation of +fcntl file locking, particularly for the +DCC client map file when it is on +an NFS file system. +

+Another common case is using an editor such as some versions of vi +that locks files on the main or a per-user +whiteclnt file, + + +

+Why does dccifd or dccm complain about +thread_create() failed: 11, try again? +or pthread_create(): Cannot allocate memory? +
+The most common cause of +thread_create() failed: 11, try again +or pthread_create(): Cannot allocate memory +error messages from dccm +and dccifd +is a too small limit on the maximum number of processes allowed +the UID running the dccm or dccifd process. +The "maxproc" limit seen with the `limit` or `limits` shell command +should be a dozen or so larger than the sum of +the queue sizes of dccm or dccifd (or both if both are running). +

+See also the common question and answer about +too many simultaneous mail messages. + + +

+Why does dccm or dccifd complain about +too many simultaneous mail messages? +
+Dccm or dccifd can fail to create a thread to deal with an incoming +mail message if there are no available file descriptors or +other resources. +Adding -d to DCCD_ARGS or DCCIFD_ARGS in +dcc_conf in the DCC home directory +sends a message to the system log that includes the limit on simultaneous mail +messages and its source, such as a process resource limit on the +number of file descriptors. +

+Another common limit is the maximum number of file descriptors +allowed by the select system call. +This limit can be escaped by building the sendmail milter library to +use the poll system call. + + + + +

+Why doesn't my DCC client pick my local DCC server? +
+The DCC clients including dccm +and dccproc pick the nearest and fastest +server in the list kept in the @prefix@/map +file. +DCC servers not in that list will not be used. +That list can be viewed with the +cdcc info +or +cdcc RTT operations. +Add to the list with +cdcc add +or cdcc load. +

+A nearby server that seems slower than a more distant server will +not be chosen. +The anonymous user delay set with dccd -u +is intended to make a server appear slow to "freeloaders." +The "RTT +/-" value that can be used with +the cdcc add +and cdcc load +operations can be used to force DCC clients to prefer or avoid servers +except when absolutely necessary. + + + +

+If I have a server-ID, do I need a DCC client-ID, or vice versa? +
+DCC server and client-IDs +serve distinct purposes. +Servers require server-IDs to identify each other in the floods of checksums +they exchange and to recognize authorized users of powerful +cdcc operations such as stop. +DCC servers require client-IDs to identify paying clients that should +be given quicker service that anonymous clients, to refuse reports from +anonymous clients, or to refuse even to answer queries from anonymous +clients. + + +

+Why does my DCC server complain about +"rejected server-IDs" among flooded checksum reports? +
+You have turned on IDS tracing, but do not have a +@prefix@/ids file that is complete. +You don't need and probably will not have a complete file unless you +are assigning DCC server-IDs. +

Redundant paths among DCC servers exchanging +or flooding reports of checksums would cause duplicate entries in +each server's database without the mechanism that depends on every DCC server +having a unique server-ID. +With IDS tracing enabled, dccd complains +about server-IDs that are not listed in the local +@prefix@/ids file. + +

+Why does my DCC server refuse to accept more than +50 operations per second? +
+A common cause of such problems is one of the DCC server's +defenses against denial of service attacks. +A DCC server cannot know anything about anonymous clients, +or clients using client-ID 1 or without a client-ID and matching password +from the @prefix@/ids file. +As far as your server can know, an anonymous client sending many +operations is run by an unhappy sender of unsolicited bulk mail trying +to flood your server with a denial of service attack. +It is easy to tell your client its ID with the +cdcc add +or load operations. +

+The default limits can changed by +adding an dccd -R argument +can be added to DCCD_ARGS in the +dcc_conf file in the DCC home directory, + + +

+How do I keep strangers from using my DCC server? +
+See the dccd -u option. + + +

+How can I determine why dccm reported +a message as spam or with a recipient count of "MANY"? +
+Dccm is usually configured to log mail with recipient counts greater +than the -t ,log-thold, +as well as mail with some conflicts among +whitelist entries. +Each log file contains a single message, its checksums, its disposition, +and other information as described in the +dccm man page. +

+See also the dblist -C command. + + +

+How can I see what checksums my server has heard from its clients? +
+The dblist -Hv +command displays the contents of the database. +Look for records with your +server-ID +with dblist -I. + + +

+How do I stop DCC false positives? +
+You are probably not seeing false positives. +The Distributed Checksum Clearing Houses detect both solicited +and unsolicited bulk mail, while spam is only unsolicited bulk email. +For your DCC client, dccm, +dccifd, or +dccproc, to know to ignore bulk mail messages +that are solicited, it must be told by entries the main or a per-user +whitelist or whiteclnt file. + + + +

+Why is mail from my favorite mailing list marked with an +X-DCC header line that says it is spam? +
+Sources of solicited bulk mail including mailing lists to which +you have subscribed should usually be in your DCC client +whitelist +so that they receive no X-DCC header lines. + + +

+Why are acknowledgments of spam reports mistakenly marked as spam by DCC? +
+There is probably no mistake. +DCC detect bulk mail and not only unsolicited bulk mail. +Whether a bulk message is spam depends on whether you solicited or asked for it. +Some INTERNET service providers have sent literally millions of +acknowledgments of spam reports, which makes them bulk mail. +Bulk mail you want to receive should be +whitelisted +in your master or per-user +whiteclnt file. + + +

+Why are some checksums missing from my X-DCC header lines? +
+If the DCC client was not able to compute a checksum for a message, +it will not ask the server about that checksum and the checksum will +not appear in the X-DCC header. +For example, if dccproc is not told and +cannot figure out the IP address of the source of the message, +that checksum will be missing. +The Fuz1 and Fuz2 checksums cannot be computed for +messages that are too small, and so will be missing for them. +A checksum will also be missing if the DCC server is configured to not count +it. + + +

Do I need both server and client + +whitelists? +
+The server whitelist file +used explicitly by dbclean +and implicitly by dccd +is not very useful and probably a bad idea. +

+The client whitelist files +used by +dccproc, +dccm, +and +dccifd +are generally required. +Client whitelists apply only to the stream of mail handled by the +DCC client, +while server whitelists apply to reports of mail from all DCC clients +of the DCC server. +

+Dccproc is intended for use by individual users +with programs such as +procmail. +Because the global whiteclnt file usually found in the DCC home directory +is as likely to be used as a private file, +the file name must be explicitly specified with +dccproc -w whiteclnt. +A perhaps inconvenient implication is programs such as +SpamAssassin that +switch unpredictably between dccproc and dccifd +might get inconsistent results unless they invoke dccproc with the global +whiteclnt file. + + +

+How do I maintain client +whitelists? +
+Start by monitoring bulk mail in the +global log directories specified with +dccproc -l +and with DCCM_LOGDIR and DCCM_USERDIRS in the +@prefix@/dcc_conf file +for dccm, +and +dccifd. +Then add entries to whitelist files. +

+The global +@prefix@/whiteclnt file +and the whitelists specified with +dccproc -w are maintained +with ordinary text editors. +

+Per-user whitelists in whiteclnt files +specified with DCCM_USERDIRS in the +@prefix@/dcc_conf file +are easily maintained with ordinary text editors by the system administrator. +However, it is often better to let individual users deal with their +own whitelists. +The DCC source includes sample CGI scripts +in the cgi-bin directory in the DCC source +to let individual end-users monitor their private logs of bulk mail +and their individual whitelists. +See the README file for those scripts. +There is also a +demonstration +of the cgi scripts. + + +

+When the whitelist file +used by dccm, +dccd, +or dccifd +is changed, +what must be done to tell the software about the change? +
+The DCC clients notice when their whiteclnt files +as well as included files change and automatically rebuild the corresponding +.dccw hash table files. +

+Changes to the DCC server or dccd +whitelist +are not effective until after dbclean is run. +

+Some text editors including versions of vi lock their files. +Dccm, +dccproc, +and dccifd +are unable to read whitelist files while they are locked. + + +

+How do I test a whiteclnt file? +
+An easy way to test a DCC client whitelist or +whiteclnt file +is to feed dccproc with a test message. +For example, the following shell script would test whether the IP address +127.0.0.1 +and the SMPT envelope Mail_From value postmaster@example.com are in the +whiteclnt file in the DCC home directory: +
+        #!/bin/sh
+        /usr/local/bin/dccproc -QCw whiteclnt \
+                -a 127.0.0.1 -f postmaster@example.com <<EOF
+        Message-ID: <1234@example.com>
+
+        text
+        EOF
+
+If the script produces something like +
+        X-DCC--Metrics: calcite.rhyolite.com; whitelist
+                            reported: 0               checksum         wlist
+                       IP: e475b896 492c60fc efecb432 6e29e3c5            ok
+                 env_From: bef98dc1 cc6ea4d7 b8daf07c a2bfbc9e
+               Message-ID: 26573398 2ab927cd 681a89fa e502496d
+
+then you know that SMTP client IP (mail sender) IP address 127.0.0.1 +is whitelisted, but the SMTP envelope Mail_From value is not. + + +

+Can I use wild cards or regular expressions in DCC + +whitelists? +
+No, regular expressions cannot be used, +because DCC client and server whitelists are converted to lists of checksums. +The same basic idea is used for DCC client whitelists +as for the DCC protocol. +A DCC client computes the checksums for a message, and then looks +for those checksums in the local whitelist. +Depending on the values associated with those checksums, +the DCC client asks a DCC server about them. +

+To use regular expressions with the DCC, consider procmail. +Procmail is included with many UNIX-like systems. +See also the +Procmail Homepage. +

+DCC clients can be configured to white- or blacklist +using called "substitute" headers. +See dccproc -S or +dccm -S. +

+It is also possible to use a sendmail access_db file entries to +white- or blacklist based on portions of SMTP envelope and +client IP addresses. +For example, an access_db file line of "From:example.com OK" +can be used to tell dccm to whitelist all mail from SMTP clients +in the example.com domain. +See the -O argument to the +misc/hackmc script. + + +

+How do I whitelist mail from a legitimate +bulk mailer using its name or SMTP headers such as Mailing-List +headers? +
+Start by determining an envelope value or SMTP header that distinguishes +the bulk mail from a sample message or DCC log file. +The name of the sending computer is the mail_host value in +dccm log files. +If the distinguishing header or envelope value is not among the main +DCC whitelist values, +then a "substitute" value must be used. +An "ok substitute ..." line must be added to the whitelist file +and the DCC client program must be told with +dccproc -S or +dccm -S. +There are example whitelist entries in the sample +@prefix@/whiteclnt file. +

+ +

+Why does dccm or dccifd complain about "incompatible whitelists"? +
+There are several points during an SMTP transaction when an SMTP server +can reject a mail message. +Early points are when the SMTP client specifies the recipients of the +mail message. +The last point is after the entire message has been received by the SMTP +server. +Spam filters that check mail message bodies must wait until that last point. +The SMTP protocol does not allow an SMTP server to reject the +mail message for only some recipients. +The SMTP server must tell the SMTP client that the message has been +accepted for all or rejected for recipients. +This is a problem when the recipients of a single mail message have +differing +DCC thresholds or other parameters +in their individual whitelist files +that require that the mail message be delivered to some mailboxes but +rejected for other mailboxes. +

+The DCC client programs solve this conflict in one of two ways. +One is telling the SMTP client +that the mail message has been accepted for all recipients and then +discarding instead of delivering the message for mailboxes with parameters +that make it spam. +This solution has the disadvantage of not informing senders of the +refusal to deliver the message. +The other solution is to temporarily reject recipients with possibly +incompatible parameters early in the SMTP transaction with the same +SMTP error status number as too many recipients for a single SMTP transaction. +This second solution has the advantage of ensuring that senders know +when their mail is rejected but the disadvantage of sometimes +requiring as many SMTP transactions as there are recipients for a mail message. +

+Which solution is used is determined by the +forced-discard-ok +and forced-discard-nok +settings in the global and per-user +whiteclnt files. +Unless all recipients for a mail message agree on the first solution, +perhaps by forced-discard-ok in the main +whiteclnt file, +the second solution is used. + + +

+Why do legitimate mail messages have +X-DCC header lines that say they are "bulk", "many", or spam? +
+There are several possible causes of such problems. +The first and most obvious is that the mail is solicited bulk mail +and that the source needs to be added to your +whitelist. + +

Another possible reason is that your individual legitimate mail messages +have not been marked as spam because their Body or Fuz1 +checksum counts are small, but that the IP address or other checksum +counts are large. +The IP address checksum count, for example, is the total of all reports +of addressees for that checksum. +That total is independent of the other checksums, and so counts +all reports for all messages with that source IP address. +A source of legitimate mail that has sent a message that was reported +as spam by one of its recipients will often have the totals +for the checksums of its IP address, From header, and +other values be MANY. +This is why it usually does not make sense to reject mail based on what the +DCC server reports for the IP address, From header, and other values that +are not unique to the message. +Only the last Received header line, the Message-ID line, and body checksums +can be expected to be unique and sometimes not the Message-ID +and Received header lines. + +

+Why is legitimate mail from someone using qmail +marked as spam? +
+A common cause for that and similar complaints involves +null or missing Message-ID header lines. +Spam often lacks Message-ID lines or has a null or "<>" ID, +so rejecting mail with null or missing Message-IDs can be an +effective filter. +DCC clients treat missing Message-ID lines as if they were present but null. +The sample @prefix@/whiteclnt +whitelist file in the DCC source +includes the line: +
+        many    message-id <>
+
+Some Mail Transfer Agents violate section 3.6.4 of RFC 2822 and +do not include Message-ID header lines in mail they send, +including some combinations of qmail and +"sendmail -bs" acting as the originating MTA, +and qmail by itself when it is generates a non-delivery message or "bounce." +Solutions to this problem include removing that line from your +whitelists +or adding lines specifying the From or envelope +from values of senders of legitimate mail lacking Message-ID header lines. + + +

+Are IP address blocks +in whitelists used by +dccproc? +
+Yes, dccproc can whitelist mail +by the IP address of the immediately +preceding SMTP client, +but only if it knows that IP address. +Unless the dccproc -a +or dccproc -R +options are used, dccproc does not know the IP address. + + +

+Why is dccproc is ignoring +env_from whitelist +entries? +
+DCC checksums are of the entire header line or envelope value. +An entry in the whitelist file for jsmith@example.com +will have no effect on mail with an envelope value of +"J.Smith" jsmith@example.com. +The file must contain "J.Smith" jsmith@example.com. +

+Another common cause for this problem is implied by the fact that +for an env_from whitelist entry +to have any effect, dccproc must be able to find the envelope value +in the message in a Return-Path header, +an old UNIX-style From_ header, or an -f argument. +If your mail delivery agent does not add a Return-Path header +and you do not use +dccproc -f, +then dccproc cannot know about +white or blacklist entries for envelope return addresses. +

+Note also that dccproc has no whitelist by default and +that dccproc -w +must be used. + + +

+What if I make a mistake with +dccproc -t many +and report legitimate mail as spam? +
+It is possible to delete checksums from the distributed DCC +database with the +cdcc delck +operation. +However, it is not worth the trouble. +Unless the same (as far as the fuzzy checksums are concerned) message +is sent again, no one is likely to notice the mistake before the +report of the message's checksums expire from the DCC servers' +databases for lack of repetition. + + +

+Can the sendmail "spamfriend" mechanism tell +dccm to not check mail sent to some addresses? +
+Sendmail decisions to accept, reject, or discard mail are largely +independent of the decisions made by dccm. +The DCC equivalent is to add +env_to entries to the +dccm whitelist. +See the sample @prefix@/whiteclnt file in the +DCC source +

+However, if your sendmail.cf file sets the +dcc_notspam macro while processing the +envelope, then the message will by whitelisted. +This is related to the dcc_isspam macro +used by sendmail.cf modified by misc/hackmc -R +to tell dccm to report blacklisted messages as spam to the DCC server. + + +

+How do I tell dccm +to not check mail for an entire domain? +
+To whitelist all mail addressed to mailboxes in a domain, +add the following line to the sendmail access_DB file and rebuild +the database with the sendmail tool, makemap: +
+        To:domain.com       DCC:OK
+
+

+You can apply finer control by adding +a third argument to the FEATURE(dcc) macro in your sendmail.mc file +as described in +misc/dcc.m4. +All mail for the domain can use a single "per-user" +whiteclnt file, +often in the @prefix@/userdirs/esmtp/example.com, where @prefix@/userdirs +is the default value for DCCM_USERDIRSin the DCC configuration file +@prefix@/dcc_conf. +Making @prefix@/userdirs/esmtp a symbolic link to @prefix@/userdir/local +can be handy. + + +

+How can I avoid polluting databases of DCC servers with +checksums of my mail that is not spam? +
+Reports of checksums with +whitelist +entries in your server's database are not flooded to its peers. +The checksums of messages whitelisted with entries in local +dccm or dccproc +whitelists are not reported to DCC servers. +It is good to add entries to DCC server and client +whitelists +for localhost, your IP address blocks, and your domains if +you know that none of your users will ever send spam. +

+However, in the common mode in which the DCC is used, no +checksums of mail are pollution. +Checksums of genuinely private mail will have target counts of +1 or a small number, and so will not be flooded by your server to +other servers. +Strangers will not see your private mail and so will not be able +to ask any DCC server about the checksums of your private mail. +On the other hand, the DCC functions best by collecting reports +of the receipt of bulk mail as soon as possible. +That implies that it is generally desirable +to send reports of all mail to a DCC server. +The DCC flooding protocol does not send checksums with counts +below 10 +to other servers. + + +

+Can DCC be fed with spam traps? +
+A spam trap is a mail address that should practically +never receive legitimate mail, +and that treats any mail that it does receive as spam. +A spam trap might a common name such as +user1 that has never been valid +and is discovered by unsolicited bulk email +advertisers by dictionary attacks or guessing. +It might instead be an address hidden in a web page +or a mailbox of an account that has been disabled for many months. +

+Any spam trap might receive legitimate mail. +For example, a spam trap that differs from an ordinary mailbox by a +single character might receive mail intended for the ordinary mailbox. +It might be best for a system to reject mail sent to such a trap so +that legitimate mail senders know that their messages have gone astray. +A mailbox that is a long string of arbitrary letters and digits is much +less likely to receive legitimate messages and so might best accept +all messages without complaint. +

+There are several ways to connect +spam trap mailboxes to DCC: +

+
dccproc +
+For example, +
dccproc -R -tMANY -cCMN,MANY -o/dev/null
+will accept a message on STDIN, +look for the IP address of the sender among +Received: SMTP fields, +reports the message to the DCC server as spam and the IP address as the sender, +and exit with the default value of +dccproc -x. +

+

dccif-test +
+dccif-test was written to test the interface to the DCC interface daemon, +dccifd. +When wired to a spam trap, it is more efficient than dccproc. +For example, +
dccif-test -cclnt-IP-addr -oSPAM -O/dev/null
+will do much the same as the dccproc example above. +

+

whiteclnt file option line +
+The best way to build a spam trap is with a +per-user whiteclnt file +with an +option spam-trap-accept or option spam-trap-reject +line. +

+With sendmail, virtual user mapping can be used to send mail to invalid +mailboxes to a single mailbox whose corresponding DCC per-user +whiteclnt file contains an +option spam-trap-accept or option spam-trap-reject +line. +

+ + +

+How many flooding peers does my DCC server need? +
+A single flooding peer delivers all reports of checksums of bulk +mail seen by any DCC server. Additional peers provided reports +sooner and so help the clients of a peer detect spews of spam sooner. +However, more peers will cause more reports to be duplicates. +

+A DCC server in a network of many servers should have at least three +flooding peers to ensure that the failure of a single server or network +link cannot partition the network. +Limiting the number the number of peers of any server to four or perhaps +a few more ensures that no single server is critical to the network. +To minimize the distances in the network, four peers +per server seem necessary. +

+An organization with more than one server can be viewed as a single +server by other organizations, with its servers flooding each other +and external peers spread among its servers. +This protects the network should the organization suffer large scale problems +while protecting the organization from single points of failure. + + +

+Do I need to tell the operators of other DCC servers +the password for controlling my server to turn on flooding? +
+No, you do not need to and generally should not tell other DCC server +operators the passwords for controlling your server with +the cdcc command. +Every Inter-server flood of checksums is authorized by lines in +each server's @prefix@/flod file +and authenticated by the password associated with the +passwd-ID in those lines. +The passwd-ID is a server-ID +defined in the @prefix@/ids file +that should generally be used only to authenticate floods of checksums. + + +

+How can I figure out why flooding is not working? +
+Many DCC server problems can be diagnosed by turning +on one or more of the tracing modes in the server with the +cdcc trace operation +or by restarting the server with +dccd -T. +

+The cdcc flood list +operation displays the current flooding peers of a DCC server. +Counts of checksum reports sent and received to and from +a single peer can be displayed with +cdcc "flood stats ID" +

+The positions in the local database of outgoing streams of checksums +are displayed by the start of dblist -Hv. + + +

+Why didn't the RTT reported by the +cdcc info operation +change when my network topology changed? +
+The RTT or round trip time is an average value. +Changes in network topology, server load, and so forth are not +immediately reflected in the RTT to avoid switching DCC servers +too frequently. + + +

+When my clients are configured to use SOCKS, they do not +realize immediately when a server is down. +
+When configured to use SOCKS, DCC clients cannot "connect" +to a server and so do not receive ICMP errors and must wait for +timeouts to know the server is not answering. + + +
+ +

+


+

+This document describes DCC version 1.3.103. +

+ + + + + + + + + + + + + + diff -r 000000000000 -r c7f6b056b673 INSTALL.html.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/INSTALL.html.in Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,980 @@ + + + + DCC Installation + + + + + + +

Distributed Checksum Clearinghouse (DCC) Installation

+ +

+

    +
  1. Fetch the Source and Read the License

    +The DCC source is available at +dcc-servers.net +and +Rhyolite Software. +

    +Please do not try to use the more than 3 year old modified +versions of DCC software distributed by some Linux packagers. +Those versions do not detect bulk mail as well as more recent versions. +Installations using those old versions also have problems using the +public DCC servers that often make it necessary to add their IP addresses +to the blacklist that protects the public DCC servers. +Even worse, all known Linux redistributions of DCC software have been +changed in ways that break things, including the +libexec/updatedcc shell script that could +otherwise be used to fetch, configure, compile, install, and restart +a current version. +

    +The license on the free source is in the source as well as +dcc-servers.net +and +Rhyolite +Software. +The free license is intended to cover individuals and organizations +including Internet service providers using DCC to filter their own mail. +Organizations selling anti-spam appliances or managed mail services are +not eligible for the free license. + + +

  2. Read the Documentation

    +

    +The DCC +and other man pages describe the features, operating modes, +required data files, and other characteristics of the DCC. +Also see the DCC FAQ +or list of frequently answered questions. + + +

  3. Build Sendmail

    +If the DCC-sendmail interface, dccm, is not used, +then skip to the next step. +

    +Sendmail must have the +Mail Filter API or Milter enabled. +Some systems such a FreeBSD 4.6 and newer are shipped with +Milter enabled and the library installed by default. +If your system comes with the Milter interface turn on, +then skip to the next step. +Otherwise, the Milter interface must be explicitly enabled +by adding lines like those in +misc/site.config.m4 +to your sendmail/devtools/Site/site.config.m4 file or equivalent. +Then build sendmail as described in the INSTALL file distributed with sendmail. +You must build libmilter separately by something like +

    +            cd libmilter
    +            sh ./Build
    +
    +

    +After sendmail has been rebuilt if necessary it will need to be restarted. +That should be done after the next step +after misc/dcc.m4 has been created by the +./configure script. + + +

  4. Configure, Build, and +Install the DCC Programs

    +

    +See the installation considerations in the +DCC man page. +

    +Most DCC files are in a "home directory" such as @prefix@. +DCC programs such as cdcc and dccproc are run by end +users and should be installed in a directory such as /usr/local/bin. +They must also be set-UID to the UID that can change the DCC +data files. +DCC programs that do not need to be run by end users +are installed by default in the libexec subdirectory of the DCC home directory. +See the table of +./configure script and makefile parameters. +If necessary, set CFLAGS, LDFLAGS, LIBS or other environment variables +listed in the table. +Omit any parameters you don't really need to change and usually use only: +

    +        ./configure
    +        make install
    +
    +

    +End users installing only dccproc +can install it in their private +~/bin directories and use private directories for their DCC +home directories. +In this case, the DCC programs that would otherwise need to be set-UID +need not be. +

    +To build dccproc +for an individual user, +use something like +

    +        ./configure --disable-sys-inst --disable-dccm --homedir=$HOME/dccdir  --bindir=$HOME/bin
    +        make install
    +
    +

    +The sendmail interface, dccm, +must be built with the sendmail source and object tree. +By default, the makefiles look for a +native sendmail libraries (e.g. on FreeBSD 4.6), an installed "package" +(e.g. on FreeBSD), or a directory named sendmail parallel to the DCC +source and object tree. +Those who regularly build new versions of sendmail may find it convenient +to make a symbolic link there to their current sendmail. +Otherwise configure the dccm makefile with +

    +        ./configure --with-sendmail=/some/where/sendmail
    +        make install
    +
    +If dccm does not build because it cannot find libmilter, +check that libmilter was compiled with sendmail +in the previous step. +

    +To connect the sendmail Milter interface to dccm, +copy or "sym-link" misc/dcc.m4 to +your sendmail/cf/feature directory and +add FEATURE(dcc) lines to your sendmail.mc configuration file. +Then rebuild and reinstall your sendmail.cf file, and restart sendmail. + + +

  5. Create Client Configuration Files

    +All DCC configuration files are in the DCC home directory, usually @prefix@. +See the +dcc, +dccm, +dccifd, +and dccproc +man pages +for the files each needs. +Example files are in the homedir directory in the source. + +
      +
    • Unless run anonymously, DCC clients need client-ID numbers and passwords +assigned by the operators of the chosen DCC servers in the @prefix@/map file. +
    • Even if run anonymously, the @prefix@/map file must contain the IP addresses +of DCC servers. +If your mail system handles fewer than 100,000 mail messages per day, +the installation process generates a serviceable @prefix@/map file +from the included homedir/map.txt. +That file points to the public DCC servers. + +

    • If using remote DCC servers such as the public DCC servers, +ensure that your firewalls allow outgoing packets to UDP port 6277 +on distant systems and incoming responses from UDP port 6277. +There is a +description +one firewall's configuration. + +

    • Your MX servers and mail submission clients should be listed in the main +whiteclnt file with lines like: +

      +    mx          ip  10.2.3.4
      +    mx          ip  10.5.6.0/28
      +    mxdcc       ip  10.5.6.0/28
      +    ok          ip  10.7.8.9
      +    submit      ip  192.168.1.0/24
      +
      +If those other systems also run DCC clients, use MXDCC instead +of MX so that messages will not be reported twice to the DCC network +and so have higher target counts, +and appear to be unsolicited bulk mail. +

      +Use OK for mail systems that you trust to never send or +forward unsolicited bulk mail. +

      +Untrusted SMTP clients such as end users with browsers used as +MUAs (mail user agents) should be listed in the +whiteclnt file with submit. + +

    • Sources of legitimate bulk mail must be recorded in whitelists. +Example whiteclnt, +whitelist, and +common whitelists are among +the sample configuration files in the homedir directory. +The format of DCC whitelists is described in the +DCC man page. + +

    • Put suitable values in the DCC configuration file, +@prefix@/dcc_conf for dccm or dccifd. +The default client values are usually good for a start and often only +DCCM_REJECT_AT needs to be changed when it is time to reject spam. + +

    • Optionally configure DNS blacklist (DNSBL) checks in +dccm +or +dccifd +by setting DNSBL_ARGS in in the configuration file, +dcc_conf, in the home directory. + + +

    • Optionally create per-user directories for logs and whitelists. +See also the +CGI scripts that allow users to +maintain their private whitelists +and monitor their individual logs of rejected mail. + +

    • Install a daily or more frequent cron job like +misc/crontab +and +@libexecdir@/cron-dccd +to prune dccm or +dccifd +log files and the prune dccd database with +dbclean. +

    + +

  6. Create Server Files and Start the Server

    +Skip this and the next step +if only remote DCC servers will be used. +You should use your own, local DCC servers if your mail system handles +more than 100,000 mail messages per day. +

    +It is best to use remote servers until the DCC client, +dccm, dccifd, or dccproc, is stable. +Then +

      +
    • Put suitable values for dccd + in the configuration file, +dcc_conf. +Every DCC server requires a unique +server-ID. +Obtain a server-ID by contacting Vernon Schryver +vjs@rhyolite.com by email +or via a +web +form. + +
    • Choose a secret password for your server-ID in your +@prefix@/ids file. +This password can be used to control your server remotely. + +

    • Start the server with the system by installing +@libexecdir@/rcDCC or an equivalent. +If it is used unchanged, rcDCC is best installed with a symbolic link +to automate installing updates. +The server can be started manually with +

      +        rcDCC start
      +
      + +
    • The script +@libexecdir@/cron-dccd +must be used to run +dbclean about once a day. +An entry like misc/crontab can be put into +the crontab file for the user that runs dccd. +If you have more than one DCC server, +stagger the times at which the cron job is run so +that not all of your servers are simultaneously busy cleaning databases. + +

    • Install the shutdown script +@libexecdir@/rcDCC +to shut down the DCC server as the operating system stops. +If the DCC server fails to close the database cleanly, +the database must be cleaned by the server with it starts. +That takes time. + +

    + + + +

  7. Configure Flooding

    +Skip to the next step +if only remote DCC servers will be used. +

    +Flooding requires that every server participating in a network of DCC +servers have a unique server-ID. +Server-IDs can be obtained by contacting Vernon Schryver +vjs@rhyolite.com by email +or via a +web +form. +

    +After you have an official server-ID, +

      +
    • Obtain the passwd-ID and its password +and add them to your @prefix@/ids file. +
    • If necessary adjust your firewalls to allow both incoming TCP connections +to port 6277 on your DCC server and outgoing TCP connections to port 6277 +on your flooding peer. +
    • Add a line for each flooding peer to +the @prefix@/flod file. +
    • Wait a few minutes for dccd to notice the change to the file +and start flooding. +The cdcc stats, +cdcc "id X; flood list" +and +@libexecdir@/dblist -Hv +commands can be used to monitor the floods of reports of checksums +of bulk mail. +
    +

    +Flooded reports of bulk email contain timestamps that are used for several +things including expiring old reports. +To accurately detect stale incoming reports, +a DCC server needs a clock that is not too inaccurate. +For that reason it is good to run an NTP daemon on systems running DCC servers. + +

  8. Configure Greylisting

    +Skip to the next step +if greylisting will not be used. +Greylist is very effective. +See this +description. +

    +Larger sites can use more than one greylist server, +with the greylist servers flooding data just like DCC servers. +

    +To configure greylisting: +

      +
    1. Assign greylist client- and server-IDs

      +

      Client-IDs and matching passwords must be used by clients of +greylist servers such as dccm and dccifd. +The client-IDs must be in the @prefix@/map file on the client system. +Greylist client- and server-IDs must be in the +@prefix@/ids file on the +greylist server. +When a system hosts both DCC and greylist servers, it is convenient +for clients to use the same client-ID and password for both. +It is also convenient for a greylist server and a DCC server on a system +to share a common server-ID and password. +

      +The vast majority of installations, which do not have local DCC servers, +can use the greylist server-ID generated by the makefiles in the +@prefix@/ids file. + +

    2. Add the greylist server to @prefix@/map

      +

      If the +cdcc "info" +command does not show the correct greylist server, +add it with something like +

      +        cdcc "add localhost greylist 32768 secret"
      +
      +The DCC makefile files add a greylist server at localhost or 127.0.0.1 +to @prefix@/map file created for a new +DCC installation. + +

    3. Set @prefix@/dcc_conf

      +In most installations, enable a local greylist server by +installing the script @libexecdir@/rcDCC +with a symbolic link, +setting GREY_ENABLE=on in @prefix@/dcc_conf +and then running +
      +        @libexecdir@/rcDCC start
      +
      + +

      If absolutely necessary, override the greylist +embargo, wait, and white values +in GREY_DCCD_ARGS in @prefix@/dcc_conf. +Usually simply set GREY_CLIENT_ARGS=on + +

    4. Set @prefix@/grey_flod

      +

      +Sites with more than one greylist server should arrange to flood +data among them by adding lines to +@prefix@/grey_flod files +in the same format as +@prefix@/flod files. +Flooding among greylist servers uses port 6276 by default, and so that +port may need to be opened in firewalls. + +

    5. Set cron job

      +

      +Install a daily cron job like +misc/crontab +and +@libexecdir@/cron-dccd +to clean the database. +

      + +

    6. Whitelist Mail Submission Clients

      +

      +Greylisting of local mail systems must be turned off because common +mail user agents (MUAs) cannot handle temporary rejections. +One way to turn off greylisting of local client is with submit lines +in the main whiteclnt file +as described above. +

      +An alternative to whitelisting mail submission clients is available with +dccm and sendmail by using the +misc/hackmc -T +script to modify sendmail.cf to trust SMTP clients authenticated with +SMTP-TLS or SMTP-AUTH. + +

    + + + +

  9. Start dccm

    +If the DCC-sendmail interface, dccm, is not used, +skip to the next step. +

    +The DCC sendmail milter interface dccm +should be started before sendmail. +That often requires changing an /etc/rc script or configuration file. +The script @libexecdir@/rcDCC +should be installed, best with a symbolic link. +The milter daemon can be started manually with +

    +        rcDCC start
    +
    + + + +

  10. Start dccifd

    +If the general MTA interface, dccifd, is not used, +skip to the next step. +If you are using SpamAssassin, then you almost certainly +should be using dccifd. +

    +The general MTA interface dccifd +should usually be started before the mail transfer agent or MTA. +It should be enabled by setting DCCIFD_ENABLE=on +in dcc_conf. +It is also usually necessary to change an /etc/rc script or configuration file +to start and stop the daemon with the system. +The script @libexecdir@/rcDCC +should be installed, best with a symbolic link. +The daemon can be started manually with +

    +        rcDCC start
    +
    +

    +Dccifd can be used as a +Postfix Before-Queue +Content filter +as described the +dccifd documentation. + + +

  11. Configure Uses of dccproc

    +If dccproc is used with procmail, +add rules to procmailrc files as described in the +dccproc man page. + +

  12. Adjust Rejection Thresholds

    +

    It is best to only mark mail with X-DCC SMTP headers +before changing procmail or dccm to reject mail. +Configure dccm with DCCM_LOG_AT in dcc_conf +to log bulk mail with somewhat lower counts. + + +

  13. Additional Considerations

    +

    Some additional mechanisms are available in the DCC client programs. +They are often unnecessary when +greylisting is used. +

    + +

    +When possible, it is almost always better to use dccifd than dccproc. +This is certainly true with SpamAssassin. + + + +

  14. Update As Needed

    +

    New versions released at the +usual place +can be installed by running the +@libexecdir@/updatedcc script. +That script is (re)built by the +./configure script +and runs ./configure with parameters and +environment variables from the previous installation. + + + +

  15. Remove or Uninstall

    +

    Most of the DCC can be removed by running +@libexecdir@/uninstalldcc script. +Some logs and configuration files with locally chosen parameters in the home +directory are not deleted. +Manual changes such as links to +@libexecdir@/rcDCC +or the installation of the cron job, +@libexecdir@/cron-dccd, +are not reversed. + + +

+ + + +

Installation Parameters

+

There are several installation configuration parameters that can +set to suit individual preferences and systems. + +

+ + +
+ Makefile and ./configure Script Controls +
Do NOT set these parameters unless absolutely necessary.
+
./configure option + env name or
make variable +
used by + default value + use +
--homedir=HOMEDIR +   + ./configure + @prefix@/ + DCC home directory with most DCC files +
--libexecdir=DIR +   + ./configure + --homedir/libexec + directory containing most DCC programs +
--bindir=DIR +   + ./configure + /usr/local/bin + installation directory for DCC user commands including cdcc and + dccproc3 +
--mandir=DIR +   + ./configure + /usr/local/man + installation directory for man pages3 +
  + NOMAN1 + make + (unset) + do not install man pages when set3 +
--with-installroot=DIR +   + ./configure + (unset) + prefix all installation directory paths to build a binary tarball +
--with-configsuffix=str +   + ./configure + (unset) + append str to generated configuration file names +
--with-uid=UID +   + ./configure + root + user name and set-UID for DCC programs and data +
  + DCC_OWN1 + make + bin, daemon on OS X, or current + owner or UID of most installed files3 +
  + DCC_GRP1 + make + bin, daemon on OS X, or current + group of most installed files3 +
  + DCC_MODE1 + make + 555 + mode of most installed programs +
  + MANOWN1 + make + DCC_OWN + or current + owner or UID of installed man pages3 +
  + MANGRP1 + make + DCC_GRP + or current + group of installed man pages3 +
--disable-sys-inst +   + ./configure + enabled + disable system installation or chmod, chgrp, and set-UID3 +
--disable-server +   + ./configure + build but do not start + do not build server including dbclean and dccd +
--disable-dccifd +   + ./configure + build but do not start + do not build program interface +
--disable-dccm +   + ./configure + build but do not start + do not build sendmail interface +
--with-sendmail=DIR +   + ./configure + ../sendmail or /usr/ports/mail/... + directory containing sendmail milter header files +
--with-cgibin=DIR +   + ./configure + --homedir/cgi-bin + directory for DCC whitelist CGI scripts +
--with-rundir=DIR +   + ./configure + @dcc_rundir@ + "run" directory for PIDs and sockets +
  + CFLAGS1 + make & ./configure +   + global compiler options such as -g or -O2 +
  + DCC_CFLAGS2 + ./configure + depends on target + global compiler options +
  + PTHREAD_CFLAGS2 + ./configure + depends on target + compiler options for compiling dccm and dccifd with pthreads +
  + LDFLAGS1 + make & ./configure +   + global linker options +
  + DCC_LDFLAGS2 + ./configure + depends on target + global linker options +
  + PTHREAD_LDFLAGS2 + ./configure + depends on target + linker options for dccm and dccifd +
  + LIBS2 + ./configure +   + additional libraries linked with all programs +
  + PTHREAD_LIBS2 + ./configure + depends on target + libraries for dccm and dccifd +
  + CC + make & ./configure + cc + C compiler such as "gcc" or "/opt/SUNWspro/SC6.1/bin/cc" +
  + INSTALL1 + make + ./autoconf/install-sh + installation script +
  + DCCD_MAX_FLOODS1 + make + 32 + maximum DCC server flooding peers +
--with-db-memory=MB +   + ./configure + 64 + minimum server database buffer size between 32 MBytes and 49152 MBytes + +
--with-max-db-mem=MB +   + ./configure + 1920 on 32-bit systems +
49152 on 64-bit systems +
maximum server database buffer size + +
--with-max-log-size=KB +   + ./configure + 32 + maximum dccifd and dccm log file size in KBytes; 0=no limit +
--without-IPv6 +   + ./configure + IPV6 on if supported + turn off IPv6 support +
--with-socks[=lib] +   + ./configure + none + location of SOCKS client library +
--enable-64-bits +   + ./configure + correct value on most systems +
32 bits Solaris and Linux PowerPC +
use MD5 code in DCC source instead of any local library +
--with-DCC-MD5 +   + ./configure + local library if available; + use MD5 code in DCC source instead of any local library +
--with-kludge=FILE +   + ./configure + none + include header FILE, best with an absolute path +
--with-fetch-cmd=pgm +   + ./configure + wget, fetch, curl, or ftp + program used by + @libexecdir@/updatedcc, + and other utilities to fetch files +
  +
+ +

+
Note1 +
These values are not built into the Makefiles by the +./configure script but their current values in the environment +are used by the script and the Makefiles. + +
Note2 +
These values are copied by the ./configure script from the +environment into the generated Makefiles. + +
Note3 +
When --disable-sys-inst +is specified, the current UID and GID become the defaults, +and the man pages are not installed. +If the ./configure script is not run as root, +dccproc, cdcc, +and dccsight are not installed set-UID. +It is usually also necessary to set +--bindir to a private directory such +as $HOME/bin. +
+ +

Compatibility

+

DCC is thought to work on several systems including: +

+
BSDI BSD/OS +
DCC works starting with version 3.0 of BSD/OS. + +
FreeBSD +
The works starting with at least version 4.0 of FreeBSD. + +
NetBSD +
The DCC should work starting with at least 1.4.2 without threads +and so with dccd, dccproc, and all of DCC except the part that uses +threads, dccm. +Dccm is available if you point PTHREAD_LIBS, PTHREAD_CFLAGS, and +PTHREAD_LDFLAGS to the optional threads package. + +
OpenBSD +
DCC works starting with at least 2.9 despite lame +the lame mmap() implementation. + +
Linux +
DCC works starting with at least RedHat 5.2. +

+On 64-bit PowerPC systems with more than 4 GBytes, +use ./configure --with-64-bits to build a DCC server that can +benefit from a full sized database. +A 64-bit sendmail milter library will be needed if +Dccm is used + +

AIX +
DCC on 4.1.PPC has been tried but not well tested. +Rumor has it that the 4.1.PPC pthreads code does not work +with the sendmail milter library and dccm, but the rest of +DCC does work. + +
Solaris +
DCC compiles on several versions of Solaris with gcc or +native C compiler by setting the environment variable CC appropriately. +You must install gmake. +Do not use "CFLAGS=-fast" with the native compiler. +

+While building the sendmail milter library, consider using +_FFR_USE_POLL to avoid problems with large file descriptors +and select(). +

+On 64-bit systems with more than 4 GBytes, +use ./configure --with-64-bits to build a DCC server that can +benefit from a full sized database. +A 64-bit sendmail milter library will be needed if +Dccm is used + +

HP-UX +
DCC compiles on versions of HP-UX starting with 11.00. +It requires gmake. Dccproc and dccm work. +Dccifd does not work with UNIX domain sockets because select() and +poll() do not notice the results of shutdown(). +Dccifd does work with TCP/IP connections to MTAs or spam filters. +
+Dccproc should work on version 10.20, since it does not use pthreads. + +
IRIX +
DCC compiles on IRIX 6.5. +It requires gmake. + +
OSF1 +
DCC compiles on OSF1 V5.0 with gmake. + +
OpenUNIX +
DCC compiles on OpenUNIX 8.0.1. + +
Mac OS/X +
DCC compiles on at least some versions of Apple's OS/X. + +
Windows +
The DCC client dccproc compiles and works on at least some versions of +Windows 98 and Windows XP with Borland's free SDK +and with Microsoft's SDK. +See the main Makefile for Windows. + + +
+

+Those system names include trademarks. Please don't abuse them. + +

Troubleshooting

+

+Much of the DCC list of frequently asked questions +concerns troubleshooting DCC installations. +Many of the messages in the archive of the +DCC mailing list +are also troubleshooting questions and answers. + +

Spam Traps

+

Dccm and sendmail can be configured to +report the checksums of unsolicited bulk mail so that other DCC clients +can reject later copies of the same unsolicited bulk mail +sent from other sources. +Such mechanisms are commonly called spam traps. + +

Entries in a sendmail access_db can also be rejected or discarded +while they are reported to the DCC server by dccm. +The script +misc/hackmc modifies the output of +sendmail .mc files to tell dccm about some undesirable mail. +The script accepts one or more .mc files and generates the corresponding +slightly modified .cf files. +If the access_db entry starts with the string "DCC:", +the message is reported by dccm to the DCC server as extremely bulky. +Otherwise the message is rejected as usual. +The remainder of the the access_db entry after "DCC:" consists of +the optional string "DISCARD" followed by an optional SMTP status message. +If the string "DISCARD" is present, the message is discarded instead of +rejected. This is important to keep senders of unsolicited bulk mail from +discovering and removing "spam trap" addresses from their target lists. + +

For example, a line like the following in an access_db can +discard all mail from example.com while reporting it to the DCC server +as extremely bulky. + Note the quotes ("). +

+    example.com     DCC: "DISCARD spam"
+
+ +

It is also possible to route mail from a spam trap address to +dccproc as described in the +dccproc man page + + +

SOCKS

+

The DCC client and server programs can be built to use the SOCKS +protocol. +The +--with-socks +./configure parameter +configures the DCC client library and the DCC server +to use common SOCKS network library functions. +If the SOCKS library is in a standard place, +something like --with-socks=socks +should be sufficient. +Setting the environment variable +DCC_LDFLAGS to something +like -L/usr/local/lib is sometimes helpful. +Otherwise, using --with-socks +without specifying the library name and setting LIBS +to the full pathname of the library +might work. +

+DCC client programs +including dccproc and dccm that use the DCC client library +must be told to use the SOCKS5 protocol with the +SOCKS on +operation of +cdcc. +SOCKS5 is required instead of SOCKS4 +because DCC clients communicate with DCC servers using UDP. + +

+DCC servers can use SOCKS4 or SOCKS5 when exchanging +floods of reports of checksums. +Links between individual pairs of peers are configured with the +passive and SOCKS flags in the flod file described +in the dccd man page. +In both cases, the SOCKS library code must be configured, often +in the files /etc/socks.conf and /etc/socksd.conf. + +

+When the DCC software is built with SOCKS, +IPv6 name resolution is turned off. + +

+The DCC server and client programs have been tested with the +DANTE library and server. +The DANTE SOCKS implementation is also one of the FreeBSD "ports" +or packages. +

+Note that if a connection fails repeatedly, Dante will disable the rule +that failed and will eventually try the underlying connect() +call. +This fails in almost every SOCKS environment because there is +no available route for an ordinary connect(). +Dante by default won't re-enable the failing rule. +To fix this, change BADROUTE_EXPIRE from the default of 0*60 +to 5 in include/config.h in the Dante source and recompile. + + +

+This document describes DCC version 1.3.103. +

+ + + + + + + + + + + + + diff -r 000000000000 -r c7f6b056b673 LICENSE --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LICENSE Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,47 @@ + * Distributed Checksum Clearinghouse + * + * 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. +--- + + + * Some parts including dcclib/getopt.c and include/sendmail-sysexits.h + * Copyright (c) 1987, 1993, 1994 + * The Regents of the University of California. All rights reserved. + + * Some other parts including dcclib/inet_ntop.c + * Copyright (c) 1996-1999 by Internet Software Consortium. + + * Some other parts including autoconf/install-sh + * Copyright 1991 by the Massachusetts Institute of Technology diff -r 000000000000 -r c7f6b056b673 Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile.in Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,73 @@ +# make all of the Distributed Checksum Clearinghouse + +# 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.50 $Revision$ +# @configure_input@ + +DEPTH =. +SUBDIR_PROGS=cdcc @SUBDIR_DCCD@ @SUBDIR_DCCM@ @SUBDIR_DCCIFD@ \ + dccproc dccsight homedir misc cgi-bin +SUBDIR_MAN =cdcc dbclean dccd dblist dccm dccifd dccproc dccsight +SUBDIR =dcclib @SUBDIR_SRVRLIB@ @SUBDIR_THRLIB@ $(SUBDIR_PROGS) +SUBDIR_ALL =$(SUBDIR) @SUBDIR_DISABLED@ include autoconf rrd-combine + +SUBDIR_HTML =$(SUBDIR_MAN:=.html) +SUBDIR_MAN0 =$(SUBDIR_MAN:=.0) +SUBDIR_MAN8 =$(SUBDIR_MAN:=.8) +MAN8 =@MAN8@ +TEXT = $(MAN8) dcc.0 $(SUBDIR_MAN0) dcc.html $(SUBDIR_HTML) + +@MAKE_INC@ +@MAKE_SUBDIR@ + +all: $(TEXT) + +@MAKE_INC2@ + +# delete all known files in build tree +purge:cleandir + find $(SUBDIR_ALL) -depth -name .manifest -print | while read NM; do\ + (cd `expr $$NM : "\(.*\)/[^/]*"`; rm -f `cat .manifest`)\ + done + -rm -rf `cat .config .manifest` + -find $(SUBDIR_ALL) -depth -type d -print | @DCC_XARGS@ rmdir + +# uninstall things we won't install +install:noinstall +noinstall: + for DIR in @SUBDIR_DISABLED@ .; do\ + if test "$$DIR" != .; then\ + (cd $$DIR; $(MAKE) deinstall); fi; done diff -r 000000000000 -r c7f6b056b673 Makefile.inc.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile.inc.in Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,143 @@ +# common Makefile lines for the Distributed Checksum Clearinghouse + +# 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.61 $Revision$ +# @configure_input@ + +# These lines must not include any rules, or the shared BSD mk files +# will be confused and not do anything. + +# BSD/OS bsd.prog.mk includes ../Makefile.inc twice +@MAKE_DOT@ifndef DCC_MAKEFILE_INC +DCC_MAKEFILE_INC=x + +# common to all DCC clients +CLNTLIBS =$(DEPTH)/dcclib/libdcc.a + +# common to threaded DCC clients +THRINC =-I$(DEPTH)/thrlib @PTHREAD_CFLAGS@ +THR_LDADD =$(DEPTH)/thrlib/libthr.a @PTHREAD_LIBS@ +THR_DPADD =$(DEPTH)/thrlib/libthr.a + +SRVRINC =-I$(DEPTH)/srvrlib +SRVRLIBS =$(DEPTH)/srvrlib/libsrvr.a + +@DCC_CC@ +RANLIB =@RANLIB@ + +NOPROFILE = # stop FreeBSD profile library +NO_PROFILE = +NOGCCERROR = #turn off NetBSD's default nonsense in bsd.sys.mk +NOLINT = #why does NetBSD care about lint today? +NO_LINT = # suppress FreeBSD noise about NOLINT +STRIP = #keep FreeBSD from stripping the a.outs + +LDADD +=$(CLNTLIBS) @LIBS@ +DPADD +=$(CLNTLIBS) + +#DBGFLAGS +=-g +#DBGFLAGS +=-DDCC_DEBUG_HEAP -DDCC_DEBUG_CKSUM -DDCC_DEBUG_CLNT_LOCK +# --with-c-warnings gcc warnings +@CWRN1@ +=-W -Wall -Wunused -Winline -Wbad-function-cast +@CWRN1@ +=-Wnested-externs -Wpointer-arith -Wshadow -Wwrite-strings +# --with-c-warnings=2 often not supported +@CWRN2@ +=-Wdeclaration-after-statement -Wmissing-noreturn -Wswitch-enum +# --with-c-warnings=3 often wrong +@CWRN3@ +=-Wformat-nonliteral -Wunreachable-code -Wcast-align +CFLAGS +=@DCC_CFLAGS@ $(DBGFLAGS) $(CWARN) -I$(DEPTH)/include $(PROFILE) +LDFLAGS +=@DCC_LDFLAGS@ $(DBGFLAGS) $(PROFILE) + +# turn off man pages if not installing on the system +@NO_SYS_INSTALL@ +@NO_SUID@ + +DCC_HOMEDIR =@prefix@ +@MAKE_DOT@ifdef DCC_BINDIR +BINDIR =$(DCC_BINDIR) +@MAKE_DOT@else +BINDIR =@installroot@@bindir@ +@MAKE_DOT@endif + +@MAKE_DOT@ifndef DCC_OWN +@MAKE_DOT@ifdef NO_SUID +DCC_OWN =@DCC_OWN@ +@MAKE_DOT@else +DCC_OWN =@DCCSUID@ +@MAKE_DOT@endif +@MAKE_DOT@endif +BINOWN =$(DCC_OWN) + +@MAKE_DOT@ifndef DCC_GRP +DCC_GRP =@DCC_GRP@ +@MAKE_DOT@endif +BINGRP =$(DCC_GRP) + +@MAKE_DOT@ifndef DCC_MODE +DCC_MODE =555 +@MAKE_DOT@endif +BINMODE =$(DCC_MODE) + +MANDIR =@installroot@@mandir@ +@MAKE_DOT@ifndef MANGRP +MANGRP =$(DCC_GRP) +@MAKE_DOT@endif +@MAKE_DOT@ifndef MANOWN +MANOWN =$(DCC_OWN) +@MAKE_DOT@endif +MANMODE =444 + +@MAKE_DOT@ifdef NO_SYS_INSTALL +NOMAN =no +SET_BINOWN= +SET_MANOWN= +SET_DCCOWN= +@MAKE_DOT@else +SET_BINOWN=-o $(BINOWN) -g $(BINGRP) +SET_MANOWN=-o $(MANOWN) -g $(MANGRP) +SET_DCCOWN=-o @DCCSUID@ -g $(BINGRP) +@MAKE_DOT@endif + +@MAKE_DOT@ifdef PROG +MAN8 =$(PROG).0 +# turn off man pages in the command directories and build them in the top level +NOMAN =no +@MAKE_DOT@endif +@MAKE_DOT@endif + +# deal with silly FreeBSD renaming frenzy +@MAKE_DOT@ifdef NOMAN +NO_MAN =no +@MAKE_DOT@endif diff -r 000000000000 -r c7f6b056b673 Makefile.inc2.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile.inc2.in Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,101 @@ +# common Makefile lines for the Distributed Checksum Clearinghouse programs + +# These rules must be included after the share BSD mk files so that +# the shared files can be happy about defining the main targets + +# 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.41 $Revision$ +# @configure_input@ + +# some versions of gmake do not understand ?= +@MAKE_DOT@ifndef INSTALL +INSTALL =@DCCINSTALL@ +@MAKE_DOT@endif + +BININSTALL=$(INSTALL) -c $(SET_BINOWN) -m $(BINMODE) + +# create the DCC home directory before trying to install files +beforeinstall:$(BINDIR) $(MANDIR)8 depend all +$(BINDIR): + $(INSTALL) -d $(SET_BINOWN) -m 755 $@ + +@USE_DCCMANINSTALL@ +dccmaninstall: +@MAKE_DOT@ifndef NOMAN +@MAKE_DOT@ifdef MAN8 + eval 'for NM in $(MAN8); do\ + $(INSTALL) -c $(SET_MANOWN) -m $(MANMODE) $$NM $(MANDIR)8@MAN8INST@;\ + done' +@MAKE_DOT@endif +@MAKE_DOT@endif + +$(MANDIR)8: +@MAKE_DOT@ifndef NOMAN +@MAKE_DOT@ifdef MAN8 + $(INSTALL) -d $(SET_MANOWN) -m 755 $(MANDIR)8 +@MAKE_DOT@endif +@MAKE_DOT@endif + + +uninstall delete:deinstall +deinstall:beforedelete + +progdelete: +@MAKE_DOT@ifdef PROG + rm -f $(BINDIR)/$(PROG) +@MAKE_DOT@endif + +beforedelete:progdelete +@MAKE_DOT@ifdef SUBDIR + for DIR in $(SUBDIR); do\ + (cd $$DIR; $(MAKE) $(GMAKE_QUIET) deinstall); done +@MAKE_DOT@endif +@MAKE_DOT@ifndef NOMAN +@MAKE_DOT@ifdef MAN8 + eval 'for NM in $(MAN8); do rm -f $(MANDIR)8@MAN8INST@/$$NM; done' +@MAKE_DOT@endif +@MAKE_DOT@endif + + +# ensure that even systems with neither the BSD nor the gmake dependency +# mechanisms rebuild things when the main parameter file changes. +@MAKE_DOT@ifdef SRCS +$(SRCS:.c=.o):$(DEPTH)/include/dcc_config.h +# ensure that adding a kludge.h file or otherwise changing included files +# rebuilds dependencies in systems with .depend files +.depend:$(DEPTH)/include/dcc_config.h Makefile $(DEPTH)/Makefile.inc \ + $(DEPTH)/Makefile.inc2 +@MAKE_DOT@endif diff -r 000000000000 -r c7f6b056b673 RESTRICTIONS --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RESTRICTIONS Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,11 @@ +The free DCC source is available only for non-commercial and some other +uses. It is not available to organizations that sell anti-spam appliances +or provide managed email services as opposed to common Internet service. +It has always been wrong to take and sell the CPU cycles, bandwidth, and +human system administration labor of the public DCC servers. + +Please read the LICENSE file in the DCC source or at +http://www.dcc-servers.net/dcc/dcc-tree/LICENSE + + +Rhyolite Software DCC 1.3.103-1.2 $Revision$ diff -r 000000000000 -r c7f6b056b673 autoconf/.manifest --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/autoconf/.manifest Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,2 @@ +install-sh +.manifest diff -r 000000000000 -r c7f6b056b673 autoconf/install-sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/autoconf/install-sh Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff -r 000000000000 -r c7f6b056b673 cdcc.0 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cdcc.0 Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,391 @@ +cdcc(8) Distributed Checksum Clearinghouse cdcc(8) + +NNAAMMEE + ccddcccc -- Control Distributed Checksum Clearinghouse + +SSYYNNOOPPSSIISS + ccddcccc [--VVddqq] [--hh _h_o_m_e_d_i_r] [--cc _i_d_s] [_o_p_1 _o_p_2 _._._. [_-]] + +DDEESSCCRRIIPPTTIIOONN + CCddcccc is used to clear, control, and query the control file used by Dis- + tributed Checksum Clearinghouse clients such as dccm(8). The host names, + UDP port numbers, IDs, and passwords local clients use to talk to servers + as well as IP addresses, round trip times, and other information are con- + tained in the _m_a_p file. While ccddcccc is set-UID, it uses the real UID only + when accessing the _m_a_p file. It refuses to display sensitive information + such as passwords unless the real UID is the same as the effective UID. + Note that ccddcccc needs to be set to a UID that can read and write the _m_a_p + file, but that UID need not be 0. + + CCddcccc is also used to send commands to DCC servers to tell them to stop, + reload their lists of DCC IDs, turn on tracing, and so forth. + + Many commands sent to DCC servers require a numeric DCC ID and a password + recognized by the server. A DCC password is a 1-32 character string that + does not contain blank, tab, newline or carriage return characters. The + ID is specified with the iidd operation. If ccddcccc is run with a real UID + that can read the _i_d_s file and a password is not specified (see the + ppaasssswwoorrdd operation), then the current password for the specified ID in + the _i_d_s file will be used. If no _i_d_s file is available and a password + and DCC ID are not specified, ccddcccc uses the anonymous DCC client-ID. DCC + servers do not expect a password from clients using the anonymous client- + ID, but they also won't honor control requests. + + Operations that modify the _m_a_p file can only be performed when the real + UID is sufficient to modify the file directly. Trying to perform an + operation that requires a password without specifying a server-ID or + without using a UID that can access the _i_d_s file produces an error mes- + sage complaining about a "privileged operation." + + Commands and operations are read from the command line or from stdin. A + series of _o_p_1 _o_p_2 _._._. operations followed a _- (a dash) causes operations + to be read from stdin after the command line operations are processed. + Semi-colons or newlines separate commands in UNIX command-line "words," + as well as when commands are read from stdin. Since each command line + operation must be a shell "word," quotes are often required as in + + % cdcc "load map.txt" + or + + % cdcc "host localhost;info" stats + + OOPPTTIIOONNSS + The following options are available: + + --VV displays the version of the DCC controller. + + --dd enables debugging output from the DCC client software. Additional + --dd options increase the number of messages. See the ddeebbuugg command. + + --qq quiets initial complaints about the map file and some messages about + successful commands. See the qquuiieett command. + + --hh _h_o_m_e_d_i_r + overrides the default DCC home directory, _/_v_a_r_/_d_c_c. See the hhoommeeddiirr + operation. + + --cc _i_d_s + specifies file containing DCC IDs and passwords known by the local + DCC server. An _i_d_s file that can be read by others cannot be used. + The format of the _i_d_s file is described in dccd(8). + + _o_p_1 _o_p_2 _._._. + are operations or commands such as "id 100; stop". Commands or + operations specified on the command line are performed before the + first interactive request. The last command can be _- to specify + that additional commands should be read from stdin. + + OOPPEERRAATTIIOONNSS + Local operations include the following: + + hheellpp [_c_o_m_m_a_n_d] + lists information about one or all available commands and opera- + tions. + + eexxiitt stops ccddcccc + + ggrreeyy [_o_n | _o_f_f] + switches between DCC and greylist servers. + + hhoommeeddiirr [_p_a_t_h] + displays or specifies the DCC home directory. + + ffiillee [_m_a_p] + displays or specifies the name or path of the map file. The string + "-" specifies the default file _m_a_p in the DCC home directory. + + nneeww mmaapp [_m_a_p] + creates a new, empty file for DCC server host names, port numbers, + passwords, and so forth. There must not already be a file of the + same name. The default is _m_a_p in the DCC home directory. + + ddeelleettee _h_o_s_t[,_p_o_r_t] + deletes the entry in the _m_a_p file for _h_o_s_t and UDP _p_o_r_t_. If + greylist mode has been set with the ggrreeyy oonn command, the entry for + the grelist server at _h_o_s_t is deleted. + + aadddd _h_o_s_t[,_p_o_r_t] [_R_T_T_+_a_d_j|_R_T_T_-_a_d_j] [_G_r_e_y_l_i_s_t] [_c_l_i_e_n_t_-_I_D [password]] + adds an entry to the _m_a_p file. The _p_o_r_t can be "-" to specify the + default DCC server port number. + + An adjustment to the round trip time is a multiple of 10 millisec- + onds between -4000 and +4000 following the string _R_T_T. The adjust- + ment is added to the average measured round trip time when the DCC + client software picks the "nearest" DCC server, or the server with + the smallest RTT. If an IP address is mentioned more than once in + the list of servers, for example because it is among the addresses + for more than one server name, conflicts among RTT adjustments are + resolved by picking the adjustment with the largest absolute value. + + _G_r_e_y_l_i_s_t marks an entry for a greylist servers. _G_r_e_y_l_i_s_t is + assumed if greylist mode has been set with the ggrreeyy oonn command, See + dccd(8). + + If both the client-ID and the password are absent, the anonymous + client-ID, 1, is used. The string _a_n_o_n is equivalent to the anony- + mous client-ID. A null password string is assumed if the password + is missing and the client-ID is 1 or also missing. + + llooaadd _i_n_f_o_-_f_i_l_e + loads the current parameter file with the host names, port numbers, + IDs, and passwords in _i_n_f_o_-_f_i_l_e. Standard input is understood if + _i_n_f_o_-_f_i_l_e is "-". + + A suitable file can be created with the iinnffoo operation. It con- + sists of ignored blank or comment lines starting with '#' and other + lines in the same format as the arguments to the aadddd operation. + Note that output of the iinnffoo command will lack passwords unless it + is run by a privileged user. + + hhoosstt [_h_o_s_t_n_a_m_e] + specifies the host name of the DCC server to which commands should + be sent. If _h_o_s_t_n_a_m_e is "-", the current default DCC server is + chosen. + + ppoorrtt [_p_o_r_t] + specifies the UDP port number of the DCC server to which commands + should be sent. The default is 6277 or 6276 depending on the set- + ting of the greylist mode controlled with the ggrreeyy command. + + ppaasssswwoorrdd _s_e_c_r_e_t + specifies the password with which to sign commands sent to the DCC + server specified with the sseerrvveerr and ppoorrtt operations. + + iidd [_I_D] + specifies or displays the numeric DCC ID for commands sent to the + DCC server specified with the sseerrvveerr and ppoorrtt operations. If no + password is specified with the ppaasssswwoorrdd command, the password is + sought in the local _i_d_s. + + iinnffoo [--NN] + displays information about the connections to DCC servers. It + starts with the current date and name of the current _m_a_p file or + says that ccddcccc is using the implicit file created with the sseerrvveerr + and ppoorrtt operations. It then says when host names will next be + resolved into IP addresses, the smallest round trip time to the IP + addresses of known DCC servers. The host name, UDP port number (or + dash if it is the default), DCC client-ID, and password (if ccddcccc is + used by a privileged user) are shown in one line per configured DCC + server. + + The currently preferred IP address is indicated by an asterisk. + The "brand" of the server, its DCC ID, and its IP address are dis- + played in one line per IP address. The performance of the server + at each IP address in the most recent 32 operations is displayed in + a second line. The second line ends with the measured delay + imposed by the server on requests with this client's ID. + + --NN displays the reverse DNS name of each server. + + RRTTTT [--NN] + measures the round trip time to the DCC servers. It does this by + discarding accumulated information and forcing a probe of all + listed server IP addresses. + + _B_e_w_a_r_e that when run with sufficient privilege, the RRTTTT operation + is like the iinnffoo and llooaadd operations and displays cleartext pass- + words. + + --NN displays the reverse DNS name of each server. + + ddeebbuugg Op Ar on | off | TTL=x + increases or decreases debugging information from the DCC client + software or sets the IP TTL on queries to the server. See --dd. + + Some operating systems do not include the functions required to + change the IP TTL. Others include the required functions but have + no apparent effect. + + qquuiieett [_o_n | _o_f_f] + makes commands more quiet or more verbose. + + IIPPvv66 [_o_n | _o_f_f] + sets a switch to cause clients using the map file to try to use + IPv6. + + SSOOCCKKSS [_o_n _o_f_f] + sets a switch to cause DCC clients using the map to use the SOCKS5 + protocol, if they have been built with a SOCKS library. The socks + library linked with the DCC client must be configured appropri- + ately, often including knowing which DCC servers must be connected + via the SOCKS proxy and which can be reached directly. DCC clients + use SOCKS functions such as Rsendto() with all or no servers + depending on the setting of this switch. + + ssrrcc [_- | _I_P_a_d_d_r_e_s_s] + displays or configures the source address of DCC client requests. + _- removes the explicit configuration of the source, while _I_P_a_d_d_r_e_s_s + sets it. This makes sense only on multi-homed hosts. It can be + useful for passing firewalls. + + DDCCCC SSEERRVVEERR CCOOMMMMAANNDDSS + Commands that can be sent to a DCC server include the following. Most of + the commands must be used with the server's _I_D specified with the iidd com- + mand. The specified ID is included in the commands sent to the server + The command itself is digitally signed with the first password associated + with the ID in the _i_d_s file. The server requires that the signature + match one of the passwords associated with the ID in its _i_d_s file. + + ddeellcckk ttyyppee hheexx11 hheexx22 hheexx33 hheexx44 + asks the server to delete the _t_y_p_e checksum with value _h_e_x_1 _h_e_x_2 + _h_e_x_3 _h_e_x_4. The type and checksum values can be found in dccproc(8) + and dccm(8) log files or computed with _d_c_c_p_r_o_c --QQCC. + + There are very few situations where it makes sense to bother to + delete checksums. For example, mail that was accidentally reported + with a target count of "MANY" is either private and so will not be + seen by other people and so will not be affected, or it is bulk and + its source so must have already been whitelisted by recipients. + + ssttaattss [_a_l_l | _c_l_e_a_r] + displays current status and statistics from the current DCC server + or for _a_l_l known DCC servers. The server's counters will be cleared + after they are displayed when the server's ID has been specified + with the iidd _I_D operation. + + cclliieennttss [--nnssiiaaVVAAKK] [_m_a_x [_t_h_o_l_d]] [_a_d_d_r[_/_p_r_e_f_i_x]] + displays some of the clients recently seen by the server. + --nn displays only the IP addresses and not the names of clients. + --ss sorts the clients by the number of requests they have made. + --ii counts clients with the same client-ID as single entities. + --aa produces 24 hour average numbers of requests. + --AA displays only anonymous clients. + --KK displays only clients using client-IDs. + --VV includes the DCC protocol versions used by clients. + _m_a_x displays only the _m_a_x most recent clients. + _m_a_x _t_h_o_l_d displays the most recent _m_a_x clients that have made at + least _t_h_o_l_d requests. + _a_d_d_r[_/_p_r_e_f_i_x] restricts the results to the DCC client with that IP + address or clients with addresses in that CIDR block. + + The mechanism that implements this command involves asking the DCC + server for the first approximately 100 clients, then the second + about 100, and so on, If entries change position in the complete + list maintained by the server between requests, the displayed list + will have duplicate or missing entries. Only clients heard from + since ssttaattss cclleeaarr was last used are displayed. + + ssttoopp + tells the DCC server to exit. + + ssyysstteemm ssttoopp + tells the DCC server to exit so that the operating system can be + shut down. This tells the DCC server on some systems to delete the + dcc_db.hash file to speed system shut down. The file will be + rebuilt automatically by ddbbcclleeaann when the DCC server is restarted. + + cclleeaann ssttoopp + tells the DCC server to exit after applying fsync() to the database. + + rreellooaadd IIDDss + tells the local DCC server to reload its DCC _i_d_s file immediately. + This command is not strictly needed. Every several minutes, the DCC + server notices if the file has been changed and automatically reads + it. + + fflloooodd cchheecckk + tells the DCC server to check for changes in the _f_l_o_d file and try + to restart any of the streams to peers that are broken. + + fflloooodd sshhuuttddoowwnn + tells the DCC server to cleanly stop flooding checksums to and from + peers. The server will wait for sending and receiving peers to + agree to stop. Each fflloooodd sshhuuttddoowwnn or fflloooodd hhaalltt request increases + a count of reasons why the server should not flood checksums. + + fflloooodd hhaalltt + tells the DCC server to abruptly stop flooding checksums to and from + peers. + + fflloooodd rreewwiinndd _s_e_r_v_e_r_-_I_D + tells the DCC server to ask its peer with _s_e_r_v_e_r_-_I_D to rewind and + resend its stream of checksums. + + fflloooodd ffffwwdd iinn _s_e_r_v_e_r_-_I_D + tells the DCC server to ask its peer to "fast forward" or skip to + the end of the incoming flood. + + fflloooodd ffffwwdd oouutt _s_e_r_v_e_r_-_I_D + tells the DCC server to "fast forward" or skip to the current end of + the flood to its peer. + + fflloooodd rreessuummee + tells the DCC server to reduce the number of reasons to not flood + checksums increased by fflloooodd sshhuuttddoowwnn and fflloooodd hhaalltt.. When the num- + ber of reasons reaches zero, the server tries to resume flooding. + + fflloooodd lliisstt + displays the list of current incoming and outgoing floods. Each + line contains the server-ID of the peer, the IP address and port + used for the outgoing flood, the address for the incoming flood if + different, and the host name. Only the server-IDs of flooding peers + are disclosed with the server's ID. + + fflloooodd ssttaattss [cclleeaarr] { _s_e_r_v_e_r_-_I_D | _a_l_l } + displays counts of checksum reports sent and received by the current + flooding connections to and from _s_e_r_v_e_r_-_I_D or _a_l_l flooding connec- + tions and then optionally clears the counts. + + DDBB cclleeaann + is used by ddbbcclleeaann to tell the server that the database expiration + has begun. + + DDBB nneeww + is used by ddbbcclleeaann to tell the server that the database cleaning is + complete. + + fflluusshh ccaacchhee + tells the server to flush its cache and to keep it clean. + + ccaacchhee ookk + tells the server to resume normal operations after fflluusshh ccaacchhee. + + cclloocckk cchheecckk + asks the DCC server to say how much its clock differs from the local + clock. + + cclloocckk kklluuddggee ++//--sseeccoonnddss + adjusts the timestamps in server commands to make it possible to + control servers with inaccurate clocks. + + ttrraaccee _d_e_f_a_u_l_t + turns on _A_N_O_N and _C_L_N_T tracing and turns off all others. + + ttrraaccee _m_o_d_e _{_o_n_|_o_f_f_} + turns the server's tracing _m_o_d_e on or off. _M_o_d_e must be one of: + _A_D_M_N administrative requests from ccddcccc + _A_N_O_N errors by anonymous clients + _C_L_N_T errors by authenticated clients + _R_L_I_M rate-limited messages + _Q_U_E_R_Y all queries and reports + _R_I_D_C messages concerning the report-ID cache that is used to + detect duplicate reports from clients + _F_L_O_O_D messages about inter-server flooding connections + _F_L_O_O_D_2 messages about flooded reports + _I_D_S unknown server-IDs in flooded reports + _B_L blacklisted clients + _D_B odd database events + _W_L_I_S_T reports of whitelisted checksums from authenticated, not + anonymous DCC clients + + ccddcccc exits with 0 on success, and >0 if an error occurs in operations + specified on the command line. + +FFIILLEESS + /var/dcc DCC home directory + map memory mapped file in the home DCC home directory of server + host names, port numbers, passwords, measured round trip times + (RTT), and so forth. + ids list of IDs and passwords, as described in dccd(8). It is only + required by systems running the DCC server, but is used by ccddcccc + if available. + +SSEEEE AALLSSOO + dbclean(8), dcc(8), dccd(8), dblist(8), dccifd(8), dccm(8), dccproc(8), + dccsight(8). + +HHIISSTTOORRYY + Implementation of ccddcccc was started at Rhyolite Software in 2000. This + document describes version 1.3.103. + + February 26, 2009 diff -r 000000000000 -r c7f6b056b673 cdcc.8.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cdcc.8.in Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,641 @@ +.\" 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.95 $Revision$ +.\" +.Dd February 26, 2009 +.ds volume-ds-DCC Distributed Checksum Clearinghouse +.Dt cdcc 8 DCC +.Os " " +.Sh NAME +.Nm cdcc +.Nd Control Distributed Checksum Clearinghouse +.Sh SYNOPSIS +.Nm cdcc +.Op Fl Vdq +.Op Fl h Ar homedir +.Op Fl c Ar ids +.Op Ar op1 op2 ... Op Ar - +.Sh DESCRIPTION +.Nm Cdcc +is used to clear, control, and query the control file used +by Distributed Checksum Clearinghouse +clients such as +.Xr dccm 8 . +The host names, UDP port numbers, IDs, and passwords local clients use +to talk to servers as well as IP addresses, round trip times, and other +information are contained in the +.Pa map +file. +While +.Nm +is set-UID, it uses the real UID only when accessing the +.Pa map +file. +It refuses to display sensitive information such as passwords +unless the real UID is the same as the effective UID. +Note that +.Nm +needs to be set to a UID that can read and write the +.Pa map +file, but that UID need not be 0. +.Pp +.Nm Cdcc +is also used to send commands to DCC servers to tell them +to stop, reload their lists of DCC IDs, turn on tracing, and so forth. +.Pp +Many commands sent to DCC servers require a numeric DCC ID +and a password recognized by the server. +A DCC password is a 1-32 character string that does not contain +blank, tab, newline or carriage return characters. +The ID is specified with the +.Ic id +operation. +If +.Nm cdcc +is run with a real UID that can read the +.Pa ids +file and a password is not specified +(see the +.Ic password +operation), +then the current password for the specified ID in the +.Pa ids +file will be used. +If no +.Pa ids +file is available and a password and DCC ID are not specified, +.Nm +uses the anonymous DCC client-ID. +DCC servers do not expect a password from clients using the +anonymous client-ID, +but they also won't honor control requests. +.Pp +Operations that modify the +.Pa map +file can only be performed when +the real UID is sufficient to modify the file directly. +Trying to perform an operation that requires a password without +specifying a server-ID or without using a UID that can access the +.Pa ids +file produces an error message complaining +about a "privileged operation." +.Pp +Commands and operations are read from the command line or from stdin. +A series of +.Ar op1 op2 ... +operations followed a +.Ar - +(a dash) causes operations to be read from stdin after the command line +operations are processed. +Semi-colons or newlines separate commands in UNIX command-line "words," +as well as when commands are read from stdin. +Since each command line operation must be a shell "word," quotes are +often required as in +.Bd -ragged -offset indent +% cdcc +.Qq load map.txt +.Ed +or +.Bd -ragged -offset indent +% cdcc +.Qq host localhost;info +stats +.Ed +.Ss OPTIONS +The following options are available: +.Bl -tag -width 3n +.It Fl V +displays the version of the DCC controller. +.It Fl d +enables debugging output from the DCC client software. +Additional +.Fl d +options increase the number of messages. +See the +.Ic debug +command. +.It Fl q +quiets initial complaints about the map file +and some messages about successful commands. +See the +.Ic quiet +command. +.It Fl h Ar homedir +overrides the default DCC home directory, +.Pa @prefix@ . +See the +.Ic homedir +operation. +.It Fl c Ar ids +specifies file containing DCC IDs and passwords known by the local DCC server. +An +.Pa ids +file that can be read by others cannot be used. +The format of the +.Pa ids +file is described in +.Xr dccd 8 . +.It Ar op1 op2 ... +are operations or commands such as "id\ 100;\ stop". +Commands or operations specified on the command line are performed +before the first interactive request. +The last command can be +.Ar "-" +to specify that additional commands should be read from stdin. +.El +.Ss OPERATIONS +Local operations include the following: +.Bl -tag -width info +.It Ic help Op Ar command +lists information about one or all available commands and operations. +.It Ic exit +stops +.Nm +.It Ic grey Op Ar on | off +switches between DCC and greylist servers. +.It Ic homedir Op Ar path +displays or specifies the DCC home directory. +.It Ic file Op Ar map +displays or specifies the name or path of the map file. +The string "-" specifies the default file +.Pa map +in the DCC home directory. +.It Ic new map Op Ar map +creates a new, empty file for DCC server host names, +port numbers, passwords, and so forth. +There must not already be a file of the same name. +The default is +.Pa map +in the DCC home directory. +.It Ic delete Ar host Ns Xo +.Ns Op , Ns Ar port +.Xc +deletes the entry in the +.Pa map +file for +.Ar host +and UDP +.Ar port. +If greylist mode has been set with the +.Ic grey\ on +command, +the entry for the grelist server at +.Ar host +is deleted. +.It Ic add Ar host Ns Xo +.Ns Op , Ns Ar port +.Op Ar RTT+adj Ns | Ns Ar RTT-adj +.Op Ar Greylist +.Op Ar client-ID Op password +.Xc +adds an entry to the +.Pa map +file. +The +.Ar port +can be "-" to specify the default DCC server port number. +.Pp +An adjustment to the round trip time is a multiple of 10 milliseconds +between -4000 and +4000 following the string +.Ar RTT . +The adjustment is added to the average measured round trip time when +the DCC client software picks the "nearest" DCC server, or the server +with the smallest RTT. +If an IP address is mentioned more than once in the list of servers, +for example because it is among the addresses for more than one server name, +conflicts among RTT adjustments are resolved by picking +the adjustment with the largest absolute value. +.Pp +.Ar Greylist +marks an entry for a greylist servers. +.Ar Greylist +is assumed if greylist mode has been set with +the +.Ic grey\ on +command, +See +.Xr dccd 8 . +.Pp +If both the client-ID and the password are absent, +the anonymous client-ID, 1, is used. +The string +.Ar anon +is equivalent to the anonymous client-ID. +A null password string is assumed if the password is missing +and the client-ID is 1 or also missing. +.It Ic load Ar info-file +loads the current parameter file with the host names, port numbers, IDs, and +passwords in +.Ar info-file . +Standard input is understood if +.Ar info-file +is "-". +.Pp +A suitable file can be created with the +.Ic info +operation. +It consists of ignored blank or comment lines starting with '#' and +other lines in the same format as the arguments to the +.Ic add +operation. +Note that output of the +.Ic info +command will lack passwords unless it is run by a privileged user. +.It Ic host Op Ar hostname +specifies the host name of the DCC server to which commands should be sent. +If +.Ar hostname +is "-", the current default DCC server is chosen. +.It Ic port Op Ar port +specifies the UDP port number of the DCC server to which commands should +be sent. +The default is 6277 or 6276 depending on the setting of the greylist +mode controlled with the +.Ic grey +command. +.It Ic password Ar secret +specifies the password with which to sign commands sent to the DCC +server specified with the +.Ic server +and +.Ic port +operations. +.It Ic id Op Ar ID +specifies or displays the numeric DCC ID for commands sent to the DCC +server specified with the +.Ic server +and +.Ic port +operations. +If no password is specified with the +.Ic password +command, +the password is sought in the local +.Pa ids . +.It Ic info Op Fl N +displays information about the connections to DCC servers. +It starts with the current date and name of the current +.Ar map +file or +says that +.Nm +is using the implicit file created with the +.Ic server +and +.Ic port +operations. +It then says when host names will next be resolved into IP addresses, +the smallest round trip time to the IP addresses of known DCC servers. +The host name, UDP port number (or dash if it is the default), +DCC client-ID, and password (if +.Nm +is used by a privileged user) +are shown in one line per configured DCC server. +.Pp +The currently preferred IP address is indicated by an asterisk. +The "brand" of the server, its DCC ID, and its IP address +are displayed in one line per IP address. +The performance of the server at each IP address in the most recent +32 operations is displayed in a second line. +The second line ends with the measured delay imposed by the server on requests +with this client's ID. +.Pp +.Fl N +displays the reverse DNS name of each server. +.It Ic RTT Op Fl N +measures the round trip time to the DCC servers. +It does this by discarding accumulated information and forcing +a probe of all listed server IP addresses. +.Pp +.Em Beware +that when run with sufficient privilege, the +.Ic RTT +operation is like the +.Ic info +and +.Ic load +operations and displays cleartext passwords. +.Pp +.Fl N +displays the reverse DNS name of each server. +.It Ic debug Xo +Op Ar on | off | TTL=x +.Xc +increases or decreases debugging information from the DCC client software +or sets the IP TTL on queries to the server. +See +.Fl d . +.Pp +Some operating systems do not include the functions required to change the +IP TTL. +Others include the required functions +but have no apparent effect. +.It Ic quiet Op Ar on | off +makes commands more quiet or more verbose. +.It Ic IPv6 Op Ar on | off +sets a switch to cause clients using the map file to try to use IPv6. +.It Ic SOCKS Op Ar on off +sets a switch to cause DCC clients using the map to use the SOCKS5 +protocol, if they have been built with a SOCKS library. +The socks library linked with the DCC client must be configured appropriately, +often including knowing which DCC servers must be connected via the +SOCKS proxy and which can be reached directly. +DCC clients use SOCKS functions such as Rsendto() with all or no servers +depending on the setting of this switch. +.It Ic src Op Ar - | IPaddress +displays or configures the source address of DCC client requests. +.Ar - +removes the explicit configuration of the source, while +.Ar IPaddress +sets it. +This makes sense only on multi-homed hosts. +It can be useful for passing firewalls. +.El +.Pp +.Ss DCC SERVER COMMANDS +Commands that can be sent to a DCC server include the following. +Most of the commands must be used with the server's +.Ar ID +specified with the +.Ic id +command. +The specified ID is included in the commands sent to the server +The command itself is digitally signed with the first password associated +with the ID in the +.Pa ids +file. +The server requires that the signature match one of the passwords associated +with the ID in its +.Pa ids +file. +.Bl -tag -width xxx +.It Ic delck type hex1 hex2 hex3 hex4 +asks the server to delete the +.Ar type +checksum with value +.Ar hex1 hex2 hex3 hex4 . +The type and checksum values can be found in +.Xr dccproc 8 +and +.Xr dccm 8 +log files +or computed with +.Em dccproc Fl QC . +.Pp +There are very few situations where it makes sense to bother to delete +checksums. +For example, mail that was accidentally reported with a target +count of "MANY" is either private and so will not be seen by other +people and so will not be affected, or it is bulk and its source +so must have already been whitelisted by recipients. +.It Ic stats Op Ar all | clear +displays current status and statistics from the current DCC server +or for +.Ar all +known DCC servers. +The server's counters will be cleared after they are displayed +when the server's ID has been specified with the +.Ic id Ar ID +operation. +.It Ic clients Xo +.Op Fl nsiaVAK +.Op Ar max Op Ar thold +.Op Ar addr Ns Op Ar /prefix +.Xc +displays some of the clients recently seen by the server. +.Bl -hang -compact -width xxx +.It Fl n +displays only the IP addresses and not the names of clients. +.It Fl s +sorts the clients by the number of requests they have made. +.It Fl i +counts clients with the same client-ID as single entities. +.It Fl a +produces 24 hour average numbers of requests. +.It Fl A +displays only anonymous clients. +.It Fl K +displays only clients using client-IDs. +.It Fl V +includes the DCC protocol versions used by clients. +.It Ar max +displays only the +.Ar max +most recent clients. +.It Ar max Ar thold +displays the most recent +.Ar max +clients that have made at least +.Ar thold +requests. +.It Ar addr Ns Op Ar /prefix +restricts the results to the DCC client with that IP address or +clients with addresses in that CIDR block. +.El +.Pp +The mechanism that implements this command involves +asking the DCC server for the first approximately 100 clients, then +the second about 100, and so on, +If entries change position in the complete list maintained by the server +between requests, +the displayed list will have duplicate or missing entries. +Only clients heard from since +.Ic stats clear +was last used are displayed. +.It Ic stop +tells the DCC server to exit. +.It Ic system stop +tells the DCC server to exit so that the operating system can be shut down. +This tells the DCC server on some systems to delete the dcc_db.hash file +to speed system shut down. +The file will be rebuilt automatically by +.Nm dbclean +when the DCC server is restarted. +.It Ic clean stop +tells the DCC server to exit after applying fsync() to the database. +.It Ic reload IDs +tells the local DCC server to reload its DCC +.Pa ids +file immediately. +This command is not strictly needed. +Every several minutes, the DCC server notices if the file has been changed +and automatically reads it. +.It Ic flood check +tells the DCC server to check for changes in the +.Pa flod +file and try to restart any of the streams to peers that are broken. +.It Ic flood shutdown +tells the DCC server to cleanly stop flooding checksums to and from peers. +The server will wait for sending and receiving peers to agree to stop. +Each +.Ic flood shutdown +or +.Ic flood halt +request increases a count of reasons why the server should not +flood checksums. +.It Ic flood halt +tells the DCC server to abruptly stop flooding checksums to and from peers. +.It Ic flood rewind Ar server-ID +tells the DCC server to ask its peer with +.Ar server-ID +to rewind and resend its stream of checksums. +.It Ic flood ffwd in Ar server-ID +tells the DCC server to ask its peer to "fast forward" or skip to +the end of the incoming flood. +.It Ic flood ffwd out Ar server-ID +tells the DCC server to "fast forward" or skip to the current end +of the flood to its peer. +.It Ic flood resume +tells the DCC server to reduce the number of reasons to +not flood checksums increased by +.Ic flood shutdown +and +.Ic flood halt. +When the number of reasons reaches zero, +the server tries to resume flooding. +.It Ic flood list +displays the list of current incoming and outgoing floods. +Each line contains the server-ID of the peer, +the IP address and port used for the outgoing flood, +the address for the incoming flood if different, +and the host name. +Only the server-IDs of flooding peers are disclosed with the server's ID. +.It Ic flood stats Xo +.Op Ic clear +.No { +.Ar server-ID | all +.No } +.Xc +displays counts of checksum reports sent and received by the current +flooding connections to and from +.Ar server-ID +or +.Ar all +flooding connections +and then optionally clears the counts. +.It Ic DB clean +is used by +.Nm dbclean +to tell the server that the database expiration has begun. +.It Ic DB new +is used by +.Nm dbclean +to tell the server that the database cleaning is complete. +.It Ic flush cache +tells the server to flush its cache and to keep it clean. +.It Ic cache ok +tells the server to resume normal operations after +.Ic flush cache . +.It Ic clock check +asks the DCC server to say how much its clock differs from the local clock. +.It Ic clock kludge +/-seconds +adjusts the timestamps in server commands to make it possible to +control servers with inaccurate clocks. +.It Ic trace Ar default +turns on +.Ar ANON +and +.Ar CLNT +tracing +and turns off all others. +.It Ic trace Ar mode {on|off} +turns the server's tracing +.Ar mode +on or off. +.Ar Mode +must be one of: +.Bl -tag -width FLOOD2 -offset 2n -compact +.It Ar ADMN +administrative requests from +.Nm +.It Ar ANON +errors by anonymous clients +.It Ar CLNT +errors by authenticated clients +.It Ar RLIM +rate-limited messages +.It Ar QUERY +all queries and reports +.It Ar RIDC +messages concerning the report-ID cache that is used +to detect duplicate reports from clients +.It Ar FLOOD +messages about inter-server flooding connections +.It Ar FLOOD2 +messages about flooded reports +.It Ar IDS +unknown server-IDs in flooded reports +.It Ar BL +blacklisted clients +.It Ar DB +odd database events +.It Ar WLIST +reports of whitelisted checksums from authenticated, not anonymous DCC clients +.El +.El +.Pp +.Nm +exits with 0 on success, +and >0 if an error occurs in operations specified on the command line. +.Sh FILES +.Bl -tag -width @prefix@ -compact +.It Pa @prefix@ +DCC home directory +.It Pa map +memory mapped file in the home DCC home directory of server host names, +port numbers, +passwords, measured round trip times (RTT), and so forth. +.It Pa ids +list of IDs and passwords, as described in +.Xr dccd 8 . +It is only required by systems running the DCC server, +but is used by +.Nm +if available. +.El +.Sh SEE ALSO +.Xr dbclean 8 , +.Xr dcc 8 , +.Xr dccd 8 , +.Xr dblist 8 , +.Xr dccifd 8 , +.Xr dccm 8 , +.Xr dccproc 8 , +.Xr dccsight 8 . +.Sh HISTORY +Implementation of +.Nm +was started at Rhyolite Software in 2000. +This document describes version 1.3.103. diff -r 000000000000 -r c7f6b056b673 cdcc.html.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cdcc.html.in Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,436 @@ + + + + + cdcc.0.8 + + + + +

+
+cdcc(8)               Distributed Checksum Clearinghouse               cdcc(8)
+
+
+
+

NAME

+     cdcc -- Control Distributed Checksum Clearinghouse
+
+
+
+

SYNOPSIS

+     cdcc [-Vdq] [-h homedir] [-c ids] [op1 op2 ... [-]]
+
+
+
+

DESCRIPTION

+     Cdcc is used to clear, control, and query the control file used by Dis-
+     tributed Checksum Clearinghouse clients such as dccm(8).  The host names,
+     UDP port numbers, IDs, and passwords local clients use to talk to servers
+     as well as IP addresses, round trip times, and other information are con-
+     tained in the map file.  While cdcc is set-UID, it uses the real UID only
+     when accessing the map file.  It refuses to display sensitive information
+     such as passwords unless the real UID is the same as the effective UID.
+     Note that cdcc needs to be set to a UID that can read and write the map
+     file, but that UID need not be 0.
+
+     Cdcc is also used to send commands to DCC servers to tell them to stop,
+     reload their lists of DCC IDs, turn on tracing, and so forth.
+
+     Many commands sent to DCC servers require a numeric DCC ID and a password
+     recognized by the server.  A DCC password is a 1-32 character string that
+     does not contain blank, tab, newline or carriage return characters.  The
+     ID is specified with the id operation.  If cdcc is run with a real UID
+     that can read the ids file and a password is not specified (see the
+     password operation), then the current password for the specified ID in
+     the ids file will be used.  If no ids file is available and a password
+     and DCC ID are not specified, cdcc uses the anonymous DCC client-ID.  DCC
+     servers do not expect a password from clients using the anonymous client-
+     ID, but they also won't honor control requests.
+
+     Operations that modify the map file can only be performed when the real
+     UID is sufficient to modify the file directly.  Trying to perform an
+     operation that requires a password without specifying a server-ID or
+     without using a UID that can access the ids file produces an error mes-
+     sage complaining about a "privileged operation."
+
+     Commands and operations are read from the command line or from stdin.  A
+     series of op1 op2 ... operations followed a - (a dash) causes operations
+     to be read from stdin after the command line operations are processed.
+     Semi-colons or newlines separate commands in UNIX command-line "words,"
+     as well as when commands are read from stdin.  Since each command line
+     operation must be a shell "word," quotes are often required as in
+
+           % cdcc "load map.txt"
+     or
+
+           % cdcc "host localhost;info" stats
+
+   OPTIONS
+     The following options are available:
+
+     -V   displays the version of the DCC controller.
+
+     -d   enables debugging output from the DCC client software.  Additional
+          -d options increase the number of messages.  See the debug command.
+
+     -q   quiets initial complaints about the map file and some messages about
+          successful commands.  See the quiet command.
+
+     -h homedir
+          overrides the default DCC home directory, @prefix@.  See the homedir
+          operation.
+
+     -c ids
+          specifies file containing DCC IDs and passwords known by the local
+          DCC server.  An ids file that can be read by others cannot be used.
+          The format of the ids file is described in dccd(8).
+
+     op1 op2 ...
+          are operations or commands such as "id 100; stop".  Commands or
+          operations specified on the command line are performed before the
+          first interactive request.  The last command can be - to specify
+          that additional commands should be read from stdin.
+
+   OPERATIONS
+     Local operations include the following:
+
+     help [command]
+           lists information about one or all available commands and opera-
+           tions.
+
+     exit  stops cdcc
+
+     grey [on | off]
+           switches between DCC and greylist servers.
+
+     homedir [path]
+           displays or specifies the DCC home directory.
+
+     file [map]
+           displays or specifies the name or path of the map file.  The string
+           "-" specifies the default file map in the DCC home directory.
+
+     new map [map]
+           creates a new, empty file for DCC server host names, port numbers,
+           passwords, and so forth.  There must not already be a file of the
+           same name.  The default is map in the DCC home directory.
+
+     delete host[,port]
+           deletes the entry in the map file for host and UDP port. If
+           greylist mode has been set with the grey on command, the entry for
+           the grelist server at host is deleted.
+
+     add host[,port] [RTT+adj|RTT-adj] [Greylist] [client-ID [password]]
+           adds an entry to the map file.  The port can be "-" to specify the
+           default DCC server port number.
+
+           An adjustment to the round trip time is a multiple of 10 millisec-
+           onds between -4000 and +4000 following the string RTT.  The adjust-
+           ment is added to the average measured round trip time when the DCC
+           client software picks the "nearest" DCC server, or the server with
+           the smallest RTT.  If an IP address is mentioned more than once in
+           the list of servers, for example because it is among the addresses
+           for more than one server name, conflicts among RTT adjustments are
+           resolved by picking the adjustment with the largest absolute value.
+
+           Greylist marks an entry for a greylist servers.  Greylist is
+           assumed if greylist mode has been set with the grey on command, See
+           dccd(8).
+
+           If both the client-ID and the password are absent, the anonymous
+           client-ID, 1, is used.  The string anon is equivalent to the anony-
+           mous client-ID.  A null password string is assumed if the password
+           is missing and the client-ID is 1 or also missing.
+
+     load info-file
+           loads the current parameter file with the host names, port numbers,
+           IDs, and passwords in info-file.  Standard input is understood if
+           info-file is "-".
+
+           A suitable file can be created with the info operation.  It con-
+           sists of ignored blank or comment lines starting with '#' and other
+           lines in the same format as the arguments to the add operation.
+           Note that output of the info command will lack passwords unless it
+           is run by a privileged user.
+
+     host [hostname]
+           specifies the host name of the DCC server to which commands should
+           be sent.  If hostname is "-", the current default DCC server is
+           chosen.
+
+     port [port]
+           specifies the UDP port number of the DCC server to which commands
+           should be sent.  The default is 6277 or 6276 depending on the set-
+           ting of the greylist mode controlled with the grey command.
+
+     password secret
+           specifies the password with which to sign commands sent to the DCC
+           server specified with the server and port operations.
+
+     id [ID]
+           specifies or displays the numeric DCC ID for commands sent to the
+           DCC server specified with the server and port operations.  If no
+           password is specified with the password command, the password is
+           sought in the local ids.
+
+     info [-N]
+           displays information about the connections to DCC servers.  It
+           starts with the current date and name of the current map file or
+           says that cdcc is using the implicit file created with the server
+           and port operations.  It then says when host names will next be
+           resolved into IP addresses, the smallest round trip time to the IP
+           addresses of known DCC servers.  The host name, UDP port number (or
+           dash if it is the default), DCC client-ID, and password (if cdcc is
+           used by a privileged user) are shown in one line per configured DCC
+           server.
+
+           The currently preferred IP address is indicated by an asterisk.
+           The "brand" of the server, its DCC ID, and its IP address are dis-
+           played in one line per IP address.  The performance of the server
+           at each IP address in the most recent 32 operations is displayed in
+           a second line.  The second line ends with the measured delay
+           imposed by the server on requests with this client's ID.
+
+           -N displays the reverse DNS name of each server.
+
+     RTT [-N]
+           measures the round trip time to the DCC servers.  It does this by
+           discarding accumulated information and forcing a probe of all
+           listed server IP addresses.
+
+           Beware that when run with sufficient privilege, the RTT operation
+           is like the info and load operations and displays cleartext pass-
+           words.
+
+           -N displays the reverse DNS name of each server.
+
+     debug Op Ar on | off | TTL=x
+           increases or decreases debugging information from the DCC client
+           software or sets the IP TTL on queries to the server.  See -d.
+
+           Some operating systems do not include the functions required to
+           change the IP TTL.  Others include the required functions but have
+           no apparent effect.
+
+     quiet [on | off]
+           makes commands more quiet or more verbose.
+
+     IPv6 [on | off]
+           sets a switch to cause clients using the map file to try to use
+           IPv6.
+
+     SOCKS [on off]
+           sets a switch to cause DCC clients using the map to use the SOCKS5
+           protocol, if they have been built with a SOCKS library.  The socks
+           library linked with the DCC client must be configured appropri-
+           ately, often including knowing which DCC servers must be connected
+           via the SOCKS proxy and which can be reached directly.  DCC clients
+           use SOCKS functions such as Rsendto() with all or no servers
+           depending on the setting of this switch.
+
+     src [- | IPaddress]
+           displays or configures the source address of DCC client requests.
+           - removes the explicit configuration of the source, while IPaddress
+           sets it.  This makes sense only on multi-homed hosts.  It can be
+           useful for passing firewalls.
+
+   DCC SERVER COMMANDS
+     Commands that can be sent to a DCC server include the following.  Most of
+     the commands must be used with the server's ID specified with the id com-
+     mand.  The specified ID is included in the commands sent to the server
+     The command itself is digitally signed with the first password associated
+     with the ID in the ids file.  The server requires that the signature
+     match one of the passwords associated with the ID in its ids file.
+
+     delck type hex1 hex2 hex3 hex4
+          asks the server to delete the type checksum with value hex1 hex2
+          hex3 hex4.  The type and checksum values can be found in dccproc(8)
+          and dccm(8) log files or computed with dccproc -QC.
+
+          There are very few situations where it makes sense to bother to
+          delete checksums.  For example, mail that was accidentally reported
+          with a target count of "MANY" is either private and so will not be
+          seen by other people and so will not be affected, or it is bulk and
+          its source so must have already been whitelisted by recipients.
+
+     stats [all | clear]
+          displays current status and statistics from the current DCC server
+          or for all known DCC servers.  The server's counters will be cleared
+          after they are displayed when the server's ID has been specified
+          with the id ID operation.
+
+     clients [-nsiaVAK] [max [thold]] [addr[/prefix]]
+          displays some of the clients recently seen by the server.
+          -n   displays only the IP addresses and not the names of clients.
+          -s   sorts the clients by the number of requests they have made.
+          -i   counts clients with the same client-ID as single entities.
+          -a   produces 24 hour average numbers of requests.
+          -A   displays only anonymous clients.
+          -K   displays only clients using client-IDs.
+          -V   includes the DCC protocol versions used by clients.
+          max  displays only the max most recent clients.
+          max thold displays the most recent max clients that have made at
+               least thold requests.
+          addr[/prefix] restricts the results to the DCC client with that IP
+               address or clients with addresses in that CIDR block.
+
+          The mechanism that implements this command involves asking the DCC
+          server for the first approximately 100 clients, then the second
+          about 100, and so on, If entries change position in the complete
+          list maintained by the server between requests, the displayed list
+          will have duplicate or missing entries.  Only clients heard from
+          since stats clear was last used are displayed.
+
+     stop
+          tells the DCC server to exit.
+
+     system stop
+          tells the DCC server to exit so that the operating system can be
+          shut down.  This tells the DCC server on some systems to delete the
+          dcc_db.hash file to speed system shut down.  The file will be
+          rebuilt automatically by dbclean when the DCC server is restarted.
+
+     clean stop
+          tells the DCC server to exit after applying fsync() to the database.
+
+     reload IDs
+          tells the local DCC server to reload its DCC ids file immediately.
+          This command is not strictly needed.  Every several minutes, the DCC
+          server notices if the file has been changed and automatically reads
+          it.
+
+     flood check
+          tells the DCC server to check for changes in the flod file and try
+          to restart any of the streams to peers that are broken.
+
+     flood shutdown
+          tells the DCC server to cleanly stop flooding checksums to and from
+          peers.  The server will wait for sending and receiving peers to
+          agree to stop.  Each flood shutdown or flood halt request increases
+          a count of reasons why the server should not flood checksums.
+
+     flood halt
+          tells the DCC server to abruptly stop flooding checksums to and from
+          peers.
+
+     flood rewind server-ID
+          tells the DCC server to ask its peer with server-ID to rewind and
+          resend its stream of checksums.
+
+     flood ffwd in server-ID
+          tells the DCC server to ask its peer to "fast forward" or skip to
+          the end of the incoming flood.
+
+     flood ffwd out server-ID
+          tells the DCC server to "fast forward" or skip to the current end of
+          the flood to its peer.
+
+     flood resume
+          tells the DCC server to reduce the number of reasons to not flood
+          checksums increased by flood shutdown and flood halt. When the num-
+          ber of reasons reaches zero, the server tries to resume flooding.
+
+     flood list
+          displays the list of current incoming and outgoing floods.  Each
+          line contains the server-ID of the peer, the IP address and port
+          used for the outgoing flood, the address for the incoming flood if
+          different, and the host name.  Only the server-IDs of flooding peers
+          are disclosed with the server's ID.
+
+     flood stats [clear] { server-ID | all }
+          displays counts of checksum reports sent and received by the current
+          flooding connections to and from server-ID or all flooding connec-
+          tions and then optionally clears the counts.
+
+     DB clean
+          is used by dbclean to tell the server that the database expiration
+          has begun.
+
+     DB new
+          is used by dbclean to tell the server that the database cleaning is
+          complete.
+
+     flush cache
+          tells the server to flush its cache and to keep it clean.
+
+     cache ok
+          tells the server to resume normal operations after flush cache.
+
+     clock check
+          asks the DCC server to say how much its clock differs from the local
+          clock.
+
+     clock kludge +/-seconds
+          adjusts the timestamps in server commands to make it possible to
+          control servers with inaccurate clocks.
+
+     trace default
+          turns on ANON and CLNT tracing and turns off all others.
+
+     trace mode {on|off}
+          turns the server's tracing mode on or off.  Mode must be one of:
+            ADMN    administrative requests from cdcc
+            ANON    errors by anonymous clients
+            CLNT    errors by authenticated clients
+            RLIM    rate-limited messages
+            QUERY   all queries and reports
+            RIDC    messages concerning the report-ID cache that is used to
+                    detect duplicate reports from clients
+            FLOOD   messages about inter-server flooding connections
+            FLOOD2  messages about flooded reports
+            IDS     unknown server-IDs in flooded reports
+            BL      blacklisted clients
+            DB      odd database events
+            WLIST   reports of whitelisted checksums from authenticated, not
+                    anonymous DCC clients
+
+     cdcc exits with 0 on success, and >0 if an error occurs in operations
+     specified on the command line.
+
+
+
+

FILES

+     @prefix@  DCC home directory
+     map       memory mapped file in the home DCC home directory of server
+               host names, port numbers, passwords, measured round trip times
+               (RTT), and so forth.
+     ids       list of IDs and passwords, as described in dccd(8).  It is only
+               required by systems running the DCC server, but is used by cdcc
+               if available.
+
+
+
+

SEE ALSO

+     dbclean(8), dcc(8), dccd(8), dblist(8), dccifd(8), dccm(8), dccproc(8),
+     dccsight(8).
+
+
+
+

HISTORY

+     Implementation of cdcc was started at Rhyolite Software in 2000.  This
+     document describes version 1.3.103.
+
+                               February 26, 2009
+
+
+
+Man(1) output converted with +man2html +modified for the DCC $Date 2001/04/29 03:22:18 $ +
+ + + + + + +
+ + diff -r 000000000000 -r c7f6b056b673 cdcc/.manifest --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cdcc/.manifest Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,4 @@ +Makefile.in +cdcc.c +win32.mak +.manifest diff -r 000000000000 -r c7f6b056b673 cdcc/Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cdcc/Makefile.in Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,51 @@ +# make the Distributed Checksum Clearinghouse server controller + +# 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.12 $Revision$ +# @configure_input@ + +DEPTH =.. +PROG =cdcc +SRCS =$(PROG).c + +@MAKE_PROG@ + +@MAKE_DOT@ifndef NO_SUID +# cdcc needs to be SUID to read the server passwords +BINMODE =4$(DCC_MODE) +BINOWN =@DCCSUID@ +@MAKE_DOT@endif +@MAKE_INC2@ diff -r 000000000000 -r c7f6b056b673 cdcc/cdcc.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cdcc/cdcc.c Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,2752 @@ +/* Distributed Checksum Clearinghouse + * + * control dcc server + * + * 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.227 $Revision$ + */ + +#include "dcc_ck.h" +#include "dcc_xhdr.h" +#include "dcc_heap_debug.h" +#include "dcc_ids.h" +#ifndef DCC_WIN32 +#include +#endif + +static DCC_EMSG dcc_emsg; +static DCC_FNM_LNO_BUF fnm_buf; + +static DCC_CLNT_CTXT *ctxt; + +static DCC_PATH info_map_nm = DCC_MAP_NM_DEF; +static const char *ids_nm; +static time_t clock_kludge; +static const char *homedir; +static DCC_PASSWD passwd; +static u_char passwd_set; +static DCC_IP src; +static DCC_SRVR_NM srvr = DCC_SRVR_NM_DEF; +static u_char port_set; +static DCC_CLNT_ID srvr_clnt_id = DCC_ID_ANON; +static enum WHICH_MAP {MAP_TMP, MAP_INFO} which_map = MAP_INFO; +static u_char map_changed = 1; + +static u_char info_flags; + +static u_char grey_set; + +static u_char quiet; + + +static u_char do_cmds(char *); +static void set_which_map(enum WHICH_MAP); +static u_char init_map(u_char, u_char); + +struct cmd_tbl_entry; +/* -1=display help message, 0=command failed, 1=success */ +typedef int CMD (const char *, const struct cmd_tbl_entry *); +typedef struct cmd_tbl_entry { + const char *cmd; + CMD (*fnc); + u_char args; /* 0=optional, 1=required, 2=none */ + u_char privileged; /* 1=must have server's password */ + u_char write_map; /* 1=write map, 2=write /var/dcc/map */ + const char *help_str; +} CMD_TBL_ENTRY; + +static CMD help_cmd; +static CMD exit_cmd; +static CMD grey_cmd; +static CMD file_cmd; +static CMD new_map_cmd; +static CMD delete_cmd; +static CMD add_cmd; +static CMD load_cmd; +static CMD host_cmd; +static CMD port_cmd; +static CMD passwd_cmd; +static CMD id_cmd; +static CMD homedir_cmd; +static CMD debug_cmd; +static CMD quiet_cmd; +static CMD no_fail_cmd; +static CMD ckludge_cmd; +static CMD ipv6_cmd; +static CMD src_cmd; +static CMD socks_cmd; +static CMD info_cmd; +static CMD rtt_cmd; +static CMD delck_cmd; +static CMD sleep_cmd; +static CMD clients_cmd; +static CMD anon_cmd; +static CMD flod_rewind; +static CMD ffwd_in; +static CMD ffwd_out; +static CMD flod_stats; +static CMD stats_cmd; +static const char *stats_help; +static CMD clock_ck_cmd; +static CMD trace_def; + +static const CMD_TBL_ENTRY cmds_tbl[] = { + {"help", help_cmd, 0, 0, 0, "help [cmd]"}, + {"?", help_cmd, 0, 0, 0, 0}, + {"exit", exit_cmd, 2, 0, 0, "exit"}, + {"quit", exit_cmd, 2, 0, 0, 0}, + {"grey", grey_cmd, 0, 0, 0, "grey [on|off]"}, + {"homedir", homedir_cmd, 0, 0, 0, "homedir [path]"}, + {"file", file_cmd, 0, 0, 0, "file [map]"}, + {"map", file_cmd, 0, 0, 0, 0}, + {"new map", new_map_cmd, 0, 0, 0, "new map [map]"}, + {"delete", delete_cmd, 1, 0, 2, "delete host[,port]"}, + {"add", add_cmd, 1, 0, 2, + "add host,[port|-] [RTT+/-#] [ID [passwd]]"}, + {"load", load_cmd, 1, 0, 2, "load {info-file | -}"}, + {"host", host_cmd, 0, 0, 0, "host [hostname]"}, + {"server", host_cmd, 0, 0, 0, 0}, + {"port", port_cmd, 0, 0, 0, "port #"}, + {"password", passwd_cmd, 0, 0, 0, "password secret"}, + {"passwd", passwd_cmd, 0, 0, 0, 0}, + {"id", id_cmd, 0, 0, 0, "id [ID]"}, + {"debug", debug_cmd, 0, 0, 0, "debug [on|off|TTL=x]"}, + {"quiet", quiet_cmd, 0, 0, 0, "-quiet [on|off]"}, + {"no fail", no_fail_cmd, 2, 0, 2, "-no fail"}, + {"clock kludge",ckludge_cmd, 0, 0, 0, "clock kludge +/-secs"}, + {"IPv6", ipv6_cmd, 0, 0, 0, "IPv6 [on|off]"}, + {"src", src_cmd, 0, 0, 0, "src [-|IPaddress]"}, + {"SOCKS", socks_cmd, 0, 0, 0, "SOCKS [on|off]"}, + {"info", info_cmd, 0, 0, 0, "info [-N]"}, + {"RTT", rtt_cmd, 0, 0, 0, "RTT [-N]"}, + {"delck", delck_cmd, 1, 1, 0, "delck type hex1..4"}, + {"sleep", sleep_cmd, 1, 0, 0, "sleep sec.onds"}, + {"clients", clients_cmd, 0, 0, 0, + "clients [-nsiaVAK] [max [thold [addr/prefix]]]"}, + {"anon delay", anon_cmd, 0, 0, 0, "\nanon delay [delay[,inflate]]"}, + {"flood rewind",flod_rewind, 1, 1, 0, "flood rewind ID"}, + {"flod rewind", flod_rewind, 1, 1, 0, 0}, + {"flood FFWD in",ffwd_in, 1, 1, 0, "flood FFWD in ID"}, + {"flod FFWD in",ffwd_in, 1, 1, 0, 0}, + {"flood FFWD out",ffwd_out, 1, 1, 0, "flood FFWD out ID"}, + {"flod FFWD out",ffwd_out, 1, 1, 0, 0}, + {"flood stats", flod_stats, 1, 1, 0, "flood stats [clear] {ID|all}"}, + {"flod stats", flod_stats, 1, 1, 0, 0}, + {"stats", stats_cmd, 0, 0, 0, "stats [clear|all]"}, + {"status", stats_cmd, 0, 0, 0, 0}, + {"clock check", clock_ck_cmd, 0, 0, 0, "clock check"}, + {"trace default",trace_def, 2, 1, 0, "trace default"}, +}; + + +#define PRV_MSG ";\n" \ +" use the \"id server-ID\" command\n" \ +" and either \"password secret\" command or `su` to read passwords from %s" + + +static DCC_OP_RESP aop_resp; +static struct timeval op_start, op_end; +static DCC_SOCKU op_result_su; + +static struct { + const char *op; + const char *help_str; + DCC_AOPS aop; + u_char privileged; + u_int32_t val; +} aops_tbl[] = { +#define TMAC(s,b) \ + {"trace "#s" on", "trace "#s" {on|off}", \ + DCC_AOP_TRACE_ON, 1, DCC_TRACE_##b},\ + {"trace "#s" off", 0, DCC_AOP_TRACE_OFF, 1, DCC_TRACE_##b} + TMAC(admn,ADMN_BIT), + TMAC(anon,ANON_BIT), + TMAC(clnt,CLNT_BIT), + TMAC(rlim,RLIM_BIT), + TMAC(query,QUERY_BIT), + TMAC(ridc,RIDC_BIT), + TMAC(flood,FLOD_BIT), + TMAC(flood2,FLOD2_BIT), + TMAC(ids,IDS_BIT), + TMAC(bl,BL_BIT), + TMAC(db,DB_BIT), + TMAC(wlist,WLIST_BIT), +#undef TMAC + + {"stop", "", DCC_AOP_STOP, 1, 0}, + {"system stop", "", DCC_AOP_STOP, 1, 1}, + {"clean stop", "", DCC_AOP_STOP, 1, 2}, + {"flood check", "", DCC_AOP_FLOD, 1, DCC_AOP_FLOD_CHECK}, + {"flod check", 0, DCC_AOP_FLOD, 1, DCC_AOP_FLOD_CHECK}, + {"flood shutdown", "", DCC_AOP_FLOD, 1, DCC_AOP_FLOD_SHUTDOWN}, + {"flood shutdown", 0, DCC_AOP_FLOD, 1, DCC_AOP_FLOD_SHUTDOWN}, + {"flood halt", "", DCC_AOP_FLOD, 1, DCC_AOP_FLOD_HALT}, + {"flood halt", 0, DCC_AOP_FLOD, 1, DCC_AOP_FLOD_HALT}, + {"flood resume", "", DCC_AOP_FLOD, 1, DCC_AOP_FLOD_RESUME}, + {"flood resume", 0, DCC_AOP_FLOD, 1, DCC_AOP_FLOD_RESUME}, + {"flood list", "", DCC_AOP_FLOD, 0, DCC_AOP_FLOD_LIST}, + {"flood list", 0, DCC_AOP_FLOD, 0, DCC_AOP_FLOD_LIST}, + {"DB clean", "", DCC_AOP_DB_CLEAN, 1, 0}, + {"DB new", "", DCC_AOP_DB_NEW, 1, 0}, + {"DB flush cache", "", DCC_AOP_DB_UNLOAD, 1, 0}, + {"DB cache ok", "", DCC_AOP_DB_UNLOAD, 1, 1}, +}; + + +static void NRATTRIB +usage(void) +{ + dcc_logbad(EX_USAGE, + "usage: [-Vdq] [-h homedir] [-c ids] [op1 [op2] ... ]\n"); +} + + + +int NRATTRIB +main(int argc, char **argv) +{ + char cmd_buf[500]; + int i; + + srvr.port = htons(DCC_SRVR_PORT); + + dcc_init_priv(); + dcc_syslog_init(0, argv[0], 0); + + while ((i = getopt(argc, argv, "Vdqh:c:")) != -1) { + switch (i) { + case 'V': + fprintf(stderr, DCC_VERSION"\n"); + break; + + case 'd': + ++dcc_clnt_debug; + break; + + case 'q': + ++quiet; + break; + + case 'h': + homedir = optarg; + break; + + case 'c': + ids_nm = optarg; + break; + + default: + usage(); + } + } + argc -= optind; + argv += optind; + + dcc_clnt_unthread_init(); + dcc_cdhome(0, homedir, 1); + set_ids_path(0, ids_nm); + dcc_wf_init(&cmn_wf, 0); + + dcc_all_srvrs = 1; + + if (!init_map(!quiet, 0)) + set_which_map(MAP_TMP); + + /* with a list of commands, act as a batch utility */ + if (argc != 0) { + for (;;) { + /* a final arg of "-" says switch to interactive mode */ + if (argc == 1 && !strcmp(*argv, "-")) + break; + + if (!do_cmds(*argv)) { + fputs(" ?\n", stderr); + exit(EX_UNAVAILABLE); + } + assert_ctxts_unlocked(); + assert_info_unlocked(); + + ++argv; + if (!--argc) { + exit(EX_OK); + } + } + } + + /* Without an arg list of commands, look for commands from STDIN. + * Commands end with a semicolon or newline. */ + for (;;) { + assert_ctxts_unlocked(); + assert_info_unlocked(); + printf("cdcc %s> ", + which_map == MAP_INFO ? info_map_nm : "-"); + fflush(stderr); + fflush(stdout); + if (!fgets(cmd_buf, sizeof(cmd_buf), stdin)) { + fputc('\n', stdout); + exit(EX_OK); + } + if (!do_cmds(cmd_buf)) + fputs(" ?\n", stderr); + } +} + + + +/* see if don't need a server-ID password, have one or if we can get it */ +static u_char /* 0=failed, 1=ok */ +get_passwd(u_char privileged) /* 0=no privileges need, 1=need power */ +{ + const ID_TBL *srvr_clnt_tbl; + + srvr.clnt_id = srvr_clnt_id; + if (passwd_set) { + /* set to use the manual password */ + memcpy(srvr.passwd, passwd, sizeof(srvr.passwd)); + /* succeed if this is not a priviledge command + * or if we won't be trying to get the server to do + * something priviledge for the anonymous client-ID */ + return (!privileged || srvr.clnt_id != DCC_ID_ANON); + } + memset(srvr.passwd, 0, sizeof(srvr.passwd)); + + /* fail if we would be trying to get the server to do something + * powerful for the anonymous client-ID */ + if (srvr.clnt_id == DCC_ID_ANON) + return !privileged; + + /* Fetch the common server passwords only if we can read them without + * set-UID. This keeps random local users from attacking local + * or remote servers with privileged commands, but does not slow + * down privilege users who could use an editor to read and use + * the cleartext passwords manually. */ + dcc_rel_priv(); + if (0 > access(ids_path, R_OK) && errno == EACCES) { + srvr.clnt_id = DCC_ID_ANON; + if (!privileged) + return 1; + dcc_error_msg("access(%s): %s", + fnm2abs_err(0, ids_path), ERROR_STR()); + return 0; + } + + if (0 >= load_ids(dcc_emsg, srvr_clnt_id, &srvr_clnt_tbl, 1)) { + if (srvr_clnt_id != DCC_ID_ANON && privileged) + dcc_error_msg("%s", dcc_emsg); + srvr.clnt_id = DCC_ID_ANON; + return !privileged; + } + if (srvr_clnt_tbl) + memcpy(srvr.passwd, srvr_clnt_tbl->cur_passwd, + sizeof(srvr.passwd)); + return 1; +} + + + +static void +set_which_map(enum WHICH_MAP new) +{ + /* release things even if nothing seems to be changing + * to ensure that we bind a new socket */ + if (ctxt) { + dcc_ctxts_lock(); + if (dcc_clnt_info) + dcc_unmap_close_info(0); + if (ctxt) { + dcc_rel_ctxt(ctxt); + ctxt = 0; + } + dcc_ctxts_unlock(); + } + + map_changed = 1; + which_map = new; + if (new == MAP_INFO) { + passwd_set = 0; + src.family = AF_UNSPEC; + } +} + + + +static u_char +cdcc_unlock(u_char complain) +{ + u_char result; + + result = dcc_info_unlock(dcc_emsg); + dcc_ctxts_unlock(); + if (!result && complain) + dcc_error_msg("%s", dcc_emsg); + return result; +} + + + +/* start talking to the local map file */ +static u_char /* 0=failed 1=mapped and locked */ +init_map(u_char complain, + u_char lock) /* 1=keep both locks on success */ +{ + u_char result; + + info_flags = 0; + + dcc_emsg[0] = '\0'; + dcc_ctxts_lock(); + if (which_map == MAP_TMP) { + result = (dcc_map_tmp_info(dcc_emsg, &srvr, &src, info_flags) + && dcc_info_lock(dcc_emsg)); + } else { + result = dcc_map_lock_info(dcc_emsg, info_map_nm, -1); + } + if (result) { + info_flags = dcc_clnt_info->flags; + if (!lock) + result = cdcc_unlock(complain); + } else { + dcc_ctxts_unlock(); + if (complain) + dcc_error_msg("%s", dcc_emsg); + } + return result; +} + + + +/* get ready start talking to a DCC server */ +static u_char /* 0=failed, 1=ok */ +rdy_ctxt(DCC_CLNT_FGS fgs) +{ + u_char rdy_done, need_unlock; + + info_flags = 0; + + if (grey_on) + fgs |= DCC_CLNT_FG_GREY; + else + fgs &= ~DCC_CLNT_FG_GREY; + fgs |= DCC_CLNT_FG_NO_FAIL; + + if (!dcc_clnt_info && ctxt) { + dcc_rel_ctxt(ctxt); + ctxt = 0; + } + + if (ctxt) { + rdy_done = 0; + } else { + if (which_map == MAP_TMP) { + /* create a new temporary map */ + ctxt = dcc_tmp_clnt_init(dcc_emsg, ctxt, &srvr, &src, + fgs, 0); + } else { + /* open official map file */ + ctxt = dcc_clnt_init(dcc_emsg, ctxt, info_map_nm, fgs); + } + if (!ctxt) { + dcc_error_msg("%s", dcc_emsg); + return 0; + } + rdy_done = 1; + } + + if (!grey_set && dcc_clnt_info + && !grey_on + && dcc_clnt_info->dcc.nms[0].hostname[0] == '\0' + && dcc_clnt_info->grey.nms[0].hostname[0] != '\0') { + grey_on = 1; + fgs |= DCC_CLNT_FG_GREY; + rdy_done = 0; + } + + dcc_ctxts_lock(); + if (rdy_done) { + need_unlock = 0; + } else { + dcc_emsg[0] = '\0'; + need_unlock = dcc_clnt_rdy(dcc_emsg, ctxt, fgs); + if (!dcc_clnt_info) { + dcc_rel_ctxt(ctxt); + ctxt = 0; + dcc_ctxts_unlock(); + dcc_error_msg("%s", dcc_emsg); + return 0; + } + } + info_flags = dcc_clnt_info->flags; + if (!(fgs & DCC_CLNT_FG_NO_PICK_SRVR)) + map_changed = 0; + + if (need_unlock && !dcc_info_unlock(0)) { + dcc_rel_ctxt(ctxt); + ctxt = 0; + dcc_ctxts_unlock(); + dcc_error_msg("%s", dcc_emsg); + return 0; + } + + /* check the other (greylist or not) server */ + if (which_map != MAP_TMP) { + dcc_emsg[0] = '\0'; + if (!dcc_clnt_rdy(dcc_emsg, ctxt, fgs ^ DCC_CLNT_FG_GREY)) { + if (dcc_clnt_debug > 1) + dcc_error_msg("%s", dcc_emsg); + } else { + dcc_info_unlock(0); + } + } + + dcc_ctxts_unlock(); + return 1; +} + + + +static void +fix_info(DCC_SRVR_CLASS *class) +{ + map_changed = 1; + + if (class) { + dcc_force_measure_rtt(class); + } else { + dcc_force_measure_rtt(&dcc_clnt_info->dcc); + dcc_force_measure_rtt(&dcc_clnt_info->grey); + } + cdcc_unlock(1); + + /* repair addresses in the real map file now */ + if (!quiet + && which_map == MAP_INFO) + rdy_ctxt(DCC_CLNT_FG_BAD_SRVR_OK); +} + + + +/* compare ignoring case */ +static const char * /* 0 or mismatch in str */ +cmd_cmp(const char *str, const char *op) +{ + char op_c, str_c; + int len; + + len = 0; + for (;;) { + op_c = *op; + /* avoid tolower() to avoid build hassles on odd systems */ + if (op_c >= 'A' && op_c <= 'Z') + op_c += 'a'-'A'; + str_c = *str; + if (str_c == '\t') + str_c = ' '; + else if (str_c >= 'A' && str_c <= 'Z') + str_c += 'a'-'A'; + if (op_c != str_c) { + /* compress bursts of blanks */ + if (str_c == ' ' && len != 0 && *(op-1) == ' ') { + ++str; + continue; + } + return str; + } + if (op_c == '\0') + return 0; + ++op; + ++str; + ++len; + } +} + + + +/* Display our name for the server and its address, + * while suppressing some duplicates */ +static void +print_aop(SRVR_INX srvr_inx) /* -1 or server index */ +{ + const DCC_SRVR_CLASS *class; + char date_buf[40]; + char sustr[DCC_SU2STR_SIZE]; + const char *srvr_nm; + NAM_INX nam_inx; + + dcc_su2str2(sustr, sizeof(sustr), &op_result_su); + class = DCC_GREY2CLASS(grey_on); + /* Display the preferred server if srvr_inx is NO_SRVR */ + if (!GOOD_SRVR(class, srvr_inx)) + srvr_inx = class->srvr_inx; + if (GOOD_SRVR(class, srvr_inx) + && (GOOD_NAM(nam_inx = class->addrs[srvr_inx].nam_inx))) { + srvr_nm = class->nms[nam_inx].hostname; + if (strcmp(srvr_nm, sustr)) { + fputs(srvr_nm, stdout); + putchar(' '); + } + printf("%s\n server-ID %d", + dcc_su2str_err(&op_result_su), + class->addrs[srvr_inx].srvr_id); + } else { + printf("%s\n ", + dcc_su2str_err(&op_result_su)); + } + if (srvr.clnt_id != DCC_ID_ANON) + printf(" client-ID %d", srvr.clnt_id); + if (which_map == MAP_INFO) + printf(" %s", info_map_nm); + dcc_time2str(date_buf, sizeof(date_buf), " %X", + op_start.tv_sec); + fputs(date_buf, stdout); + putchar('\n'); +} + + + +static u_char /* 0=some kind of problem, 1=done */ +start_aop(DCC_AOPS aop, u_int32_t val1, SRVR_INX srvr_inx) +{ + DCC_OPS result; + + if (!rdy_ctxt(0)) + return 0; + + gettimeofday(&op_start, 0); + result = dcc_aop(dcc_emsg, ctxt, grey_on ? DCC_CLNT_FG_GREY : 0, + srvr_inx, clock_kludge, + aop, val1, 0, 0, 0, 0, 0, &aop_resp, &op_result_su); + gettimeofday(&op_end, 0); + + if (result == DCC_OP_INVALID + || result == DCC_OP_ERROR) { + dcc_error_msg("%s", dcc_emsg); + return 0; + } + + return 1; +} + + + +static void +fin_aop(SRVR_INX srvr_inx, /* index of server */ + u_char psrvr) /* 1=print server name */ +{ + if (quiet && !dcc_clnt_debug) + return; + + if (psrvr) + print_aop(srvr_inx); + + /* say what the server had to say */ + if (aop_resp.resp.val.string[0] >= ' ' + && aop_resp.resp.val.string[0] < 0x7f) { + fputs(aop_resp.resp.val.string, stdout); + putchar('\n'); + } + + if (dcc_clnt_debug) { + printf("%.2f ms\n", + ((op_end.tv_sec-op_start.tv_sec)*1000.0 + + (op_end.tv_usec-op_start.tv_usec)/1000.0)); + } + putchar('\n'); +} + + + +static u_char /* 0=some kind of problem, 1=done */ +do_aop(DCC_AOPS aop, u_int32_t val1, SRVR_INX srvr_inx, u_char psrvr) +{ + if (!start_aop(aop, val1, srvr_inx)) + return 0; + fin_aop(srvr_inx, psrvr); + return 1; +} + + + +static u_char /* 0=not enough power */ +ck_cmd_priv(const CMD_TBL_ENTRY *ce, + u_char privileged, /* 1=need good server-ID & password */ + u_char write_map) /* 1=write map, 2=write /var/dcc/map */ +{ + /* always call get_passwd() so we have always fetched a password + * fail if this command needs a good server-ID and password */ + if (!get_passwd(privileged)) { + dcc_error_msg("\"%s\" is a privileged server command"PRV_MSG, + ce->cmd, ids_path); + return 0; + } + + if (!write_map) + return 1; + + /* we can always write to our own throw-away map file */ + if (write_map == 1 && which_map == MAP_TMP) + return 1; + + if (0 > access(info_map_nm, R_OK) + && errno != ENOENT && errno != ENOTDIR) { + dcc_error_msg("\"%s\" is a privileged command changing %s", + ce->cmd, fnm2abs_err(0, info_map_nm)); + return 0; + } + return 1; +} + + + +static u_char /* 1=ok 0=bad command */ +cmd(const char *op) +{ + const char *arg, *help_str; + int op_num, j; + const CMD_TBL_ENTRY *ce; + + /* look for the string as a command and execute it if we find */ + ce = &cmds_tbl[0]; + for (op_num = 0; op_num < DIM(cmds_tbl); ++op_num) { + if (cmds_tbl[op_num].help_str) + ce = &cmds_tbl[op_num]; + arg = cmd_cmp(op, cmds_tbl[op_num].cmd); + /* if the command table entry and the command completely + * matched, then infer a null argument */ + if (!arg) { + if (!ck_cmd_priv(ce, ce->privileged, ce->write_map)) + return 0; + if (ce->args != 1) { + j = ce->fnc("", ce); + if (j >= 0) + return j; + } + help_cmd(op, 0); + return 0; + } + /* If the command table entry is an initial sustring of + * the user's command, then the rest of the command must + * start with white space or '='. (Allow '=' to let + * homedir/fix-map not need use `eval` to quote blanks + * `eval` in bash loses exit status. + * Trim and use the rest of the string as the argument */ + j = strspn(arg, DCC_WHITESPACE"="); + if (j) { + if (ce->args == 2) { + help_cmd(op, 0); /* arg not allowed */ + return 0; + } + if (!ck_cmd_priv(ce, ce->privileged, ce->write_map)) + return 0; + j = ce->fnc(arg+j, ce); + if (j >= 0) + return j; + help_cmd(op, 0); + return 0; + } + } + + + /* otherwise try to interpret it as a DCC administrative packet */ + op_num = 0; + help_str = ""; + for (;;) { + if (op_num >= DIM(aops_tbl)) { + dcc_error_msg("unrecognized command \"%s\"", op); + return 0; + } + /* do a command */ + if (aops_tbl[op_num].help_str) { + help_str = aops_tbl[op_num].help_str; + if (*help_str == '\0') + help_str = aops_tbl[op_num].op; + } + if (!cmd_cmp(op, aops_tbl[op_num].op)) + break; + ++op_num; + } + + /* send an administrative request to the server */ + if (!get_passwd(aops_tbl[op_num].privileged)) { + dcc_error_msg("\"%s\" is a privileged operation"PRV_MSG, + help_str, ids_path); + return 0; + } + + /* try to send it */ + return do_aop(aops_tbl[op_num].aop, aops_tbl[op_num].val, + NO_SRVR, 1); +} + + + +static u_char /* 0=bad command, 1=ok */ +do_cmds(char *cmd_buf) +{ + char *next_cmd, *cur_cmd, *cmd_end; + char c; + + next_cmd = cmd_buf; + for (;;) { + cur_cmd = next_cmd + strspn(next_cmd, DCC_WHITESPACE";"); + + if (*cur_cmd == '#' || *cur_cmd == '\0') + return 1; + + next_cmd = cur_cmd + strcspn(cur_cmd, ";\n\r"); + cmd_end = next_cmd; + next_cmd += strspn(next_cmd, ";\n\r"); + + /* null terminate and trim trailing white space from + * command or arg */ + do { + *cmd_end-- = '\0'; + c = *cmd_end; + } while (cmd_end >= cur_cmd + && strchr(DCC_WHITESPACE";", c)); + + if (*cur_cmd == '\0') /* ignore blank commands */ + continue; + + if (!cmd(cur_cmd)) + return 0; + } +} + + + +static int +help_cmd_print(int pos, const char *str) +{ +#define HELP_COL 24 + int col, nl; + + if (str[0] == '\n') { + nl = 100; + ++str; + } else { + nl = 0; + } + col = strlen(str)+1; + col += HELP_COL - (col % HELP_COL); + pos += col; + if (pos > 78) { + putchar('\n'); + pos = col; + } + printf("%-*s", col, str); + pos += nl; + + return pos; +#undef HELP_COL +} + + + +static int +help_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + int i, pos; + const char *help_str; + const char *p; + + /* say something about one command */ + if (arg) { + help_str = ""; + for (i = 0; i < DIM(cmds_tbl); ++i) { + if (cmds_tbl[i].help_str) + help_str = cmds_tbl[i].help_str; + p = cmd_cmp(arg, cmds_tbl[i].cmd); + if (!p || *p == ' ' || *p == '\t') { + while (*help_str == '\n' || *help_str == '-') + ++help_str; + printf("usage: %s\n", help_str); + if (cmds_tbl[i].fnc == stats_cmd) + printf(stats_help); + return 1; + } + } + for (i = 0; i < DIM(aops_tbl); ++i) { + if (aops_tbl[i].help_str) { + help_str = aops_tbl[i].help_str; + if (*help_str == '\0') + help_str = aops_tbl[i].op; + } + p = cmd_cmp(arg, aops_tbl[i].op); + if (!p || *p == ' ' || *p == '\t') { + while (*help_str == '\n' || *help_str == '-') + ++help_str; + printf("usage: %s\n", help_str); + return 1; + } + } + } + + /* talk about all of the commands */ + printf(" version "DCC_VERSION"\n"); + pos = 0; + for (i = 0; i < DIM(cmds_tbl); ++i) { + if (cmds_tbl[i].help_str + && cmds_tbl[i].help_str[0] != '-') + pos = help_cmd_print(pos, cmds_tbl[i].help_str); + } + for (i = 0; i < DIM(aops_tbl); ++i) { + help_str = aops_tbl[i].help_str; + if (!help_str) + continue; + if (*help_str == '\0') + help_str = aops_tbl[i].op; + pos = help_cmd_print(pos, help_str); + } + putchar('\n'); + + return 1; +} + + + +static int NRATTRIB +exit_cmd(const char *arg UATTRIB, const CMD_TBL_ENTRY *ce UATTRIB) +{ + exit(EX_OK); +#ifndef HAVE_GCC_ATTRIBUTES + return -1; +#endif +} + + +static int +grey_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + if (arg[0] == '\0') { + printf(" Greylist mode %s%s\n", + grey_on ? "on" : "off", + grey_set ? "" : " by default"); + return 1; + } + if (!strcmp(arg, "off")) { + grey_on = 0; + grey_set = 1; + set_which_map(which_map); + } else if (!strcmp(arg, "on")) { + grey_on = 1; + grey_set = 1; + set_which_map(which_map); + } else { + return -1; + } + if (!port_set) + srvr.port = DCC_GREY2PORT(grey_on); + return 1; +} + + + +static int +homedir_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + if (arg[0] != '\0') { + if (!dcc_cdhome(0, arg, 1)) + return 0; + if (ids_nm && !set_ids_path(dcc_emsg, ids_nm)) + dcc_error_msg("%s", dcc_emsg); + set_which_map(MAP_INFO); + } + printf(" homedir=%s\n", dcc_homedir); + return 1; +} + + + +/* set name of map file */ +static int +file_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + if (arg[0] == '\0') { + if (which_map == MAP_INFO) + printf(" using map file %s\n", + fnm2abs_err(0, info_map_nm)); + else + printf(" map file %s but using temporary file\n", + fnm2abs_err(0, info_map_nm)); + return 1; + } + + BUFCPY(info_map_nm, arg); + set_which_map(MAP_INFO); + return 1; +} + + + +/* create a new client map or parameter file */ +static int +new_map_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + if (arg[0] == '\0') + arg = DCC_MAP_NM_DEF; + + dcc_rel_priv(); + if (!dcc_create_map(dcc_emsg, arg, 0, 0, 0, 0, 0, 0, info_flags)) { + dcc_error_msg("%s", dcc_emsg); + return 0; + } + BUFCPY(info_map_nm, arg); + set_which_map(MAP_INFO); + if (!quiet) + printf(" created %s\n", fnm2abs_err(0, info_map_nm)); + return 1; +} + + + +static int +info_work(const char *arg, int fgs) +{ + DCC_CLNT_INFO info; + u_char dcc, srcbad, names; + + if (*arg == '\0') { + names = 0; + } else if (!strcmp(arg, "-N")) { + names = 1; + } else { + return -1; + } + + if (!rdy_ctxt(fgs)) + return 0; + + /* Snapshot the data and then release it while we print it. */ + dcc_ctxts_lock(); + if (!dcc_info_lock(0)) { + dcc_ctxts_lock(); + return 0; + } + memcpy(&info, dcc_clnt_info, sizeof(info)); + srcbad = ctxt && (ctxt->flags & DCC_CTXT_SRCBAD); + cdcc_unlock(1); + + dcc_rel_priv(); + if (which_map == MAP_INFO) { + if (info.dcc.nms[0].hostname[0] != '\0' + || !grey_on) { + dcc_print_info(info_map_nm, &info, + quiet, 0, srcbad, names, + 0 <= access(info_map_nm, R_OK)); + dcc = 1; + } else { + dcc = 0; + } + if (info.grey.nms[0].hostname[0] != '\0' + || grey_on) { + if (dcc && !quiet) + fputs("\n################\n", stdout); + dcc_print_info(info_map_nm, &info, + quiet, 1, srcbad, names, + 0 <= access(info_map_nm, R_OK)); + } + } else { + dcc_print_info(0, &info, quiet, grey_on, srcbad, names, 1); + } + if (!quiet) + putchar('\n'); + return 1; +} + + + +/* server hostname */ +static int +host_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + DCC_SRVR_NM nm; + int error; + + if (arg[0] == '\0') { + if (which_map == MAP_INFO) + return info_work(arg, DCC_CLNT_FG_BAD_SRVR_OK) ; + printf(" %s server hostname \"%s\"\n", + grey_on ? "greylist" : "DCC", srvr.hostname); + return 1; + } + if (!strcmp(arg, "-")) { + set_which_map(MAP_INFO); + if (!init_map(1, 0)) { + set_which_map(MAP_TMP); + return 0; + } + return 1; + } + + arg = dcc_parse_nm_port(0, arg, 0, + nm.hostname, sizeof(nm.hostname), + &nm.port, 0, 0, + 0, 0); + if (!arg) + return 0; + arg += strspn(arg, DCC_WHITESPACE); + if (*arg != '\0') + return 0; + + set_which_map(MAP_TMP); + memcpy(srvr.hostname, nm.hostname, sizeof(srvr.hostname)); + if (nm.port != 0) { + srvr.port = nm.port; + port_set = 1; + } + + /* go with the flow for IPv6 */ + dcc_host_lock(); + if (!dcc_get_host(nm.hostname, + (info_flags & DCC_INFO_FG_IPV6) ? 2 : 3, + &error)) { + dcc_host_unlock(); + dcc_error_msg("%s: %s", nm.hostname, DCC_HSTRERROR(error)); + } else { + if (dcc_hostaddrs[0].sa.sa_family == AF_INET) + info_flags &= ~DCC_INFO_FG_IPV6; + else + info_flags |= DCC_INFO_FG_IPV6; + dcc_host_unlock(); + } + + return 1; +} + + + +/* server port # */ +static int +port_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + u_int port; + + if (arg[0] == '\0') { + if (which_map == MAP_INFO) + return info_work(arg, DCC_CLNT_FG_BAD_SRVR_OK) ; + printf(" port=%d\n", ntohs(srvr.port)); + return 1; + } + + port = dcc_get_port(0, arg, DCC_GREY2PORT(grey_on), 0, 0); + if (port == DCC_GET_PORT_INVALID) + return 0; + + srvr.port = port; + port_set = 1; + set_which_map(MAP_TMP); + return 1; +} + + + +static int +ipv6_cmd(const char *arg, const CMD_TBL_ENTRY *ce) +{ + u_char new_use_ipv6; + + if (arg[0] == '\0') { + if (!init_map(1, 0)) + return 0; + printf(" IPv6 %s\n", + (info_flags & DCC_INFO_FG_IPV6) ? "on" : "off"); + return 1; + } + + if (!strcasecmp(arg, "off")) { + new_use_ipv6 = 0; + } else if (!strcasecmp(arg, "on")) { + new_use_ipv6 = DCC_INFO_FG_IPV6; + } else { + return -1; + } + + if (!ck_cmd_priv(ce, 0, 1)) + return 0; + + if (!init_map(1, 1)) + return 0; + if ((dcc_clnt_info->flags & DCC_INFO_FG_IPV6) != new_use_ipv6) { + dcc_clnt_info->flags ^= DCC_INFO_FG_IPV6; + info_flags = dcc_clnt_info->flags; + fix_info(0); + } else if (!cdcc_unlock(1)) { + return 0; + } + + if (rdy_ctxt(0) + && (dcc_clnt_info->flags & DCC_INFO_FG_IPV6) != new_use_ipv6) { +#ifdef NO_IPV6 + dcc_error_msg("IPv6 switch not changed;" + " No IPv6 support in this system?"); +#else + dcc_error_msg("IPv6 switch not changed."); +#endif + return 0; + } + + return 1; +} + + + +static u_char +ck_new_src(DCC_IP *new_ip, const char *arg, u_char use_ipv6) +{ + SOCKET soc; + DCC_SOCKU su; + int error; + + memset(new_ip, 0, sizeof(*new_ip)); + if (!strcmp(arg, "-")) + return 1; + + dcc_host_lock(); + if (!dcc_get_host(arg, use_ipv6 ? 1 : 0, &error)) { + dcc_host_unlock(); + dcc_error_msg("%s: %s", arg, DCC_HSTRERROR(error)); + return 0; + } + if (use_ipv6) + dcc_ipv4sutoipv6(&su, &dcc_hostaddrs[0]); + else + dcc_ipv6sutoipv4(&su, &dcc_hostaddrs[0]); + dcc_su2ip(new_ip, &su); + dcc_host_unlock(); + + soc = INVALID_SOCKET; + if (0 >= dcc_udp_bind(dcc_emsg, &soc, &su, 0)) { + dcc_error_msg("%s", dcc_emsg); + return 0; + } + closesocket(soc); + + return 1; +} + + + +static int +src_cmd(const char *arg, const CMD_TBL_ENTRY *ce) +{ + DCC_IP new_ip; + char sustr[DCC_SU2STR_SIZE]; + + if (arg[0] == '\0') { + if (!init_map(1, 0)) + return 0; + + if (dcc_clnt_info->src.family == AF_UNSPEC) { + printf(" no source address specified\n"); + } else { + /* display what the system actually uses */ + printf(" source address=%s%s\n", + dcc_su2str2(sustr, sizeof(sustr), + &ctxt->bind_su), + (ctxt->flags & DCC_CTXT_SRCBAD) + ? " "DCC_INFO_USE_SRCBAD : ""); + } + return 1; + } + + if (!ck_new_src(&new_ip, arg, DCC_INFO_IPV6())) + return 0; + + if (!ck_cmd_priv(ce, 0, 1)) + return 0; + + if (!init_map(1, 1)) + return 0; + src = new_ip; + dcc_clnt_info->src = src; + + fix_info(0); + return 1; +} + + + +static int +socks_cmd(const char *arg, const CMD_TBL_ENTRY *ce) +{ + u_char new_use_socks; + + if (arg[0] == '\0') { + if (!init_map(1, 0)) + return 0; + printf(" SOCKS %s\n", + (info_flags & DCC_INFO_FG_SOCKS) ? "on" : "off"); + return 1; + } + + if (!strcmp(arg, "off")) { + new_use_socks = 0; + } else if (!strcmp(arg, "on")) { + new_use_socks = DCC_INFO_FG_SOCKS; + } else { + return -1; + } + + if (!ck_cmd_priv(ce, 0, 1)) + return 0; + + if (!init_map(1, 1)) + return 0; + if ((dcc_clnt_info->flags & DCC_INFO_FG_SOCKS) == new_use_socks) + return cdcc_unlock(1); /* nothing to do */ + + dcc_clnt_info->flags ^= DCC_INFO_FG_SOCKS; + info_flags = dcc_clnt_info->flags; + + fix_info(0); + return 1; +} + + + +static int +passwd_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + DCC_PASSWD new_passwd; + + if (arg[0] == '\0') { + if (which_map == MAP_INFO) { + printf(" using password in %s\n", + fnm2abs_err(0, info_map_nm)); + if (passwd_set) + printf(" but the password for explicitly" + " named servers is "DCC_PASSWD_PAT"\n", + passwd); + } else { + if (passwd_set) + printf(" password "DCC_PASSWD_PAT"\n", + passwd); + else + printf(" password not set\n"); + } + return 1; + } + + arg = parse_passwd(0, new_passwd, arg, "password", 0, 0); + if (!arg || *arg != '\0') + return -1; + memcpy(passwd, new_passwd, sizeof(passwd)); + passwd_set = 1; + set_which_map(MAP_TMP); + return 1; +} + + + +static int +id_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + DCC_CLNT_ID id; + + if (arg[0] == '\0') { + printf(" ID=%d\n", srvr_clnt_id); + return 1; + } + + id = dcc_get_id(0, arg, 0, 0); + if (id == DCC_ID_INVALID) + return -1; + + srvr_clnt_id = id; + set_which_map(MAP_TMP); + return 1; +} + + + +static int +debug_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + char debug_str[24]; + char ttl_str[24]; + int new_ttl, new_debug; + char *p; + + if (arg[0] == '\0') { + if (!dcc_clnt_debug) + snprintf(debug_str, sizeof(debug_str), + "debug off"); + else if (dcc_clnt_debug == 1) + snprintf(debug_str, sizeof(debug_str), + "debug on"); + else + snprintf(debug_str, sizeof(debug_str), + "debug on+%d\n", dcc_clnt_debug-1); + if (dcc_debug_ttl != 0) + snprintf(ttl_str, sizeof(ttl_str), + " TTL=%d", dcc_debug_ttl); + else + ttl_str[0] = '\0'; + printf(" %s%s\n", debug_str, ttl_str); + return 1; + } + + new_ttl = dcc_debug_ttl; + new_debug = dcc_clnt_debug; + for (;;) { + if (!CLITCMP(arg, "off")) { + new_debug = 0; + arg += LITZ("off"); + } else if (!CLITCMP(arg, "on")) { + ++new_debug; + arg += LITZ("on"); + } else if (!CLITCMP(arg, "ttl=")) { + new_ttl = strtoul(arg+LITZ("ttl="), &p, 10); +#if defined(IPPROTO_IP) && defined(IP_TTL) + if (new_ttl < 256) + arg = p; +#else + printf(" TTL setting not supported\n"); +#endif + } + + if (*arg == '\0') + break; + if (*arg == ' ' || *arg == '\t') { + arg += strspn(arg, DCC_WHITESPACE); + } else { + return -1; + } + } + dcc_debug_ttl = new_ttl; + if (dcc_debug_ttl != 0) + set_which_map(MAP_TMP); + dcc_clnt_debug = new_debug; + if (dcc_clnt_debug > 1) + printf(" debug on+%d\n", dcc_clnt_debug-1); + return 1; +} + + + +static int +no_fail_cmd(const char *arg UATTRIB, const CMD_TBL_ENTRY *ce UATTRIB) +{ + if (!init_map(1, 1)) + return 0; + DCC_GREY2CLASS(grey_on)->fail_time= 0; + cdcc_unlock(1); + return 1; +} + + + +static int +quiet_cmd(const char *arg UATTRIB, const CMD_TBL_ENTRY *ce UATTRIB) +{ + if (arg[0] == '\0') { + printf(" %s\n", quiet ? "on" : "off"); + return 1; + } else if (!CLITCMP(arg, "on")) { + quiet = 1; + return 1; + } else if (!CLITCMP(arg, "off")) { + quiet = 0; + return 1; + } + return -1; +} + + + +static int +ckludge_cmd(const char *arg UATTRIB, const CMD_TBL_ENTRY *ce UATTRIB) +{ + char *p; + long l; + + if (arg[0] == '\0') { + printf(" clock kludge=%d\n", (int)clock_kludge); + return 1; + } + + l = strtol(arg, &p, 10); + if (*p != '\0') { + dcc_error_msg("invalid clock kludge \"%s\"", arg); + return -1; + } + clock_kludge = l; + return 1; +} + + + +static int +delete_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + DCC_SRVR_CLASS *class; + DCC_SRVR_NM nm, *nmp; + DCC_SRVR_ADDR *addr; + u_char del_grey; + + del_grey = grey_on; + if (!dcc_parse_srvr_nm(dcc_emsg, &nm, &del_grey, arg, 0, 0)) { + dcc_error_msg("%s", dcc_emsg); + return 0; + } + + /* map and lock */ + set_which_map(MAP_INFO); + if (!init_map(1, 1)) + return 0; + + class = DCC_GREY2CLASS(del_grey); + for (nmp = class->nms; nmp <= LAST(class->nms); ++nmp) { + if (strcasecmp(nmp->hostname, nm.hostname) + || nmp->port != nm.port) + continue; + + /* Found it. */ + + /* zap its IP addresses so they won't be used + * if resolving the remaining names fails */ + for (addr = class->addrs; addr <= LAST(class->addrs); ++addr) { + if (addr->nam_inx == nmp - class->nms) { + addr->rtt = DCC_RTT_BAD; + addr->nam_inx = NO_NAM; + } + } + if (nmp != LAST(class->nms)) + memmove(nmp, nmp+1, + (LAST(class->nms) - nmp)*sizeof(*nmp)); + memset(LAST(class->nms), 0, sizeof(*nmp)); + ++class->gen; + fix_info(class); + return 1; + } + + dcc_error_msg("server \"%s,%d\" not found", + nm.hostname, ntohs(nm.port)); + cdcc_unlock(1); + return 0; +} + + + +static int +add_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + DCC_SRVR_CLASS *class; + DCC_SRVR_NM nm, *nmp, *tgt_nmp; + u_char add_grey; + + add_grey = grey_set && grey_on; + + if (0 >= dcc_parse_srvr_nm(dcc_emsg, &nm, &add_grey, arg, 0, 0)) { + dcc_error_msg("%s", dcc_emsg); + return 0; + } + if (nm.clnt_id == DCC_ID_ANON && add_grey) { + dcc_error_msg("anonymous client-ID invalid" + " for Greylist server %s", + nm.hostname); + return 0; + } + + /* map and lock the information */ + set_which_map(MAP_INFO); + if (!init_map(1, 1)) + return 0; + + /* look for the old entry or a new, free entry */ + class = DCC_GREY2CLASS(add_grey); + tgt_nmp = 0; + for (nmp = class->nms; nmp <= LAST(class->nms); ++nmp) { + if (nmp->hostname[0] == '\0') { + if (!tgt_nmp) + tgt_nmp = nmp; + continue; + } + if (!strcmp(nmp->hostname, nm.hostname) + && nmp->port == nm.port) { + printf(" overwriting existing entry\n"); + tgt_nmp = nmp; + break; + } + } + + if (tgt_nmp) { + memcpy(tgt_nmp, &nm, sizeof(*tgt_nmp)); + fix_info(class); + return 1; + } + + cdcc_unlock(1); + if (add_grey) + dcc_error_msg("too many Greylist server names"); + else + dcc_error_msg("too many DCC server names"); + return 0; +} + + + +static void +add_new_nms(const DCC_SRVR_NM new_nms[DCC_MAX_SRVR_NMS], + DCC_SRVR_NM old_nms[DCC_MAX_SRVR_NMS]) +{ + const DCC_SRVR_NM *new_nmp; + DCC_SRVR_NM *old_nmp; + + for (new_nmp = new_nms; + new_nmp < &new_nms[DCC_MAX_SRVR_NMS] + && new_nmp->hostname[0] != '\0'; + ++new_nmp) { + for (old_nmp = old_nms; + old_nmp <= &old_nms[DCC_MAX_SRVR_NMS]; + ++old_nmp) { + if (old_nmp->hostname[0] == '\0' + || (!strcmp(old_nmp->hostname, new_nmp->hostname) + && old_nmp->port == new_nmp->port)) { + memcpy(old_nmp, new_nmp, sizeof(*old_nmp)); + break; + } + } + } +} + + + +static int +load_cmd(const char *lfile, const CMD_TBL_ENTRY *ce UATTRIB) +{ + u_char new_info_flags, load_grey; + int flags_set; + DCC_SRVR_NM new_nm; + DCC_SRVR_NM dcc_nms[DCC_MAX_SRVR_NMS]; + int num_dcc_nms; + DCC_SRVR_NM grey_nms[DCC_MAX_SRVR_NMS]; + int num_grey_nms; + char src_addr[INET6_ADDRSTRLEN+1]; + char buf[sizeof(DCC_SRVR_NM)*3]; + DCC_IP new_src; + const char *bufp, *cp; + FILE *f; + int fd, lno; + + if (*lfile == '\0') + return -1; + + dcc_rel_priv(); + if (!strcmp(lfile,"-")) { + lfile = 0; + fd = dup(fileno(stdin)); + if (fd < 0) { + dcc_error_msg("dup(stdin): %s", ERROR_STR()); + return 0; + } + f = fdopen(fd, "r"); + if (!f) { + dcc_error_msg("fdopen(): %s", ERROR_STR()); + return 0; + } + } else { + f = dcc_open_srvr_nm(dcc_emsg, lfile); + if (!f) { + dcc_error_msg("%s", dcc_emsg); + return 0; + } + } + + /* parse the text file to create a pair of lists of server names */ + flags_set = 0; + new_info_flags = info_flags; + num_dcc_nms = 0; + memset(dcc_nms, 0, sizeof(dcc_nms)); + num_grey_nms = 0; + memset(grey_nms, 0, sizeof(grey_nms)); + memset(&new_src, 0, sizeof(new_src)); + lno = 0; + for (;;) { + bufp = fgets(buf, sizeof(buf), f); + if (!bufp) { + if (ferror(f)) { + dcc_error_msg("fgets(%s): %s", + !lfile + ? "STDIN" + : fnm2abs_err(0, lfile), + ERROR_STR()); + fclose(f); + return 0; + } + break; + } + + ++lno; + + /* skip blank lines and comments */ + bufp += strspn(bufp, DCC_WHITESPACE); + if (*bufp == '\0' || *bufp == '#') + continue; + + /* look for flags in the first non-comment line */ + if (!flags_set++) { + cp = bufp; + if (!CLITCMP(cp, DCC_INFO_USE_IPV4)) { + cp += LITZ(DCC_INFO_USE_IPV4); + new_info_flags &= ~DCC_INFO_FG_IPV6; + } else if (!CLITCMP(cp, DCC_INFO_USE_IPV6)) { + cp += LITZ(DCC_INFO_USE_IPV6); + new_info_flags |= DCC_INFO_FG_IPV6; + } else { + ++flags_set; + } + if (flags_set == 1) { + /* We found "IPv6 on" or "off". + * Look for "use SOCKS" and "src=x.y.z.w" */ + cp += strspn(cp, DCC_WHITESPACE); + if (!CLITCMP(cp, DCC_INFO_USE_SOCKS)) { + new_info_flags |= DCC_INFO_FG_SOCKS; + cp += LITZ(DCC_INFO_USE_SOCKS); + cp += strspn(cp, DCC_WHITESPACE); + } + if (!CLITCMP(cp, DCC_INFO_USE_SRC)) { + cp += LITZ(DCC_INFO_USE_SRC); + cp = dcc_parse_word(dcc_emsg, + src_addr, + sizeof(src_addr), + cp, 0, 0, 0); + if (!cp) { + dcc_error_msg("%s", dcc_emsg); + continue; + } + if (!CLITCMP(cp, DCC_INFO_USE_SRCBAD)) { + cp += LITZ(DCC_INFO_USE_SRCBAD); + cp += strspn(cp, DCC_WHITESPACE); + } + ck_new_src(&new_src, src_addr, + (new_info_flags + & DCC_INFO_FG_SOCKS)); + } + } + if (*cp == '\0') + continue; + /* the first non-comment line must be a server name */ + } + + load_grey = 0; + if (0 >= dcc_parse_srvr_nm(dcc_emsg, &new_nm, &load_grey, + bufp, lfile, lno)) { + dcc_error_msg("%s", dcc_emsg); + fclose(f); + return 0; + } + if (load_grey) { + if (new_nm.clnt_id == DCC_ID_ANON) { + dcc_error_msg("anonymous client-ID invalid" + " for Greylist server %s%s", + new_nm.hostname, + fnm_lno(&fnm_buf, lfile, lno)); + fclose(f); + return 0; + } + if (num_grey_nms >= DIM(grey_nms)) { + dcc_error_msg("too many Greylist server names" + "%s", + fnm_lno(&fnm_buf, lfile, lno)); + fclose(f); + return 0; + } + grey_nms[num_grey_nms++] = new_nm; + } else { + if (num_dcc_nms >= DIM(dcc_nms)) { + dcc_error_msg("too many DCC server names%s", + fnm_lno(&fnm_buf, lfile, lno)); + fclose(f); + return 0; + } + dcc_nms[num_dcc_nms++] = new_nm; + } + } + fclose(f); + if (num_grey_nms == 0 && num_dcc_nms == 0) { + dcc_error_msg("no DCC server names%s", + fnm_lno(&fnm_buf, lfile, lno)); + return 0; + } + + /* create the map, without set-UID powers to prevent games, + * and then lock, install, and unlock the information */ + dcc_rel_priv(); + + if (which_map != MAP_INFO) + set_which_map(MAP_INFO); + if (!init_map(0, 1)) { + /* create a new map */ + if (!dcc_create_map(0, info_map_nm, 0, + 0, 0, 0, 0, &new_src, new_info_flags)) + return 0; + printf(" created %s\n", fnm2abs_err(0, info_map_nm)); + if (!init_map(1, 1)) + return 0; + } + + /* merge the old and new entries */ + add_new_nms(grey_nms, dcc_clnt_info->grey.nms); + add_new_nms(dcc_nms, dcc_clnt_info->dcc.nms); + dcc_clnt_info->flags = info_flags = new_info_flags; + if (new_src.family != AF_UNSPEC) + dcc_clnt_info->src = new_src; + + fix_info(0); + + if (!quiet) { + if (!lfile) + printf("##################\n\n"); + return info_work("", DCC_CLNT_FG_BAD_SRVR_OK) ; + } + return 1; +} + + + +static int +info_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + /* map, copy, and unlock the information + * prefer to talk to the server, but don't wait + * unless we have changed the file */ + return info_work(arg, + map_changed + ? DCC_CLNT_FG_BAD_SRVR_OK + : (DCC_CLNT_FG_NO_PICK_SRVR + | DCC_CLNT_FG_BAD_SRVR_OK)); +} + + + +static int +rtt_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + if (!init_map(1, 1)) + return 0; + dcc_force_measure_rtt(&dcc_clnt_info->dcc); + dcc_force_measure_rtt(&dcc_clnt_info->grey); + cdcc_unlock(1); + + /* wait to talk to the server, but don't insist */ + return info_work(arg, quiet ? DCC_CLNT_FG_BAD_SRVR_OK : 0); +} + + +/* delete a checksum */ +static int /* 1=ok, 0=bad checksum, -1=fatal */ +delck_sub(DCC_EMSG emsg, DCC_WF *wf UATTRIB, + DCC_CK_TYPES type, DCC_SUM sum, DCC_TGTS tgts UATTRIB) +{ + struct timeval cmd_start, cmd_end; + char type_buf[DCC_XHDR_MAX_TYPE_LEN]; + char ck_buf[sizeof(DCC_SUM)*3+2]; + DCC_DELETE del; + DCC_OP_RESP resp; + char ob[DCC_OPBUF]; + u_char result; + + printf(" deleting %s %s\n", + dcc_type2str(type_buf, sizeof(type_buf), type, 0, 1, grey_on), + dcc_ck2str(ck_buf, sizeof(ck_buf), type, sum, 0)); + + memset(&del, 0, sizeof(del)); + gettimeofday(&cmd_start, 0); + del.date = htonl(cmd_start.tv_sec); + del.ck.type = type; + del.ck.len = sizeof(del.ck); + memcpy(&del.ck.sum, sum, sizeof(DCC_SUM)); + result = dcc_clnt_op(emsg, ctxt, DCC_CLNT_FG_NO_FAIL, + 0, 0, 0, &del.hdr, sizeof(del), + DCC_OP_DELETE, &resp, sizeof(resp)); + gettimeofday(&cmd_end, 0); + if (!result) { + dcc_error_msg("%s", dcc_emsg); + } else { + switch (resp.hdr.op) { + case DCC_OP_OK: + break; + + case DCC_OP_ERROR: + dcc_error_msg(" %.*s", + (ntohs(resp.hdr.len) + -(int)(sizeof(resp.error) + - sizeof(resp.error.msg))), + resp.error.msg); + result = 0; + break; + + default: + dcc_error_msg("unexpected response: %s", + dcc_hdr_op2str(ob,sizeof(ob), &resp.hdr)); + result = 0; + break; + } + } + + if (dcc_clnt_debug) { + printf("%.2f ms\n", + ((cmd_end.tv_sec-cmd_start.tv_sec)*1000.0 + + (cmd_end.tv_usec-cmd_start.tv_usec)/1000.0)); + } + return result; +} + + + +/* delete a simple checksum */ +static int +delck_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + char type_str[DCC_XHDR_MAX_TYPE_LEN+1]; + + if (*arg == '\0') + return -1; + arg = dcc_parse_word(0, type_str, sizeof(type_str), + arg, 0, 0, 0); + if (!arg) + return -1; + + if (!rdy_ctxt(0)) + return 0; + return 0 < dcc_parse_hex_ck(0, &cmn_wf, + type_str, dcc_str2type_del(type_str, -1), + arg, 0, delck_sub); +} + + + +static int +sleep_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + double s; + char *p; + + s = strtod(arg, &p); + if (*p != '\0' || s < 0.001 || s > 1000) + return -1; + usleep((u_int)(s*1000000.0)); + return 1; +} + + + + +static const u_char * +client_unpack4(const u_char *cp, + u_int *vp) +{ + u_char c; + u_int v; + int shift; + + v = 0; + shift = 0; + do { + c = *cp++; + v |= (c & 0x7f) << shift; + shift += 7; + } while (c & 0x80); + + *vp = v; + return cp; +} + + + +static int +client_unpack(const u_char *cp0, + u_char *flagsp, + u_int *clnt_idp, + u_int *last_usedp, + u_int *requestsp, + u_int *nopsp, + u_char *versp, + DCC_SOCKU *su) +{ + const u_char *cp; + u_char flags; + u_int v; + struct in6_addr in6_addr; + struct in_addr in_addr; + +#ifdef DCC_PKT_VERSION6 + if (aop_resp.hdr.pkt_vers <= DCC_PKT_VERSION6) { +#define CPY2(s) ((s[0]<<8) | s[1]) +#define CPY3(s) ((s[0]<<16) | (s[1]<<8) | s[2]) +#define CPY4(s) ((s[0]<<24) | (s[1]<<16) | (s[2]<<8) | s[3]) + const DCC_ADMN_RESP_CLIENTSv6 *cl; + + cl = (DCC_ADMN_RESP_CLIENTSv6 *)cp0; + flags = cl->flags; + *flagsp = flags & (DCC_ADMN_RESP_CLIENTS_BL + | DCC_ADMN_RESP_CLIENTS_SKIP); + *clnt_idp = CPY4(cl->clnt_id); + *last_usedp = CPY4(cl->last_used); + if (flags & DCC_ADMN_RESP_CLIENTS_SKIP) { + /* skip place keepers */ + *last_usedp = CPY3(cl->requests); + *requestsp = 0; + } else { + *requestsp = CPY3(cl->requests); + } + *nopsp = CPY2(cl->nops); + if (flags & DCC_ADMN_RESP_CLIENTS_IPV6) { + memcpy(&in6_addr, &cl->addr, sizeof(in6_addr)); + dcc_mk_su(su, AF_INET6, &in6_addr, 0); + return (sizeof(*cl) - sizeof(cl->addr) + + sizeof(cl->addr.ipv6)); + } + memcpy(&in_addr, &cl->addr, sizeof(in_addr)); + dcc_mk_su(su, AF_INET, &in_addr, 0); + return (sizeof(*cl) - sizeof(cl->addr) + + sizeof(cl->addr.ipv4)); + } +#undef CPY2 +#undef CPY3 +#undef CPY4 +#endif + + cp = cp0; + flags = *cp++; + *flagsp = flags & (DCC_ADMN_RESP_CLIENTS_BL + | DCC_ADMN_RESP_CLIENTS_BAD + | DCC_ADMN_RESP_CLIENTS_SKIP + | DCC_ADMN_RESP_CLIENTS_LAST); + /* if the version is absent, + * then it must be the same as the previous value */ + if (flags & DCC_ADMN_RESP_CLIENTS_VERS) + *versp = *cp++; + v = *cp++ << 24; + v |= *cp++ << 16; + v |= *cp++ << 8; + v |= *cp++; + *last_usedp = v; + if ((flags & DCC_ADMN_RESP_CLIENTS_ID1) != 0) + *clnt_idp = DCC_ID_ANON; + else + cp = client_unpack4(cp, clnt_idp); + cp = client_unpack4(cp, requestsp); + cp = client_unpack4(cp, nopsp); + if (flags & DCC_ADMN_RESP_CLIENTS_IPV6) { + memcpy(&in6_addr, cp, sizeof(in6_addr)); + dcc_mk_su(su, AF_INET6, &in6_addr, 0); + cp += 16; + } else { + memcpy(&in_addr, cp, sizeof(in_addr)); + dcc_mk_su(su, AF_INET, &in_addr, 0); + cp += 4; + } + return cp - cp0; +} + + + +/* get the server's list of recent clients */ +static int +clients_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + u_char nonames, sort, ids, req_flags; + u_char passed_flags, passed_max_clients, passed_thold, passed_cidr; + struct in6_addr addr6; + DCC_AOP_CLIENTS_CIDR addr_bits; + u_int max_clients, thold; + u_int total, subtotal; + u_int max_ops, max_nops; + int ops_width, nops_width; + u_int offset; /* next client wanted from server */ + u_int num_clients; + DCC_SOCKU su; + struct ct { + struct ct *lt, *gt, *up; + time_t last_used; + u_int requests; + u_int nops; + u_int rank; + u_char flags; + u_char vers; + DCC_CLNT_ID clnt_id; + DCC_SOCKU su; + } *clist, **ctptr, *ctup, *ct, *ctnew; + u_int versions[DCC_PKT_VERSION_MAX+1]; + + char date_buf[40]; + struct tm last, now; + char *p; + const char *ac; + u_char need_head; + int i; + + passed_flags = 0; + thold = 0; + passed_thold = 0; + max_clients = DCC_ADMIN_RESP_MAX_CLIENTS; + passed_max_clients = 0; + passed_cidr = 0; + memset(addr_bits, 0, sizeof(addr_bits)); + + ac = strpbrk(arg, "/.:"); + + /* look for "-n", "-ns", "-n -s", etc. */ + nonames = 0; + sort = 0; + ids = 0; + req_flags = 0; + while (*arg != 0) { + arg += strspn(arg, " \t"); + if (*arg == '-' && !passed_flags) { + ++arg; + do { + switch (*arg) { + case 'n': + nonames = 1; + break; + case 's': + sort = 1; + break; + case 'i': + ids = 1; + break; + case 'a': + req_flags |= DCC_AOP_CLIENTS_AVG; + break; + case 'V': + req_flags |= DCC_AOP_CLIENTS_VERS; + break; + case 'A': + req_flags |= DCC_AOP_CLIENTS_ANON; + req_flags &= ~DCC_AOP_CLIENTS_NON_ANON; + break; + case 'K': + req_flags |= DCC_AOP_CLIENTS_NON_ANON; + req_flags &= ~DCC_AOP_CLIENTS_ANON; + break; + default: + help_cmd("clients", 0); + return -1; + } + } while (*++arg != ' ' && *arg != '\t' && *arg != '\0'); + continue; + } + if (!passed_cidr && ac && !strpbrk(arg, DCC_WHITESPACE)) { + int bits; + + bits = dcc_str2cidr(0, &addr6, 0, 0, arg, 0, 0); + if (bits <= 0) + return -1; + memcpy(addr_bits, &addr6, sizeof(addr6)); + addr_bits[sizeof(addr6)] = bits; + arg = ""; + passed_cidr = 1; + passed_flags = 1; + passed_max_clients = 1; + passed_thold = 1; + continue; + } + if (!passed_max_clients + && (i = strtoul(arg, &p, 10)) != 0 + && (*p == ' ' || *p == '\t' || *p == '\0')) { + max_clients = i; + arg = p; + passed_max_clients = 1; + passed_flags = 1; + continue; + } + if (!passed_thold + && (i = strtoul(arg, &p, 10)) > 0 + && (*p == ' ' || *p == '\t' || *p == '\0') + && i <= DCC_ADMIN_RESP_CLIENTS_MAX_THOLD) { + thold = i; + arg = p; + passed_thold = 1; + passed_max_clients = 1; + passed_flags = 1; + continue; + } + help_cmd("clients", 0); + return -1; + } + + if (ids) + req_flags &= ~DCC_AOP_CLIENTS_VERS; + + /* Require a server password for client IP addresses + * The server demands only client ID for "clients -i" */ + if (!ids + && !ck_cmd_priv(ce, 1, 0)) + return 0; + + if (!rdy_ctxt(0)) + return 0; + + /* Collect all of the information before printing it to minimize + * the changes in the position of hosts and so deleted or missing + * entries. */ + total = 0; + subtotal = 0; + max_ops = 0; + max_nops = 0; + memset(versions, 0, sizeof(versions)); + offset = 0; + num_clients = 0; + clist = 0; + for (;;) { + DCC_OPS result; + int len, result_len; + u_char vers, result_flags; +# define BL_FLAGS (DCC_ADMN_RESP_CLIENTS_BL | DCC_ADMN_RESP_CLIENTS_BAD) + u_int clnt_id, last_used, requests, nops; + + if (offset > DCC_AOP_CLIENTS_MAX_OFFSET) { + dcc_error_msg("%d are too many clients", offset); + break; + } + + gettimeofday(&op_start, 0); + result = dcc_aop(dcc_emsg, ctxt, grey_on ? DCC_CLNT_FG_GREY : 0, + NO_SRVR, clock_kludge, + ids ? DCC_AOP_CLIENTS_ID : DCC_AOP_CLIENTS, + (offset << 16) + + min(thold, + DCC_ADMIN_RESP_CLIENTS_MAX_THOLD), + ISZ(aop_resp.resp.val.string + ) >> DCC_ADMIN_RESP_CLIENTS_SHIFT, + req_flags, + offset >> 16, + addr_bits, passed_cidr ? sizeof(addr_bits) : 0, + &aop_resp, &op_result_su); + if (result == DCC_OP_INVALID + || result == DCC_OP_ERROR) { + dcc_error_msg("%s", dcc_emsg); + break; + } + + /* print heading before the first chunk */ + if (!offset) + print_aop(-1); + + result_len = (ntohs(aop_resp.hdr.len) + - (sizeof(aop_resp.resp) + - sizeof(aop_resp.resp.val.string))); + /* stop when the server has nothing to add */ + if (result_len <= 1) + break; + + len = 0; + vers = 0; + do { + len += client_unpack(&aop_resp.resp.val.clients[len], + &result_flags, &clnt_id, + &last_used, + &requests, &nops, &vers, + &su); + if (result_flags & DCC_ADMN_RESP_CLIENTS_SKIP) { + offset += last_used; + continue; + } + + if (vers != 0) { + if (vers < DIM(versions)) + versions[vers] += requests; + else + versions[0] += requests; + } + + + /* quit if we are in some kind of loop */ + if (++num_clients > DCC_ADMIN_RESP_MAX_CLIENTS) + goto stop; + ++offset; + + /* add the new entry to the possibly sorted list */ + + ctnew = dcc_malloc(sizeof(*ctnew)); + memset(ctnew, 0, sizeof(*ctnew)); + ctnew->flags = (result_flags & BL_FLAGS ); + ctnew->vers = vers; + ctnew->clnt_id = clnt_id; + ctnew->last_used = last_used; + ctnew->requests = requests; + if (max_ops < requests) + max_ops = requests; + total += requests; + ctnew->nops = nops; + if (max_nops < nops) + max_nops = nops; + ctnew->su = su; + + ctptr = &clist; + ctup = 0; + for (;;) { + ct = *ctptr; + if (!ct) { + ctnew->up = ctup; + *ctptr = ctnew; + break; + } + i = !sort; + if (!i) { + i = (0!= (ct->flags & BL_FLAGS)); + i -= (0 != (ctnew->flags & BL_FLAGS)); + } + if (!i) { + i = ct->requests; + i -= ctnew->requests; + } + ctup = ct; + if (i >= 0) { + ctptr = &ct->lt; + } else { + /* update the threshold if sorting */ + if (++ct->rank >= max_clients + && thold < ct->requests) { + thold = ct->requests; + } + ctptr = &ct->gt; + } + } + } while (len < result_len); + if (len != result_len) { + dcc_error_msg("wrong sized clients response; %d != %d", + result_len, len); + break; + } + + /* quit if the server ran out of things to say */ + if (result_flags & DCC_ADMN_RESP_CLIENTS_LAST) + break; + + /* Quit if we want only part of the list and we have it. + * We must get everything the server sends if we are sorting. + * The server uses our threshold to avoid sending everything + * it know. */ + if (!sort && offset >= max_clients) + break; +#undef BL_FLAGS + } +stop: + if (!total) + total = 1; + + dcc_localtime(time(0), &now); + + if (max_ops > 99*1000*1000) + ops_width = 9; + else if (max_ops > 9*1000*1000) + ops_width = 8; + else + ops_width = 7; + if (max_nops > 99*1000) + nops_width = 6; + else if (max_nops > 9*1000) + nops_width = 5; + else + nops_width = 4; + + /* print the list */ + num_clients = 0; + for (ct = clist; ct; ct = ctnew) { + ctnew = ct->gt; + if (ctnew) { + ct->gt = 0; + continue; + } + + if (num_clients == 0) { + if (sort) { + printf(" %*s %*s ", + ops_width, "ops", + nops_width, "nops"); + if (ids) + fputs(" ID ", stdout); + fputs(" last ", stdout); + if (req_flags & DCC_AOP_CLIENTS_VERS) + fputs(" v", stdout); + } else { + printf("%*s %*s last ID ", + ops_width, "ops", + nops_width, "nops"); + if (req_flags & DCC_AOP_CLIENTS_VERS) + fputs(" v", stdout); + } + putchar('\n'); + } + if (++num_clients <= max_clients) { + if (sort) { + subtotal += ct->requests; + printf("%3d%% %3d%% ", + (int)(ct->requests*100.0/total), + (int)(subtotal*100.0/total)); + } + printf("%*d %*d", + ops_width, ct->requests, + nops_width, ct->nops); + if (sort && ids) + printf(" %6d", ct->clnt_id); + /* print year and no time if it was long ago */ + dcc_localtime(ct->last_used, &last); + printf(" %s", dcc_time2str(date_buf, sizeof(date_buf), + (last.tm_year != now.tm_year + && (last.tm_mon < 6 + || now.tm_mon > 2)) + ? "%Y/%m/%d" : "%m/%d %X", + ct->last_used)); + if (!sort) + printf(" %6d", ct->clnt_id); + if (req_flags & DCC_AOP_CLIENTS_VERS) { + if (ct->vers != 0) + printf(" %d", ct->vers); + else + fputs(" ?", stdout); + } + if (ct->flags & DCC_ADMN_RESP_CLIENTS_BL) + fputs(" BLACKLIST", stdout); + else if (ct->flags & DCC_ADMN_RESP_CLIENTS_BAD) + fputs(" BAD", stdout); + if (!ids) { + char name[DCC_MAXDOMAINLEN]; + char sustr[DCC_SU2STR_SIZE]; + + if (nonames) { + printf(" %s", + dcc_su2str2(sustr, sizeof(sustr), + &ct->su)); + } else { + printf(" %-16s %s", + dcc_su2str2(sustr, sizeof(sustr), + &ct->su), + dcc_su2name(name, sizeof(name), + &ct->su)); + } + } + putchar('\n'); + + ctnew = ct->lt; + if (!ctnew) { + ctnew = ct->up; + } else { + ctnew->up = ct->up; + } + } + + memset(ct, 0, sizeof(*ct)); + dcc_free(ct); + } + putchar('\n'); + + + need_head = 1; + for (i = 0; i < DIM(versions); ++i) { + if (versions[i] == 0) + continue; + if (need_head) { + need_head = 0; + fputs("version total\n", stdout); + } + printf("%6d %8d\n", i, versions[i]); + } + + return 1; +} + + + +/* get and set the server's default anonymous client delay */ +static int +anon_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + int new_delay, old_delay, inflate; + DCC_OPS result; + char *inflate_str, *p; + + inflate = 0; + if (*arg == '\0') { + new_delay = DCC_NO_ANON_DELAY; + } else { + if (!strcasecmp(arg, "forever")) { + new_delay = DCC_ANON_DELAY_FOREVER; + } else { + new_delay = strtoul(arg, &inflate_str, 10); + if (new_delay > DCC_ANON_DELAY_MAX + || (*inflate_str != '\0' && *inflate_str != ',' + && *inflate_str != '*')) { + dcc_error_msg("invalid delay: \"%s\"", arg); + return 0; + } + if (*inflate_str != '\0') { + ++inflate_str; + inflate_str += strspn(inflate_str, + DCC_WHITESPACE); + } + if (*inflate_str != '\0' + && strcasecmp(inflate_str, "none")) { + inflate = strtoul(inflate_str, &p, 10); + if (*p != '\0') { + dcc_error_msg("invalid delay inflation:" + " \"%s\"", inflate_str); + return 0; + } + } + } + if (!ck_cmd_priv(ce, 1, 0)) + return 0; + } + + if (!rdy_ctxt(0)) + return 0; + + gettimeofday(&op_start, 0); + result = dcc_aop(dcc_emsg, ctxt, grey_on ? DCC_CLNT_FG_GREY : 0, + NO_SRVR, clock_kludge, DCC_AOP_ANON_DELAY, + inflate, new_delay>>8, new_delay, 0, 0, 0, + &aop_resp, &op_result_su); + if (result == DCC_OP_INVALID + || result == DCC_OP_ERROR) { + dcc_error_msg("%s", dcc_emsg); + return 0; + } + + old_delay = ((aop_resp.resp.val.anon_delay.delay[0]<<8) + + aop_resp.resp.val.anon_delay.delay[1]); + if (old_delay == DCC_ANON_DELAY_FOREVER) { + printf(" anon delay %s FOREVER\n", + new_delay != DCC_NO_ANON_DELAY ? "was" : "is"); + } else { + printf(" anon delay %s %d", + new_delay != DCC_NO_ANON_DELAY ? "was" : "is", + old_delay); + inflate = ((aop_resp.resp.val.anon_delay.inflate[0]<<24) + +(aop_resp.resp.val.anon_delay.inflate[1]<<16) + +(aop_resp.resp.val.anon_delay.inflate[2]<<8) + +aop_resp.resp.val.anon_delay.inflate[3]); + if (inflate != 0) + printf(",%d", inflate); + putchar('\n'); + } + return 1; +} + + + +/* rewind the flood from a single server */ +static int +flod_rewind(const char *arg UATTRIB, const CMD_TBL_ENTRY *ce UATTRIB) +{ + DCC_CLNT_ID id; + + if (!arg) + return -1; + id = dcc_get_id(0, arg, 0, 0); + if (id == DCC_ID_INVALID) + return -1; + + return do_aop(DCC_AOP_FLOD, id*256 + DCC_AOP_FLOD_REWIND, NO_SRVR, 1); +} + + + +/* fast forward the flood to a single server */ +static int +ffwd_out(const char *arg UATTRIB, const CMD_TBL_ENTRY *ce UATTRIB) +{ + DCC_CLNT_ID id; + + if (!arg) + return -1; + id = dcc_get_id(0, arg, 0, 0); + if (id == DCC_ID_INVALID) + return -1; + + return do_aop(DCC_AOP_FLOD, id*256 + DCC_AOP_FLOD_FFWD_OUT, NO_SRVR, 1); +} + + + +/* fast forward the flood to a single server */ +static int +ffwd_in(const char *arg UATTRIB, const CMD_TBL_ENTRY *ce UATTRIB) +{ + DCC_CLNT_ID id; + + if (!arg) + return -1; + id = dcc_get_id(0, arg, 0, 0); + if (id == DCC_ID_INVALID) + return -1; + + return do_aop(DCC_AOP_FLOD, id*256 + DCC_AOP_FLOD_FFWD_IN, NO_SRVR, 1); +} + + + +/* get the flood counts for a server */ +static int +flod_stats(const char *arg UATTRIB, const CMD_TBL_ENTRY *ce UATTRIB) +{ + u_int32_t id, next_id; + DCC_AOP_FLODS op; + u_char heading; + int sresult; + + if (!arg) + return -1; + if (!CLITCMP(arg, "clear")) { + arg += LITZ("clear"); + arg += strspn(arg, DCC_WHITESPACE); + op = DCC_AOP_FLOD_STATS_CLEAR; + } else { + op = DCC_AOP_FLOD_STATS; + } + + heading = 1; + if (!strcasecmp(arg, "all")) { + id = DCC_SRVR_ID_MAX+1; + for (;;) { + if (!start_aop(DCC_AOP_FLOD, id*256 + op, NO_SRVR)) + return 0; + sresult = sscanf(aop_resp.resp.val.string, + DCC_AOP_FLOD_STATS_ID, &next_id); + if (1 == sresult + && id == next_id) { + if (id == DCC_SRVR_ID_MAX+1) { + BUFCPY(aop_resp.resp.val.string, + " (no flooding peers)"); + fin_aop(NO_SRVR, 1); + } + return 1; + } + fin_aop(NO_SRVR, heading); + heading = 0; + if (1 != sresult) + return 0; + id = next_id+DCC_SRVR_ID_MAX+1; + } + } + + id = dcc_get_id(0, arg, 0, 0); + if (id == DCC_ID_INVALID) + return -1; + return do_aop(DCC_AOP_FLOD, id*256 + op, NO_SRVR, heading); +} + + + +static const char *stats_help = ""; + +/* get the statistics from all known servers */ +static int +stats_cmd(const char *arg, const CMD_TBL_ENTRY *ce UATTRIB) +{ + DCC_SRVR_CLASS *class; + SRVR_INX srvr_inx; + int srvrs_gen; + DCC_AOPS aop; + + /* look for "clear" or "all" */ + srvr_inx = NO_SRVR; + aop = DCC_AOP_STATS; + while (*arg != 0) { + arg += strspn(arg, " \t"); + if (srvr_inx == NO_SRVR + && !CLITCMP(arg, "clear")) { + arg += LITZ("clear"); + aop = DCC_AOP_STATS_CLEAR; + if (!get_passwd(aops_tbl[aop].privileged)) { + dcc_error_msg("\"stats clear\"" + " is a privileged operation" + PRV_MSG, ids_path); + return 0; + } + } else if (aop == DCC_AOP_STATS + && !CLITCMP(arg, "all")) { + arg += LITZ("all"); + srvr_inx = 0; + } + if (*arg != '\0' && *arg != ' ' && *arg != '\t') + return -1; + } + + if (!rdy_ctxt(0)) + return 0; + class = DCC_GREY2CLASS(grey_on); + srvrs_gen = class->gen; + do { + if (srvrs_gen != class->gen) { + dcc_error_msg("list of servers changed"); + return 0; + } + /* skip dead servers */ + if (srvr_inx != NO_SRVR + && class->addrs[srvr_inx].srvr_id == DCC_ID_INVALID ) + continue; + + do_aop(aop, sizeof(aop_resp.resp.val.string), srvr_inx, 1); + fflush(stderr); + fflush(stdout); + } while (srvr_inx != NO_SRVR && ++srvr_inx < class->num_srvrs); + + return 1; +} + + + +static int +clock_ck_cmd(const char *arg UATTRIB, const CMD_TBL_ENTRY *ce UATTRIB) +{ + if (!rdy_ctxt(0)) + return 0; + do_aop(DCC_AOP_CLOCK_CHECK, sizeof(aop_resp.resp.val.string), + NO_SRVR, 1); + + return 1; +} + + + +/* restore tracing to default */ +static int +trace_def(const char *arg UATTRIB, const CMD_TBL_ENTRY *ce UATTRIB) +{ + if (!rdy_ctxt(0)) + return 0; + + return (do_aop(DCC_AOP_TRACE_ON, DCC_TRACE_ON_DEF_BITS, + NO_SRVR, 1) + && do_aop(DCC_AOP_TRACE_OFF, DCC_TRACE_OFF_DEF_BITS, + NO_SRVR, 1)); + +} diff -r 000000000000 -r c7f6b056b673 cdcc/win32.mak --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cdcc/win32.mak Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,53 @@ +# Makefile for cdcc for WIN32. + +# This assumes Borland's free command line tools FreeCommandLineTools.exe +# available in 2004 at +# http://www.borland.com/products/downloads/download_cbuilder.html +# and elsewhere + +# 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.7 $Revision$ + +!include "../win32.makinc1" + +TARGET =cdcc +SRCS =$(TARGET).c +OBJS =$(SRCS:.c=.obj) + +$(TARGET): $(OBJS) ../dcclib/dcclib.lib + $(CC) $(LFLAGS) $? + +!include "../win32.makinc2" diff -r 000000000000 -r c7f6b056b673 cgi-bin/.manifest --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgi-bin/.manifest Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,12 @@ +Makefile.in +README +chgpasswd.in +common.in +edit-whiteclnt.in +footer +header +http2https +list-log.in +list-msg.in +webuser-notify.in +.manifest diff -r 000000000000 -r c7f6b056b673 cgi-bin/Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgi-bin/Makefile.in Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,72 @@ +# install the Distributed Checksum Clearinghouse sample white list CGI files + +# 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.15 $Revision$ +# @configure_input@ + +# Install only the CGI scripts in the cgi-bin directory to minimize +# the risks of letting Apache execute files in it. Install the other +# scripts in the usual DCC libexec directory. + +DEPTH =.. +CSCRIPTS=chgpasswd edit-whiteclnt list-log list-msg http2https webuser-notify +OFILES =README common +LOCFILES=header footer + +@MAKE_PROG@ +@MAKE_INC2@ + +INST_BINDIR=@installroot@@cgibin@ + +all: + @: + +install: + $(INSTALL) -d $(SET_BINOWN) -m 755 $(INST_BINDIR) + for NM in $(CSCRIPTS); do $(INSTALL) $(SET_BINOWN) \ + -m $(BINMODE) -c $$NM $(INST_BINDIR)/$$NM; done + for NM in $(OFILES); do $(INSTALL) $(SET_BINOWN) \ + -m 644 -c $$NM $(INST_BINDIR)/$$NM; done + for NM in $(LOCFILES); do \ + if test ! -f $(INST_BINDIR)/$$NM; then \ + $(INSTALL) $(SET_BINOWN) -m 644 -c $$NM $(INST_BINDIR)/$$NM; \ + fi; done + +deinstall: + -if test -d $(INST_BINDIR); then\ + (cd $(INST_BINDIR); rm -f $(OFILES) $(CSCRIPTS));\ + rmdir $(INST_BINDIR);\ + fi diff -r 000000000000 -r c7f6b056b673 cgi-bin/README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgi-bin/README Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,137 @@ +Sample CGI scripts for managing per-user dccm, dccifd, and dccproc whitelists +and logs. + Each user with a white list directory can + - browse logged messages + - point-and-click to add checksums from logged messages to an + individual white list + - choose to receive a daily notice about messages since the user's + log was last checked, but no more than one notice per week + when the log is not checked. + +............................................................................... + + newwebuser see misc/README + It is installed in the DCC libexec directory + instead of the cgi-bin directory so that the HTTP + server need not be tempted by distant users to + execute it. + + webuser-notify send a mail message notifying a user of new DCC log + files. This file must be edited, copied to the DCC + libexec directory, and made executable so that the + DCC cron script can use it. + + common utility functions + + header common HTML used near top of the web pages + footer common HTML used near bottom of the web pages + The scripts look first for a copy of the file + in the per-user directory and then in the cgi-bin + directory. + + list-log list a user's log files + + list-msg list a single message among the log files + + edit-whiteclnt edit a user's white list file + + chgpasswd change a user's password. + BEWARE that this script users `htpasswd -b` which + momentarily exposes passwords to other users on the + system using the `ps` command. On systems with user + shell accounts, this script should be turned off or + replaced with something like the HTTPD::UserAdmin + Perl module. To get it to work at all, you may need + to adjust $PATH to reach htpasswd. + + http2https CGI script to redirect HTTP accesses to HTTPS. + +............................................................................... + + +These scripts are intended to be portable and usable instead of fast or fancy. +Large organizations should consider perl_mod, templates, and so forth. + +Instead of modifying them in place, copying them to a directory other + than /var/dcc/cgi-bin will avoid difficulties when installing new + versions of the DCC. + +They are intended to be used with dccm and dccifd, but can be used with dccproc + if dccproc is told to follow the per-user logging and whitelist + conventions used by dccm or dccifd with + dccproc -E -l /var/dcc/userdirs/local/$USER/log \ + -w /var/dcc/userdirs/local/$USER/whiteclnt + It might be good to use the "include" facility to add a global + whiteclnt file to those per-user files. The /var/dcc/libexec/newwebuser + script starts per-user whiteclnt files from a prototype file and creates + a log directory. + It is not necessary to include the global whiteclnt file in each per-user + file with dccm or dccifd. The global whiteclnt file is consulted if a + per-user's file fails to yield a black or white answer. + + These scripts base their decisions about which additional or + "subsititute" headers to show on the -S parameters in DCCM_ARGS in + /var/dcc/dcc_conf. If you are not use dccm or dccifd but are using dccproc, + you must still set DCCM_ARGS for any local substitute SMTP headers. + Less likely to be useful SMTP headers such as non-null Message-IDs are + not supported to avoid confusing end-users. + +The log directory and whitelist for a local user in .../userdirs/local/name + are mapped to the htpasswd username "name", while those for remote + users in such as .../userdirs/esmtp/xxx@example.com are mapped to + esmtp/name@example.com + +These scripts should be installed and protected with an equivalent to the +following in httpd.conf with Apache: + ScriptAlias /DCC-cgi-bin/ /var/dcc/cgi-bin/ + + Order deny,allow + allow from all + AuthType Basic + AuthName "DCC user" + SetEnv AuthName "DCC user" + AuthUserFile /var/dcc/userdirs/webusers + require valid-user + # + SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP + SSLRequireSSL + # install the http2http2 script in your main /cgi-bin/ directory and + # add something like the following line to redirect HTTP to HTTPS + # ErrorDocument 403 /cgi-bin/http2https + + +Httpd must be able to read and write the per-user files and directories, +usually by sharing a GID with the DCC user and having the directories +writable-by-group. By default, the newwebuser script uses the group www. + + +This scripts can be used with the main client DCC log directory and whitelist by + + 1. let httpd read the main DCC log files. + Make the /var/dcc/log directory readable and searchable by 'group' + but neither searchable nor readable by 'other'. + Give the log directory the group used by httpd. + On SVR4 and Solaris systems, also make the directory set-GID + + 2. use `/var/dcc/libexec/newwebuser %postmaster` + to recreate a per-user directory for a local username that is + invalid and will not be hit by spammer dictionary attacks + + 3. replace the resulting userdirs/local/%postmaster/log directory with a + symbolic link to the main log directory: + rmdir /var/dcc/userdirs/local/%postmaster/log + ln -s ../../../log /var/dcc/userdirs/local/%postmaster/log + + 4. replace the resulting userdirs/%postmaster/whiteclnt file with a + symbolic link to the DCC client white list: + rm /var/dcc/userdirs/local/%postmaster/whiteclnt + ln -f -s ../../../whiteclnt /var/dcc/userdirs/local/%postmaster + + ensure that the /var/dcc/whiteclnt file can be read and written + by the httpd group. If you don't trust your httpd daemon, + it might be best to forget this idea. + + 5. follow the hints above for installing the sample CGI scripts. + + + Rhyolite Software DCC 1.3.103-1.12 $Revision$ diff -r 000000000000 -r c7f6b056b673 cgi-bin/chgpasswd.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgi-bin/chgpasswd.in Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,167 @@ +#! @PERL@ -wT + +# Change a DCC end-user's password + +# 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.19 $Revision$ +# @configure_input@ + +# This file must protected with equivalents to the httpd.conf lines +# in the README file. + +use strict 'subs'; +use 5.004; +use Fcntl qw(:DEFAULT :flock); + + +sub emsg { + my($msg) = html_str_encode(@_); + + $msg =~ s/^\s+//; + $msg =~ s/\s+$//; + $msg =~ s/\n/
\n/g; + + return "

$msg"; +} + + +my($preq, $passwd1, $passwd2, @file, %dict, + $locked, $result_msg, $restart_url); + +# get DCC parameters +local($DCCM_USERDIRS, + $hostname, + $user, + $whiteclnt_lock, + $edit_url, $passwd_url, + $url_ques, $url_suffix, + $form_hidden); +do('@cgibin@/common') || die("could not get DCC configuration: $!\n"); + +read_whiteclnt(\@file, \%dict); + + +$webusers="@prefix@/$DCCM_USERDIRS/webusers"; +$webusers_lock="$webusers.lock"; + +$passwd1 = $query{passwd1} ? $query{passwd1} : ""; +$passwd2 = $query{passwd2} ? $query{passwd2} : ""; +if ($hostname eq "www.rhyolite.com" + && $ENV{AuthName} && $ENV{AuthName} eq "DCC-demo-cgi" + && $user eq "cgi-demo" + && $passwd1 && $passwd2 && $passwd1 eq $passwd2) { + $passwd1 = "cgi-demo"; + $passwd2 = "cgi-demo"; +} + +$preq="The password must be 4 or more characters."; +$locked = ($whiteclnt_lock =~ /\blocked/) ? " disabled" : ""; +if ($locked) { + $result_msg = emsg("$whiteclnt locked; password not changed"); +} elsif (!$passwd1) { + if ($locked) { + $result_msg = emsg("$whiteclnt locked"); + } else { + $result_msg = html_str_encode($preq); + } +} elsif (length($passwd1) < 4) { + $result_msg = emsg("$preq"); + +} elsif ($passwd1 ne $passwd2) { + $result_msg = emsg("The two copies of the password differ."); +} elsif ($passwd1 !~ /^([^'"`]+)$/) { + $result_msg = emsg("Quotes are not allowed in passwords."); +} else { + $passwd1 = $1; # quite Perl taint warnings + + # use a separate lock file in case htpasswd does some locking of its own + if (!sysopen(LOCKFH, "$webusers_lock", O_WRONLY | O_CREAT)) { + $result_msg = emsg("open($webusers_lock): $!"); + } elsif (!flock(LOCKFH, LOCK_EX | LOCK_NB)) { + $result_msg = emsg("$webusers_lock busy: $!\nTry again"); + close(LOCKFH); + } else { + $locked = " disabled"; + open(CMD, "@HTPASSWD@ -b $webusers '$user' '$passwd1' 2>&1 |"); + if (!read(CMD, $result_msg, 1000)) { + $result_msg = emsg("read(htpasswd): $!"); + # put the error message into the Apache error log + print STDERR "DCC cgi chgpasswd $result_msg\n"; + $result_msg = emsg($result_msg); + close(CMD); + close(LOCKFH); + } else { + close(LOCKFH); + if (!close(CMD)) { + $result_msg = ($! ? "$result_msg\nclose(htpasswd): $!" + : "$result_msg\nhtpasswd exit status $?"); + # put the error message into the Apache error log + print STDERR "DCC cgi chgpasswd $result_msg\n"; + $result_msg = emsg($result_msg); + } else { + $restart_url = ($query{goback} && $query{goback} ne $passwd_url + ? "$query{goback}$url_suffix" + : $edit_url); + $restart_url .= $url_ques; + } + } + } +} + +html_head("Change DCC Password for $user", $restart_url); + +print "

Change DCC Password for $user

\n

\n"; + +common_buttons(); +print < + +

+

+ +
+ +
+ +
$form_hidden +
+
+ +

+$result_msg + +EOF +html_footer(); +print "\n\n"; diff -r 000000000000 -r c7f6b056b673 cgi-bin/common.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgi-bin/common.in Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,2031 @@ +#! @PERL@ -wT + +# get local DCC parameters for DCC whitelist CGI scripts. + +# 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.89 $Revision$ +# @configure_input@ + +# check this file by running it separately +use strict 'subs'; + +use integer; + +use 5.004; +use Fcntl qw(:DEFAULT :flock); +use POSIX qw(strftime); + +# quiet Perl taint checks with a path that should work everywhere for +# the few commands these scripts use. +$ENV{PATH}="/sbin:/bin:/usr/sbin:/usr/bin"; + +# global variables +# $DCCM_USERDIRS, # from dcc_conf +# $whiteclnt, # path to the per-user whitelist file +# %query, +# $thold_cks, # checksums that can have thresholds +# $user, +# $hostname, +# $user_dir, +# $edit_url, +# $list_log_url, +# $list_log_link, +# $list_msg_link, +# $edit_url, $edit_link, +# $passwd_url, $passwd_link, +# $logoutID, +# $url_ques, $url_suffix, +# $sub_white, # 'subsitute' headers from dcc_conf +# $form_hidden # state for main form + + + +# so this file can be used with do('@cgibin@/common') +# besides, check_user() must be called before html_head() +return check_user(); + + + +sub debug_time { + my($label) = @_; + + return if (!$query{debug}); + + my(@ts, $ts); + require 'sys/syscall.ph'; + + $ts = pack("LL", ()); + syscall(&SYS_gettimeofday, $ts, 0); + @ts = unpack("LL", $ts); + + chomp($label); + printf STDERR "%38s", $label; + print STDERR strftime(" %X", localtime($ts[0])); + printf STDERR ".%03d", $ts[1]/1000; + printf STDERR " %.3f", $_ foreach times; + print STDERR "\n"; +} + + + +sub debug_printf { + my($label, $str) = @_; + + return if (!$query{debug}); + $str =~ s/\n/\\n/g; + print STDERR "$label='$str'\n"; +} + + +# emit HTTP/HTML header +sub html_head { + my($title, # title of the web page + $refresh_url) = @_; # next step in re-login sequence if not null + my($header, $style); + + print < + + + $title + + +EOF + + print "\n" + if ($refresh_url); + + # Use header if supplied + # it is mostly text for the start of the , + # but it can also contain either ... + $header = "\n"; + if (open(HEADER, "$user_dir/header") + || open(HEADER, "@cgibin@/header")) { + my $line; + + $header .= $line while ($line =

); + close(HEADER); + } + + # Use our style style if the supplied header has none + if ($header =~ s/([ \t]*]*>.*<\/STYLE>\s*)//si) { + $style = $1; + } elsif ($header =~ s/([ \t]*]*rel=['"]?stylesheet[^>]*>)//si) { + $style = $1; + } else { + $style = < + + +EOF + } + + print < + +

$title

+$header +EOF +} + + + +sub html_footer { + if (open(FOOTER, "$user_dir/footer") + || open(FOOTER, "@cgibin@/footer")) { + my $line; + + print $line while ($line =