Para configurar o certificado SSL no servidor Issabel vamos precisar de um domínio válido. Se você já possui um domínio crie um novo registro apontando para o IP público do servidor Issabel.
Exemplo:
Host: pbx.meudominio.com.br
Tipo: Address (A)
Destino: IP Publico do Servidor
Valide o DNS criado acessando http://pbx.meudominio.com.br.
Configurando Apache
Acesse o servidor via SSH, no arquivo ssl.conf busque pelo parâmetro ServerName, adicione uma nova linha informando o seu DNS criado.
vi /etc/httpd/conf.d/ssl.conf
Servername pbx.meudominio.com.br
No final do arquivo adicione o Host Virtual apontando para o ServerName configurado.
1 2 3 4 5 6 7 |
Salve as alterações e saia do arquivo.
Após as alterações reinicie o serviço Apache com o comando:
1 2 3 4 5 6 |
# systemctl restart httpd |
Instalando o Certificado
Acesse o servidor Issabel via SSH e execute os comandos para realizar a instalação do certificado
1 2 3 |
# yum install python2-certbot-apache |
Após a instalação vamos gerar um novo certificado SSL.
Execute o comando abaixo, será necessário responder algumas questões para configuração do certificado.
Primeiro informe o número do domínio listado que deseja instalar o certificado.
Na segunda opção informe se não deseja redirecionar todas as requisições HTTP para o HTTPS (opção 1) ou se deseja redirecionar todas as requisições para HTTPS (opção 2).
sudo certbot –apache
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 |
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator apache, Installer apache Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org Which names would you like to activate HTTPS for? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: pbx.meudominio.com.br - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate numbers separated by commas and/or spaces, or leave input blank to select all options shown (Enter 'c' to cancel): 1 Obtaining a new certificate Performing the following challenges: http-01 challenge for pbx.meudominio.com.br Waiting for verification... Cleaning up challenges Resetting dropped connection: acme-v02.api.letsencrypt.org Created an SSL vhost at /etc/httpd/conf.d/ssl-le-ssl.conf Deploying Certificate to VirtualHost /etc/httpd/conf.d/ssl-le-ssl.conf Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2 Enhancement redirect was already set. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://pbx.meudominimo.com.br You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=pbx.meudominio.com.br - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/pbx.meudominio.com.br/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/pbx.meudominio.com.br/privkey.pem Your cert will expire on 2019-04-07. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew" - Some rewrite rules copied from /etc/httpd/conf.d/ssl.conf were disabled in the vhost for your HTTPS site located at /etc/httpd/conf.d/ssl-le-ssl.conf because they have the potential to create redirection loops. - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le |
Pronto! O certificado SSL foi instalado com sucesso e você pode verificar a validade acessando o site
https://www.ssllabs.com/ssltest/analyze.html?d=pbx.meudominio.com.br
Se durante a instalação surgir algum erro, você pode consultar o log gerado em:
1 2 3 |
# cat /var/log/letsencrypt/letsencrypt.log |
Verificando Certificados
Para verificar os certificados existentes execute o comando:
1 2 3 |
# certbot certificates |
Resultado:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Found the following certs:
Certificate Name: pbx.meudominio.com.br
Domains: pbx.meudominio.com.br
Expiry Date: 2019-04-07 16:51:32+00:00 (VALID: 89 days)
Certificate Path: /etc/letsencrypt/live/pbx.meudominio.com.br/fullchain.pem
Private Key Path: /etc/letsencrypt/live/pbx.meudominio.com.br/privkey.pem
Excluindo certificado
Para excluir o certificado execute o comando seguido do nome do certificado.
1 2 3 |
# certbot delete --cert-name pbx.meudominio.com |
Resultado:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Deleted all files relating to certificate PBX.
Para maiores informações sobre como administrar os certificados SSL acesse a documentação oficial em https://certbot.eff.org/docs/using.html#managing-certificates.