Более подробно тут
1. Устанавливаем утилиту для выпуска сертмфиката:
1 2 3 |
$ sudo yum install python2-certbot-apache |
Для CentOS6 надо проверить установлен ли Python3. Если нет, то делаем так (и далее не certbot, а certbot-auto):
1 2 3 4 5 6 7 8 9 10 |
# yum install epel-release # yum --disablerepo="*" --enablerepo="epel" info python3* # yum --disablerepo="*" --enablerepo="epel" install python34 # wget https://dl.eff.org/certbot-auto # chmod a+x certbot-auto # ./path/to/certbot-auto --apache certonly # ./path/to/certbot-auto renew --dry-run # ./path/to/certbot-auto renew |
2. Делаем сертификат:
1 2 3 |
$ sudo certbot --apache certonly |
3. Сертификат выпускается на 3 месяца. После этого периода тестируем перевыпуск сертификата:
1 2 3 |
$ sudo certbot renew –dry-run |
Если все нормуль, то:
1 2 3 |
$ sudo certbot renew |
Рекмендуется выполнять эту команду дважды в день. Потому что по каким-то причинам LetsEncrypt может отозвать ваш сертификат или обновить что-то, что потребует обновления сертификата.
Пример выполнения обновления сертификата по crontab:
1 2 3 |
0 0,12 * * * python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew |
4. Дальше конфиг https апача (ssl.conf):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
<VirtualHost ip_вашего_сервера:443> DocumentRoot "/data/www/site.ru/html/" ServerName site.ru:443 <Directory "/data/www/site.ru/html"> Options +FollowSymLinks -Indexes AllowOverride All # Require ip 192.168. 172.16. - доступ только с этих ip Require all granted </Directory> ErrorLog logs/ssl_error_log TransferLog logs/ssl_access_log LogLevel warn SSLEngine on SSLProtocol all -SSLv2 -SSLv3 SSLCipherSuite HIGH:3DES:!aNULL:!MD5:!SEED:!IDEA #SSLCipherSuite RC4-SHA:AES128-SHA:HIGH:MEDIUM:!aNULL:!MD5 #SSLHonorCipherOrder on SSLCertificateFile /etc/letsencrypt/live/site.ru/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/site.ru/privkey.pem #SSLCertificateChainFile /etc/letsencrypt/live/site.ru/fullchain.pem #SSLCACertificateFile /etc/letsencrypt/live/site.ru/chain.pem #SSLVerifyClient require #SSLVerifyDepth 10 #<Location /> #SSLRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \ # and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \ # and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \ # and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \ # and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20 ) \ # or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/ #</Location> #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire <Files ~ "\.(cgi|shtml|phtml|php3?)$"> SSLOptions +StdEnvVars </Files> <Directory "/data/www/site.ru/cgi-bin"> SSLOptions +StdEnvVars </Directory> BrowserMatch "MSIE [2-5]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 CustomLog logs/ssl_request_log \ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" </VirtualHost> |
Posfix (main.cf):
1 2 3 4 5 6 7 8 9 |
### TLS smtpd_use_tls = yes smtpd_tls_cert_file = /etc/letsencrypt/live/mail.site.ru/fullchain.pem smtpd_tls_key_file = /etc/letsencrypt/live/mail.site.ru/privkey.pem smtp_tls_security_level=may smtpd_tls_mandatory_protocols=TLSv1, TLSv1.1, TLSv1.2, !SSLv2, !SSLv3 smtpd_tls_auth_only = yes |
Dovecot (dovecot.conf):
1 2 3 4 5 6 7 8 9 10 11 |
# SSL # http://wiki2.dovecot.org/SSL/DovecotConfiguration ssl = yes ssl_cert = </etc/letsencrypt/live/mail.site.ru/fullchain.pem ssl_key = </etc/letsencrypt/live/mail.site.ru/privkey.pem ssl_protocols = TLSv1 TLSv1.1 TLSv1.2 !SSLv2 !SSLv3 ssl_cipher_list = ALL:!LOW:!SSLv2:!EXP:!aNULL # Запрет аутентификации открытым текстом. yes - запретить, no - разрешить. disable_plaintext_auth = no |
Оставить комментарий