O Uso de certificado SSL válido tem um custo certamente alto, mas podemos usar um certificado válido gratuito que tem a duração de 3 meses .
O certbot fará a atualização desse certificado caso seja necessário .
Vamos adicionar o repositóio:
add-apt-repository ppa:certbot/certbot
Atualizar a lista de pacotes.
sudo apt-get update
Instalar o certbot.
sudo apt-get install python-certbot-apache
Agora vamos gerar o certificado.
sudo certbot --apache -d it-howto.org
Ele automaticamente já adiciona no final do meu virtual host.
cat /etc/apache2/sites-enabled/ssl.conf <IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin #@it-howto.org ServerName it-howto.org DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/it-howto-ssl-error.log CustomLog ${APACHE_LOG_DIR}/it-howto-ssl-access.log combined SSLEngine on SSLProtocol all -SSLv2 -SSLv3 #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /var/www/html> Options Indexes FollowSymLinks MultiViews AllowOverride All Require all granted </Directory> SSLCertificateFile /etc/letsencrypt/live/it-howto.org/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/it-howto.org/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf </VirtualHost> </IfModule>
Caso precise renovar o certificado.
sudo certbot renew --dry-run
sudo certbot renew --dry-run Saving debug log to /var/log/letsencrypt/letsencrypt.log - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Processing /etc/letsencrypt/renewal/it-howto.org.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cert not due for renewal, but simulating renewal for dry run Plugins selected: Authenticator apache, Installer apache Starting new HTTPS connection (1): acme-staging-v02.api.letsencrypt.org Renewing an existing certificate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - new certificate deployed with reload of apache server; fullchain is /etc/letsencrypt/live/it-howto.org/fullchain.pem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ** DRY RUN: simulating 'certbot renew' close to cert expiry ** (The test certificates below have not been saved.) Congratulations, all renewals succeeded. The following certs have been renewed: /etc/letsencrypt/live/it-howto.org/fullchain.pem (success) ** DRY RUN: simulating 'certbot renew' close to cert expiry ** (The test certificates above have not been saved.) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -