Access policies based only on “is this email address allowed” don’t survive contact with an audit. The auditor asks “what if that account is signed in from an unmanaged laptop?” and the answer “we trust the IdP MFA” stops being satisfying. Device posture closes the gap: only managed devices, with the right OS version, disk encryption on, and a current MDM check-in, get through. For machine traffic — CI runners, internal cron — the equivalent is a service token, scoped narrowly and rotated on a schedule.
How to verify
Posture and service-token state are visible from the API and the WARP client itself:
# List configured posture checks at the account level
curl -fsS "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/devices/posture" \
-H "Authorization: Bearer $CF_API_TOKEN" | jq '.result[] | {id, name, type}'
# On a macOS or Windows host with WARP installed, query the local agent
warp-cli status
warp-cli registration show
warp-cli posture status
# Output lists each enabled check and PASS / FAIL per check
# List service tokens (rotation candidates)
curl -fsS "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/access/service_tokens" \
-H "Authorization: Bearer $CF_API_TOKEN" \
| jq '.result[] | {name, id, expires_at, last_seen_at}'
The last_seen_at field on a service token is the rotation tripwire. If a token hasn’t been seen in 90 days, either the workload is dead and the token should be deleted, or something silently broke and you need to know before audit week.
What’s happening
Cloudflare collects two kinds of posture signal. The first comes from the WARP client running on the device — it’s a small daemon that reports the OS family, OS version, disk encryption state, firewall state, presence of specific files or running processes, and the result of certificate-based device identity checks. The second comes from third-party integrations — Crowdstrike, SentinelOne, Tanium, Kolide, Microsoft Intune, generic MDM via SCIM. Each integration pulls a list of “compliant” device IDs from the third-party API; a device is considered to pass that check if its serial number / hardware UUID appears in the compliant list at the moment of access.
Posture checks are defined once at the account level and referenced from Access policies as a Require condition. The check is evaluated at session creation and re-evaluated periodically while the session is active (configurable, default 15 minutes). When a check starts failing mid-session — disk encryption turned off, MDM check-in lapsed — the next protected request fails and the user is bounced back through the login flow, where the check now blocks them.
Service tokens are the parallel for machines. A token is a client ID plus a client secret, presented as headers on each request. The token doesn’t carry an identity in the IdP sense — it carries an Access-internal label that policies can match. The rotation discipline is the only thing keeping a leaked CI secret from being a long-lived backdoor: scope each token narrowly (one CI runner, one cron job), set an expiration, and replace it on a schedule.
The procedure
-
Roll out WARP to the fleet. Posture for end users depends on WARP being installed and enrolled. Push the WARP client via the MDM you already run (Jamf, Intune, Kandji). On enrollment, the client registers against your team domain and now reports posture signals to Cloudflare. Verify on one device with
warp-cli status— it should show Connected and a team domain matching yours. -
Define posture checks at the account level. In Zero Trust → Settings → WARP Client → Device posture, add the checks you want available to policies. Useful ones for a typical fleet:
- OS Version — minimum macOS, Windows, Linux version
- Disk Encryption — FileVault / BitLocker / LUKS enabled
- Firewall — host firewall on (macOS Application Firewall, Windows Defender Firewall, ufw)
- Domain Joined (Windows) — device joined to AD / Entra
- Application Check — a specific binary/process is running (EDR agent, anti-malware)
- Serial Number List — the device’s serial is in an explicit allow-list
Each check has an ID. Policies reference checks by ID, not by name.
-
Add posture to an Access policy. Open the application’s policy in Access → Applications. Add a Require condition:
Device Posture → all of: WARP enrolled, disk encrypted, OS version >= 14.0. Save. The next time a user authenticates, WARP is queried for those checks at session creation; if any fail, the policy doesn’t match and the user sees the standard Access denial page. -
Issue a service token. Access → Service Auth → Service Tokens → Create. Name it for the workload that will use it (
gh-actions-prod-deploys, notci-token-1). Set the duration — 90 days is the common ceiling. The dashboard reveals the client ID and client secret once, so store both in your secrets manager immediately. The secret is never shown again. -
Use the token in a workflow. GitHub Actions example with secrets:
- name: Deploy env: CF_CLIENT_ID: ${{ secrets.CF_ACCESS_CLIENT_ID }} CF_CLIENT_SECRET: ${{ secrets.CF_ACCESS_CLIENT_SECRET }} run: | curl -fsS -X POST "https://deploy.internal.example.com/release" \ -H "CF-Access-Client-Id: $CF_CLIENT_ID" \ -H "CF-Access-Client-Secret: $CF_CLIENT_SECRET" \ -d '{"sha":"'"$GITHUB_SHA"'"}'Then in the Access policy, add a
Service Authrule that requires this exact service token. Don’t mix human Allow rules and service token rules in a way that lets a stolen token impersonate a human — keep them as separate, narrowly-scoped policies. -
Rotate on a schedule. Two patterns work. The overlap pattern: create the new token, deploy the new secret to the runner, verify, delete the old token — leaves a window where both work. The atomic pattern: rotate the secret on the existing token via the API, update the secret in the manager, deploy. Overlap is safer for distributed runners; atomic is fine for a single deployment target. Either way, automate it with a calendar event or a cron job that fires off a runbook, not “we’ll do it next quarter.”
-
Audit on the way in. Once per quarter, list all service tokens. Anything with
last_seen_atmore than 30 days ago is either dead infrastructure or a credential someone forgot. Delete it. The audit log entry “service token deleted because unused for 60 days” is what an auditor wants to see, not “we have 47 service tokens and we don’t know what most of them do.”
Common pitfalls
- Posture check exists but isn’t required in any policy. Defining the check is free; it only does something when a policy references it. Audit periodically that the checks you assume are protecting apps actually are.
- Mixing WARP signals with third-party MDM checks badly. A Require block of multiple checks is AND’ed — adding one too many makes the policy un-matchable. Test the policy yourself before turning it on for the team.
- Service token secret in the build log. A
curl -vor aset -xin CI can echo headers, and headers contain the secret. Always usecurl -fsS(silent) and disable shell tracing around the curl call. - Token expiration set to “never”. Tempting; never appropriate. Pick a max of 1 year and put the rotation date in a shared calendar.
- Posture re-evaluation lag. Posture is re-checked on a configurable cadence (default 15 min) — a user who turns off disk encryption mid-session can still hit the app until the next re-evaluation. For high-sensitivity apps, shorten the session duration on the Access policy rather than expecting instant revocation.
The posture and service-token discipline above is what we operate as the standard for clients on Cloudflare Zero Trust — fleet rolled out via the client’s existing MDM, posture wired into every internal app’s Access policy, service tokens inventoried and rotated quarterly. Builds and audits both get easier. See Managed Operations for how that’s run end-to-end.