Files
AriWeb-Suite/modules/arimail/deploy/letsencrypt-deploy-hook.sh.in
T

13 lines
708 B
Bash

#!/bin/sh
# certbot 갱신 훅(@MAIL_HOST@): 인증서 사본을 서비스 계정 전용 경로에 두고 nginx·게이트웨이에 반영합니다.
# certbot 의 개인키는 root 만 읽으므로 게이트웨이(@APP_USER@)가 읽을 사본이 필요합니다.
set -e
LINEAGE="${RENEWED_LINEAGE:-/etc/letsencrypt/live/@MAIL_HOST@}"
case "$LINEAGE" in */@MAIL_HOST@*) ;; *) exit 0 ;; esac
mkdir -p @ETC_DIR@/tls
install -o @APP_USER@ -g @APP_USER@ -m 640 "$LINEAGE/fullchain.pem" @ETC_DIR@/tls/fullchain.pem
install -o @APP_USER@ -g @APP_USER@ -m 640 "$LINEAGE/privkey.pem" @ETC_DIR@/tls/privkey.pem
[ "${SKIP_RESTART:-0}" = 1 ] && exit 0
systemctl reload nginx || true
systemctl restart @APP_NAME@ || true