correct help, add info on deleting DNS entry

This commit is contained in:
Matthew Saunders Brown 2022-07-22 12:47:49 -07:00
parent 007fb08f40
commit 2264ba59a0

View File

@ -12,12 +12,12 @@ help()
{ {
thisfilename=$(basename -- "$0") thisfilename=$(basename -- "$0")
echo "$thisfilename" echo "$thisfilename"
echo "Get email alias data from vmail database." echo "Remove DKIM key(s) from server for specified domain."
echo "" echo ""
echo "usage: $thisfilename -d <domain> [-h]" echo "usage: $thisfilename -d <domain> [-h]"
echo "" echo ""
echo " -h Print this help." echo " -h Print this help."
echo " -d Domain name to remove DKIM key from." echo " -d Domain name to remove DKIM keys for."
echo "" echo ""
echo " DKIM key for the specified domain is removed from the server and" 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 " outgoing emails will no longer be signed with DKIM. You should also"
@ -30,19 +30,39 @@ vmail:getoptions "$@"
# check for domain # check for domain
if [[ -z $domain ]]; then if [[ -z $domain ]]; then
echo "domain name is required" echo "Domain name is required."
exit exit 1
fi fi
# check for existing dkim # check for existing dkim
if [ ! -f /etc/ssl/dkim/$domain.dkim ]; then if [ ! -f /etc/ssl/dkim/$domain.dkim ]; then
echo "dkim for $domain does not exist" echo "DKIM for $domain does not exist."
exit 1 exit 1
fi fi
echo delete this dkim dns record if [[ -f /etc/ssl/dkim/$domain.selector ]]; then
echo echo Deleting the `cat /etc/ssl/dkim/$domain.selector`._domainkey.$domain DKIM key.
cat /etc/ssl/dkim/$domain.dns if [[ -f /usr/local/etc/pdns.conf ]] &&
echo echo To remove the associated DNS record run this command:
echo
echo pdns-rr-del.sh -z $domain -n `cat /etc/ssl/dkim/$domain.selector`._domainkey.$domain -t TXT
else
echo You can now delete the DNS TXT record for `cat /etc/ssl/dkim/$domain.selector`._domainkey.$domain
fi
else
echo You can now delete the associated DNS TXT record.
fi
rm /etc/ssl/dkim/$domain.* rm /etc/ssl/dkim/$domain.dkim
if [ ! -f /etc/ssl/dkim/$domain.dns ]; then
rm /etc/ssl/dkim/$domain.dns
fi
if [ ! -f /etc/ssl/dkim/$domain.pem ]; then
rm /etc/ssl/dkim/$domain.pem
fi
if [ ! -f /etc/ssl/dkim/$domain.pub ]; then
rm /etc/ssl/dkim/$domain.pub
fi
if [ ! -f /etc/ssl/dkim/$domain.selector ]; then
rm /etc/ssl/dkim/$domain.selector
fi