Make the Let's Encrypt backup an email attachment.
authorMatt Birkholz <matt@birchwood-abbey.net>
Sat, 15 Mar 2025 21:14:08 +0000 (16:14 -0500)
committerMatt Birkholz <matt@birchwood-abbey.net>
Sat, 15 Mar 2025 21:14:08 +0000 (16:14 -0500)
README.org
roles_t/abbey-front/files/cron.daily_letsencrypt

index 7415d1a06877883afa29e603a768365b714d7855..fdb1dc463376f69e15a68c6fa1586f08f3f98fc4 100644 (file)
@@ -756,9 +756,20 @@ cd /etc/
 && diff -rq letsencrypt/ letsencrypt~/ \
 && exit 0
 
+F=`date "+%Y%m%d"`.tar.gz
 ( echo "Subject: New /etc/letsencrypt/ on Droplet."
   echo ""
-  tar czf - letsencrypt/ \
+  ( echo "Content-Type: multipart/mixed; boundary=\"boundary\""
+    echo "MIME-Version: 1.0"
+    echo ""
+    echo "--boundary"
+    echo "Content-Type: application/gzip; name=\"$F\""
+    echo "Content-Disposition: attachment; filename=\"$F\""
+    echo "Content-Transfer-Encoding: base64"
+    echo ""
+    tar czf - letsencrypt/ | base64
+    echo ""
+    echo "--boundary--" ) \
   | gpg --encrypt --armor \
        --trust-model always --recipient root@core ) \
 | sendmail root \
index 24c4eef4d93b6a15d0f61c262cbc37c51bac46f4..2dca228b7050e9052beff0a60def31dfbccfe75a 100644 (file)
@@ -6,9 +6,20 @@ cd /etc/
 && diff -rq letsencrypt/ letsencrypt~/ \
 && exit 0
 
+F=`date "+%Y%m%d"`.tar.gz
 ( echo "Subject: New /etc/letsencrypt/ on Droplet."
   echo ""
-  tar czf - letsencrypt/ \
+  ( echo "Content-Type: multipart/mixed; boundary=\"boundary\""
+    echo "MIME-Version: 1.0"
+    echo ""
+    echo "--boundary"
+    echo "Content-Type: application/gzip; name=\"$F\""
+    echo "Content-Disposition: attachment; filename=\"$F\""
+    echo "Content-Transfer-Encoding: base64"
+    echo ""
+    tar czf - letsencrypt/ | base64
+    echo ""
+    echo "--boundary--" ) \
   | gpg --encrypt --armor \
        --trust-model always --recipient root@core ) \
 | sendmail root \