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

luci-app-zerotier: add a new luci app to manage zerotier vpn #5672

Draft
wants to merge 48 commits into
base: master
Choose a base branch
from

Conversation

andrewc12
Copy link

@andrewc12 andrewc12 commented Feb 1, 2022

Based on https://github.com/coolsnowwolf/lede/tree/master/package/lean/luci-app-zerotier

  • without the interface code and scripts for allowing NAT access to the local LAN.
  • added missing btn class to Zerotier.com button which fixes button style in the openwrt2020 theme.
  • removed html from Zerotier.com button translation.
  • add es translation and template from https://github.com/openwrtdiy/openwrt-ipk/tree/main/luci-app-zerotier
  • regenerated translation template from source
  • normalised translation files
  • add luci-compat to package dependencies

Signed-off-by: Andrew Innes andrew.c12@gmail.com

@andrewc12 andrewc12 changed the title luci-app-zerotier: add a new app to manage zerotier luci-app-zerotier: add a new luci app to manage zerotier vpn Feb 2, 2022
@andrewc12
Copy link
Author

andrewc12 commented Feb 2, 2022

This doesn't work on a fresh install.
I found out I need to install luci-compat (as per https://forum.openwrt.org/t/luci-app-bird1-ipv4-errors/70288 ) to get it to work

@andrewc12
Copy link
Author

fixed and package successfully tested in a new vm

@castillofrancodamian
Copy link
Contributor

I doubt they'll accept this PR if it's not in JavaScript.

@andrewc12
Copy link
Author

I only found out about that transition at the end.
I was going to try to write something myself but then I found this, so I decided try to get it upstreamed instead.
I'll have to actually put work in.

@BKPepe
Copy link
Member

BKPepe commented Mar 5, 2023

It seems that this pull request can be closed for now and once it will be converted to the JavaScript, it can be reopened, right?

@andrewc12
Copy link
Author

sure but I'm not going to do that.

@andrewc12 andrewc12 closed this Mar 5, 2023
@animegasan
Copy link
Contributor

Is this still going on?
Because I saw that there was the same package in Immortalwrt and it already used JavaScript.

CC @1715173329

@andrewc12
Copy link
Author

andrewc12 commented Feb 5, 2024

Nah it's closed.
I might take a look at that though

https://github.com/immortalwrt/luci/tree/master/applications/luci-app-zerotier

@animegasan
Copy link
Contributor

Nah it's closed. I might take a look at that though

https://github.com/immortalwrt/luci/tree/master/applications/luci-app-zerotier

So is there any possibility that this package is in openwrt?

@andrewc12 andrewc12 reopened this Feb 9, 2024
@andrewc12 andrewc12 force-pushed the luci-app-zerotier branch 2 times, most recently from 52fbd57 to 025939e Compare February 9, 2024 02:43
@andrewc12 andrewc12 marked this pull request as draft February 9, 2024 02:43
@andrewc12
Copy link
Author

I went through and collected/rewrote the history of this app from the following three repos
https://github.com/coolsnowwolf/lede/commits/cc9ce1dbb53b58c66fd5e72e6ec7a5e7428d91d2/package/lean/luci-app-zerotier
https://github.com/1715173329/imoutowrt/commits/aa3fa0df3cb49af67adbd3ec792422815d482fa1/package/lean/luci-app-zerotier
https://github.com/immortalwrt/luci/commits/master/applications/luci-app-zerotier

@animegasan I'm going to try to get this merged.
It's been so long I don't remember how to do this though.
Are you able to test this out in the meantime?

Copy link
Contributor

@animegasan animegasan left a comment

Choose a reason for hiding this comment

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

Isn't this correct?

I'm also new to github lately so sorry I can't help.

@hnyman
Copy link
Contributor

hnyman commented Feb 9, 2024

As this is introduction of a new app, you should git squash the 44 commits into one.

@andrewc12
Copy link
Author

I'm planning on it

@andrewc12
Copy link
Author

@1715173329 do you want to take a look?

applications/luci-app-zerotier/root/etc/zerotier.start Outdated Show resolved Hide resolved
applications/luci-app-zerotier/root/etc/zerotier.start Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't do this (log to /root). Logs are ephemeral and belong in either /tmp or /var/log

Copy link
Author

Choose a reason for hiding this comment

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

I'm removing it because it's not used anymore


nat_enable="$(uci get zerotier.sample_config.nat)"
zt0="$(ifconfig | grep 'zt' | awk '{print $1}')"
echo "${zt0}" > "/tmp/zt.nif"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this file ever used?

This file just seems a bit messy. This one looks far more suitable. Consider using it.

Although, those init.d files belong in the zerotier package.

Copy link
Author

Choose a reason for hiding this comment

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

yeah this is probably what needs to be done.
thanks for the link

"description": "Grant access to ZeroTier configuration",
"read": {
"file": {
"/sbin/ifconfig": [ "exec" ]
Copy link
Contributor

@systemcrash systemcrash Feb 10, 2024

Choose a reason for hiding this comment

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

Revise to ip as per above suggestion. Or remove entirely and use rpcd.

for i in ${zt0}
do
ip_segment="$(ip route | grep "dev $i proto kernel" | awk '{print $1}')"
echo 'iifname '$i' counter accept comment "!fw4: Zerotier allow inbound forward '$i'"' >> /usr/share/nftables.d/chain-pre/forward/zerotier.nft
Copy link
Contributor

Choose a reason for hiding this comment

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


return view.extend({
load: function() {
return fs.exec('/sbin/ifconfig').then(function(res) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please revise to an rpcd or ucode script. We definitely should not be parsing ifconfig output to display info here.

A ucode script is better suited to this. See an example here. Might this be the reason for the jsonfilter dep?

Copy link
Author

Choose a reason for hiding this comment

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

@andrewc12
Copy link
Author

@systemcrash Thanks for the suggestions. I'm soon starting university again so I might not get to it for a couple of months

@andrewc12 andrewc12 force-pushed the luci-app-zerotier branch 2 times, most recently from d8d7455 to c2b924f Compare February 16, 2024 06:28
1715173329 and others added 26 commits February 25, 2024 07:32
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
Based off of https://github.com/coolsnowwolf/lede/tree/master/package/lean/luci-app-zerotier
- without the interface code and scripts for allowing NAT access to the local lan.
- added missing btn class to Zerotier.com button which fixes button style in the openwrt2020 theme.
- removed html from Zerotier.com button translation.
- add es translation and template from https://github.com/openwrtdiy/openwrt-ipk/tree/main/luci-app-zerotier
- regenerated translation template from source
- normalised translation files
- add luci-compat to package dependencies

Signed-off-by: Andrew Innes <andrew.c12@gmail.com>
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
Signed-off-by: ZiMing Mo <msylgj@immortalwrt.org>
Signed-off-by: ZiMing Mo <msylgj@immortalwrt.org>
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
Signed-off-by: ZiMing Mo <msylgj@immortalwrt.org>
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This is the prevue of the zerotier package
@Neustradamus
Copy link

@andrewc12: Have you progressed on this PR?

@andrewc12
Copy link
Author

Nope

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.