Instalar certificados SSL Let’s Encrypt en Apache en Linux Ubuntu

Para instalar certificados SSL Let’s Encrypt en Apache en Linux Ubuntu primero debes instalar certbot con el siguiente comando desde una terminal.

sudo apt install certbot python3-certbot-apache

Para que certbot pueda de forma automática instalar los certificados necesarios en tu servidor primero debes haber configurado Virtualhosts, si no sabes como hacerlo te dejo a continuación el link del paso a paso.

Ahora para obtener los certificados ejecuta el siguiente comando desde una Terminal.
sudo certbot –apache

Este comando te retornara un mensaje como el siguiente donde debes colocar una cuenta de correo valida donde te llegaran mensajes sobre renovaciones o de seguridad.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): nombre@dominio

Después de agregar el correo y presionar Enter te pedira que aceptes los terminos de servicio.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

Luego de presionar Enter te mostrara los dominios que configuraste como VirtualHosts, aqui puedes seleccionarlos tecleando el numero que lo representa o simplemente presionando Enter sin colocar ningún numero para que los tome todos y veras un mensaje como el siguiente.

Obtaining a new certificate
Performing the following challenges:
http-01 challenge for your_domain
http-01 challenge for www.your_domain
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/your_domain-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/your_domain-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/your_domain-le-ssl.conf
Deploying Certificate to VirtualHost /etc/apache2/sites-available/your_domain-le-ssl.conf

Al finalizar este paso te preguntara si quieres que las consultas por HTTP se redirijan automáticamente a HTTPS, deberemos digitar el numero 2 y luego Enter como se muestra a continuación.

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

Listo el mensaje a continuación te dice que el certificado Letsencrypt fue correctamente instalado, ahora solo debes probar en un navegador para confirmar que todo este bien.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://your_domain and
https://www.your_domain

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=your_domain
https://www.ssllabs.com/ssltest/analyze.html?d=www.your_domain
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/your_domain/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/your_domain/privkey.pem
   Your cert will expire on 2020-07-27. 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"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - 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

Deja un comentario