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

Is there a way to totally bypass ZeroTier's servers? #610

Closed
apognu opened this issue Oct 26, 2017 · 29 comments
Closed

Is there a way to totally bypass ZeroTier's servers? #610

apognu opened this issue Oct 26, 2017 · 29 comments
Labels
Type: Question General questions about the product, plans, etc.

Comments

@apognu
Copy link

apognu commented Oct 26, 2017

Hi,

I'm trying to wrap my head around the way ZeroTier's addresses are resolved to peers. As far I understood it, networks and members are referenced on ZeroTier's servers for it to initiate the first connection.

I set up my own moon and controller, by following the doc, which, I believe, allows me to create my own networks outside of my.zerotier.com, and to have my own root servers for my clients to resolve my network.

That's actually what happens when I copy the signed moon file to my clients, they can connect to the network by communicating directory with my moon, and then controller without, as far as I know, needing the root servers.

The whole thing still works when I don't copy the moon file. I guess this works by going through the Planet's root servers, which then refers to my moon, which then refers to my controller. I didn't find anything in the documentation that explains how that works. Does my controller register its networks with the Planet, so my client can find it through the official root servers? Does my moon do it?

I would like to understand exactly what happens in this resolution scheme and if there is any way to prevent the root servers from learning about my networks? I know this would prevent global resolution without a manual reference to my moon, but in some implementation scenarios, I believe it would be preferred).

Don't hesitate to point it out if there is anything I did not understand in how ZeroTier works, or if I haven't been clean enough.

Thanks!

@adamierymenko
Copy link
Contributor

This isn't easy right now but it can be done. You could rebuild it without the default 'planet' definition.

Better support for air-gapped operation is slated for the future. As it stands when you add your own roots it uses them alongside ours, not in place of them.

There is a rationale behind this. The goal here is zero-configuration operation everywhere and having a core root set enables this with minimal overhead. The roots don't really do anything other than introduce peers, cache public keys, and relay traffic when direct links are not possible.

@adamierymenko adamierymenko added the Type: Question General questions about the product, plans, etc. label Oct 26, 2017
@apognu
Copy link
Author

apognu commented Oct 26, 2017

I understand, and I agree the defaults should be set for zero-config (that's one feature that is remarkable in ZeroTier!). Glad to know the idea of detaching totally from the Planet is considered. I'll wait until then.

I presume my understanding of the resolution process when the client has no reference to the moon was right? Which is:

  • my moon ID is extracted by the root servers from the network ID
  • the location(s) of my moon(s) is resolved from the root server's cache
  • my custom roots know which controller manages the network
  • profit?

Thanks for your answer.

@adamierymenko
Copy link
Contributor

We're thinking a lot about how to enable more independence without breaking zero-conf too badly or introducing other headaches. We'd ideally like it to be pretty transparent. It's not an easy problem.

@StrikerTwo
Copy link

+1 for an option to ONLY use the defined moons.
A command line or config option to disable the default planet hosts would be fine for me. People who use this probably know what they are doing ;)

@apognu
Copy link
Author

apognu commented Nov 2, 2017

From what I've seen, the only file containing the planet definition is /var/lib/zerotier-one/planet which is generated on first run. It can also be generated manually from mkworld.cpp.

I replaced lines 87-116 with parameters from my moon and distributed the file to my nodes and all went smoothly, they only connected to my moons (which were the new planet) to establish connection.

It's still a bit of a pain to configure (generate a binary planet file from code and distribute it to all nodes), it might be easier, as @StrikerTwo said, to provide a CLI option to use a custom planet definition from a JSON file on disk (even if it generates the binary planet definition on first run).

The second pain point I see here is there is not way to override the planet definition for ZeroTier One mobile apps. So I guess if your moon/controller does not use Alice and Bob to register itself, you'll have no way to connect your mobile app to your network (since it'll try and find it through the main planet).

@adamierymenko
Copy link
Contributor

adamierymenko commented Nov 2, 2017

This is both a pain point and a feature. As I said we're thinking about ways to make this easier without sacrificing the feature part.

A major thing we are trying to do here is to do away with manual network configuration as much as possible. We want networks that are like chat rooms.

