Skip to content
Home » Wildcard domain configuration on Digital Ocean using Route 53

Wildcard domain configuration on Digital Ocean using Route 53

Wildcard domain configuration is a useful tool that enables website owners to direct multiple subdomains under a single domain to the same IP address, simplifying the management of multiple websites. DigitalOcean is a popular hosting service that offers a wide range of features, including the ability to configure wildcard domains. In this article, we will explore how to configure wildcard domains on DigitalOcean.

This is a useful technique for managing large numbers of subdomains without having to create individual DNS entries for each subdomain. This technique allows you to direct all subdomains of a particular domain to a single server or group of servers.

What is a Wildcard Domain?

A wildcard domain is a domain name that matches all subdomains of a particular domain. For example, if you have a domain called familiconnect.com, a wildcard domain configuration will enable you to match all subdomains such as blog.familiconnect.com, my-family.familiconnect.com, and so on.

Route 53
Now, let’s get into the specifics of how to set up a wildcard domain on Digital Ocean using Route 53.

Step 1: Create a new domain in Route 53
The first step is to create a new domain in Route 53. If you already have a domain registered with Route 53, skip to step 2. If not, you’ll need to register a new domain first.To create a new domain in Route 53, log in to your AWS account and navigate to the Route 53 dashboard. Click on “Create Hosted Zone” and follow the prompts to create a new domain. Make sure to note the nameservers provided by Route 53, as you’ll need to update your domain’s DNS settings to use these nameservers.

Step 2: Add a wildcard DNS record to your domain
Once you have a domain set up in Route 53, the next step is to add a wildcard DNS record. This DNS record will match any subdomain of your domain and route traffic to a particular server or group of servers.

To add a wildcard DNS record, navigate to your domain’s hosted zone in Route 53 and click on “Create Record Set”. In the “Name” field, enter * to create a wildcard record. In the “Type” field, select the appropriate record type (e.g. A, CNAME, etc.) and enter the IP address or domain name of the server or group of servers that you want to route traffic to.

Step 3: Update your domain’s DNS settings to use Route 53 nameservers
The final step is to update your domain’s DNS settings to use the nameservers provided by Route 53. This will ensure that DNS queries for your domain are handled by Route 53 and that the wildcard DNS record you just created is used to route traffic to your server or group of servers.

To update your domain’s DNS settings, log in to your domain registrar’s dashboard (e.g. GoDaddy, Namecheap, etc.) and find the DNS settings section. Update the nameservers to use the ones provided by Route 53.

Once you’ve completed these steps, your domain should be set up to use a wildcard DNS record to route traffic to a particular server or group of servers. You can add additional subdomains as needed by creating new DNS records in Route 53.

what is Certbot?

Certbot is a popular and free, open-source tool used to obtain and install SSL/TLS certificates for websites. It automates the process of obtaining, installing, and configuring SSL/TLS certificates, making it easier for website owners to secure their sites. One of the challenges that website owners face when using Certbot is verifying domain ownership during the certificate issuance process. This is where certbot-dns-digitalocean comes in.

Certbot-dns-digitalocean is a plugin that automates the process of verifying domain ownership by using DigitalOcean’s DNS API. DigitalOcean is a cloud hosting provider that offers various services, including DNS hosting. The certbot-dns-digitalocean plugin allows you to automatically create, update, and delete DNS records in DigitalOcean’s DNS service to prove ownership of a domain.

The following are some of the benefits of using certbot-dns-digitalocean:
  1. Automated DNS Record Management: With certbot-dns-digitalocean, you don’t have to manually create and update DNS records to prove domain ownership. The plugin automatically creates and deletes DNS records in DigitalOcean’s DNS service during the certificate issuance process.
  2. Improved Security: SSL/TLS certificates help to secure website traffic by encrypting data exchanged between the website and its users. With certbot-dns-digitalocean, website owners can easily obtain and install SSL/TLS certificates, making their sites more secure.
  3. Time-Saving: Verifying domain ownership can be a time-consuming process, especially when done manually. Certbot-dns-digitalocean automates this process, saving website owners time that they can use to focus on other important tasks.
Getting Started with Certbot-dns-digitalocean

By using DigitalOcean APIs, dns_digitalocean automates the creation and removal of TXT records for DNS-01 challenges (DNS01). There is no default installation of the plugin. You can install it by going to certbot.eff.org, selecting your system, and selecting Wildcard.

To use certbot-dns-digitalocean, follow these steps:

  1. Install the Plugin: To install the plugin, run the following command:
sudo apt-get install certbot python3-certbot-dns-digitalocean

2. Generate an API Token:
To use this plugin, you will need a configuration file containing DigitalOcean API credentials, which can be found on the Applications & API Tokens page of your DigitalOcean account. In the host root directory, create the digitalocean.ini file with all permissions.

~/.secrets/certbot/digitalocean.ini

# DigitalOcean API credentials used by Certbot
dns_digitalocean_token = 0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff

Whenever Certbot detects that another user has access to your credentials file, it will issue a warning. A warning appears stating “Unsafe permissions on credentials configuration file”, followed by the credentials file’s path. Each time Certbot uses the credentials file, including for renewal, this warning will be emitted. Nothing can be done to silence this warning except fixing the problem (e.g., restricting access to the credentials file using chmod 600).

3. Run Certbot with the Plugin: To run Certbot with the plugin, use the following command:

In order to acquire a wildcard certificate for *.familiconnect.com

certbot certonly \
  --dns-digitalocean \
  --dns-digitalocean-credentials ~/.secrets/certbot/digitalocean.ini \
  -d familiconnect.com \
  -d '*.familiconnect.com'


In order to acquire a wildcard certificate for *.familiconnect.com waiting 60 seconds for DNS propagation

#dns-digitalocean-propagation-seconds can be increase in seconds like 60, 120

certbot certonly \
  --dns-digitalocean \
  --dns-digitalocean-credentials ~/.secrets/certbot/digitalocean.ini \
  --dns-digitalocean-propagation-seconds 60 \
  -d familiconnect.com \
  -d '*.familiconnect.com'

In this command, replace familiconnect.com with your domain name, and *.familiconnect.com with any additional subdomains you want to include in the SSL/TLS certificate.

4. Follow the On-Screen Prompts: Certbot will prompt you to choose the type of SSL/TLS certificate you want to generate and will ask for your API token. Once you provide the necessary information, Certbot will automatically create and delete DNS records in DigitalOcean’s DNS service to prove ownership of your domain.

Certbot-dns-digitalocean is a useful tool for website owners who want to obtain and install SSL/TLS certificates using Certbot. The plugin automates the process of verifying domain ownership by using DigitalOcean’s DNS service, making it easier for website owners to secure their sites.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments