Stylesheet conf/userstyle.css not found, please contact the developer of "dokuwiki_2024" template.
linux:letsencrypt_centos
Различия
Показаны различия между двумя версиями страницы.
linux:letsencrypt_centos [2020/11/10 01:35] – внешнее изменение 127.0.0.1 | linux:letsencrypt_centos [2021/06/23 15:33] (текущий) – dx | ||
---|---|---|---|
Строка 1: | Строка 1: | ||
+ | ====== Let's Encrypt + nginx в CentOS 7 ====== | ||
+ | <note important> | ||
+ | |||
+ | ===== CentOS 7 ===== | ||
+ | |||
+ | Подключаем EPEL | ||
+ | |||
+ | < | ||
+ | |||
+ | Устанавливаем certbot для nginx | ||
+ | |||
+ | < | ||
+ | |||
+ | Для apache | ||
+ | |||
+ | < | ||
+ | |||
+ | Видимо в скором времени придется перейти на более легковесное решение [[https:// | ||
+ | |||
+ | ++++ Не сликом ли много? | ||
+ | < | ||
+ | Dependencies Resolved | ||
+ | |||
+ | ===================================================================================================================== | ||
+ | | ||
+ | ===================================================================================================================== | ||
+ | Installing: | ||
+ | | ||
+ | | ||
+ | Installing for dependencies: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | ++++ | ||
+ | |||
+ | Получаем сертификат для nginx | ||
+ | |||
+ | < | ||
+ | |||
+ | Получаем сертификат для apache | ||
+ | |||
+ | < | ||
+ | |||
+ | Опция certonly подразумевает, | ||
+ | |||
+ | При первом запуске certbot необходимо будет указать email и принять ToS. | ||
+ | |||
+ | ++++ Вот так это выглядит 🙉/🙈 | | ||
+ | < | ||
+ | Saving debug log to / | ||
+ | Plugins selected: Authenticator nginx, Installer nginx | ||
+ | Enter email address (used for urgent renewal and security notices) | ||
+ | | ||
+ | Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org | ||
+ | |||
+ | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
+ | Please read the Terms of Service at | ||
+ | https:// | ||
+ | agree in order to register with the ACME server at | ||
+ | https:// | ||
+ | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
+ | (A)gree/ | ||
+ | |||
+ | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
+ | Would you be willing, once your first certificate is successfully issued, to | ||
+ | share your email address with the Electronic Frontier Foundation, a founding | ||
+ | partner of the Let's Encrypt project and the non-profit organization that | ||
+ | develops Certbot? We'd like to send you email about our work encrypting the web, | ||
+ | EFF news, campaigns, and ways to support digital freedom. | ||
+ | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
+ | (Y)es/(N)o: n | ||
+ | |||
+ | Which names would you like to activate HTTPS for? | ||
+ | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
+ | 1: wiki.foobar.com | ||
+ | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
+ | Select the appropriate numbers separated by commas and/or spaces, or leave input | ||
+ | blank to select all options shown (Enter ' | ||
+ | Obtaining a new certificate | ||
+ | Performing the following challenges: | ||
+ | http-01 challenge for wiki.foobar.com | ||
+ | Waiting for verification... | ||
+ | Cleaning up challenges | ||
+ | |||
+ | IMPORTANT NOTES: | ||
+ | - Congratulations! Your certificate and chain have been saved at: | ||
+ | / | ||
+ | Your key file has been saved at: | ||
+ | / | ||
+ | Your cert will expire on 2021-02-07. To obtain a new or tweaked | ||
+ | | ||
+ | | ||
+ | " | ||
+ | - Your account credentials have been saved in your Certbot | ||
+ | | ||
+ | | ||
+ | also contain certificates and private keys obtained by Certbot so | ||
+ | | ||
+ | - If you like Certbot, please consider supporting our work by: | ||
+ | |||
+ | | ||
+ | | ||
+ | </ | ||
+ | ++++ | ||
+ | |||
+ | ===== CentOS 8 ===== | ||
+ | |||
+ | Подключаем EPEL | ||
+ | |||
+ | < | ||
+ | |||
+ | Устанавливаем certbot для nginx | ||
+ | |||
+ | < | ||
+ | |||
+ | Для apache | ||
+ | |||
+ | < | ||
+ | |||
+ | ===== Проверка автоматического обновления сертификатов ===== | ||
+ | |||
+ | < | ||
+ | |||
+ | ++++ Вот так это выглядит 🙉/🙈 | | ||
+ | < | ||
+ | # certbot renew --dry-run | ||
+ | Saving debug log to / | ||
+ | |||
+ | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
+ | Processing / | ||
+ | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
+ | Cert not due for renewal, but simulating renewal for dry run | ||
+ | Plugins selected: Authenticator nginx, Installer nginx | ||
+ | Starting new HTTPS connection (1): acme-staging-v02.api.letsencrypt.org | ||
+ | Renewing an existing certificate | ||
+ | Performing the following challenges: | ||
+ | http-01 challenge for wiki.foobar.com | ||
+ | Waiting for verification... | ||
+ | Cleaning up challenges | ||
+ | |||
+ | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
+ | new certificate deployed with reload of nginx server; fullchain is | ||
+ | / | ||
+ | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
+ | |||
+ | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
+ | ** DRY RUN: simulating ' | ||
+ | ** (The test certificates below have not been saved.) | ||
+ | |||
+ | Congratulations, | ||
+ | / | ||
+ | ** DRY RUN: simulating ' | ||
+ | ** (The test certificates above have not been saved.) | ||
+ | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
+ | |||
+ | IMPORTANT NOTES: | ||
+ | - Your account credentials have been saved in your Certbot | ||
+ | | ||
+ | | ||
+ | also contain certificates and private keys obtained by Certbot so | ||
+ | | ||
+ | </ | ||
+ | ++++ | ||
+ | |||
+ | ===== Автоматическое обновление ===== | ||
+ | |||
+ | Никаких **/ | ||
+ | |||
+ | Для автоматического обновления существует systemd timer. | ||
+ | |||
+ | systemd service файл | ||
+ | |||
+ | < | ||
+ | # cat / | ||
+ | [Unit] | ||
+ | Description=This service automatically renews any certbot certificates found | ||
+ | |||
+ | [Service] | ||
+ | EnvironmentFile=/ | ||
+ | Type=oneshot | ||
+ | ExecStart=/ | ||
+ | </ | ||
+ | |||
+ | systemd таймер | ||
+ | |||
+ | < | ||
+ | # cat / | ||
+ | [Unit] | ||
+ | Description=This is the timer to set the schedule for automated renewals | ||
+ | |||
+ | [Timer] | ||
+ | OnCalendar=*-*-* 00/12:00:00 | ||
+ | RandomizedDelaySec=12hours | ||
+ | Persistent=true | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=timers.target | ||
+ | </ | ||
+ | |||
+ | Нужно только запустить их и добавить в автозагрузку | ||
+ | |||
+ | < | ||
+ | # systemctl enable certbot-renew.service | ||
+ | # systemctl start certbot-renew.service | ||
+ | # systemctl enable certbot-renew.timer | ||
+ | # systemctl start certbot-renew.timer | ||
+ | </ | ||
+ | |||
+ | EOM | ||
+ | |||
+ | {{tag> |