Skip to content

Commit

Permalink
Replacement patch from Steve
Browse files Browse the repository at this point in the history
  • Loading branch information
Murray S. Kucherawy committed Dec 10, 2014
1 parent 4c22d8c commit 0536e4c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions contrib/init/redhat/opendkim-default-keygen.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,31 @@ KEYGEN=@sbindir@/$prog-genkey
DKIM_SELECTOR=default
DKIM_KEYDIR=@sysconfdir@/$prog/keys

# Make some colors
red='\033[1;31m'
green='\033[1;32m'
NC='\033[0m' # No Color

# Pull in sysconfig settings (will override previously set functions)
[ -f @sysconfdir@/sysconfig/$prog ] && . @sysconfdir@/sysconfig/$prog

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."
echo -e "${red}Cannot determine host's domain name, so skipping default key generation.${NC}"
else
mkdir -p $DKIM_KEYDIR
$KEYGEN -D $DKIM_KEYDIR -s $DKIM_SELECTOR -d `hostname --domain`
chown -R root:$prog $DKIM_KEYDIR
chmod 640 $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.
echo -e "${green}Default DKIM keys for `hostname --domain` created in $DKIM_KEYDIR.${NC}"
fi
else
echo -e "${red}Default DKIM keys already exist!${NC}"
fi
}

Expand Down

0 comments on commit 0536e4c

Please sign in to comment.