Bug latent de flotte : cert-renewer rechargeait un service nommé d'après le cert (%i = FQDN, inexistant) au lieu du consommateur réel → nginx/postfix/ dovecot/slapd servaient l'ancien cert jusqu'à expiration. Symptôme : cert edge périmé en mémoire → échec TLS OIDC → login SSO cassé. Correctif : client_pki_reload_services (vrais consommateurs), par groupe. Fix immédiat de l'incident : reload nginx sur l'edge. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
25 lines
1.1 KiB
Django/Jinja
25 lines
1.1 KiB
Django/Jinja
# Gere par Set-OPS (role client_pki). Renouvellement de certificat (Smallstep).
|
|
[Unit]
|
|
Description=Certificate renewer for %I
|
|
After=network-online.target
|
|
Wants=network-online.target
|
|
Documentation=https://smallstep.com/docs/step-ca/renewal
|
|
StartLimitIntervalSec=0
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
User=root
|
|
Environment=STEPPATH={{ client_pki_steppath }}
|
|
Environment=CERT_LOCATION={{ client_pki_steppath }}/certs/%i.crt
|
|
Environment=KEY_LOCATION={{ client_pki_steppath }}/certs/%i.key
|
|
ExecCondition=/usr/bin/step certificate needs-renewal ${CERT_LOCATION}
|
|
ExecStart=/usr/bin/step ca renew --force ${CERT_LOCATION} ${KEY_LOCATION}
|
|
{% if client_pki_reload_services | default([]) | length > 0 %}
|
|
# Recharge les VRAIS consommateurs du cert (nginx, postfix…), pas un service nomme d'apres le cert.
|
|
ExecStartPost=/usr/bin/env sh -c "{% for svc in client_pki_reload_services %}systemctl try-reload-or-restart {{ svc }}; {% endfor %}true"
|
|
{% else %}
|
|
ExecStartPost=/usr/bin/env sh -c "! systemctl --quiet is-active %i.service || systemctl try-reload-or-restart %i"
|
|
{% endif %}
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|