Automated Let’s Encrypt DNS validation w/ Certbot

When securing a website with an SSL/TLS certificate, domain validation is a critical step to prove ownership or control over the domain. One of the most secure and automation-friendly methods for this is DNS-based domain validation. This method involves creating specific DNS records that a Certificate Authority (CA) can query to verify domain ownership.

This article provides a step-by-step guide on how Webnames.ca’s REST API can help you automate certificate issuance via an ACME client and temporary modification of DNS TXT validation records on domains in your Webnames account. The instructions below explain how to achieve this using Certbot, a free, open-source ACME client for Linux environments.

Prerequisites

For either method, you will need:

Install snap and snapd package manager

sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
sudo dnf upgrade
sudo yum install snapd
sudo ln -s /var/lib/snapd/snap /snap
[boot]
systemd=true
sudo systemctl enable --now snapd.socket

Install Certbot

sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo chmod +x webnames-certbot-auth-hook.sh
sudo chmod +x webnames-certbot-cleanup-hook.sh

Instructions

export WEBNAMES_API_USERNAME="webnamesuser_20250924154912_feebdaed"
export WEBNAMES_API_KEY="odsifj30$49j4ggg_340fqivm9j"
sudo -E certbot certonly --manual --manual-auth-hook /path/to/the/webnames-certbot-auth-hook.sh --manual-cleanup-hook /path/to/the/webnames-certbot-cleanup-hook.sh --preferred-challenges dns -d "sub.example.ca"

Notes

Further reading