Keywords: Let's Encrypt | SSL Certificate | Certbot | Domain Expansion | Web Server Configuration
Abstract: This article provides a comprehensive guide on adding new domains to existing Let's Encrypt SSL certificates using Certbot. Through analysis of common erroneous commands and correct solutions, it explains the working principle of the --expand parameter, the importance of complete domain lists, and suitable scenarios for different authentication plugins. The article includes specific command-line examples, step-by-step instructions, and best practice recommendations to help users avoid common configuration errors and ensure successful certificate expansion.
Problem Background and Common Error Analysis
When managing SSL certificates, there is often a need to add new domains to existing certificates. Many users attempt to use incomplete commands, resulting in the creation of new certificates rather than expanding existing ones. For example, users might erroneously execute:
./letsencrypt-auto certonly --cert-path /etc/letsencrypt/archive/example.com --expand -d test.example.com
This command creates a new certificate folder named test.example.com-0001 instead of expanding the original certificate. Another common error is:
./letsencrypt-auto renew --expand -d orange.fidka.com
This command fails because renew only works for expired certificates.
Core Principles of the Correct Solution
The correct method to add domains to an existing certificate is to reissue the certificate with a complete list of all domains that should be covered, including the original domains. Certbot's --expand parameter is specifically designed for this purpose, as clearly stated in the official documentation: "If an existing cert covers some subset of the requested names, always expand and replace it with the additional names."
Detailed Operational Steps
Assuming the original certificate already covers example.com and www.example.com, and you need to add click.example.com. The correct command format is:
/opt/certbot/certbot-auto certonly --webroot --agree-tos -w /srv/www/letsencrypt/ --expand -d example.com,www.example.com,click.example.com
The key aspects of this command include:
- Using the
--expandparameter to explicitly indicate expanding the existing certificate - Listing all domains in the
-dparameter, including both original and new domains - Maintaining the same authentication method (e.g.,
--webroot) as the original certificate
Variant Commands for Different Environments
For environments using the Apache plugin, the following command format can be used:
sudo certbot certonly --cert-name example.com -d m.example.com,www.m.example.com
This command specifies the certificate to modify using --cert-name and lists all domains in the -d parameter.
Common Issues and Solutions
When performing certificate expansion operations, you might encounter the error "Client with the currently selected authenticator does not support any combination of challenges that will satisfy the CA." This typically indicates that the currently selected authenticator cannot meet the CA's challenge requirements. Solutions include:
- Ensuring the authentication plugin used (e.g.,
--webroot,--apache) matches the server environment - Verifying that domain resolution correctly points to the server
- Confirming that the webroot path is accessible
Necessary Steps After Operation
After successfully expanding the certificate, you need to restart the web server to load the new certificate configuration:
sudo systemctl restart nginx # For Nginx
sudo systemctl restart apache2 # For Apache
This step ensures the server uses the updated certificate files.
Best Practice Recommendations
To avoid issues in production environments, it is recommended to:
- Back up existing configurations before performing any certificate modification operations
- Verify command effects in a test environment
- Document all used command parameters for future reference
- Regularly check certificate status and expiration times
By following these guidelines, users can safely and efficiently manage domain expansion requirements for Let's Encrypt certificates.