Add Certbot webroot setup and Apache renewal hook
Coulobre Panel CI / Checks (Python 3.12) (pull_request) Canceled after 0s
Coulobre Panel CI / Checks (Python 3.14) (pull_request) Canceled after 0s

This commit is contained in:
parkel committed 2026-11-21 02:43:29 +01:00
1 parent 62df077225
commit 3be2f8fd07
5 files changed
+87

No files matched your search

+58
View File
@@ -670,6 +670,63 @@ The status command reads local state. It exits with code 0 for `configured`,
code 2 for the other report states, and code 1 if it cannot read the manifest
or inspect the node. Use an HTTP request to verify the site's response as well.
### Enable HTTPS for a hosted website
Apply the web deployment manifest first. Use Certbot to obtain and renew
the website's Let's Encrypt certificate. The HTTP-01 challenge requires
public DNS for the domain and an inbound connection on port 80. If a
reverse proxy handles that port, forward `/.well-known/acme-challenge/`
for the domain to the web node, preserving the host and path.
[Let's Encrypt challenge types](https://letsencrypt.org/docs/challenge-types/)
Prepare Apache and the shared challenge directory once per web node.
Apache serves challenge files from this directory, which the web node
operator controls.
```sh
sudo apt install certbot
sudo a2enmod ssl
sudo install -d -m 0755 /var/www/coulobre-acme/.well-known/acme-challenge
sudo install -m 0644 deploy/apache/acme.conf.example \
/etc/apache2/conf-available/coulobre-acme.conf
sudo a2enconf coulobre-acme
sudo apache2ctl configtest
sudo systemctl reload apache2
```
Use the manifest's account ID for the Certbot certificate name and its
primary domain for the certificate hostname. Keep Certbot's private key
root-owned with mode `0600`. Apache uses the managed Certbot lineage on
port 443, with the same document root and PHP-FPM pool as the HTTP site.
```sh
sudo certbot certonly --webroot --webroot-path /var/www/coulobre-acme \
--cert-name coulobre-1 --domains example.org
sudo /opt/coulobre/bin/coulobre-web-node enable-https coulobre-web-plan-1.json
sudo /opt/coulobre/bin/coulobre-web-node https-status coulobre-web-plan-1.json
curl --fail https://example.org/
```
`https-status` checks the local virtual host and certificate on disk.
An HTTPS request verifies the certificate and response clients receive.
HTTP remains available for the site and future HTTP-01 challenges.
Install the renewal hook and check the Certbot timer. After a successful
renewal of a Coulobre certificate, the hook validates the Apache
configuration and reloads the service.
```sh
sudo install -D -m 0755 deploy/certbot/reload-apache.sh \
/etc/letsencrypt/renewal-hooks/deploy/coulobre-apache
systemctl status certbot.timer
sudo certbot renew --dry-run --run-deploy-hooks --cert-name coulobre-1
```
For a public domain that cannot accept inbound HTTP on port 80, Certbot
can use a DNS plugin for validation. Request the certificate under the
same lineage name before running `enable-https`.
[Certbot certificate guide](https://eff-certbot.readthedocs.io/en/stable/using.html)
### Enable local web activation
On a web node with the same Apache and PHP-FPM setup, systemd can accept local
@@ -741,6 +798,7 @@ fixtures. Then run the checks from the repository root.
ruff check .
ruff format --check .
sh -n tests/web-node/smoke.sh
sh -n deploy/certbot/reload-apache.sh
python manage.py check
python manage.py makemigrations --check --dry-run
python manage.py test coulobre