Escribí hace un tiempo sobre Let’s Encrypt, la primera organización de certificación que emite certificados gratuitos y de manera automática. Contaba entonces cómo obtener certificados Let’s Encrypt. Desde entonces la manera de obtener certificados ha cambiado: ahora es más sencillo obtenerlos, renovarlos, anularlos… Hago un repaso aquí de los comandos necesarios para mantener certificados Let’s Encrypt.

Herramienta de la EFF para saber cómo instalar certbot en función del sistema operativo y el servidor web usado.
Para instalar cerbot, la Electronic Frontier Foundation pone a disposición una herramienta web en la que, eligiendo el sistema operativo y el servidor web usado, devuelve la versión de certbot
y las instrucciones precisas para instalarla y su uso básico.
certbot-auto se actualiza automáticamente, junto con todas sus dependencias. Cada vez que se ejecuta se comprueba si la versión instalada es la última; si no lo es, se inicia automáticamente la actualización:
user@server:$ sudo certbot-auto -h Upgrading certbot-auto 1.2.0 to 1.3.0... Replacing certbot-auto... Creating virtual environment... Installing Python packages... Installation succeeded. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - certbot-auto [SUBCOMMAND] [options] [-d DOMAIN] [-d DOMAIN] ... |
Listar los certificados gestionados por Let’s Encrypt
user@server:$ sudo certbot-auto certificates - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Found the following certs: Certificate Name: example.net Domains: example.net www.example.net Expiry Date: 2020-06-02 07:50:47+00:00 (VALID: 42 days) Certificate Path: /etc/letsencrypt/live/example.net/fullchain.pem Private Key Path: /etc/letsencrypt/live/example.net/privkey.pem |
Expedir un nuevo certificado
user@server:$ sudo certbot-auto certonly --webroot -w /var/www/example.org -d example.org -d www.example.org --dry-run |
Renovar un certificado
user@server:$ sudo certbot-auto renew --cert-name example.org --force-renewal Saving debug log to /var/log/letsencrypt/letsencrypt.log - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Processing /etc/letsencrypt/renewal/example.org.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Plugins selected: Authenticator webroot, Installer None Renewing an existing certificate Performing the following challenges: http-01 challenge for example.org http-01 challenge for www.example.org Waiting for verification... Cleaning up challenges - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - new certificate deployed without reload, fullchain is /etc/letsencrypt/live/example.org/fullchain.pem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations, all renewals succeeded. The following certs have been renewed: /etc/letsencrypt/live/example.org/fullchain.pem (success) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
La opción --force-renewal
fuerza la renovación incluso si la fecha de caducidad del certificado no está cercana. Se puede aplicar la opción --dry-run
también al comando de renovación.
Modificar un certificado: añadir o eliminar dominios
Para añadir al certificado example.org, el subdominio subdomain.example.org:
user@server:$ sudo certbot-auto certonly --cert-name examplel.org -d example.org -d www.example.org -d subdomain.example.org |
Para eliminar un dominio de un certificado basta no incluirlo en el comando anterior:
user@server:$ sudo certbot-auto certonly --cert-name examplel.org -d example.org -d subdomain.example.org |
Anular un certificado
user@server:$ sudo certbot-auto revoke --cert-path /etc/letsencrypt/live/example.org/cert.pem Saving debug log to /var/log/letsencrypt/letsencrypt.log - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you like to delete the cert(s) you just revoked, along with all earlier and later versions of the cert? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es (recommended)/(N)o: Y - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted all files relating to certificate example.org. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully revoked the certificate that was located at /etc/letsencrypt/live/example.org/fullchain.pem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
Solo se pueden anular los certificados que no hayan caducado.
Para eliminar del sistema todos los archivos de un certificado ya caducado o anulado:
user@server:$ sudo certbot-auto delete --cert-name example.org Saving debug log to /var/log/letsencrypt/letsencrypt.log - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted all files relating to certificate example.org. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
La documentación oficial de Let’s Encrypt recoge todos los usos de certbot.
2 comentarios
Encantado de aterrizar en este blog maravilloso
Gracias por las explicaciones me han ayudado mucho.