2026-06-24 20:17:46 -04:00
|
|
|
# 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}
|
2026-08-08 07:20:56 -04:00
|
|
|
# `--ca-url` et `--root` EXPLICITES, pour la meme raison que la tache d'emission :
|
|
|
|
|
# l'autorite ne bootstrape pas, elle n'a donc pas de `defaults.json`, et `step ca renew`
|
|
|
|
|
# sortait en erreur toutes les 14 minutes — « 'step ca renew' requires the '--ca-url'
|
|
|
|
|
# flag ». Le certificat de l'AC est reste expire plus de 8 h sans que rien ne le dise.
|
|
|
|
|
# Constate le 2026-08-08. La lecon avait ete apprise a l'emission et jamais reportee ici.
|
|
|
|
|
ExecStart=/usr/bin/step ca renew --force \
|
|
|
|
|
--ca-url {{ client_pki_ca_url }} \
|
|
|
|
|
--root {{ client_pki_steppath }}/certs/root_ca.crt \
|
|
|
|
|
${CERT_LOCATION} ${KEY_LOCATION}
|
2026-07-04 17:18:13 -04:00
|
|
|
{% 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 %}
|
2026-06-24 20:17:46 -04:00
|
|
|
ExecStartPost=/usr/bin/env sh -c "! systemctl --quiet is-active %i.service || systemctl try-reload-or-restart %i"
|
2026-07-04 17:18:13 -04:00
|
|
|
{% endif %}
|
2026-06-24 20:17:46 -04:00
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
|
WantedBy=multi-user.target
|