network/amavisd-new: Updated for version 2.10.1.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Nishant Limbachia 2014-11-25 13:22:53 +07:00 committed by Willy Sudiarto Raharjo
parent 7e749e05df
commit 29085d0e94
14 changed files with 259 additions and 92 deletions

View file

@ -2,6 +2,9 @@ If you plan to run amavisd-new, you don't need to run spamassassin separately (u
via spamd). Amavisd-new calls spamassassin internally to scan messages. You can
also install clamav and enable virus scanning in the configuration file.
RUNTIME DEPENDENCIES:
ZeroMQ library -- since amavisd-new version > 2.8.x depends heavily on ZeroMQ.
DEPENDENCIES:
FOR SPAMASSASSIN (please install in this order):
@ -23,17 +26,6 @@ perl-digest-sha1
perl-digest-hmac
perl-html-tagset
perl-html-parser
perl-encode-locale
perl-uri-escape
perl-http-date
perl-lwp-mediatypes
perl-http-message
perl-http-cookies
perl-http-daemon
perl-file-listing
perl-http-negotiate
perl-net-http
perl-www-robotrules
re2c
libwww-perl
perl-NetAddr-IP
@ -57,6 +49,8 @@ perl-MIME-tools
perl-Unix-Syslog
perl-BerkeleyDB
perl-IO-Multiplex
perl-Net-LibIDN
perl-File-LibMagic (recommended)
SLACKBUILD CHANGELOG:
Script and package changes introduced in version >= 2.6.6
@ -68,8 +62,9 @@ Script and package changes introduced in version >= 2.6.6
4. Remember to update your rc.local and rc.local_shutdown scripts accordingly.
5. With version 2.7, a new process amavisd-signer is spawned to take care
of dkim signing. Please read RELEASE_NOTES in the documentation.
6. With version > 2.8, rc script has been overhauled to start 3 daemons, more
notes are in the rc script.
SETUP:
1. Create amavis user/group, before running the script.
groupadd -g 225 amavis
@ -94,4 +89,3 @@ SETUP:
7. You can turn on debugging in log file with $sa_debug configuration
variable in /etc/amavisd.conf.

View file

