Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/interplane-forge/blob/main/infra/spark/edge-certs.sh # interplane-forge INTERPLANE Forge Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `interplane-forge / infra / spark / edge-certs.sh` 30 lines ยท 1406 bytes Raw Blame History 1 #!/bin/sh 2 # spark/edge-certs.sh: copy the TLS certificates for www.aienos.com, aienos.com and interplane.io 3 # from the hub Pi (where acme.sh renews them through Gandi DNS, independent of where :443 points) 4 # into the Spark front door's /etc/nginx/certs, and reload nginx only when a file changed and 5 # `nginx -t` passes. Runs from the spark user timer edge-certs.timer (needs passwordless sudo). 6 # Host tools: OpenSSH, tar, sha256sum, install, nginx. Omega replacement: none planned for the 7 # ACME client (encryption and certificate handling stay on vetted tools, per Drake's rule). 8 set -eu 9 HUB=${HUB:-hub} 10 W=$(mktemp -d) 11 trap 'rm -rf -- "${W:?}"' EXIT 12 timeout 300 ssh -o BatchMode=yes -o ConnectTimeout=60 "$HUB" \ 13 'sudo tar -C /etc/nginx/certs -cf - aienos.com www.aienos.com interplane.io' | tar -C "$W" -xf - 14 changed=0 15 for c in aienos.com www.aienos.com interplane.io; do 16 for f in fullchain.pem key.pem; do 17 [ -s "$W/$c/$f" ] || { echo "FAIL: $c/$f missing from hub copy"; exit 1; } 18 if ! sudo cmp -s "$W/$c/$f" "/etc/nginx/certs/$c/$f"; then 19 m=644; [ "$f" = key.pem ] && m=600 20 sudo install -d -m 700 "/etc/nginx/certs/$c" 21 sudo install -m "$m" -o root -g root "$W/$c/$f" "/etc/nginx/certs/$c/$f" 22 changed=1; echo "updated $c/$f" 23 fi 24 done 25 done 26 if [ "$changed" = 1 ]; then 27 sudo nginx -t && sudo systemctl reload nginx && echo "RELOADED" 28 else 29 echo "UNCHANGED" 30 fi