# nebumohan/cloudflare-zerotrust-lab architecture

> Architecture diagram of the GitHub repository nebumohan/cloudflare-zerotrust-lab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nebumohan/cloudflare-zerotrust-lab
- Repository: https://github.com/nebumohan/cloudflare-zerotrust-lab

## Overview

1. **Repository role**
   - This repo is not an application implementation; it is a **Cloudflare Zero Trust lab** that documents a working security architecture and the steps/observations from a manual setup.
   - The only tracked content is the README and screenshots, so the repo functions as **architecture documentation and evidence capture**, not source code.

2. **Primary system boundary**
   - The architecture spans two sides: **your Windows machine** and **Cloudflare’s managed edge/network**.
   - The local side contains a Windows-hosted origin service and the `cloudflared` connector.
   - The Cloudflare side contains the enforcement points: **Gateway**, **Access**, **Tunnel**, and the **Worker**.

3. **Local host component**
   - The Windows machine is the origin environment and runs `cloudflared` as a **Windows service**.
   - This host does not expose inbound ports; its security posture is based on **outbound-only connectivity** to Cloudflare.

4. **Secure transport boundary: Cloudflare Tunnel**
   - `cloudflared` creates the secure channel from the origin to Cloudflare.
   - The tunnel is the connectivity bridge that lets Cloudflare proxy traffic to the local service without opening firewall holes.
   - In the lab, the tunnel is named `nebu-seclab-tunnel` and is expected to remain in a healthy connected state.

5. **Protected application boundary: Cloudflare Worker**
   - The lab’s protected application is a **Cloudflare Worker** deployed on Cloudflare’s edge.
   - It acts as the destination behind the Zero Trust Access policy, with the endpoint `production.nebu-seclab.nbmohan6.workers.dev`.
   - The Worker is the app surface users try to reach; it is not directly trusted by the network.

6. **Identity enforcement: Cloudflare Access**
   - Access sits in front of the Worker and performs **identity-based admission control**.
   - The configured policy allows access only for approved email identities, with a 24-hour session duration.
   - Requests are intercepted before reaching the Worker, making identity the primary authorization boundary.

7. **DNS-layer threat prevention: Cloudflare Gateway**
   - Gateway is configured as the **DNS resolver/control point** for the lab network.
   - It blocks categories such as malware, phishing, command-and-control, botnet, and cryptomining at the resolution stage.
   - This means malicious domains fail at DNS lookup time, before any TCP or HTTP session can be established.

8. **Network location and resolver registration**
   - The local network is registered in Cloudflare as a **Gateway location** named `Nebu-SecLab`.
   - DNS traffic is routed through Cloudflare’s resolver endpoint (`172.64.36.1` and the DoH endpoint shown in the README).
   - This location registration is what binds the local environment to the policy layer.

9. **End-to-end request flow**
   - There are really two separate flows:
     - **DNS flow:** client DNS queries go to Gateway, which either resolves or blocks based on threat category.
     - **Application flow:** user traffic to the Worker hits Access first; if identity is valid, the request is permitted onward.
   - The tunnel flow is orthogonal: it keeps the origin reachable to Cloudflare through a secure outbound connection.

10. **Data and control planes**
    - The lab demonstrates a strong separation between:
      - **Control plane:** Cloudflare dashboard configuration of policies, location, app, and tunnel.
      - **Data plane:** live DNS queries, authentication attempts, and tunnel traffic.
    - Most of the “logic” lives in managed Cloudflare services rather than in repository code.

11. **Operational telemetry**
    - The README highlights three log sources that matter architecturally:
      - **Gateway DNS logs** for blocked lookups and threat categories
      - **Access logs** for identity checks and policy decisions
      - **Tunnel logs** for connector health and connection events
    - These are the key signals a SOC would correlate in a real deployment.

12. **What the repo omits**
    - There is no implementation source, IaC, or automation here.
    - The repository does not define the Worker code, tunnel config files, or policy-as-code; instead, it records the configured Cloudflare services and their observed state.
    - For an architecture diagram, this repo should be modeled as a **reference lab documenting managed Cloudflare security components around a Windows origin**.

