feat: CERTBOT_DOMAIN may name several domains
Build docker image and push to registry.bitdeals.org / main-build-job (push) Successful in 30s
Build docker image and push to registry.bitdeals.org / main-build-job (push) Successful in 30s
certbot's own -d already takes a comma-separated list and puts every name
in the certificate's Subject Alternative Names, so `-d "$CERTBOT_DOMAIN"`
needed no change at all. What assumed a single domain was everything that
treated the variable as a *file name*: --cert-name, and the two scripts
that address the lineage under /etc/letsencrypt/live. Certbot names a
lineage after the first domain of the list, so all three now take
${CERTBOT_DOMAIN%%,*} instead of the whole string -- otherwise a two-domain
value asks for a lineage literally called "a.org,b.org" and the renewal
pass looks for a directory nobody made.
One certificate with several names rather than several lineages: HAProxy
binds a single site.pem, and a second lineage would have nowhere to go.
Adding a domain to CERTBOT_DOMAIN on a machine that already holds a
certificate still needs one manual issuance -- `certbot renew` reads the
names off the certificate it has and never looks at the variable. The
README says so, and gives the command.
This commit is contained in:
+9
-3
@@ -43,7 +43,7 @@ services:
|
||||
image: registry.bitdeals.org/certbot
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- CERTBOT_DOMAIN=example.org
|
||||
- CERTBOT_DOMAIN=example.org,www.example.org
|
||||
- CERTBOT_EMAIL=admin@example.org # необязательно, для уведомлений об истечении
|
||||
volumes:
|
||||
- certificates:/etc/certificates # общий с haproxy
|
||||
@@ -63,7 +63,7 @@ volumes:
|
||||
|
||||
```sh
|
||||
docker run -d \
|
||||
-e CERTBOT_DOMAIN=example.org \
|
||||
-e CERTBOT_DOMAIN=example.org,www.example.org \
|
||||
-v certificates:/etc/certificates \
|
||||
-v letsencrypt:/etc/letsencrypt \
|
||||
-v letsencrypt_work:/var/lib/letsencrypt \
|
||||
@@ -103,7 +103,7 @@ docker push registry.bitdeals.org/certbot
|
||||
|
||||
|Параметр|Назначение|
|
||||
|:--------|:-------|
|
||||
|-e CERTBOT_DOMAIN|Домен, на который выпускается сертификат. По умолчанию: пусто — сертификат не запрашивается и сайт молча остаётся с самоподписанной заглушкой. Домен только один: скрипты передают единственный `-d`|
|
||||
|-e CERTBOT_DOMAIN|Домен, на который выпускается сертификат, либо несколько через запятую (`a.org,b.org`) — это собственный синтаксис `-d` у certbot: получается один сертификат, несущий все имена в Subject Alternative Names. По первому домену назван каталог сертификата под `/etc/letsencrypt/live`. По умолчанию: пусто — сертификат не запрашивается и сайт молча остаётся с самоподписанной заглушкой|
|
||||
|-e CERTBOT_EMAIL|Адрес для уведомлений Let's Encrypt об истечении срока. По умолчанию: пусто, регистрация идёт с `--register-unsafely-without-email`, и предупреждений не будет — см. «Замечания»|
|
||||
|-v /etc/certificates|Общий с HAProxy. Содержит `site.pem` — склеенные сертификат и приватный ключ, которые загружает HAProxy|
|
||||
|-v /etc/letsencrypt|Каталог конфигурации certbot: ключ учётной записи ACME, выпущенные сертификаты и настройки перевыпуска. Его потеря означает повторную регистрацию и повторный выпуск|
|
||||
@@ -166,6 +166,12 @@ docker push registry.bitdeals.org/certbot
|
||||
еженедельной пересборкой по cron означает, что новый выпуск certbot попадает в
|
||||
реестр, а через Watchtower и в продуктив, без того чтобы кто-либо запускал
|
||||
сборку. Для воспроизводимых сборок фиксируйте версию тегом.
|
||||
- **Добавленный в `CERTBOT_DOMAIN` домен сам по себе не приводит к
|
||||
перевыпуску.** Цикл вызывает `certbot renew`, а тот берёт имена из уже
|
||||
выданного сертификата и в `CERTBOT_DOMAIN` не заглядывает. Если сертификат на
|
||||
машине уже есть, выпустите новый набор имён один раз вручную — дальше цикл
|
||||
будет его поддерживать:
|
||||
`certbot certonly --standalone -n --agree-tos --http-01-port=380 --cert-name <первый-домен> --expand -d <новый,список>`.
|
||||
- **У Let's Encrypt есть ограничения частоты.** Повторяющиеся неудачные попытки
|
||||
выпуска на один домен в них засчитываются; проверяйте изменения на
|
||||
`--server https://acme-staging-v02.api.letsencrypt.org/directory`, прежде чем
|
||||
|
||||
Reference in New Issue
Block a user