Cloudflare¶
Cloudflare runs DNS, CDN, WAF and Zero Trust services in front of your sites; one connector covers one Cloudflare account and its zones.
- What DRACO uses: Account and zone settings for posture scans, audit logs, security events and Logpush HTTP requests.
- What for: Compliance and attack paths, detections and hunts on edge traffic, the ID directory, WAF response and list blocklists.
Add it in Connectors > Add connector: pick Cloudflare, then choose what DRACO collects and what it may change. Add more later with Add a part on its connector page. See Connectors for how connectors, sign-in and tags work.
Parts¶
| Part | What DRACO uses | Access | Permissions |
|---|---|---|---|
| Posture | Cloudflare | read | A custom API token with read permissions Account > Account Settings; Zone > Zone, Zone Settings, DNS, SSL and Certificates, Bot Management, Zone WAF, on every account and zone to scan. |
| Logs | Cloudflare audit logs, Cloudflare security events, Cloudflare Logpush | read | Audit logs: Account > Account Settings > Read (the scan permissions include it). Security events: Zone > Zone > Read and Zone > Analytics > Read on the zones to collect. Logpush (Enterprise zone): Zone > Logs > Edit only to create the job; that token is not stored in DRACO. |
| Directory | Cloudflare audit logs, Cloudflare security events | read | None beyond the logs part: names are learned from its events. |
| Response | Add user to Access deny group (Cloudflare Zero Trust), Block ASN, country or path (Cloudflare WAF), Block IP (Cloudflare WAF), Enable or disable a WAF custom rule (Cloudflare), I'm Under Attack mode (Cloudflare), Revoke Access sessions (Cloudflare Zero Trust) | write | Add user to Access deny group (Cloudflare Zero Trust), Revoke Access sessions (Cloudflare Zero Trust): Account > Access: Organizations, Identity Providers, and Groups > Edit Block ASN, country or path (Cloudflare WAF), Enable or disable a WAF custom rule (Cloudflare): Zone > Zone WAF > Edit Block IP (Cloudflare WAF): Account > Account Filter Lists > Edit; Zone > Zone WAF > Edit I'm Under Attack mode (Cloudflare): Zone > Zone Settings > Edit |
| Enforcement | Cloudflare WAF rule, Cloudflare list | write | Cloudflare WAF rule: Custom rule per zone: Account > Account Filter Lists > Edit and Zone > Zone WAF > Edit; IP Access Rules (account): Account > Account Firewall Access Rules > Edit Cloudflare list: Account > Account Filter Lists > Edit |
Posture¶
DRACO for Cloudflare scans zones for security misconfigurations, including SSL/TLS settings, DNSSEC, HSTS, WAF rules, DNS records, and more.
Prerequisites¶
Set up authentication for Cloudflare with the Cloudflare Authentication guide before starting either path:
- Create a Cloudflare User API Token (recommended) or locate the Global API Key
- Grant the required read-only permissions (
Account Settings:Read,Zone:Read,Zone Settings:Read,DNS:Read,SSL and Certificates:Read,Bot Management:Read,Zone WAF:Read) - Identify the Cloudflare Account ID to use as the provider identifier
Note
Quick Setup: Use these pre-configured links to create a token with the required permissions already selected:
- Create User API Token — creates a User API Token (recommended).
- Create Account-Owned API Token — creates an account-owned token, better suited for automation and CI/CD.
Both links open the Cloudflare Dashboard with the seven required read-only scopes (Account Settings, Zone, Zone Settings, DNS, SSL and Certificates, Bot Management, Zone WAF) and the name DRACO Security Scanner prefilled. See Cloudflare Authentication for the equivalent manual steps.
Connect the provider in DRACO¶
Step 1: Locate the Account ID¶
- Log into the Cloudflare Dashboard.
- Select any zone in the target account.
- On the zone overview page, find the Account ID in the right sidebar under the "API" section.
Note
The Account ID is a 32-character hexadecimal string (e.g., 372e67954025e0ba6aaa6d586b9e0b59). This value acts as the unique identifier for the Cloudflare account in DRACO.
Step 2: Open DRACO¶
- Sign in to DRACO, open Connectors, click Add connector and pick Cloudflare: the wizard opens at Link a Provider.
- Enter the Account ID and an optional alias (the connector's name), then click Next.
Step 3: Choose and Provide Authentication¶
After the Account ID is in place, select the authentication method that matches the Cloudflare setup:
User API Token Authentication (Recommended)¶
- Select API Token.
- Enter the User API Token created in the Cloudflare Dashboard.
Use this method for scoped, least-privilege access. Full setup steps are in the Authentication guide.
API Key and Email Authentication (Legacy)¶
- Select API Key + Email.
- Enter the Global API Key.
- Enter the email address associated with the Cloudflare account.
For the complete setup workflow, follow the Authentication guide.
Step 4: Check and launch¶
- Click Authenticate, then Check connection.
- When the connection works, launch the first scan (Run now or On a schedule). Scans then run on the provider's schedule.
- After Launch Scan, the wizard goes on with Collectors (tick Logs or Directory) and Responders (tick what DRACO may change in Cloudflare, with its write token) on the same connector. Tick nothing more to keep scans only; anything else can be added later with Add a part on the connector page.
Every authentication option, with the exact token permissions: Cloudflare authentication.
Logs¶
Three data sources: Cloudflare audit logs (who changed DNS, WAF, settings, members and tokens), Cloudflare security events (WAF, rate limiting, bot and firewall rule hits per zone) and Cloudflare Logpush (every HTTP request of an Enterprise zone, pushed to DRACO). The audit logs and security events use the provider's token, or a picked token credential with other permissions.
- Audit logs: the provider's token with Account > Account Settings > Read, or a separate token with only that permission saved as a
tokencredential. - Security events: edit the provider's token (My Profile > API Tokens > Edit) or create one with Zone > Zone > Read and Zone > Analytics > Read on the zones.
-
Logpush (Enterprise zones): create the source and copy its endpoint and token; with a token that has Zone > Logs > Edit (used only to create the job, not stored), create a Logpush job with the HTTP destination
<endpoint>?header_Authorization=Bearer%20<token>(the source page shows the API call). -
Audit logs: entries in the legacy shape (
rec_add,DNS_record) and in the audit log v2 names Cloudflare returns now (create,update,deleteondns.record,access_created_service_token,zone.settings...) are both understood by the built-in rules. DNS records named_acme-challenge*(certificate automation) do not raise "DNS record changed". - Security events follow each zone's plan for retention and query width; large accounts are read over several runs (25 zones per run by default, least recently read first). Quota and rate-limit answers keep the cursor and show a warning. Cloudflare samples security events when there are many: each event carries
sampleInterval, and a row withsampleIntervalN stands for about N requests, so counts made from sampled rows are lower bounds. - Logpush: keep
ZoneNamein the job's fields so events link to the zone. Cloudflare sends the requests to DRACO over the internet: DRACO must be reachable at a public HTTPS address with a publicly trusted certificate (a domain name, for example with a Let's Encrypt certificate). A DRACO server reached by its IP address, or with its own certificate, cannot receive Logpush; the security events pulled by API still cover WAF, rate limiting, bot and firewall hits.
Directory¶
Names the vendor's IDs (hosts, agents, users) in the ID directory, learned from the events of the logs. There is nothing to turn on: the directory is on whenever Logs is on.
Setup: Cloudflare logs.
Response¶
Runs response actions on the Cloudflare account from incidents and workflows: Add user to Access deny group (Cloudflare Zero Trust), Block ASN, country or path (Cloudflare WAF), Block IP (Cloudflare WAF), Enable or disable a WAF custom rule (Cloudflare), I'm Under Attack mode (Cloudflare) and Revoke Access sessions (Cloudflare Zero Trust).
Setup: Response actions.
Enforcement¶
Keeps blocklists of threat intel indicators up to date: Cloudflare WAF rule and Cloudflare list.
Setup: Push targets, Setting up the permissions.
Cloudflare WAF rule: blocking method¶
The Cloudflare WAF rule blocks or challenges the IPs of your selection in one of two ways. Pick it in Blocking method when you set up the target, or change it later in the target's settings.
| Blocking method | What DRACO creates | Use it when |
|---|---|---|
| Custom rule per zone (default) | One IP list in the account and one custom rule ip.src in $<list name> in each chosen zone |
You want the block inside your zones' custom rules, next to your own rules, with control of its position |
| IP Access Rules (account) | One IP Access Rule per IP address or range at account level | Your zones have no free custom-rule slot, or hold older rules that use features above the zone's current plan |
Why the method matters. When any custom rule of a zone changes, Cloudflare checks every custom rule of that zone against the zone's plan. A zone that still holds rules from a higher plan (for example a rule that uses a region field, the Log action or a custom response that the plan no longer includes) refuses the DRACO rule, even though the DRACO rule itself is valid. A Free zone that already has 5 custom rules has no room for it either. IP Access Rules are not part of the zone's custom rules, so neither problem applies, and you do not have to change your own rules.
IP Access Rules (account)
- The rules apply to every zone of the account, including zones you add later. There are no zones to pick, no list and no rule order.
- Each IP address is one rule. Ranges are written as Cloudflare takes them: IPv4 /16 and /24, IPv6 /32, /48 and /64. A range of another size is split into those (at most 256 rules for one range). Single IPv6 addresses are blocked as single addresses. IPv6 ranges narrower than /64 are widened to their /64, and IPv4 ranges wider than /8 are left out. The sync says when it does either.
- Rule action sets the mode of every rule: block, managed challenge, JS challenge or interactive challenge.
- DRACO only changes the rules it created. Their Notes read
DRACO threat intel: <target name> (<target id>), and DRACO never edits or deletes any other IP Access Rule. If one of your own rules already covers an address (an allow or block rule for the same IP), DRACO leaves that rule as it is and the sync names the address. - Cloudflare allows 50,000 IP Access Rules per account on every plan, and your own rules count towards that limit. When the selection needs more than the room left, the sync says how many rules were not created. Lower the target's size limit, or use the custom rule method, whose list holds up to 10,000 items on Free, Pro and Business plans.
- Cloudflare allows 1,200 API requests per 5 minutes for each user, and DRACO writes one request per rule. DRACO keeps under that limit: a sync with more changes than fit writes part of them, says so, and the next sync continues within 10 minutes. A first sync of 10,000 IPs therefore takes about an hour. Requests you make in the dashboard or with other tools as the same user count towards the same limit.
The write token for IP Access Rules
| Type | Item | Access |
|---|---|---|
| Account | Account Firewall Access Rules | Edit |
No zone permission is needed. Test lists DRACO's IP Access Rules and changes nothing. If the token cannot read them, it names Account Firewall Access Rules. Cloudflare does not tell whether a token may edit, so a refused change shows up on the sync.
Changing the method. After you change the method in the target's settings, the next sync first builds the new method, then removes what DRACO made with the old one: the DRACO rule of each zone and the list DRACO created, or DRACO's IP Access Rules. With the custom rule method, the old objects go once the zones that accept the DRACO rule have it; a zone that refuses it (see Why the method matters) is named in the sync and is not blocked by DRACO until it takes the rule. To keep the old method until every zone has the new one, turn on Keep the old method until every zone accepts the new one. While no zone at all has the rule, the old method always stays. The sync messages say what was created and what was removed. Keep the old method's permissions on the token until the switch is finished, so DRACO can remove its old rules.
Cloudflare WAF rule: zones¶
With Custom rule per zone, the Cloudflare WAF rule keeps one IP list in the account and adds a custom rule that blocks or challenges it (ip.src in $<list name>) to each zone you choose. One list serves every zone.
Which zones
- All zones of this account, including new ones: every sync reads the account's zones again and adds the rule where it is missing, so a domain you add to Cloudflare later is protected from the next sync. Give the write token Zone Resources: Include > All zones from an account (that account); a token limited to some zones only reaches those.
- Zones: press Load zones to see the zones the write token reaches (domain, zone ID, plan and status) and tick the ones to protect, or paste zone IDs, one per line or comma separated. A zone ID is on the domain's Overview page, under API.
The write token
| Type | Item | Access |
|---|---|---|
| Account | Account Filter Lists | Edit |
| Zone | Zone WAF | Edit |
Zone WAF Edit is needed on every zone the rule goes to. Test reads each zone's custom rules and names the zones the token cannot reach; Cloudflare does not tell whether a token may edit, so a zone that refuses the change shows up on the sync.
What a sync does
- The list is written once; then each zone is checked: the rule is created where it is missing, turned back on or set back to the chosen action if someone changed it, and left alone when it is in place. This runs on every sync, also when the list did not change.
- A zone that refuses (missing permission, no room for one more custom rule) is a warning on the sync, and the other zones still get the rule. The sync fails only when the list itself cannot be written. The sync detail lists every zone with its state.
- Every rule counts against the zone's custom rules limit: 5 on the Free plan, 20 on Pro, 100 on Business, 1,000 on Enterprise.
Rule order
Cloudflare runs custom rules from top to bottom. A Skip rule above the DRACO rule (for example one that lets an API host bypass the WAF) lets those requests through even from blocked IPs. The sync warns about it, names the zone and links to its custom rules. Turn on Put the rule first to place the DRACO rule at the top of each zone and keep it there (a sync moves it back if someone moves it down).
Zones taken out, list renamed, pause and delete
- A zone you take out of Zones, or that All zones no longer covers, loses the DRACO rule on the next sync. Your own rules in that zone stay.
- After you rename the list, the next sync creates the new list and rules, then removes the DRACO rules that use the old list and the old list itself. While a rule of your own still names the old list, the old list keeps its entries (your rule goes on blocking) and each sync says which zones still use it.
- Pause removes the DRACO rule from every zone, DRACO's IP Access Rules and the list DRACO created; Resume builds them again. Delete does the same before the target goes.
- DRACO deletes a list only when it created it and no custom rule in any zone of the account still names it. A list your own rules use is emptied and kept, and the sync names the zones whose rules still use it.
- With many IP Access Rules a cleanup can take more than one pass because of the API request limit; a paused target shows Cleanup pending until it is done.
See What DRACO removes from the vendor.
If you turn on several parts¶
When you connect Cloudflare once and tick several parts, the wizard shows one guide for all of them: what to check first, the access to create once, one list of permissions that names the part each one is for, the extra steps of each part, and one test that checks every part on its own. Turning a part on later shows only what it adds.
Posture, audit logs and security events read with one API token with eight read permissions (Account Settings; Zone, Zone Settings, DNS, SSL and Certificates, Bot Management, Zone WAF, Analytics) on all accounts and zones. Response actions and blocklists (Responders) need edit permissions (Account Filter Lists, Zone WAF, Zone Settings, Access, and Account Firewall Access Rules for the IP Access Rules method): put them on a second token pasted at the Write access step, never on the read token. Logpush needs an Enterprise plan and its own job.
Any part can be skipped (Skip for now) and finished later: the connection is saved with what is done, and its page lists what is not set up yet with a Set up button that opens the wizard at that step.