"Oh, join my network it's (network ID.)"

"Ok."

If you don't have some common basis then you need additional information beyond the network ID. We don't want to require that.

@apognu
Copy link
Author

apognu commented Nov 2, 2017

I do understand, and I would never suggest removing that feature or make it non-default. The beauty of this project rests on its zero-configuration capabilities.

Just giving some hints at what you could do to provide an optional way of overriding the planet's definition when you decide to take this on. ;)

@StrikerTwo
Copy link

StrikerTwo commented Nov 2, 2017

This is both a pain point and a feature. As I said we're thinking about ways to make this easier without sacrificing the feature part.

I'm not asking you to sacrifice a feature. I'm asking you to add one ;) Like I said, the majority of users are fine with it the way it is. Just adding an option for the 0.01% of users who would like something different won't hurt.

That said, if I had to design this feature, I would probably do something like

  • Network X is registered at ZeroTier with moons Y and Z and a flag "use only those moons" (maybe an extension of the existing switch public / private)
  • Host wants to join network X, contacts Zerotier root servers, learns about moons and flag
  • Host contacts moons and waits for authorization
  • Moon authorizes host
  • Host never asks ZeroTier root servers again until it wants to join another network

Easy configuration, completely transparent to the user, but minimal metadata leaking outside my control.

Edit: I do realize this is not exactly what the OP wanted, but maybe a step in his direction while still maintaining the principle of ZeroTier ;)

@apognu
Copy link
Author

apognu commented Nov 2, 2017

In some scenario, even having a single request home which would leak the client ID and IP address, the moons IDs and IP addresses would be too much.

In my mind, the easiest solution would be to be able to override the planet's definition through a configuration file (still optional).

@StrikerTwo
Copy link

Agreed. Personally, I'd be happy with a "don't use the planet" option. Just wanted to suggest ideas for more decentralization as well.

@andrew-d
Copy link

Worth noting that this is something I'm interested in both from a decentralization perspective ("what if ZeroTier the company goes away?") but also a security perspective ("what if someone compromises the ZeroTier root servers?"). It's likely true that if you can compromise the ZeroTier servers you can also do so to any roots hosted by others, but it's an additional layer of defense if you can host literally everything yourself.

If it would be helpful, I'm also happy to contribute code towards achieving this, but I'm new-ish to this project so I'm not sure what would be helpful (and also, the mobile apps don't appear to be open-source?). Feel free to let me know!

@apognu
Copy link
Author

apognu commented Nov 13, 2017

I forked the client (not yet on GitHub, purely as a proof of concept) so it picks up a custom planet if and only if /etc/zerotier-one/planet exists (this file has to be generated beforehand but can then be distributed through CM).

As far as I know, once this is enabled, the client does not have a single reference to ZTO's root servers. But all properly configured clients can join the networks managed by the controllers referenced by the moon. You cannot join global networks anymore, but that's not what we are looking for, here.

@fauust
Copy link

fauust commented Feb 5, 2018

Hi @apognu,
could I look at your fork? I am also interested in finding a way to totally bypass ZeroTier's servers.
Should I just rebuild the zerotier-one binary with my specific options in the mkworld.cpp file?

@adamierymenko
Copy link
Contributor

We will be making this easier in the 1.4 tree, but right now this requires a custom 'planet' file or a fork. Closing since it's already on the road map.

@jstasiak
Copy link

jstasiak commented Mar 12, 2019

The 1.4 tree with the changes mentioned is not available yet, right? I could really use this, as I have two endpoints behind NAT and they have to communicate over a relay – as long as the connection goes through my moon all is relatively well, but when zerotier thinks (incorrectly), that one of the roots is faster than my moon and starts using it instead of my moon everything slows down to a crawl.

PS. It may not be the best place to say this, but thank you for the project.

@Fastidious
Copy link

1.4 is out, is there a way to run planets now? If so, how?

@ziyifeihu
Copy link

Will the project continue?

@abclution
Copy link

I have a simple, somewhat related question regarding moons and planets.

I have several multi-gateway locations, one with a fast (4g 15dl/5up) and slow (adsl 15dl/0.8up), I run several other self run vpns and I initiate the VPNS by forcing them through the fastest gateway availiable. But in order to do that, I need to know the IP/DNS of the destination servers to setup my route mangling rules.

