From 5c90cd7c1d2e64a6e89eb032971385a9f3840ff2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alin=20N=C4=83stac?= Date: Tue, 17 Apr 2007 08:11:22 +0000 Subject: [PATCH] Version bump, thanks to steveb and Natanael Copa (#172929). Package-Manager: portage-2.1.2.3 --- mail-filter/dspam/ChangeLog | 9 +- mail-filter/dspam/Manifest | 29 +- mail-filter/dspam/dspam-3.8.0.ebuild | 450 +++++++++++++++++++++ mail-filter/dspam/files/digest-dspam-3.8.0 | 9 + mail-filter/dspam/files/dspam-3.8.0.cron | 321 +++++++++++++++ 5 files changed, 809 insertions(+), 9 deletions(-) create mode 100644 mail-filter/dspam/dspam-3.8.0.ebuild create mode 100644 mail-filter/dspam/files/digest-dspam-3.8.0 create mode 100644 mail-filter/dspam/files/dspam-3.8.0.cron diff --git a/mail-filter/dspam/ChangeLog b/mail-filter/dspam/ChangeLog index 4910416307a3..fabd35f8e4bc 100644 --- a/mail-filter/dspam/ChangeLog +++ b/mail-filter/dspam/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for mail-filter/dspam # Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/ChangeLog,v 1.86 2007/04/03 18:08:30 gustavoz Exp $ +# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/ChangeLog,v 1.87 2007/04/17 08:11:22 mrness Exp $ + +*dspam-3.8.0 (17 Apr 2007) + + 17 Apr 2007; Alin Năstac +files/dspam-3.8.0.cron, + +dspam-3.8.0.ebuild: + Version bump, thanks to steveb and Natanael + Copa ( #172929). 03 Apr 2007; Gustavo Zacarias dspam-3.6.8-r3.ebuild: Stable on sparc wrt #172756 diff --git a/mail-filter/dspam/Manifest b/mail-filter/dspam/Manifest index 20cb5933379d..f38da429eb1c 100644 --- a/mail-filter/dspam/Manifest +++ b/mail-filter/dspam/Manifest @@ -9,6 +9,10 @@ AUX README.qmail 2317 RMD160 ebdd90be77441540848caf39b6fcde3d332b2b93 SHA1 081b2 MD5 e0469b961385fda4305602dc2519d319 files/README.qmail 2317 RMD160 ebdd90be77441540848caf39b6fcde3d332b2b93 files/README.qmail 2317 SHA256 c70a32eb183401f3d36b8e13c1e298875692b8a9d3f34151ae42b172dd6f064a files/README.qmail 2317 +AUX dspam-3.8.0.cron 9166 RMD160 55a4b2ecfe4b2f7fc18a23a8b3fd99ed5408e7df SHA1 0bc9f618820ee161a165b37aa4023bc6094670fe SHA256 dbdfadb70cdca046c24a23b86c15bea3a8ded81a573d663b7a4c74f966526346 +MD5 99305dc93a6e01fb6a46eaaab005d1fd files/dspam-3.8.0.cron 9166 +RMD160 55a4b2ecfe4b2f7fc18a23a8b3fd99ed5408e7df files/dspam-3.8.0.cron 9166 +SHA256 dbdfadb70cdca046c24a23b86c15bea3a8ded81a573d663b7a4c74f966526346 files/dspam-3.8.0.cron 9166 AUX dspam.cron 4794 RMD160 b5e8f577700abceb4bf06ac41376c94b9f5e3db8 SHA1 d370b7c922e72dd5b2f1de01dce2870ddcc17ebf SHA256 c46325e7e5de7f57e571bd2b718abf48dfc82a3ba66aad25889d47d3082b68d5 MD5 18428af50d78d693e39355866b463831 files/dspam.cron 4794 RMD160 b5e8f577700abceb4bf06ac41376c94b9f5e3db8 files/dspam.cron 4794 @@ -23,15 +27,21 @@ RMD160 256f2607b275336f944b0882591366c39b53daf7 files/logrotate.dspam 156 SHA256 75e04139e564ad55011ee77b8245dc5cdefbb6d56ca451feab5861ab907d614e files/logrotate.dspam 156 DIST dspam-3.6.8-patches-20070322.tar.gz 5518 RMD160 76bc1194891527da5c221f0f8d33b806911e288b SHA1 4a13338009f849fe928eae7ca6b7d3fb72103732 SHA256 3f38801f4437053e71ccde146c62b1af0adb5be6bd7d7d34914565160ba00df4 DIST dspam-3.6.8.tar.gz 743275 RMD160 93a70db14070cb61bd2ef1b0ca55a18be1dbfd7b SHA1 e8c413882eadf1e02837e4a2ffcfc98b801eded1 SHA256 88c7b41fb81e90ba8a260885a1d14bce39f2ef4a06cc2c6b8bfa0b99ba1aec34 +DIST dspam-3.8.0-patches-20070416.tar.gz 7062 RMD160 05d6d294edab5f4ca058aa9daf5c3d9c69ddd91c SHA1 f71080f39b3f11e654c708651885bd622866e1df SHA256 9cc2d1cf1482ceff124a9017910bb6c3a7ed0be828e2d3c6c83b08e6b871a649 +DIST dspam-3.8.0.tar.gz 726160 RMD160 e7831e2415e30e819dd9cbc0ba3f269e113e2fb9 SHA1 d1de7ee2134522adaf52f49167accecf1589fa96 SHA256 84a227934a7aee73516bdb82c33ee7b359e955c8cd95a1544a9a13069f79bfc7 DIST dspam_sa_trainer.tar.gz 1230 RMD160 c3d0fca7169d23ecf9d44c850ee255b42d97d818 SHA1 71a002f26a888bdfe47759cf1f780cd6478dacac SHA256 8fb6b1ebe592acf00a028737ef8e174544af166768b987d29048b2319bc5a215 EBUILD dspam-3.6.8-r3.ebuild 17130 RMD160 9a913710930d24d9a79af111b1ab8973b17e8f74 SHA1 460905f7ceede56e7e381995dd2fd82f59447f5c SHA256 6b55ff04c1080314f4e3e6b95fd3d692154a7ae98121f1ee83d1b51aa9d04d31 MD5 61e46c0895f070b706d4c6ca3bd15140 dspam-3.6.8-r3.ebuild 17130 RMD160 9a913710930d24d9a79af111b1ab8973b17e8f74 dspam-3.6.8-r3.ebuild 17130 SHA256 6b55ff04c1080314f4e3e6b95fd3d692154a7ae98121f1ee83d1b51aa9d04d31 dspam-3.6.8-r3.ebuild 17130 -MISC ChangeLog 15346 RMD160 b35d8837dbb7086593ed339392386671a278e220 SHA1 a3d4e212ed24e9ba3c6aed29a38a51ba2416a96a SHA256 43fcf3dee74031dc9ae3209d960969434f35618fe482e387120b666df7a77453 -MD5 f6661a3ef8f5de31ecd107e6a5480e63 ChangeLog 15346 -RMD160 b35d8837dbb7086593ed339392386671a278e220 ChangeLog 15346 -SHA256 43fcf3dee74031dc9ae3209d960969434f35618fe482e387120b666df7a77453 ChangeLog 15346 +EBUILD dspam-3.8.0.ebuild 15122 RMD160 a0e8dc6deebb99f4dece2800cda754800a62daf0 SHA1 b9bfe297e75dda6c0ff95d1e80b71d8926638e8d SHA256 c585684c9cae2ebe5ddfd5029f915f556222c1a0d9f9322c60292f7ca123c2c5 +MD5 5706e2eebbf006a3d0c41568d954b9e8 dspam-3.8.0.ebuild 15122 +RMD160 a0e8dc6deebb99f4dece2800cda754800a62daf0 dspam-3.8.0.ebuild 15122 +SHA256 c585684c9cae2ebe5ddfd5029f915f556222c1a0d9f9322c60292f7ca123c2c5 dspam-3.8.0.ebuild 15122 +MISC ChangeLog 15600 RMD160 11addad729b95c242f6c4589a48c2c1b1a916e97 SHA1 4fd5ecd4e929b4963e55586b1193b7e273c386a5 SHA256 d4e2bb10b84a03a6f35d468374770269ec2a684b8d792ae7100ae04b76d16037 +MD5 2b3a7263157f374578a1450059790e43 ChangeLog 15600 +RMD160 11addad729b95c242f6c4589a48c2c1b1a916e97 ChangeLog 15600 +SHA256 d4e2bb10b84a03a6f35d468374770269ec2a684b8d792ae7100ae04b76d16037 ChangeLog 15600 MISC metadata.xml 335 RMD160 acb18f015dcada8300ffce56be0c4a285ce2a215 SHA1 87ddabb196434e9e9363ba4b5b5596b78aa463f1 SHA256 23816215482cfc089c2e3fe9ae75547c364ad01fbb2a98886ad91d28f5971e17 MD5 47349dfc68ef142782e134a2e7696a37 metadata.xml 335 RMD160 acb18f015dcada8300ffce56be0c4a285ce2a215 metadata.xml 335 @@ -39,10 +49,13 @@ SHA256 23816215482cfc089c2e3fe9ae75547c364ad01fbb2a98886ad91d28f5971e17 metadata MD5 70bb8cee0421ab362030f6820112e350 files/digest-dspam-3.6.8-r3 759 RMD160 aeb37fa95434477546b28ff8c7edecec216f28bc files/digest-dspam-3.6.8-r3 759 SHA256 d7d4d1f5c8b678914be3b634fd9d775032e2f80de07ec153b17505463bfc1b36 files/digest-dspam-3.6.8-r3 759 +MD5 aa8d15fb95ae7874e5257d4ba2d26a12 files/digest-dspam-3.8.0 759 +RMD160 34ffbeec1fde9939a536496bd3f78a35a4851382 files/digest-dspam-3.8.0 759 +SHA256 d1fcb86334be0e078dbcd8322f7b543931dbdc40969dda6dce32716e52aa6870 files/digest-dspam-3.8.0 759 -----BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.6-ecc01.6 (GNU/Linux) +Version: GnuPG v2.0.3 (GNU/Linux) -iD4DBQFGEpgnKRy60XGEcJIRAhXKAJi5uxqQk0a0+AinJ2hdFMi76EH0AKCgB2DI -9P9M9HmnmnKi+cMELeEF1g== -=1Ohx +iD8DBQFGJIFDJnxX6mF440QRAkMgAKD6E2wJ6XGbw+nX85OgHx3wWCm00wCg47wx +vVwwN2IkiQieCjLeErUSIE0= +=F5y6 -----END PGP SIGNATURE----- diff --git a/mail-filter/dspam/dspam-3.8.0.ebuild b/mail-filter/dspam/dspam-3.8.0.ebuild new file mode 100644 index 000000000000..d9792763c11d --- /dev/null +++ b/mail-filter/dspam/dspam-3.8.0.ebuild @@ -0,0 +1,450 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.8.0.ebuild,v 1.1 2007/04/17 08:11:22 mrness Exp $ + +WANT_AUTOCONF="latest" +WANT_AUTOMAKE="latest" + +inherit eutils autotools flag-o-matic + +DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter" +HOMEPAGE="http://dspam.nuclearelephant.com/" +SRC_URI="http://dspam.nuclearelephant.com/sources/${P}.tar.gz + mirror://gentoo/${P}-patches-20070416.tar.gz + http://dspam.nuclearelephant.com/sources/extras/dspam_sa_trainer.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +IUSE="clamav daemon debug large-domain ldap logrotate mysql postgres \ + sqlite sqlite3 virtual-users user-homedirs" + +DEPEND="clamav? ( >=app-antivirus/clamav-0.90.2 ) + ldap? ( >=net-nds/openldap-2.2 ) + mysql? ( virtual/mysql ) + postgres? ( >=dev-db/postgresql-7.4.3 ) + sqlite? ( = 1000, for being able to use suexec in apache + for euid in $(seq 1000 5000 ) ; do + [[ -z $(egetent passwd ${euid}) ]] && break + done + for egid in $(seq 1000 5000 ) ; do + [[ -z $(egetent group ${egid}) ]] && break + done + + enewgroup dspam ${egid} + enewuser dspam ${euid} -1 ${HOMEDIR} dspam,mail +} + +pkg_setup() { + if use virtual-users && use user-homedirs ; then + eerror "If the users are virtual, then they probably should not have home directories." + die "Incompatible USE flag selection" + fi + + create_dspam_usergroup +} + +src_unpack() { + unpack ${A} + cd "${S}" + + EPATCH_SUFFIX="patch" + epatch "${WORKDIR}"/patches + + # Fix Lazy bindings + append-flags $(bindnow-flags) + + AT_M4DIR="${S}/m4" + eautoreconf +} + +src_compile() { + local myconf="--enable-long-usernames --enable-syslog" + + use large-domain && myconf="${myconf} --enable-large-scale" || \ + myconf="${myconf} --enable-domain-scale" + + use user-homedirs && myconf="${myconf} --enable-homedir" + + use debug && myconf="${myconf} --enable-debug --enable-bnr-debug" + + if use virtual-users ; then + if use mysql || use postgres ; then + myconf="${myconf} --enable-virtual-users" + fi + fi + + if use mysql || use postgres ; then + myconf="${myconf} --enable-preferences-extension" + fi + + local STORAGE + # select storage driver + if use sqlite ; then + if [ "$STORAGE" ] ; then STORAGE="${STORAGE}," ; fi + STORAGE="${STORAGE}sqlite_drv" + fi + if use sqlite3 ; then + if [ "$STORAGE" ] ; then STORAGE="${STORAGE}," ; fi + STORAGE="${STORAGE}sqlite3_drv" + fi + if use mysql; then + if [ "$STORAGE" ] ; then STORAGE="${STORAGE}," ; fi + STORAGE="${STORAGE}mysql_drv" + myconf="${myconf} --with-mysql-includes=/usr/include/mysql" + myconf="${myconf} --with-mysql-libraries=/usr/lib/mysql" + fi + if use postgres ; then + if [ "$STORAGE" ] ; then STORAGE="${STORAGE}," ; fi + STORAGE="${STORAGE}pgsql_drv" + myconf="${myconf} --with-pgsql-includes=/usr/include/postgresql" + myconf="${myconf} --with-pgsql-libraries=/usr/lib/postgresql" + fi + if [[ -z "${STORAGE}" ]]; then + STORAGE="${STORAGE}hash_drv" + fi + + econf ${myconf} --with-storage-driver=${STORAGE} \ + --with-dspam-home=${HOMEDIR} \ + --sysconfdir=${CONFDIR} \ + $(use_enable daemon) \ + $(use_enable ldap) \ + $(use_enable clamav) \ + --with-dspam-group=dspam \ + --with-dspam-home-group=dspam \ + --with-dspam-mode=${DSPAMPERMS} \ + --with-logdir=${LOGDIR} || die "econf failed" + emake || die "emake failed" +} + +src_install () { + diropts -m0770 -o dspam -g dspam + dodir ${CONFDIR} + insinto ${CONFDIR} + insopts -m640 -o dspam -g dspam + doins src/dspam.conf + + dosym /etc/mail/dspam /etc/dspam + + # make install + make DESTDIR="${D}" install || die "make install failed" + + dodir /usr/lib/dspam + if [[ "${D}"/usr/lib/*drv* != *"*" ]]; then + mv "${D}"/usr/lib/*drv* "${D}"/usr/lib/dspam/ + fi + + diropts -m0755 -o dspam -g dspam + keepdir /var/run/dspam + + # create logdir + if use debug ; then + diropts -m0770 -o dspam -g dspam + keepdir ${LOGDIR} + fi + + #clean options + diropts -m0755 + insopts -m0644 + + if use daemon; then + # We use sockets for the daemon instead of tcp port 24 + sed -e 's:^#*\(ServerDomainSocketPath[\t ]\{1,\}\).*:\1\"/var/run/dspam/dspam.sock\":gI' \ + -e 's:^#*\(ServerPID[\t ]\{1,\}\).*:\1/var/run/dspam/dspam.pid:gI' \ + -e 's:^#*\(ClientHost[\t ]\{1,\}\)/.*:\1\"/var/run/dspam/dspam.sock\":gI' \ + -i "${D}/${CONFDIR}/dspam.conf" + + newinitd "${FILESDIR}/dspam.rc" dspam + + fowners root:dspam /usr/bin/dspamc + fperms u=rx,g=xs,o=x /usr/bin/dspamc + fi + + # generate random password + local PASSWORD="${RANDOM}${RANDOM}${RANDOM}${RANDOM}" + + # database related configuration and scripts + if use sqlite; then + insinto ${CONFDIR} + newins src/tools.sqlite_drv/purge-2.sql sqlite_purge.sql + fi + if use sqlite3; then + insinto ${CONFDIR} + newins src/tools.sqlite_drv/purge-3.sql sqlite3_purge.sql + fi + if use mysql; then + DSPAM_DB_DATA[0]="/var/run/mysqld/mysqld.sock" + DSPAM_DB_DATA[1]="" + DSPAM_DB_DATA[2]="dspam" + DSPAM_DB_DATA[3]="${PASSWORD}" + DSPAM_DB_DATA[4]="dspam" + DSPAM_DB_DATA[5]="true" + + # Modify configuration and create mysql.data file + sed -e "s:^#*\(MySQLServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \ + -e "s:^#*\(MySQLPort[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[1]}:gI" \ + -e "s:^#*\(MySQLUser[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[2]}:gI" \ + -e "s:^#*\(MySQLPass[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[3]}:gI" \ + -e "s:^#*\(MySQLDb[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[4]}:gI" \ + -e "s:^#*\(MySQLCompress[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[5]}:gI" \ + -i "${D}"/${CONFDIR}/dspam.conf + for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do + echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> "${D}"/${CONFDIR}/mysql.data + done + + insinto ${CONFDIR} + newins src/tools.mysql_drv/mysql_objects-space.sql mysql_objects-space.sql + newins src/tools.mysql_drv/mysql_objects-speed.sql mysql_objects-speed.sql + newins src/tools.mysql_drv/mysql_objects-4.1.sql mysql_objects-4.1.sql + if use virtual-users ; then + newins src/tools.mysql_drv/virtual_users.sql mysql_virtual_users.sql + newins src/tools.mysql_drv/virtual_user_aliases.sql mysql_virtual_user_aliases.sql + fi + newins src/tools.mysql_drv/purge.sql mysql_purge.sql + newins src/tools.mysql_drv/purge-4.1.sql mysql_purge-4.1.sql + + fperms 640 ${CONFDIR}/mysql.data + fowners root:dspam ${CONFDIR}/mysql.data + fi + if use postgres ; then + DSPAM_DB_DATA[0]="127.0.0.1" + DSPAM_DB_DATA[1]="5432" + DSPAM_DB_DATA[2]="dspam" + DSPAM_DB_DATA[3]="${PASSWORD}" + DSPAM_DB_DATA[4]="dspam" + + # Modify configuration and create pgsql.data file + sed -e "s:^#*\(PgSQLServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \ + -e "s:^#*\(PgSQLPort[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[1]}:gI" \ + -e "s:^#*\(PgSQLUser[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[2]}:gI" \ + -e "s:^#*\(PgSQLPass[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[3]}:gI" \ + -e "s:^#*\(PgSQLDb[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[4]}:gI" \ + -e "s:^#*\(PgSQLConnectionCache[\t ]*.\):\1:gI" \ + -i "${D}"/${CONFDIR}/dspam.conf + for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do + echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> "${D}"/${CONFDIR}/pgsql.data + done + + insinto ${CONFDIR} + newins src/tools.pgsql_drv/pgsql_objects.sql pgsql_objects.sql + if use virtual-users ; then + newins src/tools.pgsql_drv/virtual_users.sql pgsql_virtual_users.sql + fi + newins src/tools.pgsql_drv/purge.sql pgsql_purge.sql + + fperms 640 ${CONFDIR}/pgsql.data + fowners root:dspam ${CONFDIR}/pgsql.data + fi + + sed -e "s:^\(Purge.*\):###\1:g" \ + -e "s:^#\(Purge.*\):\1:g" \ + -e "s:^###\(Purge.*\):#\1:g" \ + -i "${D}"/${CONFDIR}/dspam.conf + + # installs the notification messages + # -> The documentation is wrong! The files need to be in ./txt + echo "Scanned and tagged as SPAM with DSPAM ${PV} by Your ISP.com">"${T}"/msgtag.spam + echo "Scanned and tagged as non-SPAM with DSPAM ${PV} by Your ISP.com">"${T}"/msgtag.nonspam + insinto ${CONFDIR}/txt + doins "${S}"/txt/*.txt + doins "${T}"/msgtag.* + + # Create the opt-in / opt-out directories + diropts -m0770 -o dspam -g dspam + dodir ${HOMEDIR} + keepdir ${HOMEDIR}/opt-in + keepdir ${HOMEDIR}/opt-out + diropts -m0755 + + # logrotation scripts + if use logrotate && use debug ; then + insinto /etc/logrotate.d + newins "${FILESDIR}/logrotate.dspam" dspam + fi + + # dspam cron job + exeinto /etc/cron.daily + newexe "${FILESDIR}/${P}.cron" dspam.cron + + # documentation + dodoc CHANGELOG README* RELEASE.NOTES UPGRADING + docinto doc + dodoc doc/*.txt + docinto gentoo + dodoc "${FILESDIR}"/README.{postfix,qmail} + docinto sa_train + dodoc "${WORKDIR}"/dspam_sa_trainer/* + doman man/dspam* +} + +pkg_preinst() { + # Preserve *.data files + local installed_datafiles="${ROOT}"/${CONFDIR}/*.data + if [[ "${installed_datafiles}" != *"*.data" ]]; then + cp "${ROOT}"/${CONFDIR}/*.data "${D}"/${CONFDIR} + fi +} + +pkg_postinst() { + # need enewgroup/enewuser in this function for binary install. + create_dspam_usergroup + + if use mysql || use postgres; then + elog + elog "To setup DSPAM to run out-of-the-box on your system with a MySQL" + elog "or PostgreSQL database, run:" + elog "emerge --config =${PF}" + fi + + if use postgres && has_version ">dev-db/postgresql-8.0"; then + elog + elog "Before executing the configuration command mentioned above you have" + elog "to execute the following command:" + elog "createlang plpgsql -U postgres dspam" + fi + + if use daemon; then + elog + elog "If you want to run DSPAM in the new daemon mode remember" + elog "to make the DSPAM daemon start during boot:" + elog " rc-update add dspam default" + fi + if use daemon ; then + elog + elog "To use the DSPAM daemon mode, the used storage driver must be thread-safe." + fi + + elog + elog "Edit /etc/mail/dspam.conf with your delivery agent" + elog "See http://dspamwiki.expass.de/Installation for more info" + elog +} + +pkg_config () { + local AVAIL_BACKENDS=() + use mysql && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} mysql ) + use postgres && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} postgres ) + use sqlite && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} sqlite ) + use sqlite3 && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} sqlite3 ) + local USE_BACKEND + read -p "Which backend do you want to configure? (available backends are ${AVAIL_BACKENDS[*]}) " USE_BACKEND + if [[ " ${AVAIL_BACKENDS[*]} " != *" ${USE_BACKEND} "* ]] + then + eerror "The '${USE_BACKEND}' backend is not available." + return 1 + fi + + case "${USE_BACKEND}" in + + sqlite | sqlite3) + einfo "sqlite_drv will automatically create the necessary database" + ;; + + mysql) + DSPAM_DB_DATA=( $(sed "s:^[\t ]*$:###:gI" "${ROOT}${CONFDIR}/mysql.data") ) + for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do + [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" + done + DSPAM_MySQL_USER="${DSPAM_DB_DATA[2]}" + DSPAM_MySQL_PWD="${DSPAM_DB_DATA[3]}" + DSPAM_MySQL_DB="${DSPAM_DB_DATA[4]}" + + local MYSQL_ROOT_USER="" + echo -n "Please enter your administrative MySQL account (default root): " + read MYSQL_ROOT_USER + if [[ -z "${MYSQL_ROOT_USER}" ]]; then + MYSQL_ROOT_USER="root" + fi + ewarn "When prompted for a password, please enter your MySQL ${MYSQL_ROOT_USER} password" + ewarn + + einfo "Creating DSPAM MySQL database \"${DSPAM_MySQL_DB}\"" + /usr/bin/mysqladmin -u ${MYSQL_ROOT_USER} -p create ${DSPAM_MySQL_DB} + + + if has_version ">=virtual/mysql-4.1"; then + /usr/bin/mysql -u ${MYSQL_ROOT_USER} -p ${DSPAM_MySQL_DB} < ${CONFDIR}/mysql_objects-4.1.sql + else + einfo "Creating DSPAM MySQL tables for data objects" + einfo " Please select what kind of object database you like to use." + einfo " [1] Space optimized database" + einfo " [2] Speed optimized database" + einfo + while true + do + read -n 1 -s -p " Press 1 or 2 on the keyboard to select database" DSPAM_MySQL_DB_Type + [[ "${DSPAM_MySQL_DB_Type}" == "1" || "${DSPAM_MySQL_DB_Type}" == "2" ]] && echo && break + done + + if [[ "${DSPAM_MySQL_DB_Type}" == "1" ]]; then + /usr/bin/mysql -u ${MYSQL_ROOT_USER} -p ${DSPAM_MySQL_DB} < ${CONFDIR}/mysql_objects-space.sql + else + /usr/bin/mysql -u ${MYSQL_ROOT_USER} -p ${DSPAM_MySQL_DB} < ${CONFDIR}/mysql_objects-speed.sql + fi + fi + + if use virtual-users ; then + einfo "Creating DSPAM MySQL database for virtual-users users" + einfo " Please select what kind of virtual_uids table you like to use." + einfo " [1] Virtual users added automatically (use this if this server is the primary MX)" + einfo " [2] Virtual users added manually (use it if this server is a secondary MX)" + einfo + while true; do + read -n 1 -s -p " Press 1 or 2 on the keyboard to select table type" DSPAM_MySQL_DB_Type + [[ "${DSPAM_MySQL_DB_Type}" == "1" || "${DSPAM_MySQL_DB_Type}" == "2" ]] && echo && break + done + + if [[ "${DSPAM_MySQL_DB_Type}" == "1" ]]; then + /usr/bin/mysql -u ${MYSQL_ROOT_USER} -p ${DSPAM_MySQL_DB} < ${CONFDIR}/mysql_virtual_users.sql + else + /usr/bin/mysql -u ${MYSQL_ROOT_USER} -p ${DSPAM_MySQL_DB} < ${CONFDIR}/mysql_virtual_user_aliases.sql + fi + fi + + einfo "Creating DSPAM MySQL user \"${DSPAM_MySQL_USER}\"" + /usr/bin/mysql -u ${MYSQL_ROOT_USER} -p -e "GRANT SELECT,INSERT,UPDATE,DELETE ON ${DSPAM_MySQL_DB}.* TO ${DSPAM_MySQL_USER}@localhost IDENTIFIED BY '${DSPAM_MySQL_PWD}';FLUSH PRIVILEGES;" -D mysql + ;; + + postgres) + DSPAM_DB_DATA=( $(sed "s:^[\t ]*$:###:gI" "${ROOT}${CONFDIR}/pgsql.data") ) + for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do + [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" + done + DSPAM_PgSQL_USER="${DSPAM_DB_DATA[2]}" + DSPAM_PgSQL_PWD="${DSPAM_DB_DATA[3]}" + DSPAM_PgSQL_DB="${DSPAM_DB_DATA[4]}" + + ewarn "When prompted for a password, please enter your PgSQL postgres password" + ewarn + + einfo "Creating DSPAM PostgreSQL database \"${DSPAM_PgSQL_DB}\" and user \"${DSPAM_PgSQL_USER}\"" + /usr/bin/psql -h localhost -d template1 -U postgres -c "CREATE USER ${DSPAM_PgSQL_USER} WITH PASSWORD '${DSPAM_PgSQL_PWD}' NOCREATEDB NOCREATEUSER; CREATE DATABASE ${DSPAM_PgSQL_DB}; GRANT ALL PRIVILEGES ON DATABASE ${DSPAM_PgSQL_DB} TO ${DSPAM_PgSQL_USER}; GRANT ALL PRIVILEGES ON SCHEMA public TO ${DSPAM_PgSQL_USER}; UPDATE pg_database SET datdba=(SELECT usesysid FROM pg_shadow WHERE usename='${DSPAM_PgSQL_USER}') WHERE datname='${DSPAM_PgSQL_DB}';" + + einfo "Creating DSPAM PostgreSQL tables" + PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${CONFDIR}/pgsql_objects.sql 1>/dev/null 2>&1 + + if use virtual-users ; then + einfo "Creating DSPAM PostgreSQL database for virtual-users users" + PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${CONFDIR}/pgsql_virtual_users.sql 1>/dev/null 2>&1 + fi + ;; + + esac +} diff --git a/mail-filter/dspam/files/digest-dspam-3.8.0 b/mail-filter/dspam/files/digest-dspam-3.8.0 new file mode 100644 index 000000000000..463a04ecb8db --- /dev/null +++ b/mail-filter/dspam/files/digest-dspam-3.8.0 @@ -0,0 +1,9 @@ +MD5 11861e3b89a6e2554c65ab185260dc3e dspam-3.8.0-patches-20070416.tar.gz 7062 +RMD160 05d6d294edab5f4ca058aa9daf5c3d9c69ddd91c dspam-3.8.0-patches-20070416.tar.gz 7062 +SHA256 9cc2d1cf1482ceff124a9017910bb6c3a7ed0be828e2d3c6c83b08e6b871a649 dspam-3.8.0-patches-20070416.tar.gz 7062 +MD5 056b8c8b3ad9415a52c01b22ff1e64cf dspam-3.8.0.tar.gz 726160 +RMD160 e7831e2415e30e819dd9cbc0ba3f269e113e2fb9 dspam-3.8.0.tar.gz 726160 +SHA256 84a227934a7aee73516bdb82c33ee7b359e955c8cd95a1544a9a13069f79bfc7 dspam-3.8.0.tar.gz 726160 +MD5 8ffe9d41e6104a4c6d19067528193145 dspam_sa_trainer.tar.gz 1230 +RMD160 c3d0fca7169d23ecf9d44c850ee255b42d97d818 dspam_sa_trainer.tar.gz 1230 +SHA256 8fb6b1ebe592acf00a028737ef8e174544af166768b987d29048b2319bc5a215 dspam_sa_trainer.tar.gz 1230 diff --git a/mail-filter/dspam/files/dspam-3.8.0.cron b/mail-filter/dspam/files/dspam-3.8.0.cron new file mode 100644 index 000000000000..cd305a622055 --- /dev/null +++ b/mail-filter/dspam/files/dspam-3.8.0.cron @@ -0,0 +1,321 @@ +#!/bin/sh +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# +# Remove old signatures and unimportant tokens from the DSPAM database. +# Purge old log entries in user logs. +# + +# +# Parameters +# +LOGROTATE_AGE=30 # Delete log entries older than $LOGROTATE_AGE days + +# +# Function to run dspam_clean +# +run_dspam_clean() { + if [ ! -f "/usr/bin/dspam_clean" ] + then + echo "/usr/bin/dspam_clean not found!" + return 1 + else + /usr/bin/dspam_clean -s -p -u >/dev/null 2>&1 + return 0 + fi +} + + +# +# Function to check if we have all needed tools +# +check_for_tools() { + local myrc=0 + for foo in awk cut sed getent + do + if ! which ${foo} >/dev/null 2>&1 + then + echo "Command ${foo} not found!" + myrc=1 + fi + done + return ${myrc} +} + + +# +# Acquire lock file and start processing +# +DSPAM_CRON_LOCKFILE="/var/run/$(basename $0 .sh).pid" +if ( set -o noclobber; echo "$$" > "${DSPAM_CRON_LOCKFILE}") 2> /dev/null; then + + trap 'rm -f "${DSPAM_CRON_LOCKFILE}"; exit $?' INT TERM EXIT + + # + # Check for needed tools + # + if ! check_for_tools + then + # We have not all needed tools installed. Run just the dspam_clean part. + run_dspam_clean + exit $? + fi + + + # + # Try to get DSPAM config directory + # + DSPAM_CONFIGDIR=$(getent passwd dspam | awk -F : '{print $6}') + if [ ! -f "${DSPAM_CONFIGDIR}/dspam.conf" ] + then + # Something is wrong in passwd! Check if /etc/mail/dspam exists instead. + if [ -f /etc/mail/dspam/dspam.conf ] + then + DSPAM_CONFIGDIR="/etc/mail/dspam" + fi + fi + if [ ! -d "${DSPAM_CONFIGDIR}" ] + then + echo "Configuration directory not found!" + exit 2 + fi + + # + # Try to get DSPAM data home directory + # + DSPAM_HOMEDIR=$(awk '$1 ~ /^[[:space:]]*Home[[:space:]]/ {print $2}' "${DSPAM_CONFIGDIR}/dspam.conf") + if [ ! -d "${DSPAM_HOMEDIR}" ] + then + # Something is wrong in dspam.conf! Check if /var/spool/dspam exists instead. + if [ -d /var/spool/dspam ] + then + DSPAM_HOMEDIR="/var/spool/dspam" + fi + fi + if [ ! -d "${DSPAM_HOMEDIR}" ] + then + echo "Home directory not found! Please fix your dspam.conf." + exit 2 + fi + + + # + # User log purging + # + if [ -d "${DSPAM_CONFIGDIR}/data" ] + then + dspam_logrotate -a ${LOGROTATE_AGE} -d "${DSPAM_CONFIGDIR}/data" >/dev/null # 2>&1 + fi + + + # + # MySQL + # + if [ -f "${DSPAM_CONFIGDIR}/mysql.data" ] + then + if [ ! -f "/usr/bin/mysql_config" ] + then + echo "Can not run MySQL purge script:" + echo " /usr/bin/mysql_config does not exist" + run_dspam_clean + exit 1 + fi + DSPAM_MySQL_PURGE_SQL= + DSPAM_MySQL_VER=$(/usr/bin/mysql_config --version | sed "s:[^0-9.]*::g") + DSPAM_MySQL_MAJOR=$(echo "${DSPAM_MySQL_VER}" | cut -d. -f1) + DSPAM_MySQL_MINOR=$(echo "${DSPAM_MySQL_VER}" | cut -d. -f2) + DSPAM_MySQL_MICRO=$(echo "${DSPAM_MySQL_VER}" | cut -d. -f3) + DSPAM_MySQL_INT=$(($DSPAM_MySQL_MAJOR * 65536 + $DSPAM_MySQL_MINOR * 256 + $DSPAM_MySQL_MICRO)) + + # For MySQL >= 4.1 use the new purge script + if [ "${DSPAM_MySQL_INT}" -ge "262400" ] + then + if [ -f "${DSPAM_CONFIGDIR}/config/mysql_purge-4.1-optimized.sql" -o -f "${DSPAM_CONFIGDIR}/mysql_purge-4.1-optimized.sql" ] + then + # See: http://securitydot.net/txt/id/32/type/articles/ + [ -f "${DSPAM_CONFIGDIR}/config/mysql_purge-4.1-optimized.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/config/mysql_purge-4.1-optimized.sql" + [ -f "${DSPAM_CONFIGDIR}/mysql_purge-4.1-optimized.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/mysql_purge-4.1-optimized.sql" + else + [ -f "${DSPAM_CONFIGDIR}/config/mysql_purge-4.1.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/config/mysql_purge-4.1.sql" + [ -f "${DSPAM_CONFIGDIR}/mysql_purge-4.1.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/mysql_purge-4.1.sql" + fi + else + [ -f "${DSPAM_CONFIGDIR}/config/mysql_purge.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/config/mysql_purge.sql" + [ -f "${DSPAM_CONFIGDIR}/mysql_purge.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/mysql_purge.sql" + fi + + if [ -z "${DSPAM_MySQL_PURGE_SQL}" ] + then + echo "Can not run MySQL purge script:" + echo " No mysql_purge SQL script found" + run_dspam_clean + exit 1 + fi + + if [ ! -f "/usr/bin/mysql" ] + then + echo "Can not run MySQL purge script:" + echo " /usr/bin/mysql does not exist" + run_dspam_clean + exit 1 + fi + + # Get DSPAM MySQL username and password + DSPAM_MySQL_HOST=$(sed "1q;d" "${DSPAM_CONFIGDIR}/mysql.data") + DSPAM_MySQL_PORT=$(sed "2q;d" "${DSPAM_CONFIGDIR}/mysql.data") + DSPAM_MySQL_USER=$(sed "3q;d" "${DSPAM_CONFIGDIR}/mysql.data") + DSPAM_MySQL_PWD=$(sed "4q;d" "${DSPAM_CONFIGDIR}/mysql.data") + DSPAM_MySQL_DB=$(sed "5q;d" "${DSPAM_CONFIGDIR}/mysql.data") + + # Check if MySQL is remote or using a socket + if [ -S "${DSPAM_MySQL_HOST}" ] + then + DSPAM_MySQL_HOSTCMD="--socket" + else + DSPAM_MySQL_HOSTCMD="--host" + fi + + # Run the MySQL purge script + /usr/bin/mysql --silent --user="${DSPAM_MySQL_USER}" --password="${DSPAM_MySQL_PWD}" ${DSPAM_MySQL_HOSTCMD}="${DSPAM_MySQL_HOST}" ${DSPAM_MySQL_DB} < ${DSPAM_MySQL_PURGE_SQL} + + # Run the dspam_clean command + run_dspam_clean + + # Optimize the MySQL tables for DSPAM + for foo in $(/usr/bin/mysql --user="${DSPAM_MySQL_USER}" --password="${DSPAM_MySQL_PWD}" ${DSPAM_MySQL_HOSTCMD}="${DSPAM_MySQL_HOST}" --silent --skip-column-names --batch ${DSPAM_MySQL_DB} -e 'SHOW TABLES;' 2>&1) + do + /usr/bin/mysql --user="${DSPAM_MySQL_USER}" --password="${DSPAM_MySQL_PWD}" ${DSPAM_MySQL_HOSTCMD}="${DSPAM_MySQL_HOST}" ${DSPAM_MySQL_DB} -e "OPTIMIZE TABLE ${foo};" 1>/dev/null 2>&1 + done + exit 0 + + + # + # PostgreSQL + # + elif [ -f "${DSPAM_CONFIGDIR}/pgsql.data" ] + then + DSPAM_PgSQL_PURGE_SQL="" + [ -f "${DSPAM_CONFIGDIR}/config/pgsql_purge.sql" ] && DSPAM_PgSQL_PURGE_SQL="${DSPAM_CONFIGDIR}/config/pgsql_purge.sql" + [ -f "${DSPAM_CONFIGDIR}/pgsql_purge.sql" ] && DSPAM_PgSQL_PURGE_SQL="${DSPAM_CONFIGDIR}/pgsql_purge.sql" + + if [ -z "${DSPAM_PgSQL_PURGE_SQL}" ] + then + echo "Can not run PostgreSQL purge script:" + echo " No pgsql_purge SQL script found" + run_dspam_clean + exit 1 + fi + + if [ ! -f "/usr/bin/psql" ] + then + echo "Can not run PostgreSQL purge script:" + echo " /usr/bin/psql does not exist" + run_dspam_clean + exit 1 + fi + + # Get DSPAM PostgreSQL username and password + DSPAM_PgSQL_HOST=$(sed "1q;d" "${DSPAM_CONFIGDIR}/pgsql.data") + DSPAM_PgSQL_PORT=$(sed "2q;d" "${DSPAM_CONFIGDIR}/pgsql.data") + DSPAM_PgSQL_USER=$(sed "3q;d" "${DSPAM_CONFIGDIR}/pgsql.data") + DSPAM_PgSQL_PWD=$(sed "4q;d" "${DSPAM_CONFIGDIR}/pgsql.data") + DSPAM_PgSQL_DB=$(sed "5q;d" "${DSPAM_CONFIGDIR}/pgsql.data") + + # Run the PostgreSQL purge script + PGUSER="${DSPAM_PgSQL_USER}" PGPASSWORD="${DSPAM_PgSQL_PWD}" /usr/bin/psql -q -U "${DSPAM_PgSQL_USER}" -d "${DSPAM_PgSQL_DB}" -p "${DSPAM_PgSQL_PORT}" -h "${DSPAM_PgSQL_HOST}" -f "${DSPAM_PgSQL_PURGE_SQL}" + + # Run the dspam_clean command + run_dspam_clean + + exit 0 + + + # + # SQLite3 + # + elif ( grep -q "^[[:space:]]*StorageDriver[[:space:]]*.*libsqlite3_drv" "${DSPAM_CONFIGDIR}/dspam.conf" ) + then + DSPAM_SQLite3_PURGE_SQL="" + [ -f "${DSPAM_CONFIGDIR}/config/sqlite3_purge.sql" ] && DSPAM_SQLite3_PURGE_SQL="${DSPAM_CONFIGDIR}/config/sqlite3_purge.sql" + [ -f "${DSPAM_CONFIGDIR}/sqlite3_purge.sql" ] && DSPAM_SQLite3_PURGE_SQL="${DSPAM_CONFIGDIR}/sqlite3_purge.sql" + + if [ -z "${DSPAM_SQLite3_PURGE_SQL}" ] + then + echo "Can not run SQLite3 purge script:" + echo " No sqlite_purge SQL script found" + run_dspam_clean + exit 1 + fi + + if [ ! -f "/usr/bin/sqlite3" ] + then + echo "Can not run SQLite3 purge script:" + echo " /usr/bin/sqlite3 does not exist" + run_dspam_clean + exit 1 + fi + + # Run the SQLite3 purge script + find "${DSPAM_HOMEDIR}" -name "*.sdb" -exec /usr/bin/sqlite3 "{}" < "${DSPAM_SQLite3_PURGE_SQL}" \; 1>/dev/null 2>&1 + + # Run the dspam_clean command + run_dspam_clean + + # Optimize the SQLite tables for DSPAM + find "${DSPAM_HOMEDIR}" -name "*.sdb" -exec echo 'vacuum;' \| /usr/bin/sqlite3 "{}" \; + + exit 0 + + + # + # SQLite + # + elif ( grep -q "^[[:space:]]*StorageDriver[[:space:]]*.*libsqlite_drv" "${DSPAM_CONFIGDIR}/dspam.conf" ) + then + DSPAM_SQLite_PURGE_SQL="" + [ -f "${DSPAM_CONFIGDIR}/config/sqlite_purge.sql" ] && DSPAM_SQLite_PURGE_SQL="${DSPAM_CONFIGDIR}/config/sqlite_purge.sql" + [ -f "${DSPAM_CONFIGDIR}/sqlite_purge.sql" ] && DSPAM_SQLite_PURGE_SQL="${DSPAM_CONFIGDIR}/sqlite_purge.sql" + + if [ -z "${DSPAM_SQLite_PURGE_SQL}" ] + then + echo "Can not run SQLite purge script:" + echo " No sqlite_purge SQL script found" + run_dspam_clean + exit 1 + fi + + if [ ! -f "/usr/bin/sqlite" ] + then + echo "Can not run SQLite purge script:" + echo " /usr/bin/sqlite does not exist" + run_dspam_clean + exit 1 + fi + + # Run the SQLite purge script + find "${DSPAM_HOMEDIR}" -name "*.sdb" -exec /usr/bin/sqlite "{}" < "${DSPAM_SQLite_PURGE_SQL}" \; 1>/dev/null 2>&1 + + # Run the dspam_clean command + run_dspam_clean + + # Optimize the SQLite tables for DSPAM + find "${DSPAM_HOMEDIR}" -name "*.sdb" -exec echo 'vacuum;' \| /usr/bin/sqlite "{}" \; + + exit 0 + + + # + # Generic + # + else + run_dspam_clean + exit $? + fi + + + # + # Release lock + # + rm -f "${DSPAM_CRON_LOCKFILE}" + trap - INT TERM EXIT +fi -- 2.26.2