issue-cert 575 B

1234567891011
  1. #!/bin/bash
  2. # issue-cert <host> — request a Let's Encrypt cert using the shared ACME webroot.
  3. # Run through sudo by the deploy user; accepts a single *.monoexp.com hostname.
  4. set -euo pipefail
  5. PATH=/usr/sbin:/usr/bin:/sbin:/bin
  6. [[ $# -eq 1 ]] || { echo "usage: issue-cert <host>" >&2; exit 2; }
  7. host=$1
  8. [[ $host =~ ^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+monoexp\.com$ ]] \
  9. || { echo "issue-cert: '$host' is not a monoexp.com hostname" >&2; exit 2; }
  10. exec certbot certonly --non-interactive --webroot -w /srv/www/acme \
  11. -d "$host" --deploy-hook 'systemctl reload nginx'