network/dkimproxy: Added (SMTP-proxy).

Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
This commit is contained in:
Steven King 2013-12-02 10:55:47 +01:00 committed by Robby Workman
parent 98ae15ded4
commit 38db967d63
6 changed files with 355 additions and 0 deletions

7
network/dkimproxy/README Normal file
View File

@ -0,0 +1,7 @@
DKIMproxy is an SMTP-proxy that signs and/or verifies emails, using
the Mail::DKIM module. It is designed for Postfix, but should work
with any mail server. It comprises two separate proxies, an
"outbound" proxy for signing outgoing email, and an "inbound" proxy
for verifying signatures of incoming email. With Postfix, the proxies
can operate as either Before-Queue or After-Queue content filters.
DKIMproxy is written in Perl.

View File

@ -0,0 +1,138 @@
#!/bin/sh
# Slackware build script for DKIMproxy
# Copyright 2010, Steven King <kingrst@gmail.com>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''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 THE 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.
PRGNAM=dkimproxy
VERSION=${VERSION:-1.4.1}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
# Bail if the user or group dkim is not on the system
if [ ! `/usr/bin/getent passwd dkim` ]; then
cat << EOF
You must have the dkim user to run this script
# groupadd -g 239 dkim
# useradd -u 239 -d /dev/null -s /bin/false -g dkim dkim
EOF
exit
elif [ ! `/usr/bin/getent group dkim` ]; then
cat << EOF
You must have the dkim group to run this script
# groupadd -g 239 dkim
EOF
exit
fi
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar vxzf $CWD/$PRGNAM-$VERSION.tar.gz
cd $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 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
perllibdir=/usr/share/perl5/vendor_perl/$PRGNAM \
CFLAGS="$SLKCFLAGS" \
CXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib$LIBDIRSUFFIX \
--sysconfdir=/etc/$PRGNAM \
--mandir=/usr/man \
--build=$ARCH-slackware-linux
make
make install DESTDIR=$PKG
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
AUTHORS COPYING INSTALL NEWS README TODO ChangeLog smtpprox.ChangeLog \
smtpprox.README smtpprox.TODO \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
install -m 0755 -D $CWD/rc.dkimproxy $PKG/etc/rc.d/rc.dkimproxy.new
install -m 0644 -D $TMP/$PRGNAM-$VERSION/scripts/dkimproxy_in.conf.example \
$PKG/etc/dkimproxy/dkimproxy_in.conf.example
install -m 0644 -D $TMP/$PRGNAM-$VERSION/scripts/dkimproxy_out.conf.example \
$PKG/etc/dkimproxy/dkimproxy_out.conf.example
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View File

@ -0,0 +1,10 @@
PRGNAM="dkimproxy"
VERSION="1.4.1"
HOMEPAGE="http://dkimproxy.sourceforge.net/"
DOWNLOAD="http://downloads.sourceforge.net/dkimproxy/dkimproxy-1.4.1.tar.gz"
MD5SUM="3ecaa38a8c865a5b7682f7f261354218"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="perl-Crypt-OpenSSL-RSA perl-digest-sha1 perl-MailTools perl-net-dns perl-Net-Server perl-Mail-DKIM"
MAINTAINER="Steven King"
EMAIL="kingrst@gmail.com"

View File

@ -0,0 +1,25 @@
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# 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
}
preserve_perms etc/rc.d/rc.dkimproxy.new

View File

