summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLim Swee Tat <st_lim@gentoo.org>2004-06-26 16:45:28 +0000
committerLim Swee Tat <st_lim@gentoo.org>2004-06-26 16:45:28 +0000
commita912160870b658e5f8eb3815e3724717210f30be (patch)
tree1a264499f4fa100cbd383fdf28def49dc2fb9a0a /mail-filter
parents/via the ntp client/via the NTP client/ for the ntp-client.rc script. (diff)
downloadhistorical-a912160870b658e5f8eb3815e3724717210f30be.tar.gz
historical-a912160870b658e5f8eb3815e3724717210f30be.tar.bz2
historical-a912160870b658e5f8eb3815e3724717210f30be.zip
Initial commit. Closing Bug #26744
Diffstat (limited to 'mail-filter')
-rw-r--r--mail-filter/dspam/ChangeLog15
-rw-r--r--mail-filter/dspam/Manifest16
-rw-r--r--mail-filter/dspam/dspam-3.0.0.ebuild194
-rw-r--r--mail-filter/dspam/files/README.postfix7
-rw-r--r--mail-filter/dspam/files/README.qmail69
-rw-r--r--mail-filter/dspam/files/crontab.db42
-rw-r--r--mail-filter/dspam/files/crontab.mysql3
-rw-r--r--mail-filter/dspam/files/digest-dspam-3.0.01
-rw-r--r--mail-filter/dspam/files/logrotate.dspam5
-rw-r--r--mail-filter/dspam/files/mysql.data5
-rw-r--r--mail-filter/dspam/files/mysql_create_user.sql4
-rw-r--r--mail-filter/dspam/files/mysql_install_db3
-rw-r--r--mail-filter/dspam/files/mysql_purge_db1
-rw-r--r--mail-filter/dspam/files/trusted.users4
-rw-r--r--mail-filter/dspam/files/untrusted.mailer_args1
-rw-r--r--mail-filter/dspam/files/upgrade.sql15
-rw-r--r--mail-filter/dspam/metadata.xml9
17 files changed, 354 insertions, 0 deletions
diff --git a/mail-filter/dspam/ChangeLog b/mail-filter/dspam/ChangeLog
new file mode 100644
index 000000000000..1f8a502f543a
--- /dev/null
+++ b/mail-filter/dspam/ChangeLog
@@ -0,0 +1,15 @@
+# ChangeLog for mail-filter/dspam
+# Copyright 1999-2004 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/ChangeLog,v 1.1 2004/06/26 16:45:28 st_lim Exp $
+
+*dspam-3.0.0 (27 Jun 2004)
+
+ 27 Jun 2004; Lim Swee Tat <st_lim@gentoo.org> +files/README.postfix,
+ +files/README.qmail, +files/crontab.db4, +files/crontab.mysql,
+ +files/logrotate.dspam, +files/mysql.data, +files/mysql_create_user.sql,
+ +files/mysql_install_db, +files/mysql_purge_db, +files/trusted.users,
+ +files/untrusted.mailer_args, +files/upgrade.sql, +dspam-3.0.0.ebuild:
+ Initial commit. Most of the ebuild was thanks to work done by Mark Renouf
+ <mark@tweakt.net> on bug #26744. I just tried harder to be anal about it. :)
+ Closing bug.
+
diff --git a/mail-filter/dspam/Manifest b/mail-filter/dspam/Manifest
new file mode 100644
index 000000000000..ccc5a5767062
--- /dev/null
+++ b/mail-filter/dspam/Manifest
@@ -0,0 +1,16 @@
+MD5 04f58812fe08680efaf87acf3115e6bb dspam-3.0.0.ebuild 5778
+MD5 ee04048535bd70c99b556351533baddd ChangeLog 764
+MD5 02610fe17122bb3a27ca3dcbf7374fcc metadata.xml 311
+MD5 2cd345708a9889a04c472a9e5be7400e files/untrusted.mailer_args 24
+MD5 2a79c945ef6c7e7bd45aa1d46ae99e69 files/mysql_install_db 114
+MD5 e87e8df27c8d229cd1c0c41112c2fb5d files/crontab.mysql 120
+MD5 05dce5dc8cf516655657aa2a4cc5f1da files/digest-dspam-3.0.0 63
+MD5 8b68501138fbe92e10bbd93a03c9f2ab files/upgrade.sql 807
+MD5 cd96721195a9fd9d6dae9513aa8f80ca files/crontab.db4 198
+MD5 84ec40b77696359ae49560588db9b948 files/mysql.data 52
+MD5 d10a51bd9e83658cb5ea1e501570261b files/trusted.users 26
+MD5 cefc786a1b60f3041eb3972aafb0b543 files/logrotate.dspam 154
+MD5 e0469b961385fda4305602dc2519d319 files/README.qmail 2317
+MD5 9fed58b73e35e02ecc3f9a08dcd94eaa files/mysql_purge_db 73
+MD5 5bcf982f468f4843ef3aa51213cc0023 files/mysql_create_user.sql 194
+MD5 c12a54112c6fec3530a7b1a368d04ac8 files/README.postfix 309
diff --git a/mail-filter/dspam/dspam-3.0.0.ebuild b/mail-filter/dspam/dspam-3.0.0.ebuild
new file mode 100644
index 000000000000..c5e59985bc0b
--- /dev/null
+++ b/mail-filter/dspam/dspam-3.0.0.ebuild
@@ -0,0 +1,194 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.0.0.ebuild,v 1.1 2004/06/26 16:45:28 st_lim Exp $
+
+inherit eutils
+
+DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter"
+SRC_URI="http://www.nuclearelephant.com/projects/dspam/sources/${P}.tar.gz"
+HOMEPAGE="http://www.nuclearelephant.com/projects/dspam/index.html"
+LICENSE="GPL-2"
+
+IUSE="debug mysql procmail neural"
+DEPEND="mysql? ( >=dev-db/mysql-3.23 ) || ( >=sys-libs/db-4.0 )
+ procmail? ( >=mail-filter/procmail-3.22 )"
+RDEPEND="virtual/cron
+ app-admin/logrotate"
+KEYWORDS="~x86"
+SLOT="3.0"
+
+# some FHS-like structure
+HOMEDIR="/etc/mail/dspam"
+DATADIR="/var/spool/dspam"
+LOGDIR="/var/log/dspam"
+CONFIGDIR="${HOMEDIR}/config"
+
+MYSQL_TABLE_TYPE="space.optimized"
+
+src_compile() {
+ local myconf
+
+ # these are the default settings
+ myconf="${myconf} --with-signature-life=14"
+ use procmail && myconf="${myconf} --with-delivery-agent=/usr/bin/procmail"
+
+ myconf="${myconf} --enable-robinson-pvalues"
+ myconf="${myconf} --enable-source-address-tracking"
+
+ # ${HOMEDIR}/data is a symlink to ${DATADIR}
+ myconf="${myconf} --with-dspam-home=${HOMEDIR}"
+ myconf="${myconf} --with-dspam-mode=4755"
+ myconf="${myconf} --with-dspam-owner=root"
+ myconf="${myconf} --with-dspam-group=mail"
+ myconf="${myconf} --with-dspam-home-owner=root"
+ myconf="${myconf} --with-dspam-home-group=mail"
+
+ # enables support for debugging (touch /etc/dspam/.debug to turn on)
+ # optional: even MORE debugging output, use with extreme caution!
+ use debug && myconf="${myconf} --enable-debug --enable-verbose-debug"
+
+ # select storage driver
+ if [ `use mysql` ] ; then
+ myconf="${myconf} --with-storage-driver=mysql_drv"
+ myconf="${myconf} --with-mysql-includes=/usr/include/mysql"
+ myconf="${myconf} --with-mysql-libraries=/usr/lib/mysql"
+
+ # an experimental feature available with MySQL backend
+ if [ `use neural` ] ; then
+ myconf="${myconf} --enable-neural-networking"
+ fi
+ else
+ myconf="${myconf} --with-storage-driver=libdb4_drv"
+ myconf="${myconf} --with-db4-includes=/usr/include"
+ myconf="${myconf} --with-db4-libraries=/usr/lib"
+ fi
+
+ econf ${myconf} || die
+ emake || die
+
+}
+
+src_install () {
+ # open up perms on /etc/mail/dspam
+ diropts -m0775 -o root -g mail
+ dodir ${HOMEDIR}
+ keepdir ${HOMEDIR}
+
+ # keeps dspam data in /var
+ diropts -m0770 -o root -g mail
+ dodir ${DATADIR}
+ keepdir ${DATADIR}
+
+ # keeps dspam log in /var/log
+ diropts -m0770
+ diropts -m0775 -o root -g mail
+ dodir ${LOGDIR}
+ keepdir ${LOGDIR}
+
+ # make install
+ make DESTDIR=${D} install || die
+
+ # documentation
+ dodoc CHANGELOG LICENSE README RELEASE.NOTES
+ dodoc ${FILESDIR}/README.postfix ${FILESDIR}/README.qmail
+ if [ `use mysql` ] ; then
+ newdoc tools.mysql_drv/README README.MYSQL
+ fi
+
+ # install some initial configuration
+ insinto ${HOMEDIR}
+ insopts -m0640 -o root -g mail
+ doins ${FILESDIR}/trusted.users
+ doins ${FILESDIR}/untrusted.mailer_args
+
+ # database related configuration and scripts
+ if [ `use mysql` ] ; then
+ local PASSWORD="${RANDOM}${RANDOM}${RANDOM}${RANDOM}"
+
+ # Replace some variables in the configuration files
+ sed -e "s,@HOMEDIR@,${HOMEDIR},g" \
+ -e "s,@confdir@,${CONFIGDIR},g" \
+ ${FILESDIR}/crontab.mysql > ${T}/dspam.cron
+
+ sed -e "s,@password@,${PASSWORD},g" \
+ ${FILESDIR}/mysql.data > ${T}/mysql.data
+
+ sed -e "s,@password@,${PASSWORD},g" \
+ ${FILESDIR}/mysql_create_user.sql > ${T}/mysql_setup.sql
+ cat ${S}/tools.mysql_drv/mysql_objects.sql.${MYSQL_TABLE_TYPE} >> ${T}/mysql_setup.sql
+
+ sed -e "s,@HOMEDIR@,${HOMEDIR},g" \
+ -e "s,@confdir@,${CONFIGDIR},g" \
+ ${FILESDIR}/mysql_install_db > ${T}/mysql_install_db
+
+ sed -e "s,@HOMEDIR@,${HOMEDIR},g" \
+ -e "s,@password@,${PASSWORD},g" \
+ -e "s,@confdir@,${CONFIGDIR},g" \
+ ${FILESDIR}/mysql_purge_db > ${T}/mysql_purge_db
+
+ insinto ${CONFIGDIR}
+ insopts -m644 -o root -g mail
+ doins ${T}/mysql.data
+ doins ${T}/mysql_setup.sql
+ doins ${FILESDIR}/upgrade.sql
+ newins tools.mysql_drv/purge.sql mysql_purge.sql
+
+ exeinto ${CONFIGDIR}
+ exeopts -m755 -o root -g mail
+ doexe ${T}/mysql_install_db
+ doexe ${T}/mysql_purge_db
+
+ einfo "Fresh install: run ${HOMEDIR}/mysql_install_db to setup the dspam database"
+ einfo "Upgrades from 2.x: See the README for instructions on updating your tables for dspam-3.0"
+ else
+ cp ${FILESDIR}/crontab.db4 ${T}/dspam.cron
+ fi
+
+ # installs the cron job to the cron directory
+ diropts -m0755 -o root -g mail
+ dodir /etc/cron.daily
+ keepdir /etc/cron.daily
+ exeinto /etc/cron.daily
+ exeopts -m0755 -o root -g mail
+ doexe ${T}/dspam.cron
+
+ # installs the logrotation scripts to the logrotate.d directory
+ diropts -m0755 -o root -g mail
+ dodir /etc/logrotate.d
+ keepdir /etc/logrotate.d
+ insinto /etc/logrotate.d
+ insopts -m0755 -o root -g mail
+ newins ${FILESDIR}/logrotate.dspam dspam
+
+ # Symlinks data to HOMEDIR
+ dosym ${DATADIR} ${HOMEDIR}/data
+
+ # Log files for symlinks
+ diropts -m0755 -o root -g mail
+ dodir ${LOGDIR}
+ keepdir ${LOGDIR}
+ touch ${D}${LOGDIR}/sql.errors
+ touch ${D}${LOGDIR}/system.log
+ touch ${D}${LOGDIR}/dspam.debug
+ touch ${D}${LOGDIR}/dspam.messages
+
+ # dspam still wants to write to a few files in it's home dir
+ dosym ${LOGDIR}/sql.errors ${HOMEDIR}/sql.errors
+ dosym ${LOGDIR}/system.log ${HOMEDIR}/system.log
+ dosym ${LOGDIR}/dspam.debug ${HOMEDIR}/dspam.debug
+ dosym ${LOGDIR}/dspam.messages ${HOMEDIR}/dspam.messages
+}
+
+pkg_postinst() {
+ if [ `use mysql` ] ; then
+ einfo "To setup dspam to run out-of-the-box on your system with a mysql database, run:"
+ einfo "ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config"
+ fi
+}
+
+pkg_config () {
+ if [ `use mysql` ] ; then
+ ${CONFIGDIR}/mysql_install_db
+ mv ${CONFIGDIR}/mysql.data ${HOMEDIR}
+ fi
+}
diff --git a/mail-filter/dspam/files/README.postfix b/mail-filter/dspam/files/README.postfix
new file mode 100644
index 000000000000..fa3badbd388f
--- /dev/null
+++ b/mail-filter/dspam/files/README.postfix
@@ -0,0 +1,7 @@
+Postfix will deliver to mailbox_transport as user 'nobody'.
+This is set by the option 'default_privs'.
+
+Postfix is installed setuid root setgid dspam.
+Add 'nobody' to /etc/mail/dspam/trusted.users
+
+mailbox_transport = /usr/bin/dspam --user %u --deliver=innocent --mode=teft --feature=chained,noise,whitelist
diff --git a/mail-filter/dspam/files/README.qmail b/mail-filter/dspam/files/README.qmail
new file mode 100644
index 000000000000..ab4b12c25a47
--- /dev/null
+++ b/mail-filter/dspam/files/README.qmail
@@ -0,0 +1,69 @@
+DSPAM for Gentoo qmail
+Author - $Author: st_lim $
+Version - $Id: README.qmail,v 1.1 2004/06/26 16:45:28 st_lim Exp $
+
+These are some steps I took to use dspam with qmail. If you have a better
+method of using qmail with DSPAM, do send a message to me at
+<st_lim@gentoo.org> to share your ideas.
+
+My set up includes:
+a. qmail
+b. qmail-scanner
+c. Mail-SpamAssassin
+d. f-prot (I'm not using it at the moment, coz mails do get stuck in the queue
+when I use f-prot)
+e. dspam (of course)
+
+For setting up spamassassin, I think I shall not go into details with it. I
+think an excellent tutorial can be found at
+http://cmisip.home.insightbb.com/Qmail.htm.
+
+So once you have spamassassin set up, you will want to use dspam without
+procmail. And since you have .qmail, here is what you do:
+
+1. add your user and qmailq to /etc/mail/dspam/trusted.users
+$ cat /etc/mail/dspam/trusted.users
+apache
+nobody
+root
+qmailq
+alias
+st_lim
+spteo
+
+2. type the following into your /home/<user>/.qmail file
+
+| /usr/bin/dspam --user <user> --deliver=innocent --mode=teft --feature=chained,noise,whitelist
+[your normal delivery options]
+
+3. When you get spam, you have either of 2 options:
+ a. Run the dspam command on the mail via your email client:
+
+==========================================================================================
+/usr/bin/dspam --user <user> --mode=teft --class=spam --source=error < [spam-mail]
+==========================================================================================
+
+ b. Or run the dspam command on a set of emails in a directory via a cron job,
+ my suggested script is below:
+
+==========================================================================================
+#!/bin/sh
+JUNK_DIR=/home/<user>/Maildir/Junk
+JUNK_MAILS=$JUNK_DIR/cur/[0-9]*
+
+QMAIL_SPAMASSASSIN=/var/qmail/.spamassassin
+
+sa-learn --spam $JUNK_MAILS
+for i in $JUNK_MAILS; do
+ cat $i | /usr/bin/dspam --user qmailq --mode=teft --class=spam --source=error
+done
+cp $ROOT_SPAMASSASSIN/bayes* $QMAIL_SPAMASSASSIN
+chown -R qmailq:qmail $QMAIL_SPAMASSASSIN
+rm -rf $JUNK_MAILS
+==========================================================================================
+
+If you have any problems with the abovementioned setup, pls share it via
+bugs.gentoo.org. I'll try to help you resolve the issues.
+
+Regards
+Lim Swee Tat
diff --git a/mail-filter/dspam/files/crontab.db4 b/mail-filter/dspam/files/crontab.db4
new file mode 100644
index 000000000000..34df7b1833ef
--- /dev/null
+++ b/mail-filter/dspam/files/crontab.db4
@@ -0,0 +1,2 @@
+0 0 */7 * * /usr/bin/dspam_clean -s -p -u 2>&1 > /dev/null
+
diff --git a/mail-filter/dspam/files/crontab.mysql b/mail-filter/dspam/files/crontab.mysql
new file mode 100644
index 000000000000..475abdaf5651
--- /dev/null
+++ b/mail-filter/dspam/files/crontab.mysql
@@ -0,0 +1,3 @@
+# Remove old signatures and unimportant tokens from the database
+0 0 */7 * * @confdir@/mysql_purge_db 2>&1 > /dev/null
+
diff --git a/mail-filter/dspam/files/digest-dspam-3.0.0 b/mail-filter/dspam/files/digest-dspam-3.0.0
new file mode 100644
index 000000000000..f27f0f265cf9
--- /dev/null
+++ b/mail-filter/dspam/files/digest-dspam-3.0.0
@@ -0,0 +1 @@
+MD5 f5b568e8fea50faaf4c1fcabee177934 dspam-3.0.0.tar.gz 575382
diff --git a/mail-filter/dspam/files/logrotate.dspam b/mail-filter/dspam/files/logrotate.dspam
new file mode 100644
index 000000000000..4f0c19033971
--- /dev/null
+++ b/mail-filter/dspam/files/logrotate.dspam
@@ -0,0 +1,5 @@
+/var/log/dspam/sql.errors /var/log/dspam/system.log /var/log/dspam/dspam.debug /var/log/dspam/dspam.messages {
+ weekly
+ compress
+ create 0644 root mail
+}
diff --git a/mail-filter/dspam/files/mysql.data b/mail-filter/dspam/files/mysql.data
new file mode 100644
index 000000000000..5cd72638273d
--- /dev/null
+++ b/mail-filter/dspam/files/mysql.data
@@ -0,0 +1,5 @@
+/var/run/mysqld/mysqld.sock
+
+dspam
+@password@
+dspam
diff --git a/mail-filter/dspam/files/mysql_create_user.sql b/mail-filter/dspam/files/mysql_create_user.sql
new file mode 100644
index 000000000000..b443db6c6fdd
--- /dev/null
+++ b/mail-filter/dspam/files/mysql_create_user.sql
@@ -0,0 +1,4 @@
+CREATE DATABASE IF NOT EXISTS dspam;
+GRANT USAGE ON dspam.* TO 'dspam'@'localhost' IDENTIFIED BY '@password@';
+GRANT SELECT, INSERT, UPDATE, DELETE ON dspam.* TO 'dspam'@'localhost';
+USE dspam;
diff --git a/mail-filter/dspam/files/mysql_install_db b/mail-filter/dspam/files/mysql_install_db
new file mode 100644
index 000000000000..39f9f08403d2
--- /dev/null
+++ b/mail-filter/dspam/files/mysql_install_db
@@ -0,0 +1,3 @@
+#!/bin/sh
+echo Type your mysql root password at the prompt
+/usr/bin/mysql -u root -p < @confdir@/mysql_setup.sql
diff --git a/mail-filter/dspam/files/mysql_purge_db b/mail-filter/dspam/files/mysql_purge_db
new file mode 100644
index 000000000000..5bc1a112fad2
--- /dev/null
+++ b/mail-filter/dspam/files/mysql_purge_db
@@ -0,0 +1 @@
+/usr/bin/mysql -u dspam -p'@password@' dspam < @confdir@/mysql_purge.sql
diff --git a/mail-filter/dspam/files/trusted.users b/mail-filter/dspam/files/trusted.users
new file mode 100644
index 000000000000..2060d114d907
--- /dev/null
+++ b/mail-filter/dspam/files/trusted.users
@@ -0,0 +1,4 @@
+apache
+nobody
+root
+qmailq
diff --git a/mail-filter/dspam/files/untrusted.mailer_args b/mail-filter/dspam/files/untrusted.mailer_args
new file mode 100644
index 000000000000..697e37f43b55
--- /dev/null
+++ b/mail-filter/dspam/files/untrusted.mailer_args
@@ -0,0 +1 @@
+/usr/bin/procmail -d %u
diff --git a/mail-filter/dspam/files/upgrade.sql b/mail-filter/dspam/files/upgrade.sql
new file mode 100644
index 000000000000..160f686764e1
--- /dev/null
+++ b/mail-filter/dspam/files/upgrade.sql
@@ -0,0 +1,15 @@
+alter table dspam_stats add spam_learned int;
+alter table dspam_stats add innocent_learned int;
+alter table dspam_stats add spam_classified int;
+alter table dspam_stats add innocent_classified int;
+update dspam_stats set spam_learned = total_spam;
+update dspam_stats set innocent_learned = total_innocent;
+update dspam_stats set spam_classified = 0, innocent_classified = 0;
+alter table dspam_stats drop column total_spam;
+alter table dspam_stats drop column total_innocent;
+alter table dspam_stats add spam_misclassified int;
+alter table dspam_stats add innocent_misclassified int;
+update dspam_stats set spam_misclassified = spam_misses;
+update dspam_stats set innocent_misclassified = false_positives;
+alter table dspam_stats drop column spam_misses;
+alter table dspam_stats drop column false_positives;
diff --git a/mail-filter/dspam/metadata.xml b/mail-filter/dspam/metadata.xml
new file mode 100644
index 000000000000..9cfc3ccf6872
--- /dev/null
+++ b/mail-filter/dspam/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>mail-filter</herd>
+<maintainer>
+ <email>st_lim@gentoo.org</email>
+</maintainer>
+<longdescription>A statistical-algorithmic hybrid anti-spam filter</longdescription>
+</pkgmetadata>