add vmail-dkim-get.sh
This commit is contained in:
parent
3ac3ee2b75
commit
cde8de9972
63
bin/vmail-dkim-get.sh
Executable file
63
bin/vmail-dkim-get.sh
Executable file
|
@ -0,0 +1,63 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# vmail-stack
|
||||
# https://git.stack-source.com/msb/vmail-stack
|
||||
# Copyright (c) 2022 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>
|
||||
# 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 <domain>] [-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
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user