GoAdmio

dns

Add one or all hosted domains to Cloudflare and set up their DNS zone, proxy and cache mode, nameservers, and SSL

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

/go/dns puts hosted domains on Cloudflare in one step. For each domain it:

It does the work by calling cloudflare and ssl. The call is appended to /var/log/go/dns.log.


Quick start

# Add one domain to Cloudflare (DNS only, proxy off)
/go/dns example.com

Before the first run, save your Cloudflare Account ID and API token under GoAdmio Dashboard > Cloudflare API, and give the token the permissions it needs. Without them the command prints a reminder box and exits.


Syntax

/go/dns <domain> [--cache [--override] | --nocache]
/go/dns all [--cache [--override] | --nocache]
/go/dns quick
Form Behavior
/go/dns <domain> Sets up one hosted domain. Prints <domain> not exists. if /home/<domain>/www is missing.
/go/dns all Sets up every hosted domain, one after another.
/go/dns quick For every hosted domain, deletes the main A record and adds it again with the proxy off.

The second argument is ignored. Options are found anywhere in the command line.


Options

Option Proxy Cache Notes
(none) Off Not changed DNS only.
--cache On Mode respect Uses Cloudflare caching.
--cache --override On Mode override --override only has an effect together with --cache.
--nocache On Cache turned off Proxied, but not cached.

quick ignores all options.


Output

The command prints a progress line per domain in all and quick runs:

[3/42] example.com...

The rest of the output comes from cloudflare and ssl.

Message Meaning
Cloudflare API Configuration Required (boxed) The Account ID or API token is not saved. Set them under GoAdmio Dashboard > Cloudflare API.
<domain> not exists. The domain has no /home/<domain>/www folder.

Examples

# One domain, DNS only
/go/dns example.com
# One domain, proxied with Cloudflare caching that respects the site's headers
/go/dns example.com --cache
# One domain, proxied with Cloudflare overriding the site's cache headers
/go/dns example.com --cache --override
# One domain, proxied but not cached
/go/dns example.com --nocache
# Every hosted domain, proxied and cached
/go/dns all --cache
# Refresh the main A record of every hosted domain, proxy off
/go/dns quick

Troubleshooting

Symptom Likely cause Fix
Boxed Cloudflare API Configuration Required message No Account ID or API token saved. Add them in the dashboard, with the permissions the token needs.
<domain> not exists. No /home/<domain>/www folder. Check the spelling, or create the account with create.
Email stopped working after the run The domain's mail records were cleared. Add the records again with mx, spf, dkim, and dmarc. See What it deletes.
Site verification TXT records disappeared All TXT records were cleared. Add them again with txt.
Domain is in Cloudflare but traffic doesn't go through it The registrar still uses the old nameservers. Change the nameservers at the registrar to the ones Cloudflare assigned.
No certificate after the run ssl could not issue one. Run ssl for the domain and read its output.
Folders that aren't domains are processed A /scripts folder exists (see Details). Remove /scripts, or run for one domain at a time.

Details

Steps for each domain

  1. Checks that /home/<domain>/www exists.
  2. Looks up the domain's MX records with dig to decide whether to clear mail records.
  3. Adds the domain to Cloudflare (cloudflare --action addsite).
  4. If the domain qualifies, deletes all TXT and MX records from the zone.
  5. Sets the proxy and cache mode from the options.
  6. Runs cloudflare --action nameservers.
  7. If /etc/letsencrypt/live/<domain> doesn't exist, runs ssl <domain> --skipbackupssl.

quick replaces all of this with two calls per domain: cloudflare --action DeleteMainARecord, then cloudflare adda --proxy off.

What it deletes

[!WARNING] Step 4 removes every TXT and MX record in the Cloudflare zone, including SPF, DKIM, DMARC, and site-verification records.

The records are kept only when the domain's current MX lookup returns two or more records, or mentions google, zoho, or outlook. A domain with a single MX record at another provider, or one whose lookup fails or returns nothing, is cleared. Check the domain's mail setup before running all.

Hosted domains

A folder in /home counts as a hosted domain when it contains a www folder. If a /scripts folder exists on the server, every entry in /home passes this check, and so does any domain name you type.


See also

Command Description
cloudflare Manage DNS records using Cloudflare's API
proxy Change Cloudflare's proxy setting
purge Delete the Cloudflare edge cache (purge everything)
mx Add an MX record to a domain through Cloudflare
txt Add a TXT record to a domain through Cloudflare
spf Add or refresh the SPF TXT record via Cloudflare
dkim Add a DKIM TXT record to a domain's Cloudflare DNS (auto-generated or custom value)
dmarc Add a DMARC TXT record to a domain's Cloudflare DNS (auto-generated or custom value)
ssl Install an SSL certificate for a domain in GoAdmio
zone Create, update, or delete a DNS zone file and register it with BIND