Restricted Tailscale docker instance

a year ago by TheFrogThatFlies to c/selfhosted

My ISP uses CG NAT which is stopping me from reaching my internal network, so I'm thinking about using Tailscale to allow me to connect to my server and hence to my internal network.

But I'm not very comfortable giving 100% access to Tailscale to my internal network, so I was thinking if I could limit it only to what it requires to connect to the internet and to a wireguard service running in the same container. This would in turn connect to a wireguard server in the container's host and provide me with full network access.

I know, as long as they have a service running in the server, even if inside a container, they can always be able to access the host. But even do I would feel safer if at least tried to contain it.

Does anyone know if this is possible? And can it be done through Docker Compose?

deur 10 points a year ago
path: 0 15980141, hotness: undefined, score: 10, children: 1
eskuero 2 points a year ago

Note that using headscale transfers the anxiety of contril from tailscale as a company to whatever vps you would be hosting the headscale on

path: 0 15980141 15987720, hotness: undefined, score: 2, children: 0
codemichael 6 points a year ago

Yes, you can run Tailscale in a container. You could create a second VLAN, attach it to your hosts interface, add a macvlan docker interface to the container and put it directly on your network.

If you have concerns about the software running on your host I would recommend getting a dedicated piece of hardware instead (rpi, zimaboard, etc).

How paranoid are you wanting to be? You can either go Headscale, or Tailnet Lock (my preference) to give your self some peace of mind. It completely depends on your threat model, which you didn't mention.

path: 0 15982036, hotness: undefined, score: 6, children: 0
droolio 5 points a year ago

There's no point doing anything fancy like that - wireguard over Tailscale is pretty pointless, as Tailscale is literally wireguard with NAT traversal and authentication bolted on. Unless you enable subnetting, it can't get more secure than that.

And even if you do enable subnetting (which you might wanna do if you need access to absolutely everything), you can use Tailscale ACLs to keep tighter control - say, from specific (tagged) devices.

path: 0 15982516, hotness: undefined, score: 5, children: 0
Cerothen 2 points a year ago

Depending on what services you want to give access with, I have had great luck with an ultra cheap VPS

https://lowendbox.com/...

Then I host my edge services on a container and use an ssh tunnel to the remote host which gives me an ipv4 and any port forward that I want.

For example I have my reverse proxy inside my network and my VPN server then I use a command like:

ssh -R 8080:localhost:80 public.example.com

Which would forward publicip:8080 to localhost:80

Read more here: https://www.ssh.com/academy/ssh/tunneling-example.

I use autossh to keep the tunnel alive at all times.

https://www.harding.motd.ca/autossh/

This is an ultra cheap way to get any ports you want and self host the whole thing. The remote VPS also doesn't get any extra access to your local network and doesn't initiate the connection so it doesn't have credentials for your local network

path: 0 16007971, hotness: undefined, score: 2, children: 0
irmadlad 2 points a year ago

But I’m not very comfortable giving 100% access to Tailscale to my internal network

Out of curiosity, why are you uncomfortable with Tailscale?

path: 0 16090010, hotness: undefined, score: 2, children: 2
TheFrogThatFlies 2 points a year ago

I have a single server with everything inside. By using Tailscale to access my server I'm giving full access to it and the entirety of my network to a third party tool that I don't know that well.

path: 0 16090010 16091626, hotness: undefined, score: 2, children: 1
irmadlad 1 point a year ago

entirety of my network to a third party tool that I don’t know that well.

Understandable.

path: 0 16090010 16091626 16091824, hotness: undefined, score: 1, children: 0
BCsven 0 points a year ago

Just setup wireguard on your server, add masquerading and ip forwarding. That single wireguard in, will give you full access to your lan

path: 0 16000106, hotness: undefined, score: 0, children: 2
bier 5 points a year ago

He can't open ports because of the ISPs setup.

path: 0 16000106 16003774, hotness: undefined, score: 5, children: 1
BCsven -1 points a year ago

Edit NVM, read up on it. Seems like you have to run PCP protocal on IP4 to bypass thr CGNAT issues.

You can use any open port and port forward at the router, or is CG NAT only 80

path: 0 16000106 16003774 16006413, hotness: undefined, score: -1, children: 0
selfhosted
selfhosted

@lemmy.world

login for more options
61554
6650
5623

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

Detailed Rules Post

  1. Be civil.

  2. No spam.

  3. Posts are to be related to self-hosting.

  4. Don't duplicate the full text of your blog or readme if you're providing a link.

  5. Submission headline should match the article title.

  6. No trolling.

  7. Promotion posts require active participation, with an account that is at least 30 days old. F/LOSS without a paywall has exceptions, with requirements. See the rules link for details. Tags [CBH] or [AIP] are required, see the links in Rule 8 for details.

  8. AI-related discussions and AI-involved promotional posts have additional requirements for tagging, as noted in Rule 7 and the AI & Promotional Post Expanded Rules post, and find example disclosures here.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

go to feed...