From f7fab1059464edace429172b849affed6f9baa87 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Thu, 16 Feb 2023 09:27:01 -0800 Subject: [PATCH] clean up output --- bin/vmail-dkim-add.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/bin/vmail-dkim-add.sh b/bin/vmail-dkim-add.sh index 11946f8..4f35eaa 100755 --- a/bin/vmail-dkim-add.sh +++ b/bin/vmail-dkim-add.sh @@ -43,20 +43,21 @@ fi cd /etc/ssl/dkim date +%Y%m%d > $domain.selector -openssl genrsa -out $domain.pem 2048 -openssl rsa -in $domain.pem -out $domain.pub -pubout +openssl genrsa -out $domain.pem 2048 2> /dev/null +openssl rsa -in $domain.pem -out $domain.pub -pubout 2> /dev/null tail -n +2 $domain.pub |head -n -1|tr -d '\n' > $domain.dkim echo `cat $domain.selector`._domainkey.$domain 3600 IN TXT \""k=rsa; p=`cat $domain.dkim`"\" > $domain.dns chown Debian-exim:ssl-cert $domain.* -echo -echo Create this dns record: -echo -cat $domain.dns if [[ -f /usr/local/etc/pdns.conf ]]; then + dnsname=`cat /etc/ssl/dkim/$domain.selector` + dnsname="$dnsname._domainkey.$domain" + dnsrecord=`cat /etc/ssl/dkim/$domain.dkim` + dnsrecord="k=rsa; p=$dnsrecord" + echo pdns-rr-rep.sh -z $domain -n $dnsname -t TXT -r \'$dnsrecord\' + exit +else + echo Create this dns record: echo - echo Looks like you have powerdns-tools enabled, you can simply run this: - echo - echo pdns-rr-rep.sh -z $domain -n `cat $domain.selector`._domainkey.$domain -t TXT -r \'k=rsa\; p=`cat $domain.dkim`\' - echo + cat $domain.dns fi