RedNet Cloud/Docs 中文 EN
RedNet Cloud is an enterprise Web protection management platform. Go + Gin REST API backend, Vue 3 SPA frontend, with the zcloud CLI for automation.

This document belongs to RedNet Cloud — Enterprise Web Protection Management Platform
CLI tool: zcloud · 6 modules: auth / config / sys / guard / analytics / tools
Full API index: /api/openapi.json · Sitemap: /sitemap.xml · AI Quick Read: /llms.txt


Full CLI Command Reference

What is zcloud

zcloud is the official CLI for RedNet Cloud, built on Cobra. It mirrors 100% of the management console's core operations across 98 commands organized in 6 modules (auth / config / sys / guard / analytics / tools).

The binary is distributed dynamically by the backend at /api/cli/version, and supports linux/darwin × amd64/arm64.

Installation

See Quickstart, or:

curl -fsSL <api_url>/api/cli/install.sh | sh
zcloud version

Common Flags

The following flags are valid for every command (inherited from the root):

Flag Type Description
--api-url string Override api_url for a single invocation
--insecure bool Skip TLS verification (self-signed certs)
--profile string Use a specific profile (defaults to active)
--format enum Output format: table / json / yaml (default table)
--verbose bool Print request details for debugging
--quiet bool Quiet mode: suppress success notices and pagination info; data on stdout and errors on stderr are unaffected
--yes / -y bool Auto-answer "yes" to any confirmation prompt (equivalent to -f on every delete command)
--help / -h bool Help for the current command

1. Authentication (auth)

Command Description Example
zcloud auth login Interactive login (prompts for username and password, password is hidden); credentials are written to ~/.zcloud/credentials.toml zcloud auth login
zcloud --api-url <URL> auth login Override the API URL for this session, then log in zcloud --api-url https://waf.example.com auth login
zcloud --insecure auth login Skip TLS verification when logging in (self-signed certs, internal testing only) zcloud --insecure auth login
zcloud auth logout Log out of the current session, clear local token zcloud auth logout
zcloud auth info Show current identity and permissions zcloud auth info --format json
zcloud auth apikey create --name N [--scopes K1,K2] [--expires-days N] Issue a new API key (plaintext returned only once, save it immediately) zcloud auth apikey create --name "prod-integration" --expires-days 30
zcloud auth apikey list [--page N] [--size N] List your own / your OEM API keys zcloud auth apikey list --format json
zcloud auth apikey revoke <key-id> [-f] Revoke an API key (idempotent soft-delete, audit trail preserved) zcloud auth apikey revoke 8f21c0c5-... -f
zcloud auth apikey renew <key-id> --add-days N Extend an API key's expiry (--add-days required, 1-365 days) zcloud auth apikey renew 8f21c0c5-... --add-days 90
zcloud auth apikey revoke-all [--user-id U] [--reason R] [-f] Revoke ALL active API keys of a user in one shot (emergency lockdown; --user-id is platform-level only, empty = yourself) zcloud auth apikey revoke-all -f --reason "possible credential leak"
zcloud auth apikey logs <key-id> [--event call|manage] [--page N] [--size N|--limit N] List audit logs for the given key (default event=call, call traces) zcloud auth apikey logs 8f21c0c5-... --limit 50
zcloud auth apikey stats <key-id> [--since 24h|7d|30m] Aggregate stats for the given key (success rate / error breakdown / top endpoints / last-1h QPS) zcloud auth apikey stats 8f21c0c5-... --since 24h

Bound APIs: POST /api/auth/login / POST /api/auth/logout / GET /api/auth/userinfo / GET\|POST\|DELETE /api/sys/api-keys[/<id>] / PUT /api/sys/api-keys/<id>/renew / POST /api/sys/api-keys/revoke-all / GET /api/sys/api-keys/<id>/logs / GET /api/sys/api-keys/<id>/stats

API Key invocation: send Authorization: ApiKey zck_<prefix>.<secret> (parallel channel to Bearer session). effective_perms = user.RBAC ∩ key.scope; empty scope = inherit user RBAC fully.

2. Configuration (config)

Command Description Example
zcloud config set <key> <value> Set a config key in the active profile zcloud config set api_url https://waf.example.com
zcloud config get <key> Read a config key from the active profile zcloud config get api_url
zcloud config list List all config keys in the active profile zcloud config list
zcloud config profiles list List all profiles zcloud config profiles list
zcloud config profiles create <name> Create an empty profile (no flags; the first profile is auto-activated) zcloud config profiles create prod
zcloud config profiles activate <name> Switch the active profile zcloud config profiles activate prod
zcloud config profiles delete <name> Delete a profile zcloud config profiles delete dev

After creating a profile, run zcloud --profile <name> config set api_url <URL> to write the api_url and other settings.
The profiles create command takes only one positional argument <name> and does not accept any flags.

config commands are local only and do not call the backend.

3. sys Module (System Management)

3.1 Users (sys users)

Command Description Example
zcloud sys users list [--page N] [--size N] [--keyword K] Paginated user list zcloud sys users list --page 1 --size 20
zcloud sys users describe <uuid> User detail zcloud sys users describe abc-123-...
zcloud sys users create --username U --password P [--nick-name N] [--email E] [--mobile M] [--comment C] Create user (--username and --password are required; no --oem-id / --display-name flag exists) zcloud sys users create --username u1 --password '***' --nick-name 'Ops A'
zcloud sys users update <uuid> [--nick-name N] [--email E] [--mobile M] [--comment C] Update user basics (incremental, only changed flags are sent) zcloud sys users update abc-123 --nick-name 'Ops A'
zcloud sys users delete <uuid> [-f] Delete user (-f skips confirm; or use the global -y) zcloud sys users delete abc-123 -f
zcloud sys users reset-password <uuid> --password NEW Reset password (--password required) zcloud sys users reset-password abc-123 --password 'New***'
zcloud sys users lock <uuid> [--locked true|false] Lock / unlock account (--locked defaults to true) zcloud sys users lock abc-123 --locked false
zcloud sys users assign-roles <uuid> --role-ids 1,2,3 Assign roles (required --role-ids, comma-separated) zcloud sys users assign-roles abc-123 --role-ids 5,6

