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 +