Skip to content

Commit

Permalink
New version from
Browse files Browse the repository at this point in the history
  • Loading branch information
Murray S. Kucherawy committed Mar 29, 2015
1 parent f56dcf9 commit 17c0637
Showing 1 changed file with 5 additions and 33 deletions.
38 changes: 5 additions & 33 deletions contrib/init/redhat/opendkim.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
# that can plug in to any milter-aware MTA.
### END INIT INFO

# OpenDKIM startup script v1.8 for RHEL/CentOS/Fedora
# by Steve Jenkins (SteveJenkins.com) - 10-29-2012
# OpenDKIM startup script v2.0 for RHEL/CentOS/Fedora
# by Steve Jenkins (SteveJenkins.com) - 03-24-2015
# Based on a script by Andrew Colin Kissa (TopDog) for dkim-milter - 05-28-2009
# - Additional functionality to prevent multiple instances and a reload
# handler by Chris LaJoie - 01-11-2011
Expand All @@ -30,7 +30,9 @@
# - Changed default stop priority - 09-19-2011
# - Updated success and warning outputs for default key generation - 09-20-2011
# - Changed default key directory ownership and permissions - 09-22-2011
# - Updated opendkim-genkey location to /usr/sbin - 10-29-2012
# - No longer automatically creates default keys on startup (user must now manually
# generate keys as privileged user after install) - 08-04-2014
# - Removed uneeded code from automatic key creation - 12-09-2014

. /etc/rc.d/init.d/functions

Expand All @@ -43,42 +45,12 @@ prog="opendkim"
DAEMON=@sbindir@/$prog
CONF_FILE=@sysconfdir@/$prog.conf
PID_FILE=@localstatedir@/run/$prog/$prog.pid
KEYGEN=@exec_prefix@/sbin/opendkim-genkey
DKIM_KEYDIR=@sysconfdir@/$prog/keys
DKIM_SELECTOR=default
AUTOCREATE_DKIM_KEYS=yes

if [ -f /etc/sysconfig/opendkim ]; then
. /etc/sysconfig/opendkim
fi

do_dkim_keygen() {
if [ ! -s $DKIM_KEYDIR/$DKIM_SELECTOR.private ]; then
echo -n $"Generating default DKIM keys: "
if [ "x`hostname --domain`" = "x" ]; then
echo_warning
echo
echo $"Cannot determine host's domain name, so skipping default key generation."
else
mkdir -p $DKIM_KEYDIR
$KEYGEN -D $DKIM_KEYDIR -s $DKIM_SELECTOR -d `hostname --domain`
chown root:$prog $DKIM_KEYDIR
chown $prog:$prog $DKIM_KEYDIR/$DKIM_SELECTOR.{private,txt}
chmod 600 $DKIM_KEYDIR/$DKIM_SELECTOR.private
chmod 644 $DKIM_KEYDIR/$DKIM_SELECTOR.txt
echo_success
echo
echo Default DKIM keys for `hostname --domain` created in $DKIM_KEYDIR.
fi
fi
}

start() {
# Create keys if necessary
if [ "x${AUTOCREATE_DKIM_KEYS}" != xNO ]; then
do_dkim_keygen
fi

echo -n $"Starting OpenDKIM Milter: "
if [ -f $PID_FILE ]; then
PID=`cat $PID_FILE`
Expand Down

0 comments on commit 17c0637

Please sign in to comment.