3.1.1 Zombie WeChat bindings (sys wx-zombies)

Command Description Example
zcloud sys wx-zombies cleanup [--service-ids ID1,ID2] [--max-pages N] Dry-run scan for local WeChat bindings whose openid no longer appears in the official account follower list zcloud sys wx-zombies cleanup --max-pages 50
zcloud sys wx-zombies cleanup --apply [--max-pages N] Apply cleanup: clear users.wx_union_id/wx_nick_name, matching alert_receivers.weixin, and weixin_userinfo zcloud sys wx-zombies cleanup --apply --max-pages 50

Safety: the command uses WeChat user/get follower lists for set difference instead of per-user user/info calls. Hitting --max-pages aborts to avoid false positives. If the follower list is empty while local bindings exist, --apply is refused unless --allow-empty-followers is explicitly set.

3.2 Roles (sys roles)

Command Description Example
zcloud sys roles list [--page N] [--size N] [--keyword K] List roles zcloud sys roles list
zcloud sys roles create --name N [--level L] [--comment C] Create role (--level defaults to 1) zcloud sys roles create --name Operator --level 10
zcloud sys roles update <id> [--name N] [--level L] [--comment C] Update role (incremental, only changed flags are sent) zcloud sys roles update 5 --name 'Senior Operator'
zcloud sys roles delete <id> [-f] Delete role (-f skips confirm; or use global -y) zcloud sys roles delete 5 -f
zcloud sys roles get-permissions <id> Show current permissions zcloud sys roles get-permissions 5
zcloud sys roles set-permissions <id> --permissions K1,K2,K3 Replace permissions (overwrite; required) zcloud sys roles set-permissions 5 --permissions guard.domain.list,guard.domain.view

3.3 OEMs (sys oems)

Command Description Example
zcloud sys oems list [--page N] [--size N] [--keyword K] List OEMs zcloud sys oems list
zcloud sys oems configs Current OEM branding / company info zcloud sys oems configs
zcloud sys oems describe <uuid> OEM detail zcloud sys oems describe oem-abc
zcloud sys oems create --name N --hostname H [--tag T] [--comment C] Create OEM (--name and --hostname required) zcloud sys oems create --name 'Customer A' --hostname a.example.com
zcloud sys oems update <uuid> [--name N] [--hostname H] [--tag T] [--comment C] Update OEM (incremental) zcloud sys oems update oem-abc --name 'New'
zcloud sys oems delete <uuid> [-f] Delete OEM zcloud sys oems delete oem-abc -f
zcloud sys oems get-setting <uuid> <key> Read OEM setting zcloud sys oems get-setting oem-abc theme
zcloud sys oems set-setting <uuid> <key> <value> Write OEM setting zcloud sys oems set-setting oem-abc theme dark

3.4 Sessions (sys sessions)

Command Description Example
zcloud sys sessions list [--page N] [--size N] [--keyword K] List active sessions zcloud sys sessions list
zcloud sys sessions kill <session-id> [-f] Force-kick a session zcloud sys sessions kill sess-xxx -f

3.5 Operation Audit (sys audit-logs)

Command Description Example
zcloud sys audit-logs list [--page N] [--size N] [--keyword K] [--start TS] [--end TS] Operation audit records (--start / --end take Unix seconds or milliseconds, bounds inclusive) zcloud sys audit-logs list --start 1786518806 --size 50
zcloud sys audit-logs login-records list [--page N] [--size N] [--keyword K] [--start TS] [--end TS] Login history (same time filter semantics as operation audit) zcloud sys audit-logs login-records list --start 1786518806
zcloud sys audit-logs permissions Permission tree (with i18n names) zcloud sys audit-logs permissions --format json

4. guard Module (Web Protection)

4.1 Domains (guard domains)

Command Description Example
zcloud guard domains list [--page N] [--size N] [--keyword K] List domains zcloud guard domains list
zcloud guard domains describe <domain-id> Domain detail zcloud guard domains describe 12
zcloud guard domains create --domain D --policy-id P [--asset-name A] Create domain (--domain and --policy-id both required; find policy IDs with policies list) zcloud guard domains create --domain api.example.com --policy-id 1 --asset-name "Main Site"
zcloud guard domains update <domain-id> [--asset-name A] [--policy-id P] Update domain (incremental; at least one flag) zcloud guard domains update 12 --policy-id 2
zcloud guard domains delete <domain-id> [-f] Delete domain zcloud guard domains delete 12 -f
zcloud guard domains audit <domain-id> --audit-status <2|3|4> Audit a domain (2=in review, 3=rejected, 4=approved; unapproved domains are not pushed to protection nodes, approval automatically triggers config distribution; --audit-status required) zcloud guard domains audit 12 --audit-status 4
zcloud guard domains get-settings <domain-id> Read full domain config zcloud guard domains get-settings 12
zcloud guard domains src-check-peers <domain-id> Peers probing the same origin (read-only; the node uses the smallest interval per origin) zcloud guard domains src-check-peers 12
zcloud guard domains set-settings <domain-id> --key K --value V Write a single domain setting (KV mode, not a JSON file) zcloud guard domains set-settings 12 --key cc_protect --value enable
zcloud guard domains set-origin-status <domain-id> --service-id N --status enable|disable [--ip I --port P [--line L]] Toggle a service or a single origin inside it (omit --ip to toggle the whole service; the two levels are independent) zcloud guard domains set-origin-status d_8a3b1c --service-id 1 --ip 10.0.0.9 --port 80 --status disable

4.1.1 Domain Node Assignment (guard domains nodes)

Which protection nodes a domain is bound to determines which nodes carry its traffic. Successful assign/remove calls trigger config re-distribution; lock only changes state without re-distribution. sync is an ops reconciliation tool: it fully aligns node bindings of ALL domains with the upstream (aeg) per-user node allocation (adding missing bindings, removing surplus ones) — run it once after nodes are reclaimed to batch-clean ghost bindings. It overwrites manual per-domain fine-grained assignment; for day-to-day incremental assignment use assign (the console no longer exposes the sync entry, CLI only).

