Categories: How To

Generate Let’s Encrypt Certificate with DNS Challenge

Step 1 — Install Let’s Encrypt Certbot

Let’s Encrypt provides CLI namely Certbot to generate the certificate

sudo apt install certbot

Step 2 — Generate new certificate using Certbot

The command to generate the cert is relatively simple. You can do for single domain, for multiple domains then just needs to append -d DOMAIN. In this case I used *.DOMAIN so that the certificate can be used for subdomain as well. The wizard will ask for a few simple information.

sudo certbot certonly --manual --preferred-challenges dns -d "*.DOMAIN"

Step3 — Setting DNX TXT ACME Challenge in Namecheap

Once Y is entered in the previous step, Certbot will revert with ACME challenge token to be configured in DNS provider to allow verification. Copy the token and insert as TXT record in DNS console of Namecheap.

Please set TTL to 1 minute to allow Top-level DNS servers to pick up this new subdomain — _acme-challenge.DOMAIN. You can verify this DNS TXT record using nslookup before proceed with verification.

nslookup -type=TXT _acme-challenge.DOMAIN

Step 4 — Verify the domain challenge

Press Enter and Certbot will continue with the verification process.

Step 5 — Retrieve the certificate

You will hit permission error when trying to retrieve the file. This is due to folder permission of /etc/letsencrypt/liveis set to root. Therefore we can set permission to allow other users to read via sudo chmod +x /etc/letsencrypt/live

After that you can extract the fullchain.pem and privkey.pem for ingress / route / web server configuration.

Reference: here

ferisetyawanmyid

Recent Posts

10 Essential Linux Commands Every SysAdmin Should Know

As a Linux System Administrator, mastering the command line is key to efficiently managing servers,…

4 weeks ago

🚀 How to Install WireGuard with Docker on Ubuntu 24.04 (wg-easy Dashboard)

Introduction WireGuard is a fast, lightweight, and modern VPN protocol designed for simplicity and performance.If…

2 months ago

How To Install Certbot on Ubuntu 24.04: Set Up Let’s Encrypt for Apache and Nginx

Securing your website with HTTPS is essential for privacy, SEO ranking, and user trust. Let’s…

2 months ago

Best SSH Clients for Linux: Top Tools for Secure Remote Connections

If you manage Linux servers regularly, you know how important SSH (Secure Shell) is. Whether…

2 months ago

🐧 Best Linux Distributions for Beginners and Daily Use (2025 Edition)

If you’re new to Linux or thinking about switching from Windows or macOS, this guide…

2 months ago

Essential SRE Tools That Run on Linux

Introduction Site Reliability Engineering (SRE) has become a critical discipline in modern IT operations. The…

3 months ago

This website uses cookies.