/go/cloudflare is the single entry point GoAdmio uses to manage Cloudflare. Depending on the options you pass, it can: Every operation works on one domain, or on every hosted domain at once with –domain all. Domains marked API Ignore in GoAdmio are always skipped. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.
Quick start
# 1. Save your Cloudflare credentials once
/go/cloudflare --cloudflareaccountid <account-id> --cloudflareapitoken <token>
# 2. Point a domain at this server and apply the standard settings
/go/cloudflare --domain example.com
Options
| Option | Required | Default | Notes |
|---|---|---|---|
--domain |
Yes | — | A domain that exists in /home, or all for every hosted domain. See Which domains are processed. |
--type |
No | — | Selects a record type or record operation. See Types. |
--action |
No | — | Selects an action. See Actions. |
--name |
No | @ |
Record name for --type txt and --type cname. |
--value |
No | Depends on the operation | Record content, IP, or TTL. See each operation. |
--priority |
No | 0 |
MX priority for --type mx. |
--proxy |
No | Off | on, true, or 1 turns the Cloudflare proxy (orange cloud) on. Any other value, or no value, turns it off. |
--cloudflareaccountid |
No | — | Saves the account ID, then exits. |
--cloudflareapitoken |
No | — | Saves the API token, then exits. |
--mode |
No | respect |
Accepted but not used by the script. |
An unrecognized option stops the command with MAIL: Unknown parameter: <option>. The MAIL: prefix is a label left over from another script. Nothing is changed.
Prerequisites
| Requirement | Details |
|---|---|
| Credentials | Saved in the Config table of /var/lib/sqlite/config.db. Without them the command prints a "Cloudflare API Configuration Required" box and exits. |
| API token permissions | Must cover the operations you use: reading zones, editing DNS, editing zone settings, firewall access rules, cache rules, page rules, bot management, and creating or deleting zones. Check Cloudflare’s current permission names when you create the token. |
| Zones in Cloudflare | Each domain must exist in the Cloudflare account, except when you use --action addsite. |
| Tools | curl, sqlite3, and dig. jq is needed for the status messages of spf, dmarc, txt, cname, and mx. ping and gawk are needed when an external SMTP host is configured. |
| Internet access | To api.cloudflare.com, checkip.amazonaws.com, and icanhazip.com. |
Examples
# Save credentials
/go/cloudflare --cloudflareaccountid <account-id> --cloudflareapitoken <token>
# Point one domain at this server (DNS only, no proxy)
/go/cloudflare --domain example.com
# Point every hosted domain at this server with the Cloudflare proxy on
/go/cloudflare --domain all --proxy on
# Switch a domain to Google Workspace mail
/go/cloudflare --domain example.com --action google
# Add a verification TXT record
/go/cloudflare --domain example.com --type txt --name _verify --value "abc123"
# Add a proxied CNAME
/go/cloudflare --domain example.com --type cname --name blog --value example.com --proxy on
# Add an MX record
/go/cloudflare --domain example.com --type mx --value mail.example.net --priority 10
# Refresh the SPF record
/go/cloudflare --domain example.com --type spf
# Show Cloudflare nameservers (and update the registrar if configured)
/go/cloudflare --domain example.com --action nameservers
# Set SSL mode to strict: pass the value in both options
/go/cloudflare --domain example.com --action strict --type strict
# Enable edge caching, then set a 4-hour browser cache
/go/cloudflare --domain example.com --action cache
/go/cloudflare --domain example.com --action browser --value 14400
# Add a new site to Cloudflare, then fetch its nameservers
/go/cloudflare --domain example.com --action addsite
/go/cloudflare --domain example.com --action nameservers
Output
There is no single output format. Typical lines:
[1/12] Configuring DNS for example.com...
[2/12] Skipping DNS Configuration for example.net | Excluded Domains
[3/12] Adding A Record 203.0.113.10 (example.org) | Success.
Adding SPF Record for example.com | Success
Adding DMARC Record for example.com | Zone does not exist
| Output | Meaning |
|---|---|
[N/C] Configuring DNS for <domain>... |
Default mode is running for this domain. |
Skipping DNS Configuration for <domain> | Excluded Domains |
The domain is flagged API Ignore in GoAdmio (the --apiignore option of create). |
Record already exists. / Success. / Failed. |
Result of adding a single record, where the command checks it. |
Adding <type> Record for <domain> | Success or | <message> |
Result for spf, dmarc, txt, cname, and mx. The message is Cloudflare’s own error text. |
| Raw JSON | Some delete operations print Cloudflare’s full response. |
| Nothing | Default mode, addsite, cache, full/strict/flexible/off, and several others print no result. Check the domain in Cloudflare to confirm. |
[!NOTE]
The exit status is1for most paths, including successful ones. Do not use it to detect failure in scripts.
Security
[!WARNING]
The whole command line is written to/var/log/go/cloudflare.log. If you save credentials with--cloudflareapitoken, the token is stored in that log in plain text, and it is also visible in your shell history and the process list. Remove the entry from the log after saving credentials, or save them from the GoAdmio dashboard instead (Cloudflare API).
The token is stored unencrypted in config.db. Dynadot and ResellerClub nameserver updates send their API keys in the URL over plain http (port 2020) to the helper server configured in GoAdmio.
See the full reference at /go/cloudflare and the GoAdmio command index.
GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.
