Towonel: Open Source drop-in Cloudflare Tunnel alternative (erwanleboucher.dev)
from fhoekstra@feddit.nl to selfhosted@lemmy.world on 21 May 10:33
https://feddit.nl/post/56825643

So you don’t want to port-forward on your home router or have Cloudflare decrypt all your traffic? Check out Towonel.

Most open source Cloudflare Tunnel alternatives involve setting up a VPS, terminating TLS there on a reverse proxy, then setting up a Wireguard tunnel to your server at home.

Towonel is different: it does not decrypt your traffic on the VPS and you can easily share one, so not every self-hoster has to buy and maintain a VPS.

Check it out!

Mastodon link: gts.erwanleboucher.dev/…/01KS4YNA2SYMSP0FSKJVNJA1…

#selfhosted

threaded - newest

hirihit640@sh.itjust.works on 21 May 10:48 next collapse

Very cool. I personally use a double wireguard network: a wireguard vpn at home for all my services, and then since my home network is behind a double NAT and impossible to access publicly, I use a second wireguard tunnel to a VPS, to forward traffic to my internal wireguard network. The only thing the VPS can see is encrypted wireguard packets.

Edit: it seems like this service is more for public or shared services (like a public blog), rather than private personal services, so wireguard is less of an option

INeedMana@piefed.zip on 21 May 10:59 next collapse

Oh, nice find. I’m saving that

PotatoesFall@discuss.tchncs.de on 21 May 11:05 next collapse

Oh great. So now there’s a tuwunel and a towonel and they’re completely different things.

(tuwunel is a fork of the matrix backend conduwuit. not to be confused with continuwuity, another conduwuit fork)

fhoekstra@feddit.nl on 21 May 11:14 next collapse

I know, the naming isn’t ideal.

On the bright side, you can now expose multiple tuwunel instances via a single towonel and federate with other tuwunels on other towonels for maximum uwu owo

Which is almost what my friends and I are doing, except we’re running continuwuity instead of tuwunel.

ryokimball@infosec.pub on 21 May 13:09 next collapse
irmadlad@lemmy.world on 21 May 13:41 collapse

Holy shit. That’s all I got

<img alt="" src="https://lemmy.world/pictrs/image/3db7dd08-ebfa-40c2-8141-e9ac57b3991a.jpeg">

T4V0@lemmy.pt on 21 May 12:01 collapse

Huh, I wasn’t aware there were Conduit forks, thanks!

PotatoesFall@discuss.tchncs.de on 21 May 15:25 collapse

Oh right, forgot to mention conduwuit was itself a fork of conduit. Man

hendrik@palaver.p3x.de on 21 May 11:49 next collapse

Uh. Blog is down. All I get is an 404 for the link in the Mastodon post.

Edit: Here’s a link that works: https://github.com/eleboucher/towonel

Deebster@infosec.pub on 21 May 12:00 collapse
Deebster@infosec.pub on 21 May 12:10 next collapse

So I built towonel. In Rust, partly because I wanted to learn the language properly

This bit makes me a little wary.

atomicbocks@sh.itjust.works on 21 May 15:58 collapse

Why? I didn’t know python until one of my clients decided they would only use it for everything going forward. It took me all of a day to start converting C# code and this was a decade before LLMs.

Knowledge of a specific language does not reflect development skill.

MinFapper@startrek.website on 21 May 16:21 collapse

Yes, but ported C# usually doesn’t make for the most idiomatic Python.

99% of the time that doesn’t matter, but a highly security sensitive reverse proxy shared by multiple users most likely part of the stack to be attacked might be an exception.

atomicbocks@sh.itjust.works on 21 May 16:28 collapse

I like how you just assumed that what I was doing wasn’t security oriented…

BakedCatboy@lemmy.ml on 21 May 12:29 next collapse

Do most people running a vps reverse proxy terminate tls on the vps? I just proxy TCP 1:1 without touching it to my homelab over my wireguard tunnel. That seems easier than coordinating between the vps which services I’m running locally.

hamFoilHat@lemmy.world on 21 May 14:26 collapse

Do you have a link to a tutorial or an example setup for that? I’ve wanted that exact setup but couldn’t find how to do it.

BakedCatboy@lemmy.ml on 21 May 15:15 next collapse

