Для установки certboot запустите
docker-compose -f agis-certboot.yml up
В реузльтате будут установлены сертификаты. Не забудьте предоставить доступ по 80 порту. При этом используйте для nginx конфигурационный файл default.conf
agis-certbot | Saving debug log to /var/log/letsencrypt/letsencrypt.log agis-certbot | Plugins selected: Authenticator webroot, Installer None agis-certbot | Obtaining a new certificate agis-certbot | Performing the following challenges: agis-certbot | http-01 challenge for your.domain agis-certbot | http-01 challenge for www.your.domain agis-certbot | Using the webroot path /var/www/certbot for all unmatched domains. agis-certbot | Waiting for verification... agis-certbot | Cleaning up challenges agis-certbot | IMPORTANT NOTES: agis-certbot | - Congratulations! Your certificate and chain have been saved at: agis-certbot | /etc/letsencrypt/live/info-sec.kz/fullchain.pem agis-certbot | Your key file has been saved at: agis-certbot | /etc/letsencrypt/live/info-sec.kz/privkey.pem agis-certbot | Your cert will expire on 2021-02-15. To obtain a new or tweaked agis-certbot | version of this certificate in the future, simply run certbot agis-certbot | again. To non-interactively renew *all* of your certificates, run agis-certbot | "certbot renew" agis-certbot | - If you like Certbot, please consider supporting our work by: agis-certbot | agis-certbot | Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate agis-certbot | Donating to EFF: https://eff.org/donate-le agis-certbot | agis-certbot exited with code 0
Конфигурационный файл default.conf:
server {
listen [::]:80;
listen 80;
server_name your.domain www.your.domain;
location ~ /.well-known/acme-challenge {
allow all;
root /var/www/certbot;
}
}
В дальнейшем, для обновления сертификатов внесите измения в agis-certboot.yml (–force-renewal):
version: "3.3"
services:
certbot:
image: certbot/certbot:latest
container_name: agis-certbot
# command: certonly --webroot --webroot-path=/var/www/certbot --email your@mail.com --agree-tos --no-eff-email -d your.domain -d www.your.domain
command: certonly --webroot --webroot-path=/var/www/certbot --email your@mail.com --agree-tos --no-eff-email --force-renewal -d your.domain -d www.your.domain
volumes:
- ./certbot/conf:/etc/letsencrypt
- ./certbot/logs:/var/log/letsencrypt
- ./certbot/data:/var/www/certbot
networks:
default:
external:
name: agis-net
После успешной проверки, будут созданы следующие сертификаты в папке /etc/letsencrypt/live/[имя домена]:
privkey.pem — приватный ключ для сертификата
Используется Apache для SSLCertificateKeyFile и nginx для ssl_certificate_key.
cert.pem (сертификат сервера)
Используется Apache для SSLCertificateFile.
chain.pem (сертификат цепочки)
Он же используется Apache для SSLCertificateChainFile.
fullchain.pem (соединение chain.pem и cert.pem)
Он же используется nginx для ssl_certificate.
Проверим полученный сертификат
Убедимся что полученный сертификат — именно тот, что нам нужен:
# openssl x509 -text -in /etc/letsencrypt/live/example.com/cert.pem
Certificate:
Signature Algorithm: ...
Validity
Not Before: Jan 3 06:00:00 2017 GMT
Not After : Apr 3 06:00:00 2017 GMT
X509v3 extensions:
...
X509v3 Subject Alternative Name:
DNS:example.com, DNS:www.example.comИли, если подробности вам не нужны:
cat /etc/letsencrypt/live/*/cert.pem | openssl x509 -text |
grep -o 'DNS:[^,]*' | cut -f2 -d:Команда должна вывести список доменов в сертификате.
How to Install Nginx and Let’s Encrypt with Docker – Ubuntu 20.04