aboutsummaryrefslogtreecommitdiffstats
path: root/example-hook.sh
diff options
context:
space:
mode:
authorLexi Winter <ivy@FreeBSD.org>2025-06-03 07:21:08 +0100
committerLexi Winter <ivy@FreeBSD.org>2025-06-03 07:21:08 +0100
commite1f2a8dd272cdbe4f5e54853008a3e5f24f4af71 (patch)
tree2afe7daa22b636948498595a4b1e07b3fe9b2eea /example-hook.sh
downloadlfacme-e1f2a8dd272cdbe4f5e54853008a3e5f24f4af71.tar.gz
lfacme-e1f2a8dd272cdbe4f5e54853008a3e5f24f4af71.tar.bz2
initial commit
Diffstat (limited to 'example-hook.sh')
-rw-r--r--example-hook.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/example-hook.sh b/example-hook.sh
new file mode 100644
index 0000000..01c5644
--- /dev/null
+++ b/example-hook.sh
@@ -0,0 +1,25 @@
+#! /bin/sh
+# An example hook.
+
+# Action is always 'newcert', at least for now.
+action="$1"
+
+# Environment variables:
+# $LFACME_CERT is the name of the certificate
+# $LFACME_CERTFILE is the filename of the certificate.
+# $LFACME_KEYFILE is the filename of the private key.
+
+set -e
+
+case "$action" in
+newcert)
+ # The certificate was issued or renewed.
+ cp "$LFACME_CERTFILE" /usr/local/etc/nginx/tls/cert.pem
+ cp "$LFACME_KEYFILE" /usr/local/etc/nginx/tls/key.pem
+ nginx -s reload
+ ;;
+
+*)
+ # Ignore unknown actions, because new ones might be added later.
+ ;;
+esac