-
-
Save iborba/050d715244e64f32fc81dc5ce00294ea to your computer and use it in GitHub Desktop.
Geração de Certificado SSL com Let's Encrypt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Geração de certificado SSL com o Let's Encrypt | |
#1) Instalação | |
sudo apt-get update | |
sudo apt-get install software-properties-common | |
sudo add-apt-repository ppa:certbot/certbot | |
sudo apt-get update | |
sudo apt-get install certbot | |
#2) Geração de um novo certificado | |
Opção via HTTP Challenge: | |
sudo certbot certonly --manual | |
Criar arquivo conforme solicitado no servidor. | |
Opção via DNS Challenge: | |
sudo certbot certonly --manual --preferred-challenges dns | |
Criar DNS conforme solicitado no servidor. | |
-> Serão gerados 4 arquivos no seguinte diretório /etc/letsencrypt/archive/{domain}: | |
-> cert1.pem, chain1.pem, fullchain1.pem, privkey1.pem | |
-> Apenas o usuário root consegue acessar estes arquivos, é necessário alterar o owner e do arquivos: | |
-> sudo chown -R username:username /etc/letsencrypt/archive/{domain} | |
-> Mover arquivos gerados para o diretório do usuário corrente: | |
-> sudo mv /etc/letsencrypt/archive/{domain} ~ | |
-> Geração do arquivo .pfx: | |
-> openssl pkcs12 -export -in cert1.pem -inkey privkey1.pem -out cert.pfx -certfile fullchain1.pem | |
Arquivo cert.pfx gerado! | |
No azure, para fazer o challenge eh necessario: | |
-> Em WWWROOT (raiz) criar a estrutura de pastas determinada pelo challenge, geralmente .well-known/acme-challenge | |
-> No web.config adicionar as tags abaixo dentro de <staticContent> | |
<remove fileExtension="." /> | |
<mimeMap fileExtension="." mimeType="text/plain" /> | |
No windows, é necessário: | |
-> Fazer a instalação do arquivo .pfx gerado (boto direito > instalar > next, next next.) [necessario inserir a senha gerada anteriormente] | |
-> Atualizar o certificado no IIS | |
* Botão direito no app | |
* Edit Bindings | |
* Selecionar porta 443 | |
* Edit | |
* Em SSL Certificate, clicar em Select e marcar o novo certificado instalado (cuidar data de validade) | |
* Next, Next, Next | |
** Antes de aceitar o desafio (fazer um teste no postman) | |
Referências: | |
https://letsencrypt.org/ | |
https://certbot.eff.org/lets-encrypt/ubuntuartful-other |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to restore the Private Key in SSL Certificate ?
The is another utility (CertUtil) which can be used to re-generate/repair the private keys for the certificates.
Start -> mmc.exe -> Add snap-in -> Certificates -> Computer account. Verify that the installed certificate appears in the “Personal/Certificates” tab. If not, import it. A missing private key is visualized by the icon next to the certificate not containing a key icon.