Cloudflare Integration

Cloudflare Integration


This guide will walk you through the process of integrating your Cloudflare Zero Trust environment with Lumia. This configuration allows Cloudflare to route traffic from AI applications through Lumia’s engine for real-time inspection and governance.

Before You Begin

To ensure a smooth integration, please have the following information and permissions ready:
  • Cloudflare Account ID: Found in your Cloudflare dashboard URL or under Account Home > Overview.
  • Cloudflare API Token: A token with Zero Trust: Edit permissions (required for syncing Lumia’s AI domain list).
  • Lumia CIDR Allocation: The unique private network range provided to you by Lumia (e.g., 172.20.0.0/16).
  • Lumia Tenant UUID: Your unique organization identifier, supplied by your Lumia representative.

Prerequisites

Before configuring your account to integrate with the Lumia Security proxy, ensure the following settings are enabled in your Cloudflare Zero Trust dashboard to allow for traffic inspection and certificate propagation:
1. Device Certificate Propagation
Navigate to Team & Resources > Devices > Management and enable Install CA to system certificate store.
⚠️
Critical: This must be enabled before configuring HTTPS inspection (Step 2 below) to ensure the Cloudflare certificate is properly trusted by user devices.
2. Gateway Proxy & Inspection
Navigate to Traffic policies > Traffic settings and verify that the following are enabled:
  • Allow Secure Web Gateway to proxy traffic
  • Inspect HTTPS requests with TLS decryption

Installation Steps

Step 1: Network Preparation

Configure Split Tunnel Settings
Lumia uses a specific private network range (CIDR) to receive traffic. You must ensure this range is not bypassed by existing split tunnel rules.
  1. Navigate to Team & Resources > Devices > Device profiles.
  2. Locate your active profile and click Edit (or click the three dots menu > Configure).
  3. Scroll down to the Split Tunnels section and click Manage. Here you can view your split tunnel entries and verify the following:
Configuration Options:
  • If using "Exclude IPs and domains" mode:
    • Ensure Lumia’s assigned CIDR range (e.g., 172.20.0.0/16) is NOT in the exclude list.
    • Important: Also check for broader CIDR ranges that may include your network.
      • Example: If 172.16.0.0/12 is excluded, it includes ALL networks from 172.16.0.0 to 172.31.255.255, which would block 172.20.0.0/16.
  • If using "Include IPs and domains" mode:
    • Add the Lumia CIDR to the list to ensure it is explicitly routed through the tunnel.
⚠️
Critical: Check for CIDR Range Overlaps
List all excluded CIDR ranges in your configuration and confirm the Lumia network doesn't fall within them (use an online CIDR calculator or subnet tool if needed). Common overlapping ranges to watch for:
  • 10.0.0.0/8 (includes all 10.x.x.x networks)
  • 172.16.0.0/12 (as mentioned above)
  • 192.168.0.0/16 (includes all 192.168.x.x networks)
Verification Steps:
  • Test connectivity to your private network after making configuration changes.
  • Verify that tunnel traffic is routing correctly through the expected path.

Step 2: Setup Connection

2.1 Create Network Tunnel
  1. Navigate to Networks > Connectors.
  2. Select Cloudflared.
  3. Create a new tunnel with the following name format: [client]-tunnel-[environment].
  4. Click Save tunnel.
  5. Important: Save the generated token and share it with Lumia Security along with the selected tunnel name.
  6. Click Next.
  7. Under the CIDR tab, add 172.20.0.0/16.
2.2 Create Access Application
  1. Navigate to Access controls > Applications.
  2. Click Add Application.
  3. Select Self-Hosted application.
  4. Configure the following settings:
    • Name: [Client] Security Access App
    • Session duration: Set according to your organization's security requirements.
  5. Click Add private hostname and enter the following details:
    • Hostname: 172.20.0.0/16
    • Port: 443
  6. Click Next, click Next again, and then click Save.
2.3 Advanced Application Settings
After saving the application, you must verify specific security behaviors to ensure compatibility:
  1. Navigate back to Access controls > Applications and select the application you just created.
  2. Go to the Advanced settings tab.
  3. Verify and configure the following:
    • CORS Settings: Toggle Bypass options requests to origin to ON (enabled).
    • Service Auth Behavior: Toggle Return 401 Response to OFF (disabled).
    • Authentication Support: Toggle Authenticate with Cloudflare One Client to ON (enabled).

Step 3: Setup Policies

3.1 Create Managed Domain List
This step must be performed using the Cloudflare API, as the Cloudflare console does not support manual uploads of DOMAIN lists containing wildcards.
Ensure you have the following ready before proceeding:
  • Your Cloudflare API Token with Zero Trust: Editpermissions.
  • Lumia Tenant UUID (provided by Lumia).
  • Account ID
1. Download Lumia’s domain list:
Run the following command in your terminal to download the latest domain list. Replace <Tenant_UUID> with the UUID supplied by Lumia.
curl https://downloads.lumiasecurity.com/feed/<Tenant_UUID>/domains.list > domains.list
2. Create the list in Cloudflare:
Run the following command to create an empty list named LUMIA_HOSTS. Replace <account_id> and <token> with your actual values.
curl -X POST "https://api.cloudflare.com/client/v4/accounts/<account_id>/gateway/lists" \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ --data '{ "name": "LUMIA_HOSTS", "type": "DOMAIN", "description": "Managed via API" }'
3. Verify the Response:
You should receive a JSON response similar to the one below.
Copy the value of the "id" field - you will need it for the next step.
{ "result": { "id": "b3c66255-85bf-425f-8f10-32f8abbc296c", # <-- use this in the next call "name": "LUMIA_HOSTS-1", "description": "Lumia Hosts", "type": "DOMAIN", "created_at": "2025-12-31T15:58:06Z", "updated_at": "2025-12-31T15:58:06Z" }, "success": true, "errors": [], "messages": [] }
4. Update the list with the domain file:
Now, upload the domains from your domains.list file to the list you just created. Replace <List_id> with the ID you copied from the previous response.
curl -X PUT "https://api.cloudflare.com/client/v4/accounts/<account_id>/gateway/lists/<list_id>" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <token>" \ --data-binary "@domains.list"
5. Confirmation Response:
A successful upload will return a response showing the total count of domains synced (e.g., "count": 826).
{ "result": { "id": "2aea1f29-f829-4e17-9063-f99056365f12", "name": "LUMIA_HOSTS", "description": "Lumia Hosts", "type": "DOMAIN", "created_at": "2025-12-31T15:40:04Z", "updated_at": "2025-12-31T15:42:25Z", "count": 826 }, "success": true, "errors": [], "messages": [] }
3.2 Create DNS Policy
Now that your domain list is synced, you must configure Cloudflare to override the DNS for these hosts.
  1. Navigate to Traffic policies > Firewall policies.
  2. Select the DNS tab and click Add a policy.
  3. Step 1 (Name): Enter the name Lumia Host Override Policy.
  4. Step 2 (Traffic): Set the following conditions:
    • Selector: Domain
    • Operator: in list
    • Value: Select the LUMIA_HOSTS list.
  5. Step 3 (Identity): (Optional) If deployment is restricted to specific users, list them here. Otherwise, leave blank.
  6. Step 4 (Action): Configure the action:
    • Action: Override
    • Override Hostname: 172.20.0.242
  7. Click Save policy.
3.3 Create HTTP Policy
This policy prevents TLS certificate validation errors when accessing private IPs.
  1. Navigate to Traffic policies > Firewall policies and select the HTTP tab.
  2. Click Add a policy.
  3. Step 1 (Name): Enter the name Allow no-TLS Validation for Access App.
  4. Step 2 (Traffic): Set the following conditions:
    • Selector: Self-hosted Access App with Private Address
    • Operator: is
    • Value: Present
  5. Step 3 (Identity): (Optional) If deployment is restricted to specific users, list them here. Otherwise, leave blank.
  6. Step 4 (Action): Configure the action:
    • Action: Allow
    • Untrusted certificate action: Pass Through
  7. Step 5 (Headers): Click Add a header and enter:
    • Custom header name: Ls-Tenant
    • Custom header value: Your <Tenant_UUID> supplied by Lumia Security.
  8. Click Save policy.

Step 4. Verification and Troubleshooting

After completing the configuration, perform the following tests to ensure traffic is routing correctly through the Lumia tunnel.
1. DNS Resolution Testing
Verify that domains in your managed list are being intercepted and overridden by Cloudflare.
Command:
# Test DNS resolution for a domain in your list nslookup chatgpt.com # Should resolve to tunnel IP
Expected Result: The domain should resolve to the Lumia override IP you configured in Step 3 (e.g., 172.20.0.242).
2. Traffic Flow Validation
Test the end-to-end connection through the tunnel. We use the -k flag to bypass certificate warnings since local trust is not yet established.
Command:
# Test connection (using -k to ignore certificate warnings) curl -v -k https://chatgpt.com
Expected Result: You should see a successful connection (HTTP 200 or a redirect) and the verbose output should indicate the traffic is passing through the Cloudflare gateway.
3. Service Monitoring
  • Check tunnel connection status in Cloudflare dashboard
  • Monitor traffic flow through logs
💡
Troubleshooting
If your tests didn't produce the expected results, work through these common issues:

Connection & Routing

  • WARP Client: Verify that the WARP client is Connected and that Gateway is enabled in the client settings.
  • CIDR Overlaps: Double-check that no broader CIDR ranges (e.g., 172.16.0.0/12) in your Split Tunnel settings are inadvertently excluding the Lumia range.
  • DNS Selector: Ensure the DNS policy uses the Domain selector (not Host).
  • Tunnel Health: Check the tunnel status in Networks > Connectors. It must be Healthy.

DNS Resolution Failures

  • Policy Configuration: Confirm the DNS policy is correctly configured to use the LUMIA_HOSTS list.
  • Policy Priority: Verify the policy priority order. Ensure Lumia policies are at the top of the list to prevent them from being overridden.
  • Direct Access: Test direct access to the tunnel hostname to isolate the issue.

TLS Certificate Errors

  • HTTP Policy: Verify the "Allow no-TLS Validation for Access App" policy is active and set to Pass Through.
  • Access App IPs: Check that private IPs are correctly defined within the Access Application settings.

Ongoing Maintenance

To keep your protection up to date, you should periodically update the domain list.
💡
Note: Before updating Cloudflare, ensure you have downloaded the latest list from Lumia using the command provided in Step 3.
Update the Domain List:
Run the following API call to sync the updated list with Cloudflare:
curl https://api.cloudflare.com/client/v4/accounts/<account_id>/gateway/lists/<list_id> \ -X 'PUT' \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer <api_token>" \ --data-binary "@<path_to_file>"
Replace the placeholders with your specific values:
  • <account_id> - Your Cloudflare account ID (found in the dashboard URL or under Account Home > Overview).
  • <list_id> - The unique identifier for the LUMIA_HOSTS list created in step 3.
  • <api_token> - Your Cloudflare API token with Zero Trust: Edit permissions.
  • <path_to_file> - The path to the domain list file downloaded from Lumia
    (e.g., domains.list). Ensure the @ symbol is included.

Next Step

If your manual tests (Step 4) confirm a successful connection, return to our Getting Started guide and proceed to Step 1.2: Verify Integration to confirm that logs are appearing in your Lumia Portal.