Skip to content

Commit 61922ef

Browse files
committed
note update
- networking (secure tunneling)
1 parent e684d8a commit 61922ef

File tree

1 file changed

+33
-23
lines changed

1 file changed

+33
-23
lines changed

content/Networking Concepts/Secure Tunneling.md

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ tags:
1010
- macos
1111
- ngrok
1212
Creation Date: 2024-02-23, 23:49
13-
Last Date: 2024-03-05T01:23:24+08:00
13+
Last Date: 2024-03-12T11:06:01+08:00
1414
References:
1515
draft:
1616
description:
@@ -55,50 +55,60 @@ description:
5555

5656
## Cloudflare Tunnel
5757
---
58-
>[!tip] Protect Cloudflare Tunnel with Cloudflare Access
59-
> By default, Cloudflare Tunnel is accesible by anyone from the Internet via the public [[Hostname#Domain Name]]. We can make use of [[Cloudflare Access]] to ensure only authenticated users can access the Cloudflare Tunnel
60-
6158
- Cloudflare's Secure Tunneling offering. The notes here focuses on setting it up. For more details refer to [Cloudflare Tunnel · Cloudflare Zero Trust docs](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/)
6259
- You need the `cloudflared` cli to managed the [[#Secure Tunneling Client]]
6360
```bash
6461
brew install cloudflared
6562
```
6663

64+
>[!tip]- Create Cloudflare Tunnel without an account
65+
> This is for quick testing without a Cloudflare account, but it comes with minimal control. No custom domain, no authentication, limited bandwidth and unstable etc. Refer to [Cloudflare Quick Tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/do-more-with-tunnels/trycloudflare/) for more details
66+
>
67+
> ```bash title="Secure Tunneling of a local port"
68+
> cloudflared tunnel --url 127.0.0.1:<PORT_NUMBER>
69+
> ```
70+
71+
>[!tip]- Restrict access to Cloudflare Tunnel endpoint with Cloudflare Access
72+
> By default, Cloudflare Tunnel is accesible by anyone from the Internet via the public [[Hostname#Domain Name]]. We can make use of [[Cloudflare Access]] to ensure only authenticated users can access the Cloudflare Tunnel
73+
6774
75+
### Create a remotely-managed tunnel
76+
- This requires us to have a Cloudflare account and the creation of the Cloudflare Tunnel is done inside the Cloudflare website. Refer to [Create a remotely-managed tunnel (dashboard)](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/get-started/create-remote-tunnel/) for more details
6877
69-
### Approach 1: Create a locally-managed Cloudflare Tunnel (CLi)
70-
- Refer to [Create a locally-managed tunnel (CLI)](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/get-started/create-local-tunnel/) for more details
78+
>[!info]- Create a locally-managed Cloudflare Tunnel with cloudflared CLI
79+
> This approach requires you to have a config yaml file on your machine. This comes higher overhead in managing the config files in your [[File System Hierarchy]]. Refer to [Create a locally-managed tunnel (CLI)](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/get-started/create-local-tunnel/) for more details.
7180
72-
### Approach 2: Create a remotely-managed tunnel (dashboard)
73-
- Refer to [Create a remotely-managed tunnel (dashboard)](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/get-started/create-remote-tunnel/) for more details
7481
</br>
7582
76-
- There are 2 ways to perform the **[[#Secure Tunneling Client]] ([connector](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/get-started/tunnel-useful-terms/#connector)) Installation**
77-
1. **System Service:** Use `sudo cloudflared service install <TOKEN>` to register the connector as a service managed by [[Init System]]. You can only have **one Cloudflare Tunnel Service on one machine** at any time!
78-
2. **Docker:** Run the connector as a docker container without the need to grant root access but we have to manually manage the lifecycle of the connector
83+
>[!abstract] Client-side Setup
84+
> There are 2 ways to perform the **[[#Secure Tunneling Client]] ([Cloudflare Tunnel Connector](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/get-started/tunnel-useful-terms/#connector)) Installation** via **System Service** or **Docker**
85+
86+
**System Service**
87+
- Use `sudo cloudflared service install <TOKEN>` to register the connector as a service managed by [[Init System]]. You can only have **one Cloudflare Tunnel Service on one machine** at any time!
7988
80-
>[!bug] Connector Installation Issue with Docker
81-
> For some reasons, when I close the terminal, the connector container will auto exit. Even thought I used both `-d` and `--restart unless-stopped`. I am running Docker on my Raspberry Pi. If you know why, please comment down below to tell me why. Thanks :)
8289
8390
>[!info]- Cloudflare Tunnel Init System Service on Mac
84-
> When you run `sudo cloudflared service install <TOKEN>`, a service file should be created at the following path `/Library/LaunchDaemons/com.cloudflare.cloudflared.plist`
91+
> When you run `sudo cloudflared service install <TOKEN>`, a service file should be created at the following path `/Library/LaunchDaemons/com.cloudflare.cloudflared.plist`.
8592
>
86-
> You can remove the Cloudflare Tunnel Service by running `sudo cloudflared service uninstall <TOKEN>`
93+
> You can remove the Cloudflare Tunnel Service by running `sudo cloudflared service uninstall <TOKEN>`.
8794
>
88-
> The Cloudflare Tunnel Service's parent is `launchd`
95+
> The Cloudflare Tunnel Service's parent is `launchd`.
8996
>
9097
> ![[cloudflared_tunnel_service_btop.png|500]]
9198
9299
>[!info]- Cloudflare Tunnel Init System Service on Linux
93-
> You can check the status of service the using `sudo systemctl status cloudflared`
100+
> You can check the status of service the using `sudo systemctl status cloudflared`.
101+
102+
103+
**Docker**
104+
- Run the connector as a docker container without the need to grant root access but we have to manually manage the lifecycle of the connector
105+
106+
>[!bug] Connector Installation Issue with Docker
107+
> For some reasons, when I close the terminal, the connector container will auto exit. Even thought I used both `-d` and `--restart unless-stopped`. I am running Docker on my Raspberry Pi. If you know why, please comment down below to tell me why. Thanks :)
108+
109+
94110
95111
96-
>[!tip]- Create Cloudflare Tunnel without an account
97-
> This is for quick testing without a Cloudflare account, but it comes with minimal control. No custom domain, no authentication, limited bandwidth and unstable etc. Refer to [Cloudflare Quick Tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/do-more-with-tunnels/trycloudflare/) for more details
98-
>
99-
> ```bash title="Secure Tunneling of a local port"
100-
> cloudflared tunnel --url 127.0.0.1:<PORT_NUMBER>
101-
> ```
102112
103113
104114

0 commit comments

Comments
 (0)