20 lines
782 B
Text
20 lines
782 B
Text
|
|
#!/bin/sh
|
||
|
|
# Géré par Set-OPS (rôle serveur_dovecot). Ne pas éditer à la main.
|
||
|
|
# Synchronise le certificat step_ca (déposé par client_pki, root:root 600) vers Dovecot,
|
||
|
|
# puis recharge. Idempotent ; appelé au déploiement ET au renouvellement (unité path).
|
||
|
|
# Dovecot lit le certificat via son maître (root), donc root:root suffit.
|
||
|
|
set -eu
|
||
|
|
|
||
|
|
SRC_CERT="{{ serveur_dovecot_tls_source_cert }}"
|
||
|
|
SRC_KEY="{{ serveur_dovecot_tls_source_cle }}"
|
||
|
|
DST="{{ serveur_dovecot_tls_dir }}"
|
||
|
|
|
||
|
|
[ -f "$SRC_CERT" ] && [ -f "$SRC_KEY" ] || exit 0
|
||
|
|
|
||
|
|
install -o root -g root -m 0644 "$SRC_CERT" "$DST/cert.pem"
|
||
|
|
install -o root -g root -m 0600 "$SRC_KEY" "$DST/key.pem"
|
||
|
|
|
||
|
|
if systemctl --quiet is-active dovecot 2>/dev/null; then
|
||
|
|
systemctl reload dovecot 2>/dev/null || systemctl restart dovecot
|
||
|
|
fi
|