Instalar certificado Let’s Encrypt con Certbot en CentOS 7

Home » CentOS » Instalar certificado Let’s Encrypt con Certbot en CentOS 7
CentOS, Linux No Comments

Certbot está empaquetado en EPEL (paquetes adicionales para Enterprise Linux). Para utilizar CertBot es necesario habilitar el respositorio EPEL y habilitar el canal opcional EPEL.

 

Preinstalación

yum -y install yum-utils
yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional

 

Instalación de CertBot para Apache

yum install certbot-apache

 

Certbot tiene un plugin de Apache bastante sólido de calidad beta, que es compatible con muchas plataformas, y automatiza tanto la obtención como la instalación de certs.

sudo certbot --apache

 

A continuación el sistema nos solicitará una cuenta de correo de contacto y para que dominio deseas activar el certificado SSL.

sudo certbot --apache
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): **********@gmail.com
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org

-------------------------------------------------------------------------------
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-v01.api.letsencrypt.org/directory
-------------------------------------------------------------------------------
(A)gree/(C)ancel: a

-------------------------------------------------------------------------------
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about EFF and
our work to encrypt the web, protect its users and defend digital rights.
-------------------------------------------------------------------------------
(Y)es/(N)o: y
Starting new HTTPS connection (1): supporters.eff.org

Which names would you like to activate HTTPS for?
-------------------------------------------------------------------------------
1: javierandres.es
2: www.javierandres.es
-------------------------------------------------------------------------------
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:
tls-sni-01 challenge for javierandres.es
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/httpd/conf.d/javierandres-le-ssl.conf
Deploying Certificate for javierandres.es to VirtualHost /etc/httpd/conf.d/javierandres-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
Redirecting vhost in /etc/httpd/conf.d/javierandres.conf to ssl vhost in /etc/httpd/conf.d/javierandres-le-ssl.conf

-------------------------------------------------------------------------------
Congratulations! You have successfully enabled https://javierandres.es

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/javierandres.es/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/javierandres.es/privkey.pem
   Your cert will expire on 2018-03-14. 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

 

Renovación

Certbot se puede configurar para renovar sus certificados automáticamente antes de que caduquen. Como los certificados Let’s Encrypt duran 90 días, es muy recomendable aprovechar esta característica. Puede probar la renovación automática de sus certificados ejecutando este comando:

certbot renew --dry-run
 certbot renew --dry-run
Saving debug log to /var/log/letsencrypt/letsencrypt.log

-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/javierandres.es.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.api.letsencrypt.org
Renewing an existing certificate
Performing the following challenges:
tls-sni-01 challenge for javierandres.es
Waiting for verification...
Cleaning up challenges

-------------------------------------------------------------------------------
new certificate deployed with reload of apache server; fullchain is
/etc/letsencrypt/live/javierandres.es/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/javierandres.es/fullchain.pem (success)
** DRY RUN: simulating 'certbot renew' close to cert expiry
**          (The test certificates above have not been saved.)
-------------------------------------------------------------------------------

 

Si parece que funciona correctamente, puede organizar la renovación automática agregando un trabajo cron o systemd que ejecute lo siguiente:

certbot renew

 

Para más información: https://certbot.eff.org/

LEAVE A COMMENT