#%define name dcc
#%define version 1.2.54
#%define release 1
#
%define longtitle Distributed Checksum Clearinghouse, anti-spam tool
%define build_sendmail 0
# commandline overrides:
# rpm -ba|--rebuild --with 'xxx'
%{?_with_sendmail: %{expand: %%define build_sendmail 1}}
Summary: Distributed Checksum Clearinghouse, anti-spam tool
Name: dcc
Version: 1.2.63
Release: 1
License: BSD-like
Group: System/Servers
URL: http://www.rhyolite.com/anti-spam/dcc/
Source0: %{name}-dccd-%{version}.tar.bz2
# bite me you crazy cracker!
Source1: map
Patch0: dcc-dccd-1.2.2-initscript.patch.bz2
#PreReq: rpm-helper
Prereq: perl
#Prereq: rrdtool
%if %{build_sendmail}
BuildRequires: sendmail-devel
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
%description
Distributed Checksum Clearinghouse or DCC is a cooperative,
distributed system intended to detect "bulk" mail or mail sent to
many people. It allows individuals receiving a single mail message
to determine that many other people have been sent essentially
identical copies of the message and so reject the message. It can
identify some unsolicited bulk mail using "spam traps" and other
detectors, but that is not its focus.
The DCC can be viewed as a tool for end users to enforce their
right to "opt-in" to streams of bulk mail by refusing all bulk mail
except from sources in a "white list." White lists are generally
the responsibility of DCC clients, since only they know which bulk
mail they solicited.
NB to use DCC to reject SPAM you need to configure
%{_datadir}/dcc/dcc_conf and either use procmail or sendmail to
feed the messages to DCC
%package cgi
Summary: The cgi-scripts for managing mail delivery on a DCC enabled server
Group: System/Servers
Requires: apache2
Requires: %{name} = %{version}
%description cgi
Example set of cgi-scripts to allow users to point-and-click
manage their own DCC whitelists and thus what is delivered to
them. Allows overriding of site level lists. The scripts give
controlled access to the whitelists which are otherwise in
protected directory space (owned by dcc).
NB these scripts need configured after installation
%if %{build_sendmail}
%package sendmail
Summary: Distributed Checksum Clearinghouse Milter Interface
Group: System/Servers
Requires: sendmail
Requires: sendmail-cf
Requires: %{name} = %{version}
%description sendmail
Dccm is a daemon built with the sendmail milter interface intended
to connect sendmail to DCC servers.
%endif
%package devel
Summary: Development headers and libraries for %{name}
Group: Development/C
%description devel
Development headers and libraries for %{name}
%prep
%setup -q -n %{name}-dccd-%{version}
%patch0 -p0
# fix defaults
find . -type f | xargs perl -pi -e "s|/usr/local|%{_prefix}|g"
find . -type f | xargs perl -pi -e "s|/var/dcc|%{_localstatedir}/dcc|g"
%build
./configure \
--libexecdir=%{_sbindir} \
%if %{build_sendmail}
--with-sendmail \
--with-dccm \
%else
--disable-dccm \
%endif
--homedir=%{_localstatedir}/dcc \
--with-uid=dcc \
--with-cgibin=/var/www/dcc-bin \
--with-rundir=/var/run/dcc \
--with-db-memory=32
perl -p -i -e "s:\".*\":\"%{_sbindir}\": if m/define\s+DCC_LIBEXECDIR/ ;" include/dcc_config.h
make
# make extras
make -C dccifd/dccif-test
%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
# don't fiddle with the initscript!
export DONT_GPRINTIFY=1
install -d %{buildroot}%{_initrddir}
install -d %{buildroot}%{_sysconfdir}/cron.daily
install -d %{buildroot}%{_sysconfdir}/httpd/conf.d
install -d %{buildroot}/var/run/dcc
install -d %{buildroot}%{_localstatedir}/dcc/{log,userdirs/{local,esmtp,cyrus,procmail}}
install -d %{buildroot}%{_bindir}
install -d %{buildroot}%{_sbindir}
install -d %{buildroot}%{_mandir}
install -d %{buildroot}%{_libdir}
install -d %{buildroot}%{_includedir}/dcc
export INST_UID="`id -u`"
export INST_GID="`id -g`"
make MANOWN=$INST_UID MANGRP=$INST_GID DCC_SUID=$INST_UID DCC_OWN=$INST_UID \
DCC_GRP=$INST_GID BINOWN=$INST_UID GRP=$INST_GID INSTALL="install -C" \
DCC_PROTO_HOMEDIR=%{buildroot}%{_localstatedir}/dcc \
DCC_CGIBINDIR=%{buildroot}/var/www/dcc-bin \
DCC_LIBEXECDIR=%{buildroot}%{_sbindir} \
DCC_BINDIR=%{buildroot}%{_sbindir} \
BINDIR=%{buildroot}%{_bindir} \
MANDIR=%{buildroot}%{_mandir}/man \
install
install -m0755 misc/cron-dccd %{buildroot}%{_sysconfdir}/cron.daily/dccd
install -m0755 misc/rcDCC %{buildroot}%{_initrddir}/dccd
install -m0600 homedir/flod %{buildroot}%{_localstatedir}/dcc/flod
# why isnt make install doing this?
install -m0644 homedir/map.txt %{buildroot}%{_localstatedir}/dcc/map.txt
install -m0644 homedir/dcc_conf %{buildroot}%{_localstatedir}/dcc/dcc_conf
install -m0644 homedir/grey_flod %{buildroot}%{_localstatedir}/dcc/grey_flod
install -m0644 homedir/grey_whitelist %{buildroot}%{_localstatedir}/dcc/grey_whitelist
install -m0644 homedir/ids %{buildroot}%{_localstatedir}/dcc/ids
install -m0644 homedir/whiteclnt %{buildroot}%{_localstatedir}/dcc/whiteclnt
install -m0644 homedir/whitecommon %{buildroot}%{_localstatedir}/dcc/whitecommon
install -m0644 homedir/whitelist %{buildroot}%{_localstatedir}/dcc/whitelist
mkdir -p %{buildroot}/var/www/dcc-bin/
install -m0755 cgi-bin/chgpasswd %{buildroot}/var/www/dcc-bin/chgpasswd
install -m0755 cgi-bin/common %{buildroot}/var/www/dcc-bin/common
install -m0755 cgi-bin/edit-whiteclnt %{buildroot}/var/www/dcc-bin/edit-whiteclnt
install -m0755 cgi-bin/http2https %{buildroot}/var/www/dcc-bin/http2https
install -m0755 cgi-bin/list-log %{buildroot}/var/www/dcc-bin/list-log
install -m0755 cgi-bin/list-msg %{buildroot}/var/www/dcc-bin/list-msg
install -m0755 cgi-bin/webuser-notify %{buildroot}/var/www/dcc-bin/webuser-notify
# move some binaries in place, wierd stuff...
for i in dbclean dblist dccd dccifd dccsight wlist; do
mv %{buildroot}%{_bindir}/$i %{buildroot}%{_sbindir}/
done
# install extras
install -m0755 dccifd/dccif-test/dccif-test %{buildroot}%{_sbindir}/
install -m0755 dccifd/dccif-test/dccif-test.pl %{buildroot}%{_sbindir}/
install -m0755 dccifd/dccif.pl %{buildroot}%{_sbindir}/
%if %{build_sendmail}
install -d %{buildroot}%{_datadir}/sendmail-cf/feature
install -m0644 misc/dcc.m4 %{buildroot}%{_datadir}/sendmail-cf/feature/
install -m0644 misc/dccdnsbl.m4 %{buildroot}%{_datadir}/sendmail-cf/feature/
install -m0644 misc/dict-attack-aliases %{buildroot}%{_localstatedir}/dcc/
install -m0755 misc/filter-dict-attack %{buildroot}%{_sbindir}/
mv %{buildroot}%{_bindir}/dccm %{buildroot}%{_sbindir}/
%else
rm -f %{buildroot}%{_sbindir}/start-dccm %{buildroot}%{_mandir}/man8/dccm.8*
%endif
# Set some initial logging, but no rejections
perl -p -i -e "s/BRAND=\$/BRAND=%{version}-%{release}/ ; s/DCCM_LOG_AT=\$/\$&10/ ; " \
%{buildroot}%{_localstatedir}/dcc/dcc_conf
# install the apache2 config
cat > %{buildroot}%{_sysconfdir}/httpd/conf.d/Z15_dcc.conf <
Order deny,allow
Deny from all
allow from 127.0.0.1
SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
SSLRequireSSL
ErrorDocument 403 /dcc-bin/http2https
AuthType Basic
AuthName "DCC user"
AuthUserFile %{_localstatedir}/dcc/userdirs/webusers
require valid-user
EOF
echo "# put users in here" > %{buildroot}%{_localstatedir}/dcc/userdirs/webusers
# prepare for docs inclusion
cp misc/README README.misc
cp homedir/README README.homedir
cp cgi-bin/README README.cgi-bin
# fix strange attribs
chmod 644 CHANGES LICENSE README* *.txt *.html
# install devel files
install -m0644 dccd/*.h %{buildroot}%{_includedir}/dcc/
install -m0644 dcclib/*.h %{buildroot}%{_includedir}/dcc/
install -m0644 include/*.h %{buildroot}%{_includedir}/dcc/
install -m0644 srvrlib/*.h %{buildroot}%{_includedir}/dcc/
install -m0755 dcclib/libdcc.a %{buildroot}%{_libdir}/
install -m0755 srvrlib/libsrvr.a %{buildroot}%{_libdir}/
install -m0755 thrlib/libthr.a %{buildroot}%{_libdir}/
# house cleaning
rm -f %{buildroot}/var/www/dcc-bin/README
rm -f %{buildroot}%{_sbindir}/rcDCC
rm -f %{buildroot}%{_sbindir}/cron-dccd
rm -f %{buildroot}%{_sbindir}/logger
rm -f %{buildroot}%{_sbindir}/updatedcc
# fixing your wierdness you crazy cracker
cp %{SOURCE1} %{buildroot}/var/dcc/
%pre
if ! grep -q "^dcc:" /etc/passwd; then
/usr/sbin/useradd -s /bin/false -c "Distributed Checksum Client" -d %{_localstatedir}/dcc dcc 1>/dev/null 2>&1
fi
%post
service dccd start 1>/dev/null 2&>1
#add to startup
# this causes a hang if not connected to the internet
# deactivate it for now... user should read man pages
# instead...
#%{_bindir}/cdcc info > %{_localstatedir}/dcc/map.txt || :
#cdcc "load map.txt"
%preun
service dccd stop
%postun
/usr/sbin/userdel dcc
%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
%files
%defattr(-,root,root)
%doc CHANGES FAQ.txt INSTALL.txt LICENSE README.misc README.homedir
%doc FAQ.html INSTALL.html cdcc.html dbclean.html dblist.html
%doc dcc.html dccd.html dccifd.html dccproc.html dccsight.html
%config(noreplace) %attr(0755,root,root) %{_sysconfdir}/cron.daily/dccd
%config(noreplace) %attr(0755,root,root) %{_initrddir}/dccd
%config(noreplace) %attr(0600,dcc,dcc) %{_localstatedir}/dcc/ids
# probably not going to work
%config(noreplace) %attr(0600,dcc,dcc) %{_localstatedir}/dcc/map
%config(noreplace) %attr(0600,dcc,dcc) %{_localstatedir}/dcc/map.txt
%config(noreplace) %attr(0644,dcc,dcc) %{_localstatedir}/dcc/dcc_conf
#%config(noreplace) %attr(0644,dcc,dcc) %{_localstatedir}/dcc/dcc_db
#%config(noreplace) %attr(0644,dcc,dcc) %{_localstatedir}/dcc/dcc_db.hash
%config(noreplace) %attr(0644,dcc,dcc) %{_localstatedir}/dcc/flod
%config(noreplace) %attr(0644,dcc,dcc) %{_localstatedir}/dcc/whiteclnt
%config(noreplace) %attr(0644,dcc,dcc) %{_localstatedir}/dcc/whitecommon
%config(noreplace) %attr(0644,dcc,dcc) %{_localstatedir}/dcc/whitelist
%config(noreplace) %attr(0644,dcc,dcc) %{_localstatedir}/dcc/grey_flod
%config(noreplace) %attr(0644,dcc,dcc) %{_localstatedir}/dcc/grey_whitelist
%attr(4755,root,root) %{_bindir}/cdcc
%attr(4755,root,root) %{_bindir}/dccproc
%attr(0755,root,root) %{_sbindir}/dbclean
%attr(0755,root,root) %{_sbindir}/dblist
%attr(0755,root,root) %{_sbindir}/dccd
%attr(0755,root,root) %{_sbindir}/dccifd
%attr(0755,root,root) %{_sbindir}/newwebuser
#%attr(0755,root,root) %{_sbindir}/refeed
%attr(0755,root,root) %{_sbindir}/start-dccd
%attr(0755,root,root) %{_sbindir}/start-dccifd
%attr(0755,root,root) %{_sbindir}/stop-dccd
%attr(0755,root,root) %{_sbindir}/wlist
%attr(4755,root,root) %{_sbindir}/dccsight
%attr(0755,root,root) %{_sbindir}/start-grey
%attr(0755,root,root) %{_sbindir}/hackmc
#%attr(0755,root,root) %{_sbindir}/na-spam
#%attr(0755,root,root) %{_sbindir}/ng-spam
# rrdtool stuff
%attr(0755,root,root) %{_sbindir}/dcc-stats-collect
%attr(0755,root,root) %{_sbindir}/dcc-stats-graph
%attr(0755,root,root) %{_sbindir}/dcc-stats-init
%attr(0755,root,root) %{_sbindir}/stats-get
# extras
%attr(0755,root,root) %{_sbindir}/dccif-test
%attr(0755,root,root) %{_sbindir}/dccif-test.pl
%attr(0755,root,root) %{_sbindir}/dccif.pl
%attr(0755,root,root) %{_sbindir}/fetch-testmsg-whitelist
%attr(0755,dcc,dcc) %dir %{_localstatedir}/dcc
%attr(0755,dcc,dcc) %dir %{_localstatedir}/dcc/log
%attr(0755,dcc,dcc) %dir %{_localstatedir}/dcc/userdirs
%attr(0755,dcc,dcc) %dir %{_localstatedir}/dcc/userdirs/local
%attr(0755,dcc,dcc) %dir %{_localstatedir}/dcc/userdirs/cyrus
%attr(0755,dcc,dcc) %dir %{_localstatedir}/dcc/userdirs/procmail
%attr(0755,dcc,dcc) %dir %{_localstatedir}/dcc/userdirs/esmtp
%attr(0755,dcc,dcc) %dir /var/run/dcc
%attr(0644,root,root) %{_mandir}/man8/cdcc.8*
%attr(0644,root,root) %{_mandir}/man8/dbclean.8*
%attr(0644,root,root) %{_mandir}/man8/dblist.8*
%attr(0644,root,root) %{_mandir}/man8/dcc.8*
%attr(0644,root,root) %{_mandir}/man8/dccd.8*
%attr(0644,root,root) %{_mandir}/man8/dccifd.8*
%attr(0644,root,root) %{_mandir}/man8/dccproc.8*
%attr(0644,root,root) %{_mandir}/man8/dccsight.8*
%if %{build_sendmail}
%files sendmail
%defattr(-,root,root)
%doc dccm.html
%config(noreplace) %attr(0644,dcc,dcc) %{_localstatedir}/dcc/dict-attack-aliases
%attr(0755,root,root) %{_sbindir}/dccm
%attr(0755,root,root) %{_sbindir}/filter-dict-attack
%attr(0755,root,root) %{_sbindir}/hackmc
%attr(0755,root,root) %{_sbindir}/na-spam
%attr(0755,root,root) %{_sbindir}/ng-spam
%attr(0755,root,root) %{_sbindir}/start-dccm
%attr(0644,root,root) %{_datadir}/sendmail-cf/feature/dcc.m4
%attr(0644,root,root) %{_datadir}/sendmail-cf/feature/dccdnsbl.m4
%attr(0644,root,root) %{_mandir}/man8/dccm.8*
%endif
%files cgi
%defattr(-,root,root)
%doc README.cgi-bin
%config(noreplace) %attr(0640,root,root) %{_sysconfdir}/httpd/conf.d/Z15_dcc.conf
%config(noreplace) %attr(0644,root,root) %{_localstatedir}/dcc/userdirs/webusers
%attr(0755,root,root) /var/www/dcc-bin/chgpasswd
%attr(0755,root,root) /var/www/dcc-bin/common
%attr(0755,root,root) /var/www/dcc-bin/edit-whiteclnt
%attr(0755,root,root) /var/www/dcc-bin/http2https
%attr(0755,root,root) /var/www/dcc-bin/list-log
%attr(0755,root,root) /var/www/dcc-bin/list-msg
%attr(0755,root,root) /var/www/dcc-bin/webuser-notify
%files devel
%defattr(-,root,root)
%attr(0644,root,root) %{_includedir}/dcc/*.h
%attr(0755,root,root) %{_libdir}/*.a
%changelog
* Mon Nov 29 2004 Scott R. Shinn 1.2.63-1
- pre spec fix
- update to 1.2.63
* Tue Oct 05 2004 Scott R. Shinn 1.2.54-2
- disabled the rrdtool and rpm-helper Requires for now
* Sun Oct 03 2004 Scott R. Shinn 1.2.54-1
- updated to 1.2.54
- added in a changelog
- dar build tweaks