Deploying Cloudflare Access for Zero Trust

Deploying Cloudflare Access with Cloudflare Tunnel to provide zero trust access to self-hosted and private applications,

What Is This

Deploying Cloudflare Access for Zero Trust is a modern approach to securing access to internal or self-hosted applications by leveraging Cloudflare’s Zero Trust platform. This skill focuses on configuring Cloudflare Access in conjunction with Cloudflare Tunnel (formerly Argo Tunnel) to securely expose private web applications, SSH, and RDP services to remote users without opening inbound firewall ports. The solution integrates with identity providers (IdPs), supports device posture checks, and enables the Cloudflare WARP client to serve as a VPN replacement. This approach is part of the broader Cloudflare One suite, which includes integrated Data Loss Prevention (DLP), Cloud Access Security Broker (CASB), and Secure Web Gateway (SWG) capabilities.

Why Use It

Traditional VPNs provide broad network-level access that is difficult to segment and audit, often leading to excessive privileges and lateral movement risks. Cloudflare Access implements Zero Trust Network Access (ZTNA) by shifting to an identity-aware, application-centric model. This means users are only granted access to specific apps based on their identity, device posture, and contextual policies. Key benefits include:

  • Enhanced Security: Eliminates the attack surface by not exposing internal apps directly to the Internet, and applies granular, identity-based access controls.
  • Reduced Operational Overhead: No need for complex VPN appliances or firewall configurations. Cloudflare Tunnel securely proxies traffic without inbound ports.
  • Seamless User Experience: Supports single sign-on (SSO) with existing IdPs (e.g., Okta, Azure AD, Google Workspace) and replaces VPN clients with the Cloudflare WARP agent.
  • Integrated Security Services: Access integrates with Cloudflare’s DLP, CASB, SWG, and threat intelligence for comprehensive protection.
  • Flexible Policy Enforcement: Device posture checks and context-aware rules help ensure only compliant devices and users can reach sensitive resources.

How to Use It

Prerequisites

  • A Cloudflare account and a domain added to Cloudflare
  • Administrative access to the applications you wish to secure
  • An identity provider (IdP) for authentication (optional, but recommended)
  • Access to the host running the private application

Step 1:

Set Up Cloudflare Tunnel

Install cloudflared on the server hosting your internal application:

wget -q https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared-linux-amd64.deb

Authenticate the tunnel with your Cloudflare account:

cloudflared tunnel login

Create and run a named tunnel:

cloudflared tunnel create my-zero-trust-tunnel
cloudflared tunnel route dns my-zero-trust-tunnel app.internal.example.com
cloudflared tunnel run my-zero-trust-tunnel

Update your config.yml:

tunnel: <TUNNEL-UUID>
credentials-file: /home/youruser/.cloudflared/<TUNNEL-UUID>.json

ingress:
  - hostname: app.internal.example.com
    service: http://localhost:8080
  - service: http_status:404

Step 2:

Configure Cloudflare Access Application

  1. In the Cloudflare dashboard, navigate to Zero Trust > Access > Applications.
  2. Click Add an application and select the application type (e.g., Self-hosted).
  3. Enter the application domain (app.internal.example.com).
  4. Assign an authentication policy:
    • Choose your IdP (e.g., Google, Azure AD).
    • Add rules such as "Allow users in group engineering with device posture check WARP."
  5. Enable logging and session controls as needed.

Step 3:

Enforce Device Posture with WARP

To require device posture (such as up-to-date OS or active WARP client):

  1. Define posture checks in Zero Trust > Settings > Device Posture.
  2. Add posture requirements to your Access policy.
  3. Instruct users to install the Cloudflare WARP client and enroll in your team account.

Step 4:

Test and Validate

  • Access the protected URL from a browser or client with WARP enabled.
  • Authenticate using your IdP.
  • Confirm access is blocked for unauthorized or non-compliant devices.

Example:

SSH Access via Cloudflare Access

To secure SSH with browser-based access:

  1. Add a new SSH application in Access.
  2. Install cloudflared on the client and connect using:
cloudflared access ssh --hostname ssh.internal.example.com --username youruser

When to Use It

  • When replacing legacy VPNs with identity-aware, application-level access.
  • When exposing internal apps to remote or third-party users without opening firewall ports.
  • For distributed teams needing secure access to web, SSH, or RDP services.
  • When compliance requires audit trails, session logging, or device checks.
  • To provide contractors or partners with restricted access to specific apps.
  • When seeking a scalable, cloud-native Zero Trust solution with DLP, CASB, and SWG.

Do not use for environments needing persistent UDP, fully air-gapped deployments, or when regulations prohibit routing traffic through external proxies.

Important Notes

  • Supported Protocols: Cloudflare Tunnel supports HTTP(S), SSH, and RDP, but not arbitrary TCP/UDP protocols or persistent UDP services.
  • Privacy and Compliance: Review regional data routing and regulatory requirements before enabling Cloudflare Access.
  • Identity Provider Integration: Integrate with your IdP for streamlined user management and SSO.
  • Session Logging: Enable logging for compliance and incident response.
  • Cost: Some features (e.g., advanced posture checks, SWG, DLP) may require a Cloudflare One subscription.
  • Fallback Planning: Test failover procedures in case of tunnel or provider outage.

By deploying Cloudflare Access for Zero Trust, organizations can modernize remote access, reduce attack surface, and improve security posture without the complexity of traditional VPNs.