This article explains how to create SSL certificates using Let’s Encrypt’s manual plugin. You may need to generate these free SSL certificates in situations like the ones below, particularly when the automated method is not an option.
- No direct access to the Web Server.
- Unsupported/custom web server setups.
- Creating wildcard certificates which require DNS challenge
You can use the following command to generate free SSL certificates with Let’s Encrypt via certbot using the manual plugin. Certbot uses Let’s Encrypt to generate certificates by default.
1. Installing Certbot
Certbot is the official Let’s Encrypt client:
sudo apt-get install software-properties-commonsudo add-apt-repository ppa:certbot/certbotsudo apt-get updatesudo apt-get install certbotFurther installation instructions can be found in their official guide.
2. Generating a Certificate
This command will prompt you to provide an email address for notifications. It will then generate a TXT record that needs to be added to your DNS provider for certbot to verify domain ownership.
certbot certonly --manual --preferred-challenges=dns --key-size 4096 -d mydomain.com -d www.mydomain.com
# COMMAND BREAKDOWN# --manual: Indicates you want to handle the DNS challenge manually.# --preferred-challenges=dns: Tells Certbot to use the DNS challenge method.# --key-size 4096: Specifies that you want to use a 4096-bit RSA key for better security.# -d mydomain.com -d www.mydomain.com: This includes both the root domain mydomain.com and subdomain www.mydomain.com to ensure that both are covered by the certificate.# you can give a wildcard domain to this if needed.3. Verifying the domain ownership
Certbot will output specific DNS records (TXT records) that you need to add to your DNS provider to complete the DNS verification process. Following is a sample output,
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Please deploy a DNS TXT record under the name:
_acme-challenge.mydomain.com.
with the following value:
5lBTUVMngGj346hseQgIqAE29JusY76g2moq2gnETVBuw
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Once you’ve added the required DNS records, Certbot will verify domain ownership and issue the certificate. It may take a few minutes for the DNS to update the TXT records. If everything is successful, certbot will display the locations where the certificates are saved locally.
Successfully received certificate.Certificate is saved at: /etc/letsencrypt/live/mydomain.com/fullchain.pemKey is saved at: /etc/letsencrypt/live/mydomain.com/privkey.pemThis certificate expires on 2024-12-19.These files will be updated when the certificate renews.Please note that these certificates are valid for only 90 days, and since they were created using the manual plugin, auto-renewal is not enabled. You will need to renew them manually.
Cheers !!
