Skip to Content
IntegrationsSaaS

Secure Cloudflare with Mondoo

Continuously scan your Cloudflare account and zones for misconfigurations and security issues.

To connect Cloudflare to Mondoo, you create a read-only Cloudflare API token and add it to a Cloudflare integration in your space.

Mondoo discovers each Cloudflare account the API token can reach and each zone in those accounts as its own asset:

  • Cloudflare Account assets cover account governance, such as enforced two-factor authentication, member two-factor status, R2 bucket public access, API token hygiene, and AI Gateway settings.
  • Cloudflare Zone assets cover each zone's edge settings, such as the SSL/TLS encryption mode, minimum TLS version, Always Use HTTPS, HSTS, the WAF, and DNSSEC.

Before you begin

  • Editor or Owner access to the Mondoo space, or another role with permission to add integrations. To see every role, read Roles and permissions.
  • A Cloudflare account
  • A Cloudflare member whose role can read everything you grant the token, such as Administrator Read Only or Super Administrator. A token can only have permissions that its creator has.

Create a Cloudflare API token

Mondoo authenticates to Cloudflare with an API token. Mondoo only reads configuration, so give the token read permissions only.

  1. Log in to the Cloudflare dashboard.

  2. Go to My Profile > API Tokens and select Create Token.

  3. Next to Create Custom Token, select Get started.

  4. Name the token so you can identify it as Mondoo's.

  5. Under Permissions, add these read permissions:

    ScopePermissionAccessUsed for
    AccountAccount SettingsReadAccount settings and member two-factor
    AccountWorkers R2 StorageReadR2 bucket public access
    AccountAI GatewayReadAI Gateway authentication, limits, DLP, and guardrails
    ZoneZoneReadDiscovering zones
    ZoneZone SettingsReadSSL/TLS, HTTPS, HSTS, and other settings
    ZoneDNSReadDNSSEC status
    UserAPI TokensReadAPI token expiration, age, and IP filters
  6. Under Account Resources, include the accounts you want Mondoo to scan. Under Zone Resources, include all zones from those accounts, or the specific zones you want Mondoo to scan.

  7. Select Continue to summary, then Create Token.

  8. Copy the token. Cloudflare shows it only once.

A token that lacks one of these permissions still connects, but some checks can then pass without examining anything. When the token can't read AI Gateways, R2 buckets, or the account member list, Cloudflare refuses the request and Mondoo reads an empty list. A check over an empty list passes, so the AI Gateway, R2 public access, and member two-factor checks report a pass that tells you nothing. The API token checks can pass the same way when the token can't list API tokens. Grant every permission in the table before you rely on those results. To learn more about token permissions, see Create API token in the Cloudflare documentation.

Treat the API token like a password. Don't commit it to source control, and rotate it periodically.

Add a Cloudflare integration

You need the Editor or Owner role, or another role with this permission. To see every role, read Roles and permissions.

In the Mondoo App, navigate to the space where you want to add the integration. Some integrations can also be added once at the organization level to cover every space with one connection. To see which ones, read Set up integrations once for your whole organization.

In the space's side navigation bar, select Integrations. In the top right, select INSTALL. On the Install Integration page, find the integration you want by browsing a category or searching by name:

  1. Under SaaS Security, select Cloudflare.

    Add a Cloudflare integration in Mondoo

  2. In the Choose an integration name box, enter a name that identifies the Cloudflare account.

  3. Paste the API token you created into the Provide your Cloudflare API token box.

  4. (Optional) Under Enable security policies, review the policies that apply to Cloudflare. The Mondoo Cloudflare Security policy checks zone TLS and HTTPS settings, the WAF, DNSSEC, HSTS, account two-factor enforcement, R2 bucket public access, API token hygiene, and AI Gateway settings. If a policy isn't enabled in the space yet, select ENABLE. A policy you enable here applies to the whole space, not only this integration.

  5. Select CREATE INTEGRATION.

Mondoo starts the first scan as soon as the integration is created. To learn how policies work, read Manage Policies.

Verify the integration

When you select CREATE INTEGRATION, Mondoo starts the first scan and opens the integration's page. Status shows Active once the scan is queued, and Most Recent Activity lists each scan and any errors it reports.

The Integration Details section of an integration page, with the status Active and a SHOW ASSETS button

Mondoo adds the Cloudflare account and zone assets to the space inventory. To review them, navigate to the space and select Inventory. To see how the assets score against the policy, select Findings > Policies and choose Mondoo Cloudflare Security. To learn what each integration status means, read Integration status and troubleshooting.

Troubleshoot

MessageCauseFix
Cloudflare rejected the token: it is not a well-formed Cloudflare API token. Check it and try again.What you pasted isn't an API token, for example a Global API Key or a token ID.Copy the token value Cloudflare shows when you create the token.
token verification rejected the token when you create the integrationCloudflare refused the token: it was revoked or has expired.Create a new token and try again.
Scans are paused at the top of the integration pageThe integration's credential was rejected by Cloudflare or has expired.Rotate the API token.
ended in a scan error, so their results are missing in Most Recent ActivityThe token is missing one of the permissions listed in Create a Cloudflare API token.The message names the most common error. In Cloudflare, edit the token to add the permission. The token value doesn't change, so the next scan uses the new permissions.

Manage your integration

To open the integration, navigate to the space, select Integrations > Cloudflare, and choose the integration.

From the integration detail page, you can:

  • Scan now. Select RUN.
  • Pause or resume scanning. Select the more actions menu, then Pause or Resume.
  • Remove the integration. Select the trash can icon and confirm. Mondoo stops scanning the Cloudflare account.

Rotate the API token

How you replace the token depends on how Mondoo stored it when the integration was created. Integrations added by someone with permission to create and view credentials store the token as a credential. Older integrations, and integrations added by someone without that permission, keep the token on the integration.

  • If the integration uses a credential: The integration detail page shows a Credential section. Select the credential's name to open it, then select Rotate and enter the new token. Every integration that uses the credential switches to the new token. To learn more, read Manage Integration Credentials.

    The Credential section of an integration page, showing a Healthy credential, its expiry date, and when it was last tested

  • If the integration stores its own token: Mondoo doesn't support editing a Cloudflare integration. To use a different API token, remove the integration and add a new one.

Scan Cloudflare from the command line

The integration scans continuously from the Mondoo Platform. To scan Cloudflare from your workstation or a CI pipeline instead, see Secure Cloudflare with cnspec.

Next steps

Last updated on

On this page