2021-02-10 16:16:23 -08:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# vmail-stack
|
|
|
|
# https://git.stack-source.com/msb/vmail-stack
|
|
|
|
# MIT License Copyright (c) 2021 Matthew Saunders Brown
|
|
|
|
|
2021-04-02 12:02:50 -07:00
|
|
|
# load include file
|
|
|
|
source $(dirname $0)/vmail.sh
|
2021-02-10 16:16:23 -08:00
|
|
|
|
2021-10-15 15:17:29 -07:00
|
|
|
|
|
|
|
help()
|
|
|
|
{
|
|
|
|
thisfilename=$(basename -- "$0")
|
|
|
|
echo "$thisfilename"
|
|
|
|
echo "Get email alias data from vmail database."
|
|
|
|
echo ""
|
|
|
|
echo "usage: $thisfilename -d <domain> [-h]"
|
|
|
|
echo ""
|
|
|
|
echo " -h Print this help."
|
|
|
|
echo " -d Domain name to remove DKIM key from."
|
|
|
|
echo ""
|
|
|
|
echo " DKIM key for the specified domain is removed from the server and"
|
|
|
|
echo " outgoing emails will no longer be signed with DKIM. You should also"
|
|
|
|
echo " remove the associated DNS entry, however leaving the DNS entry in"
|
|
|
|
echo " place should not cause any immediate problems."
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
|
|
|
vmail:getoptions "$@"
|
|
|
|
|
|
|
|
# check for domain
|
|
|
|
if [[ -z $domain ]]; then
|
|
|
|
echo "domain name is required"
|
|
|
|
exit
|
2021-02-10 16:16:23 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# check for existing dkim
|
2021-10-15 15:17:29 -07:00
|
|
|
if [ ! -f /etc/ssl/dkim/$domain.dkim ]; then
|
|
|
|
echo "dkim for $domain does not exist"
|
2021-02-10 16:16:23 -08:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo delete this dkim dns record
|
|
|
|
echo
|
2021-10-15 15:17:29 -07:00
|
|
|
cat /etc/ssl/dkim/$domain.dns
|
2021-02-10 16:16:23 -08:00
|
|
|
echo
|
|
|
|
|
2021-10-15 15:17:29 -07:00
|
|
|
rm /etc/ssl/dkim/$domain.*
|