diff options
author | Jesse Luehrs <doy@tozt.net> | 2018-10-24 01:45:19 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2018-10-24 01:45:19 -0400 |
commit | a1b890f74d7c889a1e26fbfe7f30c61a83445f90 (patch) | |
tree | 13b96c353ea63d3e5f8bd60fec86b8bed41c168b /bin/helpers | |
parent | 4d4e43bb3f198936890268dbac491783c618335c (diff) | |
download | puppet-tozt-a1b890f74d7c889a1e26fbfe7f30c61a83445f90.tar.gz puppet-tozt-a1b890f74d7c889a1e26fbfe7f30c61a83445f90.zip |
automatically update dkim entry when launching mail
Diffstat (limited to 'bin/helpers')
-rwxr-xr-x | bin/helpers/launch-mail | 24 |
1 files changed, 24 insertions, 0 deletions
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" |