diff --git a/bin/vmail-dkim-get.sh b/bin/vmail-dkim-get.sh new file mode 100755 index 0000000..ddf3030 --- /dev/null +++ b/bin/vmail-dkim-get.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# +# vmail-stack +# https://git.stack-source.com/msb/vmail-stack +# Copyright (c) 2022 Matthew Saunders Brown +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +# load include file +source $(dirname $0)/vmail.sh + +help() +{ + thisfilename=$(basename -- "$0") + echo "$thisfilename" + echo "Get DKIM info." + echo "" + echo "usage: $thisfilename [-d ] [-c] [-h]" + echo "" + echo " -h Print this help." + echo " -d Domain name to get DKIM info for." + echo " -c CVS - Output in cvs format, instead of tabbed table." + echo "" + exit +} + +vmail:getoptions "$@" + +# check for domain +if [[ -n $domain ]]; then + if [ -f /etc/ssl/dkim/$domain.dkim ]; then + domains=($domain) + else + echo "ERROR: DKIM for $domain does not exist." + exit 1 + fi +else + if [[ -d /etc/ssl/dkim/ ]]; then + domains=(`ls -1 /etc/ssl/dkim/*.dkim 2>/dev/null|cut -d / -f 5|sed 's|.dkim$||g'`) + else + echo "ERROR: DKIM directory does not exist" + exit 1 + fi +fi + +if [[ ${#domains[@]} > 0 ]]; then + # create newline var + NL=$'\n' + output="domain selector dkim" + for domain in "${domains[@]}" + do + selector=`cat /etc/ssl/dkim/$domain.selector` + dkim=`cat /etc/ssl/dkim/$domain.dkim` + output="$output${NL}$domain $selector $dkim" + done + if [[ $cvs ]]; then + echo "$output" | tr " " "," + else + echo "$output" | column -t + fi +else + # no dkim keys found + exit 0 +fi diff --git a/systemd/srsd.service b/systemd/srsd.service index 8332b3f..8a66303 100644 --- a/systemd/srsd.service +++ b/systemd/srsd.service @@ -7,7 +7,7 @@ Description=Sender Rewriting Scheme Daemon [Service] -Type=Exec +Type=simple User=Debian-exim Group=Debian-exim ExecStart=/usr/bin/srsd --secretfile /etc/exim4/srsd.secret --hashlength 24