Playbook: DNS, TLS and SSL
Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.
Two layers are involved:
- DNS at a provider. Records live at Cloudflare (the supported provider), handled
through control-plane operations
dns_*. No agent is needed. - Certificates on the box. Let’s Encrypt certificates are issued and renewed by the
agent with
ssl.*job kinds. Wildcard, Cloudflare Origin and custom certificates are handled throughdns_*operations that then install the certificate on a server.
Cloudflare DNS, SSL and wildcard certificates are available on every plan.
1. Point a domain at a server
Section titled “1. Point a domain at a server”Token: operate for record create and update. Deleting a record needs full +
data:delete, and connecting a provider needs full + webhooks:admin.
-
Find the server’s public IP:
servers_ip_get {id}(usestored, orobservedwhen there is no stored address). -
Check that the zone is connected:
dns_connections_listlists connections and their zones (only the token’s last 4 characters are shown). If there’s none, the user connects Cloudflare at/connect/dns, or you calldns_connections_create {body: {provider: "cloudflare", token, account?}}(the token needs Zone.DNS edit). -
Look at the existing records:
dns_records_list {query: {domain: "example.com"}}. -
Create the record:
{ "body": { "domain": "example.com", "type": "A", "name": "shop.example.com","content": "203.0.113.10", "ttl": 1, "proxied": false } }This is
dns_records_create.domainselects the zone, andttl: 1means automatic. To change a record, calldns_records_update {id: <provider record id>, body: {…same fields}}. -
Verify resolution from the box:
jobs_create dns.lookup {domain: "shop.example.com"}.
Two-level names: Cloudflare’s free edge certificate covers only the apex and one label
below it, so never proxy a name such as app.dev.example.com — keep it proxied: false and
issue Let’s Encrypt on the box. The record MZPanel creates for a new site follows this rule.
Proxied (orange-cloud) records: if the zone runs Cloudflare in Full (strict) mode, a Cloudflare Origin certificate on the server is an alternative to Let’s Encrypt (see below).
2. Issue a Let’s Encrypt certificate
Section titled “2. Issue a Let’s Encrypt certificate”Token: operate. HTTP-01 needs the record to resolve to the server and port 80 to be
reachable.
jobs_create {id, body: {type: "ssl.issue", domain: "shop.example.com"}}, then polljobs_get.- Verify:
ssl_list {server}(core tool, live) orservers_inventory {id, kind: "ssl"}show the certificate and its expiry. - Force HTTPS:
ssl.https-redirect {domain, enabled: true}.
site.create with sslMode: "auto" (the default) already tries to issue a certificate
when the site is created.
3. Renew
Section titled “3. Renew”- Preview, then renew: core
ssl_renew {server, domain?}runs a dry run, andssl_renew {…, apply: true}renews for real. Leave outdomainto renew every certificate that is due. - Or as a job:
ssl.renew {domain?, dryRun?}. - Per-domain auto-renew:
ssl.auto-renew {domain, enabled}. - Remove a certificate:
ssl.delete {domain}.
4. Wildcard, Origin and custom certificates
Section titled “4. Wildcard, Origin and custom certificates”Token: full.
| Need | Operation | Body |
|---|---|---|
Wildcard *.example.com (ACME DNS-01 through the connected zone) | dns_wildcard_cert | {serverId, domain} |
| List or stop tracking wildcards | dns_wildcard_certs_list · dns_wildcard_certs_delete {id} (data:delete) | |
| Cloudflare Origin certificate installed on a server | dns_origin_cert | see GET /v1/api/operations |
| Generate a CSR on a server (to buy a certificate) | dns_csr (operate) | |
| Install a custom or paid certificate | dns_install_cert | see GET /v1/api/operations |
Wildcards need a managed (agent) server and a connected zone that covers the domain.
5. CDN
Section titled “5. CDN”dns_edge_get {query: {domain}}tells you whether a connected zone fronts the domain.dns_edge_purge {body: {domain, urls: [...]}}purges up to 500 URLs (operate).
Authoritative DNS on your own server (BIND9)
Section titled “Authoritative DNS on your own server (BIND9)”If the user runs their own nameserver on a box (the bind9 extension), zones and
records are job kinds: dns.zone-list, dns.zone-create {domain, ip},
dns.record-list, dns.record-add {domain, name, recordType, value, ttl?, priority?},
dns.record-del, dns.ns-get / dns.ns-set {ns, rname?} and dns.reload. Deleting a
whole zone (dns.zone-delete) needs data:delete.
Common failures
Section titled “Common failures”ssl.issuefailed: the record doesn’t resolve to this server yet (checkdns.lookup), port 80 is blocked, or Let’s Encrypt rate-limited repeated attempts. Wait before retrying.dns_records_createreturnsnot_foundor400: no connected zone coversdomain, or the provider token lacks DNS edit permission.dns_connections_verify {id}re-checks it.wildcard_failed(502): the DNS-01 challenge failed at the provider. Read the message.