From 23b2087d074970d911459ef627d85ed7d25e4921 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Tue, 10 Oct 2023 13:16:57 -0700 Subject: [PATCH] enable verbose mode --- bin/vmail-dkim-del.sh | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/bin/vmail-dkim-del.sh b/bin/vmail-dkim-del.sh index 9bae134..e06f30a 100755 --- a/bin/vmail-dkim-del.sh +++ b/bin/vmail-dkim-del.sh @@ -15,10 +15,11 @@ help() echo "$thisfilename" echo "Remove DKIM key(s) from server for specified domain." echo "" - echo "usage: $thisfilename -d [-h]" + echo "usage: $thisfilename -d [-v] [-h]" echo "" echo " -h Print this help." echo " -d Domain name to remove DKIM keys for." + echo " -v Verbose - output instructions regarding DNS." 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" @@ -41,20 +42,22 @@ if [ ! -f /etc/ssl/dkim/$domain.dkim ]; then exit 1 else if [[ -f /etc/ssl/dkim/$domain.selector ]]; then - echo Deleting the `cat /etc/ssl/dkim/$domain.selector`._domainkey.$domain DKIM key. - if [[ -f /usr/local/etc/pdns.conf ]]; then - 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 + if [[ -n $verbose ]]; then + if [[ -f /usr/local/etc/pdns.conf ]]; then + 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 fi - else - echo You can now delete the associated DNS TXT record. + rm /etc/ssl/dkim/$domain.selector fi - rm /etc/ssl/dkim/$domain.dkim fi +if [ -f /etc/ssl/dkim/$domain.dkim ]; then + rm /etc/ssl/dkim/$domain.dkim +fi if [ -f /etc/ssl/dkim/$domain.dns ]; then rm /etc/ssl/dkim/$domain.dns fi @@ -64,6 +67,4 @@ 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 +