Main entry points: [`README.md`](https://github.com/nebumohan/cloudflare-zerotrust-lab/blob/main/README.md) (Lab README), [`screenshots`](https://github.com/nebumohan/cloudflare-zerotrust-lab/tree/main/screenshots) (Screenshots)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_docs["Documentation"]
  node_repo["Lab README<br/>documentation<br/>[README.md]"]
  node_screenshots["Screenshots<br/>evidence"]
end

subgraph group_local["Local Host"]
  node_windows["Windows Host<br/>origin-host"]
  node_originapp["Origin Service<br/>local-service"]
  node_cloudflared["cloudflared<br/>connector-service"]
  node_clients(("User Clients<br/>request-source"))
end

subgraph group_cloudflare["Cloudflare Edge"]
  node_tunnel{{"Tunnel<br/>secure-bridge"}}
  node_gatewayloc["Nebu-SecLab<br/>gateway-location"]
  node_gatewaydns["Gateway DNS<br/>dns-control"]
  node_access["Access Policy<br/>identity-policy"]
  node_worker["Worker App<br/>edge-application"]
  node_dnslogs["DNS Logs<br/>telemetry"]
  node_accesslogs["Access Logs<br/>telemetry"]
  node_tunnellogs["Tunnel Logs<br/>telemetry"]
  node_controlplane["Cloudflare Config<br/>control-plane"]
end

node_repo -->|"documents"| node_controlplane
node_repo -->|"captures"| node_screenshots
node_clients -->|"DNS routed via"| node_gatewayloc
node_gatewayloc -->|"enforces"| node_gatewaydns
node_gatewaydns -->|"logs"| node_dnslogs
node_clients -->|"requests"| node_access
node_access -->|"permits"| node_worker
node_access -->|"logs"| node_accesslogs
node_clients -->|"reaches via edge"| node_tunnel
node_cloudflared -->|"maintains"| node_tunnel
node_windows -->|"runs"| node_cloudflared
node_tunnel -->|"proxies to"| node_originapp
node_originapp -->|"hosts on"| node_windows
node_tunnel -->|"logs"| node_tunnellogs
node_controlplane -->|"configures"| node_gatewaydns
node_controlplane -->|"configures"| node_access
node_controlplane -->|"configures"| node_tunnel
node_controlplane -->|"deploys"| node_worker

click node_repo "https://github.com/nebumohan/cloudflare-zerotrust-lab/blob/main/README.md"
click node_screenshots "https://github.com/nebumohan/cloudflare-zerotrust-lab/tree/main/screenshots"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_repo,node_screenshots toneBlue
class node_windows,node_originapp,node_cloudflared,node_clients toneAmber
class node_tunnel,node_gatewayloc,node_gatewaydns,node_access,node_worker,node_dnslogs,node_accesslogs,node_tunnellogs,node_controlplane toneMint
```

## Components

### Documentation

Repository content capturing the lab setup and evidence

- [Lab README](https://github.com/nebumohan/cloudflare-zerotrust-lab/blob/main/README.md): documentation · Narrative record of the Cloudflare Zero Trust lab and screenshots · `README.md`
- [Screenshots](https://github.com/nebumohan/cloudflare-zerotrust-lab/tree/main/screenshots): evidence · Captured UI and state evidence for the documented setup · `screenshots`

### Local Host

Windows origin environment and outbound connector

- **Windows Host**: origin-host · Local Windows machine that acts as the origin environment
- **Origin Service**: local-service · Protected local service reached through the tunnel
- **cloudflared**: connector-service · Windows service that maintains the outbound tunnel connection
- **User Clients**: request-source · Browsers and devices issuing DNS and application requests

### Cloudflare Edge

Managed Zero Trust enforcement and delivery services

- **Tunnel**: secure-bridge · Cloudflare Tunnel named nebu-seclab-tunnel
- **Nebu-SecLab**: gateway-location · Registered Gateway location binding the local network to policy
- **Gateway DNS**: dns-control · DNS resolver and threat-prevention policy layer
- **Access Policy**: identity-policy · Identity-based admission control with approved emails and 24-hour sessions
- **Worker App**: edge-application · Protected Cloudflare Worker at production.nebu-seclab.nbmohan6.workers.dev
- **DNS Logs**: telemetry · Records blocked lookups and threat categories from Gateway
- **Access Logs**: telemetry · Records identity checks and policy decisions
- **Tunnel Logs**: telemetry · Records connector health and tunnel connection events
- **Cloudflare Config**: control-plane · Dashboard-managed setup for policies, app, location, and tunnel

## Connections

- Lab README → Cloudflare Config: documents · README records the configured Cloudflare services and observed state
- Lab README → Screenshots: captures · Screenshots provide evidence for the lab setup
- User Clients → Nebu-SecLab: DNS routed via · Client DNS traffic is sent through the registered Gateway location
- Nebu-SecLab → Gateway DNS: enforces · Location binds network traffic to DNS threat policy
- Gateway DNS → DNS Logs: logs · Blocked or allowed lookups are recorded for review
- User Clients → Access Policy: requests · Application traffic to the Worker reaches Access first
- Access Policy → Worker App: permits · Approved identities are allowed onward to the app
- Access Policy → Access Logs: logs · Identity and policy decisions are captured
- User Clients → Tunnel: reaches via edge · User access to the protected app is delivered through Cloudflare
- cloudflared → Tunnel: maintains · Outbound connector establishes the secure tunnel to Cloudflare
- Windows Host → cloudflared: runs · cloudflared operates as a Windows service on the host
- Tunnel → Origin Service: proxies to · Cloudflare forwards traffic through the tunnel to the local service
- Origin Service → Windows Host: hosts on · The origin service resides on the Windows machine
- Tunnel → Tunnel Logs: logs · Connector health and connection events are monitored
- Cloudflare Config → Gateway DNS: configures · Dashboard sets DNS threat controls and blocked categories
- Cloudflare Config → Access Policy: configures · Dashboard sets identity policy and session duration
- Cloudflare Config → Tunnel: configures · Dashboard manages tunnel identity and state
- Cloudflare Config → Worker App: deploys · Worker is the protected application surface on Cloudflare edge