@ -3,8 +3,8 @@
# Slackware Package Build Script for amavisd-new
# Home Page http://www.ijs.si/software/amavisd/
# Copyright (c) 2009-2012, Nishant Limbachia, Hoffman Estates, IL, USA
# <nishant _AT_ mnspace _DOT_ net>
# Copyright (c) 2009-2014, Nishant Limbachia, Hoffman Estates, IL, USA
# (nishant _AT_ mnspace _DOT_ net)
# All rights reserved.
# Redistribution and use of this script, with or without modification, is
@ -26,11 +26,10 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM="amavisd-new"
VERSION=${VERSION:-2.7.1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
VERSION=${VERSION:-2.10.1}
ARCH="noarch"
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
@ -79,18 +78,22 @@ QUARANTINE_DIR=${QUARANTINE_DIR:-$AMAVIS_HOME/quarantine}
DOCS="AAAREADME.first INSTALL TODO amavisd*.conf* LDAP*
RELEASE_NOTES LICENSE README_FILES test-messages"
rm -rf $PKG
rm -fr $TMP/$PRGNAM-$VERSION $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.?z*
cd $PRGNAM-$VERSION
cd $TMP/$PRGNAM-$VERSION
chown -R root.root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# apply patches
for i in $CWD/patches/*.patch; do
patch -p0 < $i
done
### amavisd-new home directory
mkdir -p $PKG/$AMAVIS_HOME/{tmp,var,db,home}
@ -102,16 +105,16 @@ mkdir -p $PKG/var/run/amavis
### your quarantine directory into different categories
### used by $(clean|banned_files|bad_header|spam|virus)_quarantine_method directive
### in amavisd config file
mkdir -p $PKG/$QUARANTINE_DIR/{clean,spam,banned,badh,virus}
mkdir -p $PKG/$QUARANTINE_DIR/{clean,spam,banned,badh,virus,archive}
mkdir -p $PKG/usr/{sbin,doc/$PRGNAM-$VERSION}
install -m 0755 -D amavisd $PKG/usr/sbin/$PRGNAM
( cd $PKG/usr/sbin; ln -sf $PRGNAM amavisd )
patch -p0 < $CWD/amavisd-signer.patch
install -m 0755 amavisd-agent amavisd-nanny amavisd-release amavisd-signer \
amavisd-snmp-subagent amavisd-submit p0f-analyzer.pl $PKG/usr/sbin
install -m 0755 amavis-mc amavis-services amavisd-agent \
amavisd-nanny amavisd-release amavisd-signer amavisd-snmp-subagent \
amavisd-snmp-subagent-zmq amavisd-status amavisd-submit p0f-analyzer.pl \
$PKG/usr/sbin
install -m 0640 -D amavisd.conf $PKG/etc/amavisd.conf.new
# change permissions
@ -119,8 +122,7 @@ chown $USER:$GROUP $PKG/etc/amavisd.conf.new
chown -R $USER:$GROUP $PKG/$AMAVIS_HOME $PKG/var/run/amavis $PKG/$QUARANTINE_DIR
chmod -R 0770 $PKG/$AMAVIS_HOME $PKG/var/run/amavis $PKG/$QUARANTINE_DIR
cp -r $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
chmod -R +r $PKG/usr/doc/$PRGNAM-$VERSION
cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
### install rc script

View file

@ -1,10 +1,10 @@
PRGNAM="amavisd-new"
VERSION="2.7.1"
VERSION="2.10.1"
HOMEPAGE="http://www.ijs.si/software/amavisd/"
DOWNLOAD="http://www.ijs.si/software/amavisd/amavisd-new-2.7.1.tar.gz"
MD5SUM="87cd516d1c6349a4389947fb949ff1a2"
DOWNLOAD="http://www.ijs.si/software/amavisd/amavisd-new-2.10.1.tar.xz"
MD5SUM="adb0c64ac6a91249ddeb4ed97747d755"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="%README%"
REQUIRES=""
MAINTAINER="Nishant Limbachia"
EMAIL="nishant@mnspace.net"

View file

@ -1,5 +1,4 @@
/var/log/amavisd-new.log {
su amavis amavis
rotate 5
notifempty
missingok

View file

@ -11,17 +11,13 @@ config() {
# Otherwise, we leave the .new copy for the admin to consider...
}
preserve_perms() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ -e $OLD ]; then
cp -a $OLD ${NEW}.incoming
cat $NEW > ${NEW}.incoming
mv ${NEW}.incoming $NEW
fi
config $NEW
}
# Keep same perms on rc.amavisd.new:
if [ -e etc/rc.d/rc.amavisd-new ]; then
cp -a etc/rc.d/rc.amavisd-new etc/rc.d/rc.amavisd-new.new.incoming
cat etc/rc.d/rc.amavisd-new.new > etc/rc.d/rc.amavisd-new.new.incoming
mv etc/rc.d/rc.amavisd-new.new.incoming etc/rc.d/rc.amavisd-new.new
fi
preserve_perms etc/rc.d/rc.amavisd-new.new
preserve_perms etc/amavisd.conf.new
preserve_perms etc/logrotate.d/amavisd-new.new
config etc/rc.d/rc.amavisd-new.new
config etc/amavisd.conf.new
config etc/logrotate.d/amavisd-new.new

View file

@ -0,0 +1,16 @@
--- amavis-mc.orig 2014-11-08 20:40:11.560673812 -0600
+++ amavis-mc 2014-11-08 20:41:17.561010101 -0600
@@ -70,10 +70,10 @@
### USER CONFIGURABLE:
-$daemon_user = 'vscan';
-$daemon_group = 'vscan';
+$daemon_user = 'amavis';
+$daemon_group = 'amavis';
-$pid_file = '/var/amavis/amavis-mc.pid';
+$pid_file = '/var/run/amavis/amavis-mc.pid';
$log_level = 0;
$syslog_ident = 'amavis-mc';

View file

@ -0,0 +1,11 @@
--- amavis-services.orig 2014-11-08 20:45:03.199992749 -0600
+++ amavis-services 2014-11-08 20:45:51.805711423 -0600
@@ -71,7 +71,7 @@
$syslog_facility = LOG_MAIL;
$syslog_ident = $myproduct_name;
-$MYHOME = '/var/amavis';
+$MYHOME = '/var/lib/amavis';
# A socket to which amavisd child processes report their data.
# should match one of the sockets in @zmq_sockets in amavisd.conf

View file

@ -0,0 +1,11 @@
--- amavisd-agent.orig 2014-11-08 20:48:15.953806621 -0600
+++ amavisd-agent 2014-11-08 20:48:21.655008087 -0600
@@ -53,7 +53,7 @@
my($dbfile) = 'snmp.db';
my($db_home) = # DB databases directory
- defined $ENV{'AMAVISD_DB_HOME'} ? $ENV{'AMAVISD_DB_HOME'} : '/var/amavis/db';
+ defined $ENV{'AMAVISD_DB_HOME'} ? $ENV{'AMAVISD_DB_HOME'} : '/var/lib/amavis/db';
my($wakeuptime) = 10; # -w, sleep time in seconds, may be fractional
my($repeatcount); # -c, repeat count (when defined)

View file

@ -0,0 +1,11 @@
--- amavisd-nanny.orig 2014-11-08 20:50:59.129571221 -0600
+++ amavisd-nanny 2014-11-08 20:51:20.573328532 -0600
@@ -61,7 +61,7 @@
my($dbfile) = 'nanny.db';
my($db_home) = # DB databases directory
- defined $ENV{'AMAVISD_DB_HOME'} ? $ENV{'AMAVISD_DB_HOME'} : '/var/amavis/db';
+ defined $ENV{'AMAVISD_DB_HOME'} ? $ENV{'AMAVISD_DB_HOME'} : '/var/lib/amavis/db';
my($wakeuptime) = 2; # -w, sleep time in seconds, may be fractional
my($repeatcount); # -c, repeat count (when defined)

View file

@ -0,0 +1,11 @@
--- amavisd-release.orig 2014-11-08 20:52:13.295190231 -0600
+++ amavisd-release 2014-11-08 20:52:29.313755808 -0600
@@ -86,7 +86,7 @@
$log_level = 1;
# $socketname = '127.0.0.1:9998';
- $socketname = '/var/amavis/amavisd.sock';
+ $socketname = '/var/run/amavis/amavisd.sock';
### END OF USER CONFIGURABLE
}

View file

@ -0,0 +1,17 @@
--- amavisd-signer.orig 2014-11-08 21:02:36.183683393 -0600
+++ amavisd-signer 2014-11-08 21:04:50.079221328 -0600
@@ -86,11 +86,11 @@
# Please adjust the following settings as necessary:
#
-$daemon_user = 'vscan';
-$daemon_group = 'vscan';
+$daemon_user = 'amavis';
+$daemon_group = 'amavis';
# $daemon_chroot_dir = '/var/amavis'; # chroot directory or undef
-# $daemonize = 1;
+$daemonize = 1;
$log_level = 2; # 0..5
$syslog_facility = 'mail';

View file

@ -0,0 +1,11 @@
--- amavisd-snmp-subagent.orig 2014-11-08 20:58:13.439786270 -0600
+++ amavisd-snmp-subagent 2014-11-08 21:01:24.141242836 -0600
@@ -69,7 +69,7 @@
$syslog_facility = LOG_MAIL;
my($db_home) = # DB databases directory
- defined $ENV{'AMAVISD_DB_HOME'} ? $ENV{'AMAVISD_DB_HOME'} : '/var/amavis/db';
+ defined $ENV{'AMAVISD_DB_HOME'} ? $ENV{'AMAVISD_DB_HOME'} : '/var/lib/amavis/db';
my($mta_queue_dir);

View file

@ -0,0 +1,14 @@
--- amavisd-submit.orig 2014-11-08 20:54:37.766290064 -0600
+++ amavisd-submit 2014-11-08 20:55:19.205752430 -0600
@@ -72,9 +72,9 @@
### USER CONFIGURABLE:
$log_level = 0;
- $tempbase = '/var/amavis/tmp'; # where to create a temp directory with a msg
+ $tempbase = '/var/lib/amavis/tmp'; # where to create a temp directory with a msg
- $socketname = '/var/amavis/amavisd.sock';
+ $socketname = '/var/run/amavis/amavisd.sock';
# $socketname = '127.0.0.1:9998';
# $socketname = '[::1]:9998';

View file

@ -2,76 +2,150 @@
# Startup script for amavisd-new daemon for use on Slackware Linux x86|x86_64
# Copyright (c) 2008-2012, Nishant Limbachia, Hoffman Estates, IL, USA
# [nishant _AT_ mnspace _DOT_ net]
# Copyright (c) 2008-2014, Nishant Limbachia, Hoffman Estates, IL, USA
# (nishant _AT_ mnspace _DOT_ net)
# Usage: /etc/rc.d/rc.amavisd-new start|stop|restart|reload|status
# For automatic startup at boot, call this script from rc.local
PIDFILE=/var/run/amavis/amavisd.pid
# Notes - 03/25/2013 #
# With v2.8.0, amavis-mc daemon was added to the mix and so this rc script
# has been overhauled from the previous version. If you have suggestions to
# improve, please feel free to share.
# Script starts three different daemons: amavis-mc, amavisd-signer & amavisd
# All the daemons have their own start and stop functions, however, amavisd
# also has restart and reload which are supported by the program.
# Assuming you want all 3 daemons, you can start all at once like this:
# /etc/rc.d/rc.amavisd-new start
MC_PID=/var/run/amavis/amavis-mc.pid
PID=/var/run/amavis/amavisd.pid
amavisd_signer_start() {
# start amavisd-signer
printf "Starting amavisd-signer daemon\n"
/usr/sbin/amavisd-signer
}
amavisd_signer_stop() {
# stop amavisd-signer first
printf "Stopping amavisd-signer daemon\n"
pkill amavisd-signer
}
amavis_mc_start() {
# start amavis-mc process
if [ -f $MC_PID ]; then
printf "amavis-mc daemon running with PID: $(cat $MC_PID)\n"
printf "Terminating previous amavis-mc process\n"
kill $(cat $MC_PID)
rm -f $MC_PID
printf "Starting amavis-mc daemon\n"
/usr/sbin/amavis-mc -P $MC_PID
else
printf "Starting amavis-mc daemon\n"
/usr/sbin/amavis-mc -P $MC_PID
fi
}
amavis_mc_stop() {
if [ -f $MC_PID ]; then
printf "Stopping amavis-mc daemon\n"
kill $(cat $MC_PID)
rm -f $MC_PID
else
printf "amavis-mc daemon is not running\n"
fi
}
amavisd_start() {
if [ -x /etc/rc.d/rc.amavisd-new ]; then
# start amavisd-signer first
echo "Starting amavisd-signer daemon"
/usr/sbin/amavisd-signer
if [ -f $PIDFILE ]; then
echo "amavisd-new daemon running with PID: $(cat $PIDFILE)"
echo "Or we may have a stale pid file from previous run"
echo "try /etc/rc.d/rc.amavisd-new stop|restart Or"
echo "remove the stale pid file and try starting again"
echo ""
exit 1
if [ -f $PID ]; then
printf "amavisd-new daemon running with PID: $(cat $PID)\n"
printf "Terminating previous amavisd-new process\n"
kill $(cat $PID)
rm -f $PID
printf "Starting amavisd-new daemon\n"
/usr/sbin/amavisd start
else
echo "Starting amavisd-new daemon"
/usr/sbin/amavisd-new start
printf "Starting amavisd-new daemon\n"
/usr/sbin/amavisd start
fi
fi
}
amavisd_stop() {
# stop amavisd-signer first
echo "Stopping amavisd-signer daemon"
pkill amavisd-signer
if [ -f $PIDFILE ]; then
echo "Stopping amavisd-new daemon"
/usr/sbin/amavisd-new stop
if [ -f $PID ]; then
printf "Stopping amavisd-new daemon\n"
/usr/sbin/amavisd stop
rm -f $PID
else
echo "amavisd-new daemon is not running"
fi
}
amavisd_restart() {
echo "Restarting amavisd-new daemon"
/usr/sbin/amavisd-new restart
printf "amavisd-new daemon is not running\n"
fi
}
amavisd_reload() {
echo "Reloading amavisd-new daemon"
/usr/sbin/amavisd-new reload
/usr/sbin/amavisd reload
}
amavisd_status() {
echo "amavisd-new daemon running with PID: $(cat $PIDFILE)"
echo "amavisd-signer daemon running with PID: $(pgrep amavisd-signer)"
amavisd_restart() {
printf "Restarting amavisd-new daemon\n"
/usr/sbin/amavisd restart
}
### This is where all the combined processes start
daemons_start() {
amavis_mc_start
sleep 2
amavisd_signer_start
sleep 2
amavisd_start
}
daemons_stop() {
amavisd_stop
amavisd_signer_stop
amavis_mc_stop
}
daemons_restart() {
amavis_mc_stop
sleep 2
amavis_mc_start
amavisd_signer_stop
sleep 2
amavisd_signer_start
sleep 2
amavisd_restart
}
daemons_status() {
printf "amavis-mc daemon running with PID: $(cat $MC_PID)\n"
printf "amavisd-new daemon running with PID: $(cat $PID)\n"
printf "amavisd-signer daemon running with PID: $(pgrep amavisd-signer)\n"
}
###
case "$1" in
'start')
amavisd_start
daemons_start
;;
'stop')
amavisd_stop
daemons_stop
;;
'restart')
amavisd_restart
daemons_restart
;;
'reload')
amavisd_reload
;;
'status')
amavisd_status
daemons_status
;;
*)
echo "USAGE: $0 start|stop|restart|reload|status"