From 8395b8452665940e09465fab17a9c82af69fb8af Mon Sep 17 00:00:00 2001 From: David Spencer Date: Mon, 18 Jan 2016 19:31:37 +0000 Subject: network/opendkim: Renamed from network/OpenDKIM. The source tarball and the built package already use "opendkim". Signed-off-by: David Spencer --- network/opendkim/README | 35 +++++++++ network/opendkim/doinst.sh | 26 ++++++ network/opendkim/opendkim.SlackBuild | 148 +++++++++++++++++++++++++++++++++++ network/opendkim/opendkim.info | 10 +++ network/opendkim/rc.opendkim | 77 ++++++++++++++++++ network/opendkim/slack-desc | 19 +++++ 6 files changed, 315 insertions(+) create mode 100644 network/opendkim/README create mode 100644 network/opendkim/doinst.sh create mode 100644 network/opendkim/opendkim.SlackBuild create mode 100644 network/opendkim/opendkim.info create mode 100644 network/opendkim/rc.opendkim create mode 100644 network/opendkim/slack-desc (limited to 'network/opendkim') diff --git a/network/opendkim/README b/network/opendkim/README new file mode 100644 index 0000000000..3fd62deafd --- /dev/null +++ b/network/opendkim/README @@ -0,0 +1,35 @@ +OpenDKIM is an open source implementation of the DKIM +(Domain Keys Identified Mail) sender authentication system proposed by +the E-mail Signing Technology Group (ESTG), now standardized by the IETF +(RFC6376). It also includes implementations of the RFC5617) Vouch By +Reference (VBR, RFC5518) proposed standard and the experimental +Authorized Third Party Signatures protocol (ATPS, RFC6541). + +The OpenDKIM package consists of a library that implements the DKIM +service and a milter-based filter application that can plug in to any +milter-aware MTA to provide that service to sufficiently recent +sendmail MTAs and other MTAs that support the milter protocol. + +A user and group are needed in order to run opendkim: + +groupadd -g 305 opendkim +useradd -r -u 305 -g opendkim -d /var/run/opendkim/ -s /sbin/nologin \ + -c "OpenDKIM Milter" opendkim + +You may specify alternate values if desired: + +DKUSER=nobody DKGROUP=nobody ./OpenDKIM.SlackBuild + +A sample config file has been placed in /etc/opendkim.conf + +The rc.opendkim script will automatically create keys for your machine's +domain name in /etc/opendkim/keys. Set AUTOCREATE_DKIM_KEYS=no there to +disable this behavior. + +Optional MySQL and Unbound support is provided. Note that MySQL +support requires OpenDBX installed. To enable: + +USE_MYSQL=yes ./OpenDKIM.SlackBuild +USE_UNBOUND=yes ./OpenDKIM.SlackBuild + +Unbound will require the unbound package which is available in SlackBuilds. diff --git a/network/opendkim/doinst.sh b/network/opendkim/doinst.sh new file mode 100644 index 0000000000..cb643e67ad --- /dev/null +++ b/network/opendkim/doinst.sh @@ -0,0 +1,26 @@ +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.opendkim.new +config etc/opendkim.conf.new diff --git a/network/opendkim/opendkim.SlackBuild b/network/opendkim/opendkim.SlackBuild new file mode 100644 index 0000000000..8923c5528a --- /dev/null +++ b/network/opendkim/opendkim.SlackBuild @@ -0,0 +1,148 @@ +#!/bin/sh + +# Slackware build script for OpenDKIM + +# Copyright 2015 Gerardo Zamudio Mexico City, Mexico +# 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=opendkim +VERSION=${VERSION:-2.10.3} +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" = "i386" ]; then + SLKCFLAGS="-O2 -march=i386 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -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 + +DKUSER=${DKUSER:-opendkim} +DKGROUP=${DKGROUP:-opendkim} + +# Check the system user and group for opendkim: +if ! grep -q ^"$DKGROUP": /etc/group ; then + echo " You will need a dedicated group to run opendkim" + echo " # groupadd -g 305 $DKGROUP" + echo " should do the job." + exit 1 +fi + +if ! grep -q ^"$DKUSER": /etc/passwd ; then + echo " You will need a dedicated user to run opendkim, something like" + echo " # useradd -r -u 305 -g $DKGROUP -d /var/run/opendkim/ -s /sbin/nologin -c 'OpenDKIM Milter' $DKUSER" + exit 1 +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $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 {} \; + +if [ "${USE_MYSQL:-no}" == "yes" ]; then + MYSQL="--with-sql-backend --with-odbx" +else + MYSQL="" +fi + +if [ "${USE_UNBOUND:-no}" == "yes" ]; then + UNBOUND="--with-libevent --with-ldns --with-unbound" +else + UNBOUND="" +fi + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --docdir=/usr/doc/$PRGNAM-$VERSION \ + --enable-static=no \ + --with-openssl \ + --with-libcurl \ + --build=$ARCH-slackware-linux \ + $MYSQL \ + $UNBOUND + +make +make install-strip DESTDIR=$PKG + +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 FEATURES INSTALL KNOWNBUGS LICENSE* README* RELEASE_NOTES* $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/OpenDKIM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/OpenDKIM.SlackBuild + +mkdir -p $PKG/var/run/opendkim +chown $USER:$GROUP $PKG/var/run/opendkim/ +install -m 0640 -D $PRGNAM/opendkim.conf.simple $PKG/etc/opendkim.conf.new +install -m 0755 -D $CWD/rc.opendkim $PKG/etc/rc.d/rc.opendkim.new + +# Change KeyFile to match rc.opendkim +sed -i 's|^KeyFile.*|KeyFile /etc/opendkim/keys/default.private|' $PKG/etc/opendkim.conf.new + +echo "UserID $DKUSER:$DKGROUP" >> $PKG/etc/opendkim.conf.new + +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} diff --git a/network/opendkim/opendkim.info b/network/opendkim/opendkim.info new file mode 100644 index 0000000000..f261753267 --- /dev/null +++ b/network/opendkim/opendkim.info @@ -0,0 +1,10 @@ +PRGNAM="opendkim" +VERSION="2.10.3" +HOMEPAGE="http://opendkim.org/" +DOWNLOAD="http://downloads.sourceforge.net/opendkim/opendkim-2.10.3.tar.gz" +MD5SUM="916e691cdd16cfabd1cd6efe745323f9" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="libbsd" +MAINTAINER="Gerardo Zamudio" +EMAIL="gerardo.zamudio@linux.com" diff --git a/network/opendkim/rc.opendkim b/network/opendkim/rc.opendkim new file mode 100644 index 0000000000..ae30ca7dea --- /dev/null +++ b/network/opendkim/rc.opendkim @@ -0,0 +1,77 @@ +#!/bin/bash +# +# opendkim Start and stop OpenDKIM. + +# OpenDKIM startup script for Slackware 14.1 by Gerardo Zamudio +# Modified from the script by Steve Jenkins (SteveJenkins.com) - 10-29-2012 +# Based on a script by Andrew Colin Kissa (TopDog) for dkim-milter - 05-28-2009 + +USER="opendkim" +PROGRAM=/usr/sbin/opendkim +CONF_FILE=/etc/opendkim.conf +PID_FILE=/var/run/opendkim/opendkim.pid +KEYGEN=/usr/sbin/opendkim-genkey +DKIM_KEYDIR=/etc/opendkim/keys +DKIM_SELECTOR=default +AUTOCREATE_DKIM_KEYS=yes + +do_dkim_keygen() { + if [ ! -s $DKIM_KEYDIR/$DKIM_SELECTOR.private ]; then + echo -n $"Generating default DKIM keys: " + if [ "x$(hostname -d)" = "x" ]; then + echo $"Cannot determine host's domain name, so skipping default key generation." + else + mkdir -p $DKIM_KEYDIR + $KEYGEN -b 2048 -D $DKIM_KEYDIR -s $DKIM_SELECTOR -d "$(hostname -d)" + chown root:$USER $DKIM_KEYDIR + chown $USER:$USER $DKIM_KEYDIR/$DKIM_SELECTOR.{private,txt} + chmod 600 $DKIM_KEYDIR/$DKIM_SELECTOR.private + chmod 644 $DKIM_KEYDIR/$DKIM_SELECTOR.txt + echo + echo Default DKIM keys for "$(hostname -d)" created in $DKIM_KEYDIR. + fi + fi +} + +case "$1" in + start) + # Create keys if necessary + if [ "x${AUTOCREATE_DKIM_KEYS}" != xNO ]; then + do_dkim_keygen + fi + + echo -n $"Starting OpenDKIM Milter... " + echo + if [ -f $PID_FILE ]; then + PID=$(cat $PID_FILE) + echo OpenDKIM already running as pid "$PID" + exit 2; + else + $PROGRAM -l -x $CONF_FILE -P $PID_FILE + fi + ;; + stop) + echo -n $"Stopping OpenDKIM Milter... " + echo + if [ ! -f $PID_FILE ]; then + echo OpenDKIM is not running! + exit 2; + else + kill -TERM "$(cat $PID_FILE)" && rm -rf /var/run/opendkim.pid + fi + ;; + status) + if [ -f $PID_FILE ]; then + PID=$(cat $PID_FILE) + echo OpenDKIM already running as pid "$PID" + exit 2; + else + echo OpenDKIM is not running! + fi + ;; + *) + echo $"Usage: $0 {start|stop|status|}" + exit 1 +esac + +exit $? diff --git a/network/opendkim/slack-desc b/network/opendkim/slack-desc new file mode 100644 index 0000000000..d75975a9bd --- /dev/null +++ b/network/opendkim/slack-desc @@ -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------------------------------------------------------| +opendkim: OpenDKIM (A DKIM milter to sign and/or verify mail) +opendkim: +opendkim: OpenDKIM is a community effort to develop and maintain a C library +opendkim: for producing DKIM-aware applications and an open source milter for +opendkim: providing DKIM service. +opendkim: +opendkim: The project started from a code fork of version 2.8.3 of the open +opendkim: source dkim-milter package developed and maintained by Sendmail, Inc. +opendkim: +opendkim: Homepage: http://opendkim.org/ +opendkim: -- cgit v1.2.3