Configures Cloudflare Access with Google SSO to protect a subdomain, including origin IP lockdown to prevent bypass. For internal tools or staging sites needing auth without app code changes.
Ships in use-sentry. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Put a company-only login wall in front of a subdomain you already serve: Cloudflare Access for authorization, Google Workspace (or Email OTP) for identity, and an origin lockdown so nobody reaches the app by its IP address.
app.example.com and must be restricted to one email domain.Host: header.Do NOT use for:
1. Access only enforces on traffic that flows through Cloudflare. The Access application is a rule at the edge, not on your server. If the DNS record is DNS-only (grey cloud), or if a client resolves your origin IP directly, Access is not in the path at all — it still looks perfectly configured in the dashboard while enforcing nothing. Cloudflare's own docs say it plainly: if the app is already publicly routable a tunnel is not required, "however, you will then need to protect your origin IP using other methods."
2. Access is deny-by-default, and policies are standalone objects. An application with no Allow
policy blocks everyone. Create the reusable policy first
(POST /accounts/{account_id}/access/policies), then attach it to the app by id. Policies created
through the app-scoped endpoint come back as reusable: false and are legacy — do not create new
ones that way.
3. Every secret in this flow is shown exactly once. The Google OAuth client secret is not re-displayable after creation (Google stopped showing existing secrets), and Cloudflare returns service-token secrets once. Capture them into a secret store or an env var at the moment of creation, or plan to rotate.
All three are required. Removing any one silently reopens public access with no visible error.
| Part | What it does | If it is missing | Where it lives |
|---|---|---|---|
| Access app + Allow policy | Authenticates at the edge and authorizes by email domain | Anyone who reaches the hostname gets in | Cloudflare account (Zero Trust) |
| Proxied DNS (orange cloud) | Puts Cloudflare in the request path so Access can run | Access is configured but never evaluated | Cloudflare zone DNS |
| Origin lockdown | Rejects requests that did not come from Cloudflare's edge | curl --resolve to the origin IP serves the app unauthenticated | Your reverse proxy / firewall / PaaS |
The origin IP is not a secret. It leaks through TLS-certificate logs,
*.sslip.io-style hostnames, historical DNS, mail headers, and scan databases. Treat "nobody knows the IP" as false.
A zone on Cloudflare (the domain's nameservers point at Cloudflare).
Zero Trust onboarded on the account, which fixes the team domain
https://<team-name>.cloudflareaccess.com. The name is chosen once and is globally unique — a
taken name returns auth_domain_not_available.
An API token, account-scoped (there are no zone-scoped Access permissions):
| Permission | Needed for |
|---|---|
| Account → Access: Apps and Policies → Edit | Create the app and the reusable policy |
| Account → Access: Organizations, Identity Providers, and Groups → Edit | Create the Google IdP (narrower: Access: Identity Providers Edit) |
| Zone → DNS → Edit | Flip the record to proxied |
Labels drift between "Edit" and "Write" in the docs; confirm against the account's permission groups if a create call returns 403.
Shell access to the reverse proxy or firewall in front of the origin.
export CF_API_TOKEN="$(cat ~/.secrets/cf_access_token)" # never inline the literal
export CF_ACCOUNT_ID="…" # from the dashboard URL
export CF_ZONE_ID="…"
If Zero Trust has never been set up on the account, onboarding is dashboard-only: it asks for a
team name and a plan (Free covers 50 seats but still asks for payment details without charging).
Record <team-name> — the Google redirect URI in step 2 depends on it and cannot be guessed.
Agent has no browser? See references/dashboard-via-ego-browser.md for driving the console.
Google Cloud Console is dashboard-only. The one value that must be exact:
https://<team-name>.cloudflareaccess.com/cdn-cgi/access/callback
Then register it with Cloudflare:
curl -sX POST "https://api.cloudflare.com/client/v4/accounts/$CF_ACCOUNT_ID/access/identity_providers" \
-H "Authorization: Bearer $CF_API_TOKEN" -H "Content-Type: application/json" \
-d "{\"name\":\"Google\",\"type\":\"google\",
\"config\":{\"client_id\":\"$GOOGLE_CLIENT_ID\",\"client_secret\":\"$GOOGLE_CLIENT_SECRET\"}}"
Read references/google-oauth-idp.md before doing this. It covers the consent-screen trap that
costs the most debugging time: a project in Testing mode only lets listed test users complete
Google login, and the failure surfaces as a Google error before Cloudflare is ever reached — so
it looks nothing like an Access problem.
Also add Email one-time PIN as a second IdP. It is not subject to the Google test-user list and is the escape hatch when Google-side configuration breaks.
Order matters — the policy is a standalone object and the app links it by id.
POLICY_ID=$(curl -sX POST "https://api.cloudflare.com/client/v4/accounts/$CF_ACCOUNT_ID/access/policies" \
-H "Authorization: Bearer $CF_API_TOKEN" -H "Content-Type: application/json" \
-d '{"name":"Allow example.com email domain","decision":"allow",
"include":[{"email_domain":{"domain":"example.com"}}]}' | jq -r '.result.id')
curl -sX POST "https://api.cloudflare.com/client/v4/accounts/$CF_ACCOUNT_ID/access/apps" \
-H "Authorization: Bearer $CF_API_TOKEN" -H "Content-Type: application/json" \
-d "{\"name\":\"Internal Dashboard\",\"domain\":\"app.example.com\",\"type\":\"self_hosted\",
\"session_duration\":\"24h\",\"auto_redirect_to_identity\":false,
\"policies\":[{\"id\":\"$POLICY_ID\",\"precedence\":1}]}"
references/api-recipes.md has the full set: include/require/exclude selectors, multi-hostname
apps, service tokens for CI, bypass-path carve-outs, and how to migrate a legacy reusable: false
policy with make_reusable.
Field names on this API change between versions. Before scripting anything beyond the shapes above, read the current schema rather than trusting an example — including this one.
curl -sX PATCH "https://api.cloudflare.com/client/v4/zones/$CF_ZONE_ID/dns_records/$RECORD_ID" \
-H "Authorization: Bearer $CF_API_TOKEN" -H "Content-Type: application/json" \
-d '{"proxied":true}'
If the origin terminates TLS with its own certificate (Let's Encrypt via Traefik/Caddy/nginx), the zone's SSL mode must be Full or Full (strict). Flexible causes a redirect loop.
This is the step every comparable guide omits, and the reason a "protected" app is often still open. Verify the bypass exists before fixing it so you know the fix did something:
curl -skI --resolve app.example.com:443:<origin-ip> https://app.example.com/ | head -1
# HTTP/2 200 here means Access is bypassable right now
Then apply at least one of — ideally both — the IP allowlist and origin token validation, from
references/origin-lockdown.md. It has ready configs for Traefik v3 (ipallowlist, note the v2
spelling changed), nginx, Caddy, and cloud firewalls, plus the JWT-validation pattern
(CF-Access-Jwt-Assertion verified against the team JWKS), and the PaaS hazard where a
control-plane redeploy regenerates router labels and silently detaches the middleware.
Never paste a static IP list. Fetch it:
curl -s https://api.cloudflare.com/client/v4/ips | jq -r '.result.ipv4_cidrs[], .result.ipv6_cidrs[]'
| # | Check | Expected |
|---|---|---|
| 1 | curl -sI https://app.example.com/ | 302 to <team-name>.cloudflareaccess.com |
| 2 | curl -skI --resolve app.example.com:443:<origin-ip> https://app.example.com/ | 403 (was 200) |
| 3 | Log in with an in-domain identity | reaches the app |
| 4 | Log in with an out-of-domain identity | "That account does not have access." |
Check 4 is the one people skip, and it is the only one that proves the policy works rather than
the login page rendering. Run the full matrix in references/verification-matrix.md, which also
covers other hostnames on the same proxy (regression check) and HTTP :80.
The Access app, the policy, the IdP, and the DNS proxy flag live in Cloudflare's control plane.
The origin allowlist may live in a PaaS database rather than your repo. Record, in the repo's
AGENTS.md/README.md: the three parts, which one lives where, how to re-attach the origin
middleware, and how a new employee gets added. Use names and locations, never values.
This workflow handles an OAuth client secret, an API token, and possibly service-token secrets.
$GOOGLE_CLIENT_SECRET,
~/.secrets/cf_token) or the generation step (openssl rand -hex 32), never a value.example.com, app.example.com, <team-name>, <origin-ip>.sk-, GOCSPX-, Bearer ,
gho_/ghp_, and 32-hex account-id shapes.| Symptom | Cause | Fix |
|---|---|---|
| App loads with no login prompt | DNS record is grey-cloud, or the client hit the origin directly | Set proxied: true; then do step 5 |
| Everything 403s after enabling Access | Deny-by-default with no matching Allow policy | Attach a reusable Allow policy to the app |
| Redirect loop on the hostname | Zone SSL mode is Flexible against a TLS origin | Set SSL mode to Full |
| Google login fails before Cloudflare, with a Google error page | Consent screen in Testing mode; the user is not a listed test user | Add the test user, or publish the app — see references/google-oauth-idp.md |
redirect_uri_mismatch | Redirect URI does not exactly match the team domain callback | Use https://<team-name>.cloudflareaccess.com/cdn-cgi/access/callback |
| "That account does not have access." | Identity authenticated but failed the policy | Working as intended — confirm the account's email domain |
| Policy edits do not take effect | Editing a legacy reusable: false app-scoped policy | Migrate with make_reusable, or replace with a reusable policy |
| Origin 403s Cloudflare too | Allowlist missing current Cloudflare ranges, or proxy reads the wrong client IP | Refetch /client/v4/ips; check the proxy's trusted-proxy / real-IP config |
| Bypass reopens after a deploy | PaaS regenerated router labels and dropped the middleware | See the split-brain section in references/origin-lockdown.md |
auth_domain_not_available | Team name already taken globally | Pick another; it is one-time and hard to change |
Two steps here are genuinely dashboard-only — Zero Trust onboarding/team-domain selection, and Google Cloud Console OAuth-client creation. An agent with a real browser can finish the job instead of handing you a checklist.
ego-browser (from ego lite) is a Chromium built for agents: it runs agent work in an isolated task space that reuses your existing login state, so it can drive the Cloudflare and Google consoles as you without taking over your browser windows, and it hands control back for the parts you must click yourself.
citrolabs/ego-lite → skills/ego-browser/SKILL.mdscripts/install.sh (macOS), finish onboarding once, then
command -v ego-browser.Read references/dashboard-via-ego-browser.md for the console flows, the credential rules that
apply when a browser session is holding your real logins, and when to hand control back.
| File | Read when |
|---|---|
references/google-oauth-idp.md | Creating the Google OAuth client, choosing Testing vs Published / Internal vs External, adding test users, rotating the secret, or debugging a Google-side login failure. |
references/api-recipes.md | Writing any Cloudflare API call beyond the three in this file — selectors, multi-hostname apps, service tokens, bypass paths, make_reusable, listing and auditing existing objects. |
references/origin-lockdown.md | Step 5. Traefik/nginx/Caddy/cloud-firewall allowlists, JWT validation at the origin, PaaS label split-brain, and keeping IP ranges fresh. |
references/verification-matrix.md | Step 6, or auditing an Access setup someone else built. Full check matrix plus what each failure means. |
references/dashboard-via-ego-browser.md | A step is dashboard-only, or you want an agent to drive the Cloudflare/Google consoles with ego-browser. |
reusable: false) policies.agents/openai.yaml (opens in a new tab)references/api-recipes.md (opens in a new tab)references/dashboard-via-ego-browser.md (opens in a new tab)references/google-oauth-idp.md (opens in a new tab)references/origin-lockdown.md (opens in a new tab)references/verification-matrix.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/yigitkonur-use-sentry:build-cloudflare-access-ssofrom use-sentry
Generated from the plugin's indexed repository (yigitkonur/skills-by-yigitkonur) — no native marketplace selected
npx claudepluginhub p/yigitkonur-use-sentry31 skills in this plugin
/audit-agentic-cliUse if auditing or designing a CLI for agent/LLM use — JSON output, exit codes, non-interactive./audit-agentic-mcpUse if auditing or designing an MCP server for agent-readiness — framework, security, context./audit-completionUse if verifying claimed-done work or auditing session/plan/branch completion with evidence./audit-skill-by-derailmentUse if testing a skill with an agent execution trace; never for ordinary code, PR, or workflow review./audit-ui-uxUse if auditing web or mobile UI/UX via vision-first screenshot evaluation across design precision, usability heuristics, and cognitive laws./build-chrome-extensionUse if building or debugging a Chrome MV3 extension — manifest v3, service_worker, content_scripts.Other plugins' skills for the same job