src.nth.io/

summaryrefslogtreecommitdiff
path: root/prosody/templates/prosody.sh.j2
diff options
context:
space:
mode:
authorLuke Hoersten <[email protected]>2026-06-29 21:13:59 -0500
committerLuke Hoersten <[email protected]>2026-06-29 21:13:59 -0500
commitb15bc8b162e9aacd12c7882ddb3c8cc3ca82189b (patch)
tree3f2627d34069f182a130777c97d5afbf4ca3a4df /prosody/templates/prosody.sh.j2
parentad2215ee82a87f11c23a7b50c7cc09de9bb7c802 (diff)
certbot: scoped CF API token; gate prosody deploy hook on RENEWED_LINEAGE
cred.conf.j2 now emits the single-line dns_cloudflare_api_token form (scoped Cloudflare API Token) instead of the legacy account-wide email + global API key. prosody.sh.j2 deploy hook now no-ops unless $RENEWED_LINEAGE matches the prosody vhost, so unrelated lineage renewals (haskell.social, etracapital.com) no longer report a spurious "Hook reported error code 1 / No certificate for host found". Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Diffstat (limited to 'prosody/templates/prosody.sh.j2')
-rw-r--r--prosody/templates/prosody.sh.j221
1 files changed, 19 insertions, 2 deletions
diff --git a/prosody/templates/prosody.sh.j2 b/prosody/templates/prosody.sh.j2
index defe301..73cca7c 100644
--- a/prosody/templates/prosody.sh.j2
+++ b/prosody/templates/prosody.sh.j2
@@ -1,3 +1,20 @@
-#! /bin/bash
+#!/bin/bash
+#
+# certbot deploy hook — import the renewed Let's Encrypt cert into prosody's store.
+#
+# Hooks in renewal-hooks/deploy/ run after *every* lineage renewal, so when certbot
+# renews some other domain (e.g. haskell.social, etracapital.com) this script would
+# still try to import {{prosody_vhost}} and exit 1 with "No certificate for host
+# found :(" — harmless, but it makes `certbot renew` report a scary hook error.
+#
+# Gate on certbot's $RENEWED_LINEAGE so we only act on the prosody vhost's renewal.
+# When invoked manually with no $RENEWED_LINEAGE (e.g. ansible provisioning), import.
-prosodyctl --root cert import {{prosody_vhost}} /etc/letsencrypt/live/{{prosody_vhost}}/
+set -eu
+
+if [ -n "${RENEWED_LINEAGE:-}" ] \
+ && [ "${RENEWED_LINEAGE}" != "/etc/letsencrypt/live/{{prosody_vhost}}" ]; then
+ exit 0
+fi
+
+prosodyctl --root cert import {{prosody_vhost}} "/etc/letsencrypt/live/{{prosody_vhost}}/"