Certificate renewal: certbot timer, nginx reload hook, doctor checks renewal configuration

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
denis
2026-10-17 13:03:13 +02:00
parent 973fb98b91
commit 3f10adb36b
5 changed files with 79 additions and 1 deletions
+22
View File
@@ -87,6 +87,28 @@ gunzip < /var/backups/pyquest/pyquest-YYYYMMDD-HHMMSS.sql.gz | mariadb pyquest
Remember to move the backups off the VPS (copy to another machine).
### Let's Encrypt certificate: issuing and renewal
`server_setup.sh --certbot you@mail` obtains the certificate (*webroot* method, without stopping nginx), installs a
**hook** that reloads nginx after each renewal and enables `certbot.timer` (automatic renewal, twice a day, effective in
the last 30 days of validity). Checks:
```bash
certbot certificates # domains, expiry dates, certificate path
systemctl status certbot.timer # the timer is "active (waiting)"
certbot renew --dry-run # dry run of the renewal, changing nothing
```
If the certificate was obtained **another way** (by hand, with another tool, or copied), it has no renewal configuration
(`/etc/letsencrypt/renewal/<domain>.conf`) and will not renew: `vps_doctor.sh` flags it. To fix (port 80 must be
reachable, the domain must point to the server):
```bash
certbot certonly --webroot -w /var/www/pyquest/letsencrypt -d pyquest.example.org --agree-tos -m you@mail
./deploy/server_setup.sh --domain pyquest.example.org # reinstalls the hook and the timer
certbot renew --dry-run
```
### Security updates
`apt update && apt upgrade` regularly. After a Django upgrade, `./scripts/server_update.sh` reinstalls the dependencies and
+22
View File
@@ -87,6 +87,28 @@ gunzip < /var/backups/pyquest/pyquest-AAAAMMJJ-HHMMSS.sql.gz | mariadb pyquest
Pense à sortir les sauvegardes du VPS (copie vers une autre machine).
### Certificat Let's Encrypt : obtention et renouvellement
`server_setup.sh --certbot adresse@mail` obtient le certificat (méthode *webroot*, sans arrêter nginx), installe un
**hook** qui recharge nginx après chaque renouvellement et active `certbot.timer` (renouvellement automatique, deux fois
par jour, effectif dans les 30 derniers jours de validité). Vérifications :
```bash
certbot certificates # domaines, dates d'expiration, chemin du certificat
systemctl status certbot.timer # le minuteur est « active (waiting) »
certbot renew --dry-run # essai à blanc du renouvellement, sans rien changer
```
Si le certificat a été obtenu **autrement** (à la main, par un autre outil, ou copié), il n'a pas de configuration de
renouvellement (`/etc/letsencrypt/renewal/<domaine>.conf`) et ne se renouvellera pas : `vps_doctor.sh` le signale.
Corriger (le port 80 doit être joignable, le domaine doit pointer vers le serveur) :
```bash
certbot certonly --webroot -w /var/www/pyquest/letsencrypt -d pyquest.example.org --agree-tos -m toi@mail
./deploy/server_setup.sh --domain pyquest.example.org # réinstalle le hook et le minuteur
certbot renew --dry-run
```
### Mises à jour de sécurité
`apt update && apt upgrade` régulièrement. Après une mise à jour de Django, `./scripts/server_update.sh` réinstalle les