Not really haha, you could say I followed a tutorial for setting up a wireguard server on a VPS, and then once I had the wireguard container running and my homelab boxes as clients, I started up an haproxy container on the VPS with network_mode: “service:wireguard” so that the wireguard container can also see my homelab boxes through the tunnel, then also added ports 80 and 443 to the wireguard container on the VPS (in addition to the 51820 for incoming wireguard connections) - that has to be on the wireguard container because using network_mode means the haproxy container piggy backs on the wireguard container’s network, then I added a simple haproxy config that listens on 80/443 on the VPSes public IP and proxies it to the appropriate box on the other side of the tunnel.

For the wireguard config, the key seems to be using mode tcp in any backend or frontend that’s connected to port 443, so that it just proxies raw data without doing termination. With SNI, you can even proxy to different wireguard clients based on domain, because SNI exposes the domain without needing to do termination. So I do that because I have my NAS as well as a NUC connected to the wireguard network hosting different things.

This is a stripped down version of my haproxy config:

global
    maxconn     20000
    log         127.0.0.1 local0
    daemon

defaults
    mode http
    timeout connect 10s
    timeout client 1m
    timeout server 1m
    maxconn 8000
    option tcpka
    option tcp-smart-connect
    default-server init-addr last,libc,none

resolvers docker
    parse-resolv-conf

frontend ingress_http
    bind :::80
    bind :80

    acl h_secondbox_http hdr(host) -i second.box.example.com
    use_backend secondbox_http if h_secondbox_http

    default_backend vault_http

frontend ingress_https
    mode tcp
    bind :::443
    bind :443
    tcp-request inspect-delay 5s
    tcp-request content accept if { req_ssl_hello_type 1 }

    acl h_secondbox_https req_ssl_sni -i second.box.example.com
    use_backend secondbox_https if h_secondbox_https

    default_backend vault_https

backend vault_http
    server vault_server_http 10.13.13.2:80 send-proxy-v2
backend vault_https
    mode tcp
    server vault_server_https 10.13.13.2:443 send-proxy-v2

backend secondbox_http
    server secondbox_server_http 10.13.13.3:80 send-proxy-v2
backend secondbox_https
    mode tcp
    server secondbox_server_https 10.13.13.3:443 send-proxy-v2

The way this is set up, I do have to manually enter every subdomain I want to go to my second box, but the default is to route to my main vault, which is where I host most stuff anyways.

My docker compose on the VPS is pretty simple:

services:
  wireguard:
    image: linuxserver/wireguard:latest
    container_name: wireguard
    restart: unless-stopped
    cap_add:
stratself@lemdro.id on 21 May 15:42 collapse

Not exactly a tutorial, but I use SNI routing + TLS passthrough with Caddy-L4 (and previously Traefik), and wrote/collect some stuff about it over the years:

{
    layer4 {
        tcp/:443 {
            tcp/127.0.0.1:538
        }
    }
}
fightforlife@lemmy.world on 21 May 13:21 next collapse

Isn’t this similar to rathole or frp?

fhoekstra@feddit.nl on 21 May 14:08 collapse

Very similar.

The main differences are that those projects are highly configurable and can do a lot of things, while towonel is simpler: opinionated/streamlined for use as a shared Cloudflare tunnel alternative. I also think towonel may be the only one to use QUIC for the tunnel, just like Cloudflare.

Besides that, towonel is very new and still in alpha. Rathole does not seem to be actively developed anymore, which can be a good or bad thing.

EarMaster@lemmy.world on 21 May 13:29 next collapse

Is the agent only available as a docker image? I quite like the option to run Cloudflare tunnels as a local service (e.g. in LXCs).

Decronym@lemmy.decronym.xyz on 21 May 13:30 next collapse

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I’ve seen in this thread:

Fewer Letters More Letters
IP Internet Protocol
LXC Linux Containers
NAS Network-Attached Storage
NAT Network Address Translation
NUC Next Unit of Computing brand of Intel small computers
SSL Secure Sockets Layer, for transparent encryption
TCP Transmission Control Protocol, most often over IP
TLS Transport Layer Security, supersedes SSL
VPS Virtual Private Server (opposed to shared hosting)

[Thread #304 for this comm, first seen 21st May 2026, 13:30] [FAQ] [Full list] [Contact] [Source code]

irmadlad@lemmy.world on 21 May 13:55 collapse

It’s interesting OP. I use the evil Cloudflare Tunnels/Zero Trust, and I’m pretty much sold on it, much to the chagrin of others here. Yes, there are caveats, pros and cons. Even tho I am sold on the product, I would entertain a clone/fork/rewrite if it gave me everything that Cloudflare Tunnels/Zero Trust along with the security features. I’ll do some reading once the blog is back up.