I want to make sure my ZT clients all communicate over the 4g
If I run my own controller, this would be easy as I would know the controller + planet/moons ip.

But using the free tier of the ZT service, where is the list of helper planet/moons IPs or DNS so I can adjust my firewall rules? Is there a single reference source?

@StrikerTwo
Copy link

The main VPN traffic with Zerotier is peer to peer. Knowing the planet/moon IPs and setting extra routes for them will not help you (unless you force your nodes to relay through them).
Running your own controller won't change things (again, unless you force every node to relay).

You can configure all nodes to use a specific port (UDP/9993 is default) and use policy based routing to send those packets over the fast links.

@JocPelletier
Copy link

The main VPN traffic with Zerotier is peer to peer. Knowing the planet/moon IPs and setting extra routes for them will not help you (unless you force your nodes to relay through them).
Running your own controller won't change things (again, unless you force every node to relay).

You can configure all nodes to use a specific port (UDP/9993 is default) and use policy based routing to send those packets over the fast links.

Do you have an example on how I can configure/achieve that? Thanks a lot

@StrikerTwo
Copy link

Depends on your operating system and/or router.
I use OPNsense virtual machines on every site and can just set firewall rules for UDP/9993 and force them to use a specific gateway.

I have used similar rules (again, with OPNsense) to force already encrypted traffic over fast, but unencrypted links and push the rest through the VPN.

@catalystsitaly
Copy link

Since all default roots of zerotier very slow in China, I am expecting an easy way to customize own root very much.
Great project thanks.

@qiuwei
Copy link

qiuwei commented Nov 22, 2020

Since all default roots of zerotier very slow in China, I am expecting an easy way to customize own root very much.
Great project thanks.

For the speed issue, you can set up your own moon, but still use the official root.

@RobbertTamminga
Copy link

Hi, it's my first GitHub post and im still a student so please go easy on me ^^.

As stated before by others, im also trying to configure my own Zerotier network without any connection to 3rd party servers.
in my topology i will be using microsoft azure VM as the planet and 2 raspberry pi as nodes.

my goal is to create a secure connection between the raspberry pi's by using Zerotier.

I have created a new custom plannet by altering the ip address on line 89 of the mkworld.cpp file to my VM's IP address (i also removed all other servers they had. so only 1 ip address remains).
After executing the build.sh and then executing mkworld, i have copied the world.bin file into the planet file on the raspberry pi's to replace the information.

Other things i have done is opening ports on my VM to allow UDP in and outbound, so it's actually reachable.

After checking my raspberry pi's peerslist i see only 1 planet and 1 leaf (the leaf is my controller on Zerotier site, which im going to make myself later on), and the planet files are identical.

In my mind the nodes should now be able to talk with each other using Zerotier address, however they cant.

At this point im unsure of what the issue could be, and so im reaching out to this forum for suggestions.

Thanks for taking the time to read this, and if you have a suggestion please keep in mind. im very new to this line of work

@samuelxhu
Copy link

Great project thanks.

Because all default roots of zerotier very slow in China, should i set up self hosted controller inside China, or should i set up self hosted Moon inside Chian, in order to speed up things such as connection-establishing and relay (if NAT impossible)?

@laduke
Copy link
Contributor

laduke commented Nov 15, 2021

Hello,
no traffic passes through controllers. A moon might help you.

The my.zerotier.com controllers should work fine with the latency, but if you can't connect to them at all you'll need a self hosted controller too.
Hope that helps.

@samuelxhu
Copy link

@laduke Thanks a lot for the kind response.

One more question, will the mobile clients (Adroid and Apple phone) support the use of Moon nodes? and any documents on how to configure clients to use Moon nodes?

@PaleNeutron
Copy link

Any updates?

@s-t-e-p-a-n-o-v
Copy link

Hi!

@RobbertTamminga did you solved an issue ?
Looks like ZT_DEFAULT_WORLD in Topology.cpp should be modified as well.
5e8e935

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Question General questions about the product, plans, etc.
Projects
None yet
Development

No branches or pull requests