Create a wildcard certificate using let’s encrypt manually

Let’s encrypt has become the number one choice on certificates since it is free and although it is short lived, there is an abundance of tools out there making sure that your certificate will be updated on time.
This post will go through creating a wildcard let’s encrypt certificate using the dns challenge.
All you need is a domain name registered and you being able to add a txt dns record.

I assume you have the latest version of certbot installed. If not you can always run certbot through docker.

docker run -it --entrypoint=/bin/sh certbot/certbot

First step is to issue

certbot certonly --server https://acme-v02.api.letsencrypt.org/directory --work-dir ./work-dir/ --config-dir ./config-dir --logs-dir ./logs-dir/ --manual --preferred-challenges dns -d *.{your domain name}

You will have some questions on the command prompt which you should answer.
Once done you will end up with a screen asking you to take action and add a DNS txt record.

Please deploy a DNS TXT record under the name
_acme-challenge.{your domain} with the following value:

Once you put the entry to your dns record you need to wait until your txt record gets propagated

One of the ways to check if it is ready, is to use the nslookup method on another terminal.

nslookup -type=TXT _acme-challenge.{your domain}

This might take a while so feel free to use the watch command

watch -n 1 nslookup -type=TXT _acme-challenge.{your domain}

Once done you can press enter and your let’s encrypt certificates shall be generated and this would be the result on your screen.

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   {path}/fullchain.pem
   Your key file has been saved at:
   {path}privkey.pem
   Your cert will expire on 2018-08-28. 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

Now that you have your chain certificate and your private key and your are ready to use them to your applications.

One thought on “Create a wildcard certificate using let’s encrypt manually

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.