summaryrefslogtreecommitdiff
path: root/community/dspam
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2013-07-19 01:10:32 -0700
committerroot <root@rshg054.dnsready.net>2013-07-19 01:10:32 -0700
commit8fbc0076a4827ddc6af92e0b9daa4c4c31450808 (patch)
tree03fd0e2921ebd53228d9a93e32ed3976b636cbea /community/dspam
parente445a313723389ba9ee1fded025c567dae5b21ea (diff)
Fri Jul 19 01:09:18 PDT 2013
Diffstat (limited to 'community/dspam')
-rw-r--r--community/dspam/PKGBUILD86
-rw-r--r--community/dspam/dspam.install40
-rw-r--r--community/dspam/dspam.logrotated10
-rw-r--r--community/dspam/dspam.service11
-rw-r--r--community/dspam/dspam.tmpfiles1
-rw-r--r--community/dspam/dspam_maintenance.cron6
6 files changed, 154 insertions, 0 deletions
diff --git a/community/dspam/PKGBUILD b/community/dspam/PKGBUILD
new file mode 100644
index 000000000..7bdba6e41
--- /dev/null
+++ b/community/dspam/PKGBUILD
@@ -0,0 +1,86 @@
+# $Id: PKGBUILD 90661 2013-05-13 14:22:46Z spupykin $
+# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Contributor: William Rea <sillywilly@gmail.com>
+
+pkgname=dspam
+pkgver=3.10.2
+pkgrel=5
+pkgdesc="A scalable, open-source statistical anti-spam filter"
+arch=('i686' 'x86_64')
+url="http://dspam.nuclearelephant.com/"
+backup=('etc/dspam/dspam.conf'
+ 'srv/http/dspam/cgi-bin/admins'
+ 'srv/http/dspam/cgi-bin/subadmins')
+license=("GPL")
+depends=(readline libcap ncurses zlib openssl)
+makedepends=('libmariadbclient' 'postgresql-libs' 'db' 'sqlite' 'libldap')
+optdepends=('libmariadbclient: MariaDB support'
+ 'postgresql-libs: PostgreSQL support'
+ 'db: BerkeleyDB support'
+ 'sqlite: SQLite support'
+ 'clamav: ClamAV support'
+ 'libldap: external lookup support')
+options=('zipman' 'docs' '!libtool')
+install=$pkgname.install
+source=(http://downloads.sourceforge.net/project/dspam/dspam/dspam-$pkgver/dspam-$pkgver.tar.gz
+ dspam.logrotated
+ dspam.service
+ dspam.tmpfiles
+ dspam_maintenance.cron)
+md5sums=('0e0e405d3284485b2a43f47eaf6b09bb'
+ 'cec7e3df4cbc6feca387fb516a5b3490'
+ '1581a94598cec370b66f37b118970676'
+ '933643f2204ccbd7e451a439f83db1ea'
+ 'ebfb0fec16a56f6e1a3a61ced2d5015d')
+
+build() {
+ OPTS="--with-dspam-owner=dspam --with-dspam-group=dspam --with-dspam-home-group=dspam --with-dspam-mode=2510 \
+ --enable-daemon --enable-virtual-users --enable-large-scale --enable-long-usernames --enable-external-lookup \
+ --enable-split-configuration --enable-syslog --enable-clamav \
+ --with-dspam-home=/var/lib/dspam --with-logdir=/var/log/dspam --with-logfile=/var/log/dspam/dspam.log \
+ --with-mysql-includes=/usr/include/mysql --with-mysql-libraries=/usr/lib \
+ --with-storage-driver="mysql_drv,libdb4_drv,pgsql_drv,sqlite3_drv,hash_drv" --enable-preferences-extension"
+
+ cd $srcdir/$pkgname-$pkgver
+ [ $NOEXTRACT -eq 1 ] || ./configure --prefix=/usr --sysconfdir=/etc/dspam --localstatedir=/var ${OPTS}
+ make
+}
+
+package() {
+ cd $srcdir/$pkgname-$pkgver
+ make DESTDIR=$pkgdir install
+
+ mkdir -p $pkgdir/srv/http/dspam
+ cp -a webui/* $pkgdir/srv/http/dspam/
+ find $pkgdir/srv/http/dspam/ -type f -name 'Makefile*' -exec rm -f {} \;
+ find $pkgdir/srv/http/dspam/ -type f -name '*.in' -exec rm -f {} \;
+
+ install -d $pkgdir/etc/logrotate.d \
+ $pkgdir/usr/share/dspam/{mysql,pgsql}
+ install -m644 ../dspam.logrotated $pkgdir/etc/logrotate.d/dspam
+
+ sed -i 's|#ServerPID|ServerPID|' $pkgdir/etc/dspam/dspam.conf
+
+ sed -e 's:^#*\(ServerDomainSocketPath[\t ]\{1,\}\).*:\1\"/run/dspam/dspam.sock\":gI' \
+ -e 's:^#*\(ServerPID[\t ]\{1,\}\).*:\1/run/dspam/dspam.pid:gI' \
+ -i $pkgdir/etc/dspam/dspam.conf
+
+ sed -i 's|/var/lib/mysql/mysql.sock|/tmp/mysql.sock|' $pkgdir/etc/dspam/dspam.conf
+
+ cp -r src/tools.mysql_drv/*.sql $pkgdir/usr/share/dspam/mysql
+ cp -r src/tools.pgsql_drv/*.sql $pkgdir/usr/share/dspam/pgsql
+
+ # install dspam_maintenance from contrib/
+ install -Dm0755 contrib/dspam_maintenance/dspam_maintenance.sh $pkgdir/usr/bin/dspam_maintenance
+ install -Dm0644 contrib/dspam_maintenance/dspam_maintenance.1 $pkgdir/usr/share/man/man1/dspam_maintenance.1
+ install -Dm0755 $srcdir/dspam_maintenance.cron $pkgdir/etc/cron.daily/dspam_maintenance
+
+ cd $pkgdir/usr/share/man/man3
+ find -type l -exec ln -sf libdspam.3 {} \;
+
+ # make logrotate happy
+ chmod 750 $pkgdir/var/log/dspam
+
+ install -Dm0644 $srcdir/$pkgname.service $pkgdir/usr/lib/systemd/system/$pkgname.service
+ install -Dm0644 $srcdir/$pkgname.tmpfiles $pkgdir/usr/lib/tmpfiles.d/$pkgname.conf
+}
diff --git a/community/dspam/dspam.install b/community/dspam/dspam.install
new file mode 100644
index 000000000..4eac46ede
--- /dev/null
+++ b/community/dspam/dspam.install
@@ -0,0 +1,40 @@
+post_install() {
+ echo -n "adding dspam system group... "
+ groupadd -g 115 dspam && echo "done."
+ echo -n "adding dspam system user... "
+ useradd -c "DSPAM Daemon" -u 115 -d /var/lib/dspam -g dspam -s /bin/false dspam \
+ && echo "done."
+ passwd -l dspam &>/dev/null
+ chown root:dspam usr/bin/dspamc
+ chmod g+s usr/bin/dspamc
+
+cat << EOF
+>>> To populate the DSPAM database, you need to follow several steps.
+>>> First create a database. Login to the mysql command prompt.
+ $ mysql -u root -p
+ mysql> CREATE database dspam;
+>>> Next, you need to create a dspam user. At the same MySQL prompt:
+ mysql> GRANT ALL PRIVILEGES ON dspam.* TO dspam@'localhost' IDENTIFIED BY 'passwd';
+>>> Replacing passwd with your chosen password.
+>>> If you want a space optimized db do:
+ $ mysql -u dspam dspam -p < /var/lib/dspam/mysql/mysql_objects-space.sql
+>>> If you want a speed optimized db do:
+ $ mysql -u dspam dspam -p < /var/lib/dspam/mysql/mysql_objects-speed.sql
+>>> Enter the password you set in the previous step, and the database should be populated.
+
+>>> Remember to edit /etc/dspam/dspam.conf accordenly
+>>> If you want to use the postgresql, sqlite3 or Berekely DB4 backends,
+>>> read the documentation
+>>>
+EOF
+}
+
+post_upgrade() {
+ chown root:dspam usr/bin/dspamc
+ chmod g+s usr/bin/dspamc
+}
+
+post_remove() {
+ echo -n -e "\nremoving dspam system user and group..."
+ userdel dspam && echo "done."
+}
diff --git a/community/dspam/dspam.logrotated b/community/dspam/dspam.logrotated
new file mode 100644
index 000000000..c73b1dcb3
--- /dev/null
+++ b/community/dspam/dspam.logrotated
@@ -0,0 +1,10 @@
+/var/log/dspam/sql.errors
+/var/lib/dspam/system.log
+/var/log/dspam/dspam.debug
+/var/log/dspam/dspam.messages
+/var/log/dspam/dspam.log {
+ weekly
+ compress
+ missingok
+ copytruncate
+}
diff --git a/community/dspam/dspam.service b/community/dspam/dspam.service
new file mode 100644
index 000000000..1a5b1e710
--- /dev/null
+++ b/community/dspam/dspam.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=A highly accurate statistical spam filter that uses minimal resources
+
+[Service]
+Type=forking
+User=dspam
+ExecStart=/usr/bin/dspam --daemon 2>/dev/null
+PrivateTmp=true
+
+[Install]
+WantedBy=multi-user.target \ No newline at end of file
diff --git a/community/dspam/dspam.tmpfiles b/community/dspam/dspam.tmpfiles
new file mode 100644
index 000000000..9f5910969
--- /dev/null
+++ b/community/dspam/dspam.tmpfiles
@@ -0,0 +1 @@
+d /var/run/dspam 0770 dspam mail -
diff --git a/community/dspam/dspam_maintenance.cron b/community/dspam/dspam_maintenance.cron
new file mode 100644
index 000000000..940d8aed1
--- /dev/null
+++ b/community/dspam/dspam_maintenance.cron
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# DSPAM maintenance tasks
+# check "man 1 dspam_maintenance" for more options
+
+/usr/bin/dspam_maintenance --verbose --purgescriptdir=/usr/share/dspam 1> /dev/null