Tính năng 2 : Cloudflare Tunnel / Access Private and Public
Choose a connection method
Cloudflare Tunnel via cloudflared
Cloudflared là một dịch vụ proxy (daemon) giúp kết nối các ứng dụng nội bộ hoặc toàn bộ mạng riêng tư với Cloudflare bằng cách tạo ra một tunnel bảo mật giữa hệ thống nội bộ và mạng Cloudflare.
Các đặc điểm của cloudflared:
Sơ đồ:

Đường đi của tunnel
Daemon (cloudflared) trên hệ thống nội bộ của ứng dụng tạo kết nối ra ngoài bằng đường tunnel đến Cloudflare mà không cần NAT port .
Người dùng hoặc dịch vụ từ bên ngoài sẽ kết nối đến Cloudflare bằng Zero Trust.
Cloudflare sau đó định tuyến kết nối thông qua tunnel đã được thiết lập từ daemon để truy cập các ứng dụng nội bộ của bạn
Có thể chạy trên hầu hết mọi hạ tầng
Cloudflared có thể được triển khai trên nhiều loại hạ tầng khác nhau, từ máy chủ vật lý, máy ảo, container, đến các dịch vụ đám mây.
Tùy chọn về tính năng dư thừa và điều hướng
Cloudflared hỗ trợ các cấu hình để đảm bảo tính dư thừa và khả năng điều hướng lưu lượng, giúp tăng cường khả năng hoạt động ổn định và bảo mật.
Cloudflare Tunnel via WARP Connector (beta)
WARP Connector là một tùy chọn tiên tiến và linh hoạt hơn để kết nối lưu lượng mạng của bạn với Cloudflare, được thiết kế để cung cấp các tính năng bổ sung so với cloudflared.
Các đặc điểm của WARP Connector:
L3 proxy service trên Linux AMD64
WARP Connector hoạt động như một proxy tầng 3 (Layer 3) trên bất kỳ máy Linux AMD64 nào, giúp định tuyến lưu lượng qua các tầng mạng.
Nó tạo ra một tunnel được mã hóa bằng Wireguard, giúp bảo mật lưu lượng khi kết nối tới Cloudflare.
Kết nối hai chiều (bidirectional)
WARP Connector hỗ trợ kết nối hai chiều, cho phép thực hiện các chức năng như:
Gửi lưu lượng từ thiết bị người dùng tới mạng riêng của tổ chức thông qua tunnel bảo mật.
Gửi lưu lượng từ mạng riêng tới thiết bị người dùng, tạo ra các kết nối an toàn cho truy cập từ xa.
Proxy lưu lượng giữa hai hoặc nhiều mạng riêng, giúp kết nối các mạng nội bộ khác nhau thông qua Cloudflare.
Mã hóa Wireguard
Wireguard là một giao thức VPN hiện đại, được sử dụng để mã hóa kết nối giữa WARP Connector và Cloudflare, đảm bảo an toàn cho dữ liệu khi truyền qua mạng công cộng.
Tóm lại
Cloudflare Tunnel via cloudflared là lựa chọn cơ bản cho việc kết nối an toàn các ứng dụng hoặc mạng nội bộ với Cloudflare bằng cách tạo kết nối ra ngoài. ( user to network)
Cloudflare Tunnel via WARP Connector cung cấp các tùy chọn nâng cao hơn, với khả năng kết nối hai chiều và bảo mật lưu lượng bằng Wireguard, phù hợp cho các trường hợp yêu cầu kết nối linh hoạt giữa các thiết bị và mạng nội bộ khác nhau. ( site to site )
Task
Hatan's users can now connect to Cloudflare with WARP. Next, let’s onboard company’s applications. There are 3 Hatan’s applications running on your Linux server:
Public website (HTTP, port 80)
Private intranet (HTTP, port 8000)
SSH (SSH, ports 22)
Use Cloudflare Tunnel via cloudflared as an on-ramp for all of these.
Why?
Zero Trust security model requires granular access control to all your applications, including internal on-prem apps, apps hosted in private clouds, and SaaS apps.
Cloudflare Tunnel helps you connect two types (on-prem and cloud-hosted) to Cloudflare’s network, where access policies can be enforced. This is done by installing a lightweight daemon in your infrastructure (cloudflared).
As a bonus, this daemon creates outbound-only connections to Cloudflare’s edge. That means it doesn’t require any new inbound firewall rules.
Tại sao?
Mô hình bảo mật Zero Trust yêu cầu kiểm soát truy cập chi tiết cho tất cả applications của bạn, bao gồm các internal on-prem apps, apps hosted in private clouds và các ứng dụng SaaS.
Cloudflare Tunnel giúp bạn kết nối hai loại ứng dụng này (on-prem và cloud-hosted) với Cloudflare’s network , nơi các chính sách truy cập có thể được thực thi. Điều này được thực hiện bằng cách cài đặt một lightweight daemon trong infrastructure của bạn (cloudflared).
Một lợi ích bổ sung là daemon này chỉ tạo các outbound-only connections tới Cloudflare’s edge. Điều đó có nghĩa là không cần thiết lập thêm bất kỳ inbound firewall rules.
Lab Steps
1. Connect to the Ubuntu VM
Note the 3 Hatan’s applications running by typing this command:
2. Create a tunnel
In the Zero Trust dashboard, navigate to Networks ‣ Tunnels and create a new tunnel by clicking Add a tunnel.

Select Cloudflare Method.

Name your Tunnel and then press Save Tunnel
In the Install connector step, select Debian ‣ 64-bit and copy the command on the left

Paste the command into the Ubuntu Linux terminal
This will install
cloudflaredand automatically configure the tunnelWhen that command is successfully run on your Ubuntu machine, the connector should now provide a similar output as shown below on your tunnel page:

ℹ️
If you receive an error when installing the tunnel, run these commands to remove
cloudflaredbefore you try installing it again:
3. Connect to Connector tunnel
Now, your tunnel should be working.
make sure you enable zero trust :

ssh private :

website private :

4. Create and access to public website
Here we will create a public hostname for the Hatan's website running on origin server's port 80
Whenever this hostname is accessed by anyone on the internet,
cloudflaredwill tunnel that traffic to the origin server's port 80Go to Network - Tunnels - Public Hostname
Leave the subdomain field blank
Select your Domain from the dropdown
Under Service, enter Type: HTTP and URL: localhost:80
Ở đây tôi tạo service HTTP rùi ở bên server sẽ redirect HTTP -> HTTPS bằng cấu hình

Test access :
ZeroTrust is turned enable :

ZeroTrust is turn off :

You can also see these requests coming through in the Connector Diagnostics you configured in Step 3:

Last updated