-
-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added cloudflared service #545
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Cloudflared (Argo tunnel) | ||
|
||
Homepage: [https://github.com/cloudflare/cloudflared](https://github.com/cloudflare/cloudflared) | ||
|
||
Cloudflare Argo tunnel: [https://blog.cloudflare.com/argo-tunnel/](https://blog.cloudflare.com/argo-tunnel/) | ||
|
||
Cloudflare: [https://www.cloudflare.com](https://www.cloudflare.com) | ||
|
||
This service is very useful when your NAS doesn't have a static IP and it's situated a [Carrier Grade NAT](https://en.wikipedia.org/wiki/Carrier-grade_NAT). With this approach your NAS is connected directly to the Cloudflare servers, which allow public access to your externally available applications. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NAT circumvention is a useful feature but not the primary purpose |
||
|
||
## Usage | ||
|
||
Set `cloudflared_enabled: true` in your `inventories/<your_inventory>/nas.yml` file. | ||
|
||
Set `cloudflared_token` to the one you grab from the Cloudflare Zero Trust Dashboard (more below). | ||
|
||
## Specific Configuration | ||
|
||
Create a cloudflare account if you don't have one. You will need to purchase a domain name registered with Cloudflare, or migrate an existing one on the platform. | ||
|
||
On your cloudflare account page, navigate to the Zero Trust dashboard, and create a Tunnel in the Access/Tunnels menu. | ||
|
||
After choosing a name for your tunnel, in the environment section choose Docker, and take note of the token in the code section below (the long string after the `--token` command): this will be your `cloudflared_token`. | ||
|
||
In the next page (public hostname) you will need to set some values, which we will delete later: set your domain as your cloudflare hostname, Service as `HTTPS` and `localhost`, then save the changes. Edit the Catch-all-rule to be `https://localhost:443`, then delete the entry you made one step before. Your Cloudflare tunnel will now redirect all incoming requests to your Traefik service runnin on port 443, which will route them accordingly. | ||
HitLuca marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Now your chosen services are exposed to the internet (the ones that have the `*_available_externally` variable set to `true`). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
cloudflared_enabled: false | ||
|
||
cloudflared_token: "" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
- name: Cloudflared Docker Container | ||
docker_container: | ||
name: cloudflared | ||
image: cloudflare/cloudflared | ||
pull: true | ||
env: | ||
TZ: "{{ ansible_nas_timezone }}" | ||
restart_policy: unless-stopped | ||
command: "tunnel --no-autoupdate run --token {{ cloudflared_token }}" | ||
network_mode: "host" | ||
recreate: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it necessary to recreate the container on every run? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry my mistake, it's left behind from my personal setup in which I was setting watchtower labels for autoupdate, which requires recreating the container |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs tweaking - the name has been changed to "Cloudflare Tunnel", and it'd be better to mention its primary purpose (increasing security with a private VPN tunnel into the Cloudflare network).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense, I just used cloudflared to bypass CGNAT but I see how it's useful to show its other capabilities to the user