termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
12.61k stars 2.91k forks source link

[Package]: Zerotier-One #10123

Open ahobsonsayers opened 2 years ago

ahobsonsayers commented 2 years ago

Package description

ZeroTier is a smart programmable Ethernet switch for planet Earth. It allows all networked devices, VMs, containers, and applications to communicate as if they all reside in the same physical data center or cloud region.

Home page URL

https://www.zerotier.com/

Source code URL

https://github.com/zerotier/ZeroTierOne

Packaging policy acknowledgement

Additional information

This is essentially a VPN so requires access to the TUN/TAP device. I am hoping the creation of this package should be relatively simple as I imagine the patches required should be similar to the OpenVPN package.

I have tried compiling this myself but I get the following error during build:

~/ZeroTierOne $ make -f make-linux.mk
g++ -O3 -fstack-protector -fPIE -Wall -Wno-deprecated -std=c++11 -pthread  -DNDEBUG -DZT_USE_MINIUPNPC -DMINIUPNP_STATICLIB -DMINIUPNPC_SET_SOCKET_TIMEOUT -DMINIUPNPC_GET_SRC_ADDR -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DOS_STRING=\"Linux\" -DMINIUPNPC_VERSION_STRING=\"2.0\" -DUPNP_VERSION_STRING=\"UPnP/1.1\" -DENABLE_STRNATPMPERR -DZT_NO_TYPE_PUNNING -DZT_ARCH_ARM_HAS_NEON -march=armv8-a+crypto -mtune=generic -mstrict-align -DZT_BUILD_PLATFORM=1 -DZT_BUILD_ARCHITECTURE=4 -DZT_SOFTWARE_UPDATE_DEFAULT="\"disable\"" -D_MT_ALLOCATOR_H -D_POOL_ALLOCATOR_H -D_EXTPTR_ALLOCATOR_H -D_DEBUG_ALLOCATOR_H   -c -o one.o one.cpp
one.cpp:2085:2: error: use of undeclared identifier 'pthread_setattr_default_np'
        pthread_setattr_default_np(&tattr);
        ^
1 error generated.
make: *** [<builtin>: one.o] Error 1

Build works fine in a proot-distro, but ZeroTier obviously doesn't works as it cannot open the TUN/TAP device, throwing the following error on start.

root@localhost:~# zerotier-one -U -d
root@localhost:~# ERROR: unable to configure virtual network port: could not open TUN/TAP device: Permission denied
ahobsonsayers commented 2 years ago

I managed to get it to compile by commenting out the problematic line (possibly a bad thing to do, but I was experimenting so thought id give it a shot). However, on run I now get a different error, but am not sure about the reason behind it

~ $ sudo ./ZeroTierOne/zerotier-one $HOME
./ZeroTierOne/zerotier-one: fatal error: cannot bind to local control interface port 9993
Grimler91 commented 2 years ago

For pthread_setattr_default_np it should be possible to remove the call, and instead set the attributes in every pthread_create call, that's at least how I interpret the man page

For the cannot bind error, do you get the same in a tsu shell (rather than pretending sudo), or if you change to another port number?

twaik commented 2 years ago

@thunder-coding I think it should be moved back to termux-root-packages because android applications are not able to create TUN/TAP devices...

It requires root even on real Linux systems...

thunder-coding commented 2 years ago

@thunder-coding I think it should be moved back to termux-root-packages because android applications are not able to create TUN/TAP devices...

It requires root even on real Linux systems...

You seem to be missing a lot of context. All git repositories containing build recipes and patches have been merged into one (apt repos continue to be same). See #9915

twaik commented 2 years ago

You are right, I am sorry.

aikooo7 commented 4 months ago

Do we have any status on this?

TomJo2000 commented 4 months ago

I'm fairly certain this package does not meet packaging guidelines upon closer inspection, as it is licensed under the BSL 1.1 License, and has been for the last 5 years.

Last I checked BSL 1.1 was specifically not accepted for licensing. Though I can't dig up the specific source for that except for it's omission in scripts/lint-packages.sh. (Specifically the 1.1 version of the BSL)

So that's gonna be a tentative "not planned/won't fix" from me, but I wanna find the source on BSL1.1 being a deal breaker before closing this issue.

aikooo7 commented 4 months ago

I'm fairly certain this package does not meet packaging guidelines upon closer inspection, as it is licensed under the BSL 1.1 License, and has been for the last 5 years.

Last I checked BSL 1.1 was specifically not accepted for licensing. Though I can't dig up the specific source for that except for it's omission in scripts/lint-packages.sh. (Specifically the 1.1 version of the BSL)

So that's gonna be a tentative "not planned/won't fix" from me, but I wanna find the source on BSL1.1 being a deal breaker before closing this issue.

But couldn't we find a workaround to just make it work? I already saw some people on reddit/twitter wanting to run this like me, and tailscale works in termux

TomJo2000 commented 4 months ago

Make it work technically. Probably. Make it work legally. No.

There is no way for us to package a BSL 1.1 project while ensuring we are complying with the license terms. BSL 1.1 is a "source available" license, not an open source license. The entire situation is very murky.

aikooo7 commented 4 months ago

Make it work technically. Probably. Make it work legally. No.

There is no way for us to package a BSL 1.1 project while ensuring we are complying with the license terms. BSL 1.1 is a "source available" license, not an open source license. The entire situation is very murky.

Alright, that is sad for our side, users, but understable for their side as a business, thanks anyways for your helpful answers

TomJo2000 commented 4 months ago

I dug up the prior comments on BSL 1.1 by the way.

It's not not permissiable, but it needs to be reviewed on a case by case basis, and will probably need to be packaged in the TUR. Which still leaves patching and packaging, which hasn't even been attempted yet for zerotier-one on Termux yet as far as I'm aware.

nexplorer-3e commented 1 month ago

As for license there is a dirty hack. From ArchWiki:

Note: Since this commit ZeroTier switched to the Business Source License. Last GPLv3 version of ZeroTier is 1.4.2

if we can make a package that keep the version at 1.4.2 then we can workaround the license restriction. I have tested the version which is still working today.

TomJo2000 commented 1 month ago

Version 1.4.2 is not compatible with modern versions of Zerotier's service, as far as I was aware anyway. So that is gonna have to be a no.

nexplorer-3e commented 1 month ago

Version 1.4.2 is not compatible with modern versions of Zerotier's service, as far as I was aware anyway. So that is gonna have to be a no.

I can joining network, gaining IP address and pinging via -I ztwdjit* normally, so it just works on my phone: Screenshot_20240603-221029~3 Screenshot_20240603-221257~2

The main problem is extra route configuration is needed since android does not use standard linux routing policy.