From efe1a722f2804d5a5d7905ed80158e97f7fe01f6 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 21 Nov 2011 16:37:46 +0300 Subject: [PATCH] * Add debian package information. --- LICENSE | 22 ++++++ README | 93 +++++++++++++++++++++++ debian/changelog | 17 +++++ debian/compat | 1 + debian/control | 17 +++++ debian/copyright | 33 ++++++++ debian/docs | 1 + debian/rspamd-doc.docs | 1 + debian/rspamd-doc.install | 1 + debian/rspamd.default | 2 + debian/rspamd.init | 154 ++++++++++++++++++++++++++++++++++++++ debian/rspamd.logrotate | 12 +++ debian/rules | 6 ++ debian/source/format | 1 + 14 files changed, 361 insertions(+) create mode 100644 LICENSE create mode 100644 README create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/docs create mode 100644 debian/rspamd-doc.docs create mode 100644 debian/rspamd-doc.install create mode 100644 debian/rspamd.default create mode 100755 debian/rspamd.init create mode 100644 debian/rspamd.logrotate create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..d84496fca --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2011, Vsevolod Stakhov + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY Vsevolod Stakhov ''AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README b/README new file mode 100644 index 000000000..bb07035e5 --- /dev/null +++ b/README @@ -0,0 +1,93 @@ +DESCRIPTION +=========== + +Rspamd is a complex spam filter that allows to estimate messages by many rules, +statistical data and custom services like URL black lists. Each message is +estimated by rspamd and got so called 'spam score'. According to spam score and +user's settings rspamd send recommended action for this message to MTA. Rspamd +has own unique features among spam filters: +* event driven architecture allowing to process many messages at a time +* flexible syntax of rules allowing to write rules in lua language +* a lot of plugins and rules shipped with rspamd distribution +* highly optimized mail processing advanced statistic + +All these features allow rspamd to process messages fast and make good results in +spam filtering. + +INSTALLATION +============ + +Rspamd runs on a Unix like operational systems. FreeBSD users can use ports +collection (mail/rspamd) for rspamd installation. Users of other OSes should +use sources to build and install rspamd. You can obtain rspamd sources at +bitbucket download page: https:bitbucket.org/vstakhov/rspamd/downloads. + +Build requirements +================== + +Rspamd requires several 3-rd party software to build and run: + +* libevent - asynchronous event library +* glib - common purposes library +* gmime - mime parser +* lua - extendable scripting language +* cmake - advanced software build system + +You can either install them from sources or (recommended) install using package manager of your system. + +Build process +============= + +Building of rspamd is quite simple: + +$ cmake . +$ make +# make install + +After installation binaries, rules, plugins and a sample configuration will be +installed in the target directories (prefixed by /usr/local by default). To +start working with rspamd you should do several steps: + +1. Copy a sample configuration $PREFIX/etc/rspamd.xml.sample to +$PREFIX/etc/rspamd.xml +2. Edit rspamd.xml according to your system (described +later). +3. Make a directory for rspamd pid file and data (/var/run/rspamd by +default) and make rspamd user (nobody by default) as owner of rspamd data +directory. +4. Make a directory for rspamd logs (or setup syslog to accept +rspamd log messages) +5. Install start script to a proper place (this step is done +when installing from FreeBSD ports) +6. Start rspamd using start script + +If start script is not suitable for your system (now rspamd shipped with start +script for FreeBSD, Debian and RedHat like operational systems) you should +write a start script based on your system's documentation. + +FURTHER ACTIONS +=============== + +You can improve quality of rspamd by learning its statistic module. The easiest +way to do it is to use rspamc client (you can setup a custom email alias to +pipe messages to rspamc) + +$ rspamc -P 'q1' -c bayes learn_spam [ file1 [file2 [...]]] +$ rspamc -P 'q1' -c bayes learn_ham [ file1 [file2 [...]]] + +Note: you should consider to change default controller's password 'q1' to yours +one specified in controller section of configuration. + +Also a system administrator may want to customize rule's weights or actions +thresholds. This can be easily done by editing metric section in the +configuration file. + +For writing new rules you can examine the main rspamd documentation and lua api +gude and reference. + +REFERENCES +========== + +Home site: https://bitbucket.org/vstakhov/rspamd +Downloads: https://bitbucket.org/vstakhov/rspamd/downloads +Wiki: https://bitbucket.org/vstakhov/rspamd/wiki/ diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 000000000..b0b161bce --- /dev/null +++ b/debian/changelog @@ -0,0 +1,17 @@ +rspamd (0.4.5-1) unstable; urgency=low + + * Upgrade to 0.4.5 + + -- Vsevolod Stakhov Mon, 21 Nov 2011 17:04:33 +0400 + +rspamd (0.4.4-1) unstable; urgency=low + + * Upgrade to 0.4.4 + + -- Vsevolod Stakhov Tue, 15 Nov 2011 17:54:33 +0400 + +rspamd (0.4.3-1) unstable; urgency=low + + * Initial release + + -- Vsevolod Stakhov Tue, 16 Aug 2011 17:54:33 +0400 diff --git a/debian/compat b/debian/compat new file mode 100644 index 000000000..7f8f011eb --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 000000000..7c2279fe2 --- /dev/null +++ b/debian/control @@ -0,0 +1,17 @@ +Source: rspamd +Section: mail +Priority: extra +Maintainer: Vsevolod Stakhov +Build-Depends: debhelper (>= 7.0.50~), cmake, libevent1-dev(>= 1.3), libglib2.0-dev (>= 2.16.0), libgmime-2.4-dev, liblua5.1-0-dev, libpcre3-dev, cdbs +Standards-Version: 3.9.1 +Homepage: https://bitbucket.org/vstakhov/rspamd/ +Vcs-Hg: https://bitbucket.org/vstakhov/rspamd/ +Vcs-Browser: https://bitbucket.org/vstakhov/rspamd/src + +Package: rspamd +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Fast spam filtering system + Rspamd is fast, modular and lightweight spam filter. It is designed to work + with big ammount of mail and can be easily extended with own filters written in + lua. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 000000000..60d1ce290 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,33 @@ +Format: http://dep.debian.net/deps/dep5 +Upstream-Name: rspamd +Source: https://bitbucket.org/vstakhov/rspamd + +Files: contrib/lgpl/* +Copyright: 1999, 2000 Scott Wimer +Copyright: 2004, Matthias Clasen +Copyright: 2005 - 2007, Marco Barisione +License: LGPL-2+ + + +Files: * +Copyright: 2008-2011 Vsevolod Stakhov +License: BSD + +Files: debian/* +Copyright: 2011 Vsevolod Stakhov +License: GPL-2+ + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". diff --git a/debian/docs b/debian/docs new file mode 100644 index 000000000..e845566c0 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README diff --git a/debian/rspamd-doc.docs b/debian/rspamd-doc.docs new file mode 100644 index 000000000..d4f454258 --- /dev/null +++ b/debian/rspamd-doc.docs @@ -0,0 +1 @@ +#DOCS# diff --git a/debian/rspamd-doc.install b/debian/rspamd-doc.install new file mode 100644 index 000000000..d4f454258 --- /dev/null +++ b/debian/rspamd-doc.install @@ -0,0 +1 @@ +#DOCS# diff --git a/debian/rspamd.default b/debian/rspamd.default new file mode 100644 index 000000000..a9246e776 --- /dev/null +++ b/debian/rspamd.default @@ -0,0 +1,2 @@ +RSPAMD_USERNAME=nobody +RSPAMD_GROUPNAME=nogroup diff --git a/debian/rspamd.init b/debian/rspamd.init new file mode 100755 index 000000000..c8d7cd695 --- /dev/null +++ b/debian/rspamd.init @@ -0,0 +1,154 @@ +#! /bin/bash +### BEGIN INIT INFO +# Provides: rspamd +# Required-Start: $syslog $remote_fs +# Required-Stop: $syslog $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Rspamd spam filtering system +# Description: Rspamd is fast and modular spam filtering system written in C +### END INIT INFO + +# Author: Vsevolod Stakhov + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="Rspamd" +NAME=rspamd +DAEMON=/usr/bin/$NAME +DAEMON_ARGS="-c /etc/rspamd.xml" +DESC="spam filtering system" +PIDFILE=/var/run/rspamd/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME +RSPAMD_USERNAME=nobody +RSPAMD_GROUPNAME=nogroup + +# Exit if the package is not installed +[ -x "$DAEMON" ] || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. +. /lib/lsb/init-functions + +FILES=(/etc/default/rspamd_*.conf) +# check for alternative config schema +if [ -r "${FILES[0]}" ]; then + CONFIGS=(/etc/default/rspamd_*.conf) +else + CONFIGS=(/etc/default/$NAME) +fi; + +CONFIG_NUM=${#CONFIGS[@]} + +# +# Function that starts the daemon/service +# +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ + $DAEMON_ARGS -u $RSPAMD_USERNAME -g $RSPAMD_GROUPNAME \ + || return 2 +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + # Wait for children to finish too if this is a daemon that forks + # and if the daemon is only ever run from this initscript. + # If the above conditions are not satisfied then add some other code + # that waits for the process to drop all resources that could be + # needed by services started subsequently. A last resort is to + # sleep for some time. + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + [ "$?" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +# +# Function that sends a SIGHUP to the daemon/service +# +do_reload() { + start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME + return 0 +} + +_retcode=0 + +for ((i=0; i < $CONFIG_NUM; i++)); do + SCRIPT=${CONFIGS[${i}]} + . ${SCRIPT} + case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc -p $PIDFILE "$DAEMON" "$NAME" || _retcode=$? + ;; + reload|force-reload) + log_daemon_msg "Reloading $DESC" "$NAME" + do_reload + log_end_msg $? + ;; + restart) + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + exit 3 + ;; + esac +done +exit $_retcode +: diff --git a/debian/rspamd.logrotate b/debian/rspamd.logrotate new file mode 100644 index 000000000..2d0175677 --- /dev/null +++ b/debian/rspamd.logrotate @@ -0,0 +1,12 @@ +/var/log/rspamd/rspamd.log{ + daily + rotate 4 + delaycompress + compress + notifempty + missingok + postrotate + reload rspamd >/dev/null 2>&1 || true + endscript +} + diff --git a/debian/rules b/debian/rules new file mode 100755 index 000000000..3ae78f020 --- /dev/null +++ b/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/cmake.mk + +DEB_CMAKE_NORMAL_ARGS+= -DETC_PREFIX=/etc -DMAN_PREFIX=/usr/share/man -DLOCALSTATES_PREFIX=/var/run diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 000000000..163aaf8d8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) -- 2.39.5