Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

HitLuca
Copy link
Contributor

@HitLuca HitLuca commented Jul 22, 2022

What this PR does / why we need it: Adds Cloudflare Argo tunnel support through cloudflared, very useful when a user is behind a Carrier Grade NAT (often the case when using a SIM card for internet connection)

Which issue (if any) this PR fixes:

Fixes #522

@HitLuca HitLuca changed the title ✨ added cloudflared service Added cloudflared service Jul 22, 2022
Copy link
Owner

@davestephens davestephens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few tweaks needed then we should be good to merge 👍🏻

README.md Outdated
@@ -20,6 +20,7 @@ If you have a spare domain name you can configure applications to be accessible
* [Booksonic](https://booksonic.org/) - The selfhosted audiobook server
* [Calibre-web](https://github.com/janeczku/calibre-web) - Provides a clean interface for browsing, reading and downloading eBooks using an existing Calibre database.
* [Cloud Commander](https://cloudcmd.io/) - A dual panel file manager with integrated web console and text editor
* [Cloudflared (Argo tunnel)](https://github.com/cloudflare/cloudflared) - Bypass Carrier Grade NAT (CGNAT) restrictions by serving your services through a direct Cloudflare connection
Copy link
Owner

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).

Copy link
Contributor Author

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


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.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAT circumvention is a useful feature but not the primary purpose

docs/applications/cloudflared.md Outdated Show resolved Hide resolved
restart_policy: unless-stopped
command: "tunnel --no-autoupdate run --token {{ cloudflared_token }}"
network_mode: "host"
recreate: true
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to recreate the container on every run?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

📝 improved description of the cloudflared application
@allthestairs
Copy link
Contributor

I found myself setting this up recently so I thought I'd toss a link to my cloudflared branch in case either of you found any of it useful. The only real differences are in documentation and the way that I set up the container. Instead of setting it up with host networking, I use a bit of Ansible to identify the host IP address in the bridge network, then configure the containers /etc/hosts file to access the host using the hostname specified in ansible_nas_hostname as opposed to using host networking and specifying localhost.

@kamilkrz
Copy link

Hi @HitLuca This version looks promissing. Right now I am using @allthestairs approach but I would like to make it more automatic and ready for traefik serving me also internal domains.
Problems:
Probably missing step with adding cname widlcard for a tunnel
After this I am almost home
ERR Request failed error="Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: x509: certificate is valid for ___redacted___.traefik.default, not localhost" connIndex=1 dest=http://homepage.domain.com/favicon.ico ip=re.da.ct.ed type=http

I dug a bit and found aeleos/cloudflared#14 (comment)
What I understand is:
Traefik returns its own default cert instead of correct one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add cloudflared
4 participants