From a1b890f74d7c889a1e26fbfe7f30c61a83445f90 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 24 Oct 2018 01:45:19 -0400 Subject: automatically update dkim entry when launching mail --- bin/helpers/launch-mail | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'bin/helpers') diff --git a/bin/helpers/launch-mail b/bin/helpers/launch-mail index d7c6134..922656a 100755 --- a/bin/helpers/launch-mail +++ b/bin/helpers/launch-mail @@ -75,4 +75,28 @@ apt install git puppet ensure_conf_exists remote "cd '$conf_location' && puppet apply --modulepath=./mail -e 'include mail'" +echo "Done provisioning" + +echo "Creating DKIM entry" +dkim=$(remote "perl -pe'chomp; s/.*\"(.*)\".*/\$1/' /mailu/dkim/tozt.net.dkim.pub") +dkim_record_id=$(doctl \ + -t "$(cat /mnt/digitalocean)" \ + compute domain records list \ + tozt.net \ + --format Name,Type,ID \ + --no-header \ + | grep '^dkim._domainkey \+TXT ' \ + | awk '{print $3}' +) +doctl \ + -t "$(cat /mnt/digitalocean)" \ + compute domain records update \ + tozt.net \ + --record-id "$dkim_record_id" \ + --record-type TXT \ + --record-name dkim._domainkey \ + --record-data "$dkim" \ + --record-ttl 60 +echo "Done creating DKIM entry" + echo "Done" -- cgit v1.2.3-54-g00ecf