@ -0,0 +1,156 @@
#!/bin/sh
#
# Copyright (c) 2005-2007 Messiah College.
#
### BEGIN INIT INFO
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Description: Runs dkimproxy
### END INIT INFO
### BEGIN CONFIGURABLE BITS
DKIMPROXYDIR=/usr
DKIMPROXYUSER=dkim
DKIMPROXYGROUP=dkim
### END CONFIGURABLE BITS
### IF YOU MOVE THE CONFIG FILES, CHANGE THIS:
DKIMPROXY_IN_CFG="/etc/dkimproxy/dkimproxy_in.conf"
DKIMPROXY_OUT_CFG="/etc/dkimproxy/dkimproxy_out.conf"
if [ ! '(' -f "$DKIMPROXY_IN_CFG" -o -f "$DKIMPROXY_OUT_CFG" ')' ]; then
echo "Error: one or both of the following files must be created:" >&2
echo "$DKIMPROXY_IN_CFG" >&2
echo "$DKIMPROXY_OUT_CFG" >&2
exit 1
fi
HOSTNAME=`hostname -f`
DKIMPROXY_IN_ARGS="
--hostname=$HOSTNAME
--conf_file=$DKIMPROXY_IN_CFG"
DKIMPROXY_OUT_ARGS="
--conf_file=$DKIMPROXY_OUT_CFG"
DKIMPROXY_COMMON_ARGS="
--user=$DKIMPROXYUSER
--group=$DKIMPROXYGROUP
--daemonize"
DKIMPROXY_IN_BIN="$DKIMPROXYDIR/bin/dkimproxy.in"
DKIMPROXY_OUT_BIN="$DKIMPROXYDIR/bin/dkimproxy.out"
PIDDIR=/var/run/dkimproxy
DKIMPROXY_IN_PID=$PIDDIR/dkimproxy_in.pid
DKIMPROXY_OUT_PID=$PIDDIR/dkimproxy_out.pid
case "$1" in
start-in)
echo -n "Starting inbound DKIM-proxy (dkimproxy.in)..."
# create directory for pid files if necessary
test -d $PIDDIR || mkdir -p $PIDDIR || exit 1
# start the daemon
$DKIMPROXY_IN_BIN $DKIMPROXY_COMMON_ARGS --pidfile=$DKIMPROXY_IN_PID $DKIMPROXY_IN_ARGS
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo done.
else
echo failed.
exit $RETVAL
fi
;;
start-out)
echo -n "Starting outbound DKIM-proxy (dkimproxy.out)..."
# create directory for pid files if necessary
test -d $PIDDIR || mkdir -p $PIDDIR || exit 1
# start the daemon
$DKIMPROXY_OUT_BIN $DKIMPROXY_COMMON_ARGS --pidfile=$DKIMPROXY_OUT_PID $DKIMPROXY_OUT_ARGS
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo done.
else
echo failed.
exit $RETVAL
fi
;;
start)
test -f $DKIMPROXY_IN_CFG && $0 start-in || exit $?
test -f $DKIMPROXY_OUT_CFG && $0 start-out || exit $?
;;
stop-in)
echo -n "Shutting down inbound DKIM-proxy (dkimproxy.in)..."
if [ -f $DKIMPROXY_IN_PID ]; then
kill `cat $DKIMPROXY_IN_PID` && rm -f $DKIMPROXY_IN_PID
RETVAL=$?
[ $RETVAL -eq 0 ] && echo done. || echo failed.
exit $RETVAL
else
echo not running.
fi
;;
stop-out)
echo -n "Shutting down outbound DKIM-proxy (dkimproxy.out)..."
if [ -f $DKIMPROXY_OUT_PID ]; then
kill `cat $DKIMPROXY_OUT_PID` && rm -f $DKIMPROXY_OUT_PID
RETVAL=$?
[ $RETVAL -eq 0 ] && echo done. || echo failed.
exit $RETVAL
else
echo not running.
fi
;;
stop)
test -f $DKIMPROXY_IN_CFG && $0 stop-in || exit $?
test -f $DKIMPROXY_OUT_CFG && $0 stop-out || exit $?
;;
restart)
$0 stop && $0 start || exit $?
;;
status-in)
echo -n "dkimproxy.in..."
if [ -f $DKIMPROXY_IN_PID ]; then
pid=`cat $DKIMPROXY_IN_PID`
if ps -ef |grep -v grep |grep -q "$pid"; then
echo " running (pid=$pid)"
else
echo " stopped (pid=$pid not found)"
fi
else
echo " stopped"
fi
;;
status-out)
echo -n "dkimproxy.out..."
if [ -f $DKIMPROXY_OUT_PID ]; then
pid=`cat $DKIMPROXY_OUT_PID`
if ps -ef |grep -v grep |grep -q "$pid"; then
echo " running (pid=$pid)"
else
echo " stopped (pid=$pid not found)"
fi
else
echo " stopped"
fi
;;
status)
test -f $DKIMPROXY_IN_CFG && $0 status-in || exit $?
test -f $DKIMPROXY_OUT_CFG && $0 status-out || exit $?
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac

View File

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
dkimproxy: DKIMproxy (SMTP-proxy)
dkimproxy:
dkimproxy: DKIMproxy uses the Mail::DKIM module. It is designed for Postfix,
dkimproxy: but should work with any mail server. It comprises two separate
dkimproxy: proxies, an "outbound" proxy for signing outgoing email, and
dkimproxy: an "inbound" proxy for verifying signatures of incoming email.
dkimproxy: With Postfix, the proxies can operate as either Before-Queue
dkimproxy: or After-Queue content filters.
dkimproxy:
dkimproxy: homepage: http://dkimproxy.sourceforge.net/
dkimproxy: