Zero Trust means:
Trust nothing by default — not users, devices, or networks.
Instead of “you’re on the internal network so you’re trusted,” Zero Trust asks:
- Who are you?
- What device are you using?
- Are you allowed to access this specific thing?
- Right now?
Cloudflare enforces this using identity, policies, and its global edge network.
Cloudflare Zero Trust (formerly Cloudflare Access + Gateway) lets you:
- Protect internal apps without VPNs
- Enforce identity-based access rules
- Secure DNS, HTTP, and network traffic
- Control users, devices, and locations
- Log everything for auditing
All managed from the Cloudflare dashboard.
This answers “Who are you?”
Common options:
- Google Workspace
- GitHub
- Microsoft Entra ID (Azure AD)
- Okta
- One-time PIN via email
Cloudflare does not manage users directly — it relies on your identity provider.
An Application is anything you want to protect:
- Web apps
- Internal dashboards
- Admin panels
- SSH
- RDP
- Self-hosted services
Each application has access policies.
Policies define:
- Who can access
- From where
- On what device
- Under what conditions
Policies are evaluated top to bottom.
First match wins.
Cloudflare Tunnel allows you to expose internal services without opening firewall ports.
Internet → Cloudflare → Encrypted Tunnel → Your Server
Gateway secures outbound traffic:
- DNS filtering
- HTTP inspection
- Malware blocking
- Create a Cloudflare account and add your domain
- Enable Zero Trust
- Add an Identity Provider
- Install Cloudflare Tunnel
- Create an Application
- Write access policies
- Identity replaces the network
- Policies replace firewalls
- Tunnels replace open ports
- Logs replace guesswork
Cloudflare Zero Trust is practical, scalable, and has a free tier that actually works.
This guide walks you from zero to a working Zero Trust deployment using Cloudflare.
No enterprise jargon, no skipped steps.
By the end of this guide, you will have:
-
A Cloudflare Zero Trust organization
-
Identity-based login (no VPN)
-
A protected internal app
-
Zero open inbound firewall ports
-
Auditable access logs
You need:
-
A Cloudflare account
-
A domain name (any registrar is fine)
-
A server or service you want to protect
-
Basic command-line access
-
An identity provider account (Google, GitHub, etc.)
-
Log in to Cloudflare
-
Add your domain
-
Change your domain’s nameservers to Cloudflare’s
-
Wait for DNS to become active
Cloudflare Zero Trust requires Cloudflare DNS.
-
Go to:
Zero Trust → Settings
-
Click Enable Zero Trust
-
Choose a team name (used in URLs)
Your organization URL will look like:
https://your-team.cloudflareaccess.com
-
Go to:
Zero Trust → Settings → Authentication → Login methods
-
Enable one provider (Google recommended for beginners)
-
Restrict allowed domains or emails
This controls who can log in at all.
Cloudflare Tunnel lets your server connect outward to Cloudflare.
Linux example:
curl -fsSL https://pkg.cloudflare.com/install.sh | sudo bash
sudo apt install cloudflared
cloudflared tunnel login
cloudflared tunnel create my-app
Cloudflare generates a tunnel ID and credentials.
Create a config file:
tunnel: my-app
credentials-file: /etc/cloudflared/my-app.json
ingress:
- hostname: app.example.com
service: http://localhost:3000
- service: http_status:404
Start the tunnel:
cloudflared tunnel run my-app
Your app is now reachable only through Cloudflare.
In Cloudflare DNS:
-
Type: CNAME
-
Name: app
-
Target: .cfargotunnel.com
-
Proxy: Enabled
No public IP required.
-
Go to:
Zero Trust → Access → Applications
-
Add Application
-
Type: Self-hosted
-
Domain: app.example.com
-
Service: Cloudflare Tunnel
Example:
-
Action: Allow
-
Condition: Email ends with @example.com
Policies are evaluated top-down.
First match wins.
-
Visit https://app.example.com
-
You should be redirected to Cloudflare login
-
Authenticate
-
Access is granted only if policy matches
Go to:
Zero Trust → Access → Logs
You can see:
-
Who accessed what
-
From where
-
Why access was allowed or denied
Device posture lets you enforce security requirements.
Examples:
-
OS type/version
-
Disk encryption
-
MDM enrollment
-
Custom scripts
Configured under:
Zero Trust → Settings → Devices
Gateway protects outbound traffic.
Features:
-
DNS filtering
-
Malware blocking
-
App restrictions
Configured under:
Zero Trust → Gateway
-
Opening firewall ports
-
Overly broad allow rules
-
Ignoring policy order
-
Skipping logs
-
Treating Zero Trust like a VPN
-
Identity replaces network trust
-
Policies replace firewall rules
-
Tunnels replace open ports
-
Logs replace guesswork
-
Protect SSH using Cloudflare Access
-
Add multiple identity providers
-
Enable device posture checks
-
Lock down admin panels
-
Enable Gateway DNS filtering
If a service is reachable without authentication:
It is not Zero Trust.
Cloudflare Zero Trust scales from homelabs to enterprises and works well even on the free tier.