What is a Wildcard Certificate?
In computer networking, a wildcard certificate is a public key certificate which can be used with multiple subdomains of a domain. The principal use is for securing web sites with HTTPS, but there are also applications in many other fields. Compared with conventional certificates, a wildcard certificate can be cheaper and more convenient than a certificate for each subdomain.
A single wildcard certificate for
https://*.secops.in will secure all these subdomains on the
Instead of getting separate certificates for subdomains, you can use a single certificate for all main domains and subdomains and reduce cost.
Because the wildcard only covers one level of subdomains (the asterisk doesn’t match full stops), these domains would not be valid for the certificate:
The “naked” domain is valid when added separately as a Subject Alternative Name (
Who is LetsEncrypt!
Let’s Encrypt is a free, automated, and open certificate authority (CA), run for the public’s benefit. It is a service provided by the Internet Security Research Group (ISRG).
Let’s Encrypt gives people the digital certificates they need in order to enable HTTPS (SSL/TLS) for websites, for free, in the most user-friendly way we can. We do this because we want to create a more secure and privacy-respecting Web.
The key principles behind Let’s Encrypt are:
- Free: Anyone who owns a domain name can use Let’s Encrypt to obtain a trusted certificate at zero cost.
- Automatic: Software running on a web server can interact with Let’s Encrypt to painlessly obtain a certificate, securely configure it for use, and automatically take care of renewal.
- Secure: Let’s Encrypt will serve as a platform for advancing TLS security best practices, both on the CA side and by helping site operators properly secure their servers.
- Transparent: All certificates issued or revoked will be publicly recorded and available for anyone to inspect.
- Open: The automatic issuance and renewal protocol will be published as an open standard that others can adopt.
- Cooperative: Much like the underlying Internet protocols themselves, Let’s Encrypt is a joint effort to benefit the community, beyond the control of any one organization.
More detailed information about how the Let’s Encrypt CA works.
What is Certbot?
Certbot is an easy-to-use automatic client that fetches and deploys SSL/TLS certificates for your webserver. Certbot was developed by EFF and others as a client for Let’s Encrypt and was previously known as “the official Let’s Encrypt client” or “the Let’s Encrypt Python client.” Certbot will also work with any other CAs that support the ACME protocol.
While there are many other clients that implement the ACME protocol to fetch certificates, Certbot is the most extensive client and can automatically configure your webserver to start serving over HTTPS immediately. For Apache, it can also optionally automate security tasks such as tuning ciphersuites and enabling important security features such as HTTP → HTTPS redirects, OCSP stapling, HSTS, and upgrade-insecure-requests.
Certbot is part of EFF’s larger effort to encrypt the entire Internet. Websites need to use HTTPS to secure the web. Along with HTTPS Everywhere, Certbot aims to build a network that is more structurally private, safe, and protected against censorship.
Certbot is the work of many authors, including a team of EFF staff and numerous open source contributors.
Steps to generate Free Let’s Encrypt Wildcard SSL Certificate
Step#1: Install latest Certbot
$ wget https://dl.eff.org/certbot-auto $ chmod a+x ./certbot-auto $ sudo mv certbot-auto /usr/bin/certbot
Proceed to Step#2
Step#2: Generate the wildcard certificate with DNS Challenge (Eg. Domain: *.secops.in)
$ sudo certbot certonly \ --server https://acme-v02.api.letsencrypt.org/directory \ --manual --preferred-challenges dns \ -d *.secops.in -d secops.in
An important parameter to notice is
--server https://acme-v02.api.letsencrypt.org/directory, which will instruct the Certbot client to use v2 of the Let’s Encrypt API (we need that for wildcard certs). Also notice 2 domains, one is a wildcard and the second one is for TLD(Top Level Domain) as the wildcard does not cover TLD’s or records in subdomains (explained in the first section)
The Certbot client will walk you through the process of registering an account, and it will instruct you on what to do to complete the challenges.
Proceed to Step#3
Step#3: Create a DNS TXT Record as instructed in the “secops.in” DNS Zone File
------------------------------------------------------------------------------- Please deploy a DNS TXT record under the name _acme-challenge.secops.in with the following value: 02HdxCLqTbjvjtO7mnLV1XXXXXXExamplEONlyabC Before continuing, verify the record is deployed. ------------------------------------------------------------------------------- Press Enter to Continue
Proceed to Step#4 for results
Step#4: Successful or Unsuccessful Messages
A Successful message would look like:
IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/secops.in/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/secops.in/privkey.pem Your cert will expire on 2018-07-22. To obtain a new or tweaked version of this certificate in the future, simply run certbot again. To non-interactively renew *all* of your certificates, run "certbot renew" - 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
Your certificate and chain have been saved at: /etc/letsencrypt/live/secops.in/fullchain.pem
Your key file has been saved at: /etc/letsencrypt/live/secops.in/privkey.pem
An Unsuccessful message would look like:
Failed authorization procedure. secops.in (dns-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Incorrect TXT record "02HdxCLqTbjvjtO7mnxxxxXXxXxXHGZM2LlNXCSgOTQTzlp51ARngrBadcOnFigYvtv6SOg-BadcOnFigLts37Q0" found at _acme-challenge.secops.in IMPORTANT NOTES: - The following errors were reported by the server: Domain: secops.in Type: unauthorized Detail: Incorrect TXT record "02HdxCLqTbjvjtO7mnxxxxXXxXxXHGZM2LlNXCSgOTQTzlp51ARngrBadcOnFigYvtv6SOg-BadcOnFigLts37Q0" found at _acme-challenge.secops.in To fix these errors, please make sure that your domain name was entered correctly and the DNS A/AAAA record(s) for that domain contain(s) the right IP address.
In such cases, please recheck your DNS TXT Record using DNS lookup tools like dig, nslookup etc. as shown below:
$ dig TXT _acme-challenge.secops.in ; <<>> DiG 9.10.6 <<>> TXT _acme-challenge.secops.in ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10301 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;_acme-challenge.secops.in. IN TXT ;; ANSWER SECTION: _acme-challenge.secops.in. 225 IN TXT "ECtBiSVn-qIufdfzHLTTlWVx09mWAv8MbzSZGFBbkQc" ;; Query time: 33 msec ;; SERVER: 18.104.22.168#53(22.214.171.124) ;; WHEN: Mon Apr 23 14:04:44 IST 2018 ;; MSG SIZE rcvd: 154
From the output above, it is clear that the TXT Record setup is not showing up the correct value as provided in Step#3. Hence re-run the tool and always ensure that the TXT Record should be setup as suggested for a Successful SSL Wildcard certificate generation.