Command Description Example
zcloud guard domains nodes list --domain-id D List nodes assigned to the domain (with lock status; --domain-id required) zcloud guard domains nodes list --domain-id d_8a3b1c
zcloud guard domains nodes available --domain-id D List nodes still assignable to the domain (account node pool minus already-assigned; --domain-id required) zcloud guard domains nodes available --domain-id d_8a3b1c
zcloud guard domains nodes assign --domain-id D --node-ids n1,n2 [--enable-parse] Assign nodes to the domain (--node-ids comma-separated, 1-100 items; nodes are synced into CNAME DNS records, --enable-parse enables the records at the same time; success triggers re-distribution) zcloud guard domains nodes assign --domain-id d_8a3b1c --node-ids n-a,n-b
zcloud guard domains nodes remove --domain-id D --node-id N Remove a node from the domain (protective rejections: DNS records still enabled / disabled less than 30 minutes ago / node IP used by port forwarding / would empty the default line; both flags required) zcloud guard domains nodes remove --domain-id d_8a3b1c --node-id n-a
zcloud guard domains nodes lock --domain-id D --node-id N --lock-status 1|2 Lock/unlock a domain node (2=locked: rendering and distribution skip the node while the binding is kept, 1=back to normal; all three flags required) zcloud guard domains nodes lock --domain-id d_8a3b1c --node-id n-a --lock-status 2
zcloud guard domains nodes sync [--user-id U] Ops reconciliation: fully align node assignments (cleans up reclaimed nodes; overwrites manual fine-grained assignment; --user-id lets platform admins target one customer) zcloud guard domains nodes sync

4.1.2 Domain Anti-Brute-Force (guard domains brute-force)

Per-domain request-rate rules: when the same source IP / bot session exceeds the request threshold against a given URI within the counting window, the configured action is executed (block / redirect / captcha, etc.). Rules live in a shared table and are distributed to nodes; successful create/update/delete calls trigger config re-distribution. Unit flags (--req-time-unit/--block-time-unit/--window-unit) only accept the enum names ReqUnit_1_PSec (seconds) / ReqUnit_2_PMin (minutes). update overwrites the whitelisted fields as a whole row: optional flags not given are written as zero values; --status defaults to true — use --status=false to disable a rule. Weak-password interception is not part of this group — use zcloud guard domains set-settings (the guard_weak_password_setting key).

Command Description Example
zcloud guard domains brute-force list --domain-id D List the domain's anti-brute-force rules (descending by rule ID; --domain-id required) zcloud guard domains brute-force list --domain-id d_8a3b1c
zcloud guard domains brute-force create --domain-id D --name N --describe S --uri U --rate N --rate-time N --req-time-unit U --level ip|bot_session --action-type A [--block-time N] [--block-time-unit U] [--code C] [--content S] [--limit N] [--window N] [--window-unit U] [--jump-addr J] Create a rule (rule ID is server-generated, enabled on creation; --action-type is one of block/pass/jump/log/js_check/meta_check/captcha; the 9 flags --domain-id through --action-type are required; success triggers re-distribution) zcloud guard domains brute-force create --domain-id d_8a3b1c --name login-guard --describe "login rate limit" --uri /login --rate 10 --rate-time 60 --req-time-unit ReqUnit_1_PSec --level ip --action-type block --block-time 10 --block-time-unit ReqUnit_2_PMin
zcloud guard domains brute-force update --domain-id D --rule-id R <same rule-field flags as create> [--status] Update a rule (whitelisted fields overwritten as a whole row; --rule-id must belong to the domain; --status defaults to true, --status=false disables the rule; success triggers re-distribution) zcloud guard domains brute-force update --domain-id d_8a3b1c --rule-id 20220414 --name login-guard --describe "login rate limit" --uri /login --rate 20 --rate-time 1 --req-time-unit ReqUnit_2_PMin --level bot_session --action-type captcha
zcloud guard domains brute-force delete --domain-id D --rule-id R Delete a rule (detached from the domain and physically removed; both flags required; success triggers re-distribution) zcloud guard domains brute-force delete --domain-id d_8a3b1c --rule-id 20220414

4.1.3 Domain Cache Actions (guard domains cache)

Warm up / purge the domain's CDN cache. Both commands are asynchronous: the server builds a cache instruction and dispatches it to the nodes through the legacy-platform gen (zRPC cmd=554 → MQ) — send-and-return: nothing is persisted, there is no execution-result query, and command success only means the instruction was submitted to the dispatch channel. --resources maps to the request-body field cache_res (multiple resource paths separated by comma/space/newline; may be empty). Cache rules / advanced config / warm-up resource list are not part of this group — use zcloud guard domains get-settings / set-settings (the cache_config_v2_setting key).

Command Description Example
zcloud guard domains cache warm --domain-id D [--resources R] Warm up cache resources (--domain-id required, --resources may be empty; asynchronous, send-and-return) zcloud guard domains cache warm --domain-id d_8a3b1c --resources "/index.html,/static/app.js"
zcloud guard domains cache purge --domain-id D [--resources R] Purge cache resources (--domain-id required, --resources may be empty; asynchronous, send-and-return) zcloud guard domains cache purge --domain-id d_8a3b1c --resources "/index.html,/static/app.js"

4.1.4 DNS Advanced Settings (guard domains dns-advance)

Advanced DNS scheduling settings: auto return-to-origin, minimum active node records, IPv6 checks (1:1 with the zmod "DNS Advanced Settings" dialog). update overwrites all four fields as a group (all required); every other key stored in disp_config_setting (total_count/ava_ratio/max_count/auto_switch, etc.) is preserved server-side. The three toggle flags take booleans and are converted to the CFGOPTION_1_DISABLE/CFGOPTION_2_ENABLE string enum names on the wire. The IPv6 toggles are the master switch for dual-stack access: saving does not touch existing DNS records; AAAA records are generated/removed on the next zcloud guard schedules init rebuild.

Command Description Example
zcloud guard domains dns-advance describe --domain-id D Get the DNS advanced settings (--domain-id required) zcloud guard domains dns-advance describe --domain-id d_8a3b1c
zcloud guard domains dns-advance update --domain-id D --auto-switch-case N --auto-return-source B --src-ipv6-check B --default-ipv6-check B Update the DNS advanced settings (all five flags required; --auto-switch-case 1-1000) zcloud guard domains dns-advance update --domain-id d_8a3b1c --auto-switch-case 1 --auto-return-source=false --src-ipv6-check=true --default-ipv6-check=true

4.2 Certificates (guard certs)

Command Description Example
zcloud guard certs list [--page N] [--size N] [--keyword K] List certs zcloud guard certs list
zcloud guard certs describe <cert-id> Cert detail zcloud guard certs describe 3
zcloud guard certs upload --name N [--type tls|ntls|nokey] --cert F [--key F] [--sign-cert F] [--sign-key F] [--no-key-tls-addr A] [--ssl-password-file P] Upload cert (PEM). --type defaults to tls; ntls (GM) needs all four of --sign-cert/--sign-key/--cert/--key; nokey (keyless) needs --cert plus --no-key-tls-addr zcloud guard certs upload --name star --cert ./fullchain.pem --key ./private.key
zcloud guard certs update <cert-id> [--name N] [--type T] [--cert F] [--key F] [--sign-cert F] [--sign-key F] [--no-key-tls-addr A] [--ssl-password-file P] Replace cert (incremental). Material you omit is carried over from the stored record, but only while the type is unchanged; --type switches the type and never carries over the private key, signing pair or keyless address. Omitting --ssl-password-file keeps the passphrase; passing an empty string clears it zcloud guard certs update 3 --cert ./new.pem --key ./new.key
zcloud guard certs delete <cert-id> [-f] Delete cert zcloud guard certs delete 3 -f
zcloud guard certs bind <cert-id> --domain-id D Bind cert to domain (--domain-id required) zcloud guard certs bind 3 --domain-id 12
zcloud guard certs unbind <cert-id> --domain-id D Unbind cert from domain (--domain-id required) zcloud guard certs unbind 3 --domain-id 12

Three certificate types (--type, maps to the API's certificate_type):

# Standard TLS (default, --type can be omitted)
zcloud guard certs upload --name star --cert ./fullchain.pem --key ./private.key

# GM NTLS: signing pair + encryption pair, all four are mandatory (material must really be SM2, otherwise 400)
zcloud guard certs upload --name gm-2026 --type ntls \
  --sign-cert ./sign.pem --sign-key ./sign.key --cert ./enc.pem --key ./enc.key

# Keyless: the private key stays on the customer's own server; only the address is reported
zcloud guard certs upload --name keyless-2026 --type nokey \
  --cert ./fullchain.pem --no-key-tls-addr 10.0.0.9:8443

4.3 Policies (guard policies)

Command Description Example
zcloud guard policies list [--page N] [--size N] [--keyword K] List policies zcloud guard policies list
zcloud guard policies describe <policy-id> Policy detail zcloud guard policies describe 8
zcloud guard policies create --name N [--comment C] Create policy zcloud guard policies create --name p1
zcloud guard policies update <policy-id> [--name N] [--comment C] Update policy zcloud guard policies update 8 --name p1-v2
zcloud guard policies delete <policy-id> [-f] Delete policy zcloud guard policies delete 8 -f
zcloud guard policies copy <policy-id> [--name N] [--user-id U] [--domain-id D]... Copy policy (deep-copy config + rules, optionally attach domains) zcloud guard policies copy pol_xxx --name copy
zcloud guard policies geo-config describe <policy-id> Show geo blocking config zcloud guard policies geo-config describe pol_xxx
zcloud guard policies geo-config update <policy-id> --mode M [--oversea] [--world-list L] [--prov-list L] [--city-list L] [--stime N] [--etime N] Update geo blocking (pending publish) zcloud guard policies geo-config update pol_xxx --mode black --oversea
zcloud guard policies sensitive-config describe <policy-id> Show sensitive-data protection config (read-only; edit via console) zcloud guard policies sensitive-config describe pol_xxx
zcloud guard policies crawler-config describe <policy-id> Show anti-crawler config (read-only; edit via console) zcloud guard policies crawler-config describe pol_xxx
zcloud guard policies global-blacklist-config describe <policy-id> Show collaborative defense config (read-only; edit via console) zcloud guard policies global-blacklist-config describe pol_xxx
zcloud guard policies pending-changes <policy-id> Show pending (unpublished) changes zcloud guard policies pending-changes pol_xxx
zcloud guard policies set-feature <policy-id> <feature-key> [--enabled] [--mode M] Toggle feature; waf supports --mode disable|log|block zcloud guard policies set-feature pol_xxx waf --mode log

4.4 Black/White Lists (guard bwlist)

Command Description Example
zcloud guard bwlist sets list [--page N] [--size N] [--keyword K] List sets zcloud guard bwlist sets list
zcloud guard bwlist sets describe <set-id> Show set detail (scope, target domains, enabled/disabled counts, last apply time) zcloud guard bwlist sets describe 5
zcloud guard bwlist sets create --name N --type black|white [--policy-id P] [--describe D] Create a list group (--name/--type required; bind policies via bind-policies; --policy-id binds one policy at create time) zcloud guard bwlist sets create --name block-cn --type black
zcloud guard bwlist sets update <set-id> [--name N] [--describe D] Update a list group (name/describe). No --status: groups have no enable/disable, toggling is per-IP (ips set-status) zcloud guard bwlist sets update 5 --name new-name
zcloud guard bwlist sets policies <set-id> Show policies bound to a list group zcloud guard bwlist sets policies 5
zcloud guard bwlist sets domains <set-id> Domains directly bound to the list (independent of policy binding; either path takes effect) zcloud guard bwlist sets domains 5
zcloud guard bwlist sets summary Account-level list-group counts (black/white/CDN-white/total) zcloud guard bwlist sets summary
zcloud guard bwlist sets bind-policies <set-id> --policy-ids P1,P2 Set the policies a list group is bound to (replace; empty = unbind all) zcloud guard bwlist sets bind-policies 5 --policy-ids p1,p2
zcloud guard bwlist sets bind-domains <set-id> --domain-ids d1,d2 Overwrite the domains directly bound to the list (writes each domain's domain_bwl_config_setting and dispatches; empty = unbind all) zcloud guard bwlist sets bind-domains 5 --domain-ids d1,d2
zcloud guard bwlist sets delete <set-id> [-f] Delete set zcloud guard bwlist sets delete 5 -f
zcloud guard bwlist ips list <set-id> [--page N] [--size N] List IPs in set (includes expiry column) zcloud guard bwlist ips list 5
zcloud guard bwlist ips add <set-id> --ip IP Add single IP (--ip required). No expiry parameter: list entries have no TTL, matching zmod zcloud guard bwlist ips add 5 --ip 1.2.3.4
zcloud guard bwlist ips batch-add <set-id> --ips IP1,IP2,... Bulk-add IPs (comma-separated string; does NOT accept --file; duplicates skipped) zcloud guard bwlist ips batch-add 5 --ips 1.2.3.4,5.6.7.8
zcloud guard bwlist ips set-status <ip-id> --status enable|disable Enable/disable a single IP (--status required) zcloud guard bwlist ips set-status 100 --status disable
zcloud guard bwlist ips delete <ip-id> [-f] Delete a single IP zcloud guard bwlist ips delete 1234 -f
zcloud guard bwlist ips batch-delete <set-id> --ip-ids ID1,ID2,... Bulk-delete IPs (comma-separated IP entry IDs, scoped to the set) zcloud guard bwlist ips batch-delete 5 --ip-ids 100,101,102 -f
zcloud guard bwlist ips check-conflicts <set-id> --ips a,b Pre-add check: are these IPs already in an opposite-color set (allowlist wins; exact match; informational) zcloud guard bwlist ips check-conflicts 5 --ips 1.2.3.4

4.5 WAF Rules (guard waf)

Command Description Example
zcloud guard waf rules list [--page N] [--size N] [--policy-id P] List rule groups zcloud guard waf rules list
zcloud guard waf rules create --name N --policy-id P [--describe D] [--scope S] [--action 1|2|3] [--status 1|2] [--waf-type N] Create rule group (--name and --policy-id required; action 1=block / 2=log / 3=captcha) zcloud guard waf rules create --name sqli-1 --policy-id 8 --action 1
zcloud guard waf rules update <rule-id> [--name N] [--describe D] [--scope S] [--action N] [--status N] [--waf-type N] Update rule group zcloud guard waf rules update 7 --name sqli-1-v2
zcloud guard waf rules delete <rule-id> [-f] Delete rule group zcloud guard waf rules delete 7 -f
zcloud guard waf rules set-status <rule-id> --status enable|disable Enable / disable rule group (string enum, not a boolean) zcloud guard waf rules set-status 7 --status enable

4.5.1 WEB Base Protection (guard waf-base, read-only)

Policy-level WEB base protection has four parts: base config (block page/engine/XML/body size), high-frequency penalty, precision whitelist, and BODY inspection whitelist. Create/update/delete for whitelist/BODY/base config carry nested payloads (zones array, enum KEY strings, block-page linkage validation) and are UI-primary; the CLI provides four read-only inspection commands. Write CLI is a rule-5 exemption (nested payloads, UI-first).

Command Description Bound API
zcloud guard waf-base config <policy-id> View base protection config GET /api/guard/policies/{id}/waf/base-config
zcloud guard waf-base semantic <policy-id> View semantic detection config (14 analyzers: switch + level) GET /api/guard/policies/{id}/waf/semantic
zcloud guard waf-base rate-limit <policy-id> View high-frequency penalty config GET /api/guard/policies/{id}/waf/rate-limit
zcloud guard waf-base white-list <policy-id> View precision whitelist GET /api/guard/policies/{id}/waf/white-rules
zcloud guard waf-base body-list <policy-id> View BODY inspection whitelist GET /api/guard/policies/{id}/waf/body-rules
zcloud guard waf-base rule-versions <policy-id> View built-in policy "rule library version" options (v1/v2 engine) GET /api/guard/policies/{id}/waf/rule-versions
zcloud guard waf-base policy-schemas <policy-id> --rule-version <ver> View built-in policy "policy mode" options (filtered by rule version) GET /api/guard/policies/{id}/waf/policy-schemas
zcloud guard waf-base config 60806153-1332-41aa-9286-16ba4592d2cb --format json
zcloud guard waf-base white-list 60806153-1332-41aa-9286-16ba4592d2cb --format json
zcloud guard waf-base rule-versions 60806153-1332-41aa-9286-16ba4592d2cb --format json
zcloud guard waf-base policy-schemas 60806153-1332-41aa-9286-16ba4592d2cb --rule-version v2022.05.05 --format json

4.6 Forwards (guard forwards)

Command Description Example
zcloud guard forwards list [--page N] [--size N] [--domain-id D] [--keyword K] List forwards zcloud guard forwards list --domain-id 12
zcloud guard forwards create --domain-id D --port P [--schema 3|4] [--domain D] [--describe D] Create forward (--domain-id and --port required; --schema 3=TCP 4=UDP) zcloud guard forwards create --domain-id 12 --port 8443 --schema 3
zcloud guard forwards update <forward-id> [--port P] [--schema N] [--describe D] Update forward (use set-status to toggle) zcloud guard forwards update 4 --port 3307
zcloud guard forwards set-status <forward-id> --status enable|disable Toggle a forward (status only; skips node-ownership revalidation, so rules whose nodes were reclaimed can still be stopped) zcloud guard forwards set-status 4 --status disable
zcloud guard forwards delete <forward-id> [-f] Delete forward zcloud guard forwards delete 4 -f

4.7 DNS Scheduling (guard schedules)

This module only covers DNS parsing scheduling (SRC/NODE mode switch and batch record enable/disable). Every write persists compatibility-table state, then the cloud DNS worker applies it through the configured DNS provider API. Always poll with affairs to obtain the final outcome (AffairsStatus_StartSucceed / Faild).

Command Description Example
zcloud guard schedules domains [--page N] [--size N] [--keyword K] [--user-id U] [--mode 0|1|2] [--status S] List DNS scheduling domains (--mode 0=all 1=SRC 2=NODE) zcloud guard schedules domains --keyword example.com
zcloud guard schedules switch-mode <domain-id> --target-mode src|node [--comment C] Switch SRC/NODE mode (--target-mode required) zcloud guard schedules switch-mode d_8a3b1c --target-mode node
zcloud guard schedules batch-switch-mode --domain-id ID[,ID...] --target-mode src|node Switch SRC/NODE mode for many domains (one transaction; any failure rolls the whole batch back; 100 domains max per call) zcloud guard schedules batch-switch-mode --domain-id d_8a3b1c,d_9f2e4d --target-mode node
zcloud guard schedules init <domain-id> [--comment C] Initialize DNS parsing by rebuilding records from current config and submitting one sync affair zcloud guard schedules init d_8a3b1c
zcloud guard schedules reset <domain-id> [--comment C] Reset DNS parsing for the domain (switch_state to 1, status rolled back to last_status) zcloud guard schedules reset d_8a3b1c
zcloud guard schedules records <domain-id> [--group-type 1|2] [--status 1|2] [--page N] [--size N] List DNS records of the domain (read-only on zdns_db) zcloud guard schedules records d_8a3b1c --status 2
zcloud guard schedules create-record <domain-id> --record-type 1|2 --value V --group-type 1|2 [--ttl N] [--record-line L] Create a DNS record (--value/--group-type required; --record-line 1-7 basic/14 search/34-126 provincial, 0=default line; see API docs for the default-line guard) zcloud guard schedules create-record d_8a3b1c --record-type 1 --value 203.0.113.10 --group-type 1 --record-line 2
zcloud guard schedules update-record <record-id> --value V --ttl N --record-line L Update a DNS record (value/TTL/line, all three flags required; type/group immutable, locked records refuse edits) zcloud guard schedules update-record r-uuid --value 203.0.113.11 --ttl 600 --record-line 3
zcloud guard schedules delete-record <record-id> Delete a DNS record (locked / last-enabled / default-line-guard violations are rejected) zcloud guard schedules delete-record r-uuid
zcloud guard schedules batch-status --record-ids id1,id2 --status enable|disable [--comment C] Batch enable/disable DNS records (both --record-ids and --status required) zcloud guard schedules batch-status --record-ids r1,r2 --status disable
zcloud guard schedules affairs [--page N] [--size N] [--user-id U] [--status S] [--ctime-from MS] [--ctime-to MS] [--domain-id D] Affair record list (--status accepts AffairsStatus_Start|AffairsStatus_Succeed|AffairsStatus_Faild) zcloud guard schedules affairs --domain-id d_8a3b1c
zcloud guard schedules affair <affair-id> Affair record detail (full HTML message + json_content) zcloud guard schedules affair 1715600000_aB3xY9LmNq

4.8 Applies (guard applies)

Command Description Example
zcloud guard applies list [--page N] [--size N] [--domain-id D] [--status S] List apply tasks (--status is pending|success|failed|running|quit) zcloud guard applies list --status running
zcloud guard applies describe <apply-id> Task summary zcloud guard applies describe 100
zcloud guard applies create --domain-id D Trigger an apply (--domain-id required) zcloud guard applies create --domain-id 12
zcloud guard applies detail <apply-id> Task detail with subtasks zcloud guard applies detail 100
zcloud guard applies retry <apply-id> [--node-ids id1,id2] Retry failed (--node-ids targets specific nodes; empty retries all failed nodes) zcloud guard applies retry 100
zcloud guard applies quit <apply-id> [-f] Cancel running task zcloud guard applies quit 100 -f

4.9 Origin Groups (guard origin-groups)

One origin group = a set of protection nodes bound to the subset of origin servers they pull from, making "which node pulls from which origins" controllable (e.g. telecom nodes pull from telecom origins). Each domain has exactly one default origin group (holds all origins, cannot be deleted, fallback for ungrouped nodes); a node belongs to exactly one group within a domain; if any origin in a group is IPv6, the group must contain at least one IPv6-capable node. list supports the global --format table|json|yaml.

Command Description Example
zcloud guard origin-groups list --domain-id D List origin groups of a domain (default group first, then custom groups; --domain-id required) zcloud guard origin-groups list --domain-id d_8a3b1c
zcloud guard origin-groups create --domain-id D --name N --node-ids n1,n2 --src-ips ip1,ip2 Create an origin group (all 4 flags required; selected nodes are pulled out of their previous groups, emptied custom groups fall back to the default group) zcloud guard origin-groups create --domain-id d_8a3b1c --name telecom --node-ids n-a,n-b --src-ips 10.0.0.1,10.0.0.2
zcloud guard origin-groups delete --domain-id D --group-id G Delete a custom origin group (nodes/origins merge back into the default group; the default group cannot be deleted; both flags required) zcloud guard origin-groups delete --domain-id d_8a3b1c --group-id 5301

5. analytics Module (Dashboard)

Common flags (apply to every analytics <page> command; if not explicitly set, they are NOT added to the query string and the backend default applies):

Flag Type Description
--window string Time window such as last_1h / last_24h / last_7d (values defined by backend)
--stime / --etime int64 Custom start / end (Unix milliseconds)
--site-id / --domain-id string Filter by site / domain
--compare bool Period-over-period compare
--top int Top-N (1-100)
--order string Sort direction (asc / desc; chart-specific)
--page / --size int Pagination (logs/records-style charts)
--charts string Comma-separated chart keys for batch fetch (used when chart-key arg is omitted)

chart-key catalog per page:

Page chart-key
overview kpi, bandwidth, request-attack, event-type, waf-type, geo, top-domains
access request-hm, flow-hm, cache-hm, bandwidth, status, flow-duration, isp, top-ip, top-url, geo
protect overview, waf/statistics, waf/types, waf/top-ip, waf/geo, cc/statistics, cc/top-ip, cc/geo, cc/top-url, ddos/statistics, ddos/types, ddos/top-ip
ai attack-trend, top-ip, top-url, detection, test-results, logs
bot statistics, advance-warn, browser, operating, geo, top-agent, top-ip, scatter, sessions
alert total, hm, types, domains, list
Command Description Example
zcloud analytics overview [chart-key] [flags] Overview metrics (omit chart-key to fetch the whole page via batch) zcloud analytics overview kpi --window last_24h --format json
zcloud analytics access [chart-key] [flags] Access stats zcloud analytics access top-url --window last_7d --format json
zcloud analytics protect [chart-key] [flags] Protection stats zcloud analytics protect waf/statistics --format json
zcloud analytics ai [chart-key] [flags] AI detection stats zcloud analytics ai logs --page 1 --format json
zcloud analytics bot [chart-key] [flags] Active protection (Bot) zcloud analytics bot statistics --format json
zcloud analytics alert [chart-key] [flags] Alert stats zcloud analytics alert list --page 1 --size 20 --format json
zcloud analytics glossary Field glossary zcloud analytics glossary --format json
zcloud analytics batch --page P --charts C [...] Cross-page batch (--page and --charts required) zcloud analytics batch --page overview --charts kpi,bandwidth --format json
zcloud analytics overview export --charts C [--type csv|json] [...] Export overview report (only the overview sub-page exposes export) zcloud analytics overview export --type csv --charts kpi,bandwidth > overview.csv
zcloud analytics alert ack <alert-id> Acknowledge alert zcloud analytics alert ack a-20260422-0001
zcloud analytics bot session <session-id> Bot session detail (only accepts --window / --stime / --etime) zcloud analytics bot session s-abc123 --format json

5.1 2026-04-30 chart-rebuild 6-phase extension (4 new pages + 2 standalone subcommand groups)

Command Description Example
zcloud analytics health [chart-key] [flags] Phase 3 Business Health (status-breakdown / slow-uri / availability, 7 chart-keys) zcloud analytics health summary --window last_24h --format json
zcloud analytics ops [chart-key] [flags] Phase 5 Platform Ops (traffic-users / error-domains / nodes, 8 chart-keys, platform ops / superadmin only) zcloud analytics ops traffic-users --top 20 --format json
zcloud analytics closure [chart-key] [flags] Phase 6 Closure (summary / alerts / risks / trend, 4 chart-keys) zcloud analytics closure summary --format json
zcloud analytics cache [chart-key] [flags] Phase 6 Cache Value (summary / trend / top-uri / content-types) zcloud analytics cache summary --window last_7d --format json
zcloud analytics logs list [flags] Phase 1 access log list (15 filter flags in the CLI; the API field_filters supports 33 fields — isp/upstream_addr/upstream_status/response_content_type/user_agent have no flag, call POST /api/analytics/logs/search directly). 10,000-row ceiling: --page ≤ floor(10000/--size) zcloud analytics logs list --window last_24h --bot-reason "block botd" --format json
zcloud analytics logs detail <uuid> Phase 1 Raw log detail zcloud analytics logs detail req-abc123 --format json
zcloud analytics logs export --format csv [--fields ...] [flags] Phase 1 access log export (size ≤ 10000; larger goes async). Without --fields all 36 columns are exported; supplied names are intersected with the whitelist and unknown ones are dropped silently zcloud analytics logs export --format csv --fields ctime,uuid,host,uri,status > logs.csv
zcloud analytics logs export-estimate [flags] Estimate row count without exporting zcloud analytics logs export-estimate --window last_7d
zcloud analytics logs export-create [flags] [--fields a,b] Create an async export job (1M-row cap; 1 active per user; kept 3 days) zcloud analytics logs export-create --window last_7d --host a.com
zcloud analytics logs export-list List export jobs and progress zcloud analytics logs export-list
zcloud analytics logs export-download <id> [-o FILE] Download the artifact (CSV; gzip on the wire, decompressed by the client) zcloud analytics logs export-download 5 -o logs.csv
zcloud analytics logs export-cancel <id> Cancel a running export zcloud analytics logs export-cancel 5
zcloud analytics closure {alerts|risks} confirm --ids ID1,ID2,... Phase 6 Batch confirm alerts / risks (proxies /api/alert/records/confirm and /api/chart/risk/events/:event_id/confirm) zcloud analytics closure alerts confirm --ids a1,a2,a3
zcloud analytics reports templates Phase 4 List report templates zcloud analytics reports templates --format json
zcloud analytics reports list Phase 4 Report history list zcloud analytics reports list --format json
zcloud analytics reports describe <id> Phase 4 Report detail zcloud analytics reports describe r-001 --format json
zcloud analytics reports generate --template T --window W [...] Phase 4 Trigger generation (sync threshold ≤ 100k rows; larger goes async) zcloud analytics reports generate --template protection-value --window last_30d
zcloud analytics reports download <id> [--output file] Phase 4 Download artifact (pdf/csv/json/html) zcloud analytics reports download r-001 --output report.pdf

Phase 4 templates (--template): protection-value / asset-risk / attack-source / business-health / platform-summary (platform ops / superadmin only) / raw-log-export.

Truth-table field constraints (cross-cutting D3/D8/D10):

Placeholder fallback: some chart-keys currently return {available: false, reason: "data source pending..."} from the server; the API/CLI contract is stable; real SQL/ES wiring rolls out per chart-key.

6. Plan catalog (plan)

External exposure scope: Only the two read-only commands below are part of the public API/CLI surface. Plan create/edit/delete, user assignment, and subscription queries are platform-console admin operations that write the live shared billing tables — they are NOT in the external API/CLI surface (platform ops only, via console + RBAC).

Command Description Required permission
zcloud plan list [--prod-type N] [--keyword KW] [--page N] [--page-size N] Paginated plan catalog query; filterable by product type (1=WAF/2=Monitor/3=GFIP) and name keyword plan.plan.list
zcloud plan describe <plan_id> Retrieve plan detail (including content quota JSON) plan.plan.view

Examples

# List WAF plans
zcloud plan list --prod-type 1 --format json

# Search by name keyword
zcloud plan list --keyword basic

# Get plan detail
zcloud plan describe 550e8400-e29b-41d4-a716-446655440000

Bound APIs: GET /api/plan/plans / GET /api/plan/plans/:id

7. cli_release / tools

Command Description Example
zcloud update Self-update (queries /api/cli/version and downloads new release) zcloud update
zcloud completion <bash|zsh|fish> Generate shell completion script zcloud completion zsh > ~/.zsh/_zcloud
zcloud version Show current CLI version zcloud version

Backend release APIs: GET /api/cli/version (public) / GET /api/cli/install.sh (public).

8. Node Install / Upgrade (command line)

CLI exemption note (Rule 5): node install / upgrade has no zcloud node ... subcommand — zcloud currently has only six command groups: auth / config / sys / guard / analytics / plan. The node "command line" is the platform-minted one-time install one-liner (run as root on the target node host) plus management-plane HTTP endpoints. Full endpoint semantics: API docs §8 Node Install / Upgrade.

8.1 One-line install / upgrade command (run on the node host)

POST /api/node/install/commands (upgrade: /upgrades) returns a command of the form:

curl -fsSL --connect-timeout 10 --max-time 60 \
  -H 'Authorization: Bearer nit_xxx' 'https://<cloud>/api/node/install/script' \
  | sudo bash -s -- --token 'nit_xxx' --server 'https://<cloud>'

Script arguments / environment variables:

Argument Env var Default Description
--token <token> SETUP_TOKEN required one-time install token (nit_ prefix), shown once
--server <url> SERVER_ADDR required cloud public address; must match the configured public base URL
--install-dir <dir> INSTALL_DIR /opt/skynet-node install directory

Script behavior: check deps (curl/tar/gzip/sha256sum) → download package and verify X-Artifact-SHA256 → fetch env and overwrite the package's env.conf → run install.sh → report running/success/failed via /report. All downloads use --retry; the report call uses a short timeout.

8.2 Management operations (curl / API)

Operation Method + path Required permission (node.node.*)
Register package + precheck POST /api/node/install/artifacts artifact
List packages GET /api/node/install/artifacts artifact
Mint install command POST /api/node/install/commands install
Mint upgrade command POST /api/node/install/upgrades upgrade
List / get jobs GET /api/node/install/jobs[/:id] job
Revoke token POST /api/node/install/tokens/:id/revoke revoke

Key points: max_uses minimum 5 / default 20 / cap 100 (keep retry headroom); ttl_seconds default 3600 / cap 86400; the plaintext token is shown once and the DB stores only hash + prefix; installer-side auth failure returns 401 + challenge; script does not consume uses, package/env consume use_count, report uses an independent report_count and only success marks the token used. See API §8.

9. netdiag Module (Network Diagnostics)

Run a full-chain checkup on a domain (DNS → ICP → certificate → cloud-WAF access → node connectivity → origin health), or use the Ping tool. All checks are read-only probes fired from the management server; nothing is written. Responses are nested — add --format json.

Command Description Permission
zcloud netdiag dns <domain> DNS resolution check (NS / public & authoritative resolution / CNAME vs platform alias) netdiag.tool.run
zcloud netdiag icp <domain> ICP filing lookup (external API; degrades to checked=false on failure) netdiag.tool.run
zcloud netdiag ssl <domain> SSL certificate check (probed via WAF node for onboarded domains, else direct 443) netdiag.tool.run
zcloud netdiag access <domain> Cloud-WAF access config check (status / CNAME / ports / node count / origin count) netdiag.tool.run
zcloud netdiag nodes <domain> Node connectivity check (per-node per-port HTTP probe as the domain; onboarded only) netdiag.tool.run
zcloud netdiag origin <domain> Origin health check (management server to origin, TCP + HTTP; onboarded only) netdiag.tool.run
zcloud netdiag ping <target> Ping check (domain or IP, fixed 4 packets) netdiag.tool.run

Examples

# Single check: DNS resolution and whether CNAME points to the platform
zcloud netdiag dns www.example.com --format json

# Single check: origin health (TCP + HTTP two-stage probe)
zcloud netdiag origin www.example.com --format json

# Single check: ping a target
zcloud netdiag ping www.example.com --format json

Bound API: GET /api/netdiag/{dns,icp,ssl,access,nodes,origin}?domain=<domain> / GET /api/netdiag/ping?target=<target>

Full Command Tree

zcloud
├── auth         (login / logout / info)
├── config       (set / get / list / profiles[list,create,activate,delete])
├── sys
│   ├── users    (list / describe / create / update / delete / reset-password / lock / assign-roles)
│   ├── roles    (list / create / update / delete / get-permissions / set-permissions)
│   ├── oems     (list / describe / create / update / delete / get-setting / set-setting)
│   ├── sessions (list / kill)
│   └── audit-logs (list / login-records list / permissions)
├── guard
│   ├── domains  (list / describe / create / update / delete / audit / get-settings / set-settings / src-check-peers / nodes[list,available,assign,remove,lock,sync] / brute-force[list,create,update,delete] / cache[warm,purge] / dns-advance[describe,update])
│   ├── certs    (list / describe / upload / update / delete / bind / unbind)
│   ├── policies (list / describe / create / update / delete)
│   ├── bwlist   (sets[*] / ips[*])
│   ├── waf      (rules[*])
│   ├── waf-base (config / rate-limit / white-list / body-list / rule-versions / policy-schemas)  [只读 / read-only]
│   ├── forwards (list / create / update / set-status / delete)
│   ├── schedules(domains / switch-mode / batch-switch-mode / init / reset / records / create-record / update-record / delete-record / batch-status / open / close / affairs / affair)
│   ├── origin-groups (list / create / delete)
│   └── applies  (list / describe / create / detail / retry / quit)
├── analytics    (overview / access / protect / ai / bot / alert / glossary / batch / export / ack / session)
├── plan         (list / describe)  [read-only external]
├── netdiag      (dns / icp / ssl / access / nodes / origin / ping)
├── update
├── completion
└── version

RedNet Cloud · zcloud CLI · 98 commands, source of truth src/frontend/src/views/docs/cli-commands.ts