Zerotierone: ZT on openwrt: join with name iso ID

Created on 11 Aug 2020  路  17Comments  路  Source: zerotier/ZeroTierOne

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

i want to join a network , have to cat the config file to figure out what the ID was, copy/paste that to zerotier-cli join

Describe the solution you'd like
A clear and concise description of what you want to happen.

zerotier-cli join
being the name defined in /etc/config/zerotier

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

config zerotier NAME
option enabled 1
list join ID
option secret SECRET

embedded management suggestion

Most helpful comment

Yes, please make an issue here.
The OpenWrt ZeroTier init script uses touch $path/networks.d/$1.conf to join a network.

But I do not quite understand the problem. If a network is set in /etc/config/zerotier (via list join <networkid>), then the network will be joined on startup. No manual zerotier-cli join <networkid> is required.

All 17 comments

Hello. ZeroTier doesn't maintain the OpenWRT package. It's kindly provided by mwarning.

Why do you need to edit the config file _and_ do a zerotier-cli join? Seems like it should be one or the other.
I haven't used it in a while, but having the config file set up causes the network to be joined automatically.

I do see how being able to join by some easier name would be nice.

this may indeed be openwrt specific - someone on the wrt-forums asked for ZT users and pointed me here.

anyway, that's not really how it works on openwrt (IIRC), or at least not the way I use it.
After ZT is installed, you can bridge/create an interface for it. (in my case I run it through a transparent firewall)
Then you start the service (I have ZT off most of the time)
Then you join/leave a network.

@fundef1 I think I'm the one you were mentioning from the forums. Glad to see you here! @mwarning , should we make an issue for this over on a particular page on your end?

Yes, please make an issue here.
The OpenWrt ZeroTier init script uses touch $path/networks.d/$1.conf to join a network.

But I do not quite understand the problem. If a network is set in /etc/config/zerotier (via list join <networkid>), then the network will be joined on startup. No manual zerotier-cli join <networkid> is required.

Doe ZT support human readable network names that can be used with zerotier-cli join?

Doe ZT support human readable network names that can be used with zerotier-cli join?

No; Only by ID

@laduke ok, then I do need an example to understand what is asked for. I have not used ZT for quite a while.

I don't think I understand either.

since i kicked this off i guess i have to see it throuh....

the use case is simple:
as a user i can join a network by its humanfriendly name
e.g. zt-join friendly -> magic in background calls zerotier-cli join notfriendly-id

to illustrate the point here's a quick wrapper script skeleten (and a differently formatted config file 'zt')

#!/bin/sh
. /lib/functions.sh

humanfriendly=$1

function join_lookup(){
    if [ "$1" = "${humanfriendly}" ]; then
        config_get enabled "$1" 'enabled'
        if [ ${enabled} = '1' ]; then       
            config_get id "$1" id
            zerotier-cli join "${id}"
        else
            :
        fi
    fi  
}

config_load zt
config_foreach join_lookup network ${humanfriendly}

config file zt (just for convenience i didn't want to mess with the config already there)

config zt 'global'
option enabled '1' #whether to the zt service itself can be started 

config network 'humanfriendly'
option id 'nothumanfriendly-id'
option enabled '1' #whether the network can be joined
option secret 'secret1'

config network 'humanfriendly2'
option id 'nothumanfriendly-id2'
option enabled '1' #whether the network can be joined
option secret 'secret2'

obviously zerotier-cli having a 'native' awareness of humanfriendly would be much preferred.

Understood. Is this a feature for other zerotier installations? Anyway, /etc/init.d/zerotier start <friendly-name> might be a better idea than to wrap zerotier-cli.
@fundef1 does it make sense to have a different secret for each network to join? Does it need a different zerotier instance?

Understood. Is this a feature for other zerotier installations?

No. Network names in ZeroTier are not guaranteed to be unique. Only the Network ID is guaranteed unique.

Understood. Is this a feature for other zerotier installations? Anyway, /etc/init.d/zerotier start <friendly-name> might be a better idea than to wrap zerotier-cli.

I don't have an opinion on which script is doing the wrapping.
Although I would prefer to have separate 'verbs' for starting the service and for joining a network.

@fundef1 does it make sense to have a different secret for each network to join? Does it need a different zerotier instance?

That's a ZT question really. my example code was just copy/paste.
I don't know if ZT supports different secrets per network or whether it's one device(service instance) one secret.

Understood. Is this a feature for other zerotier installations? Anyway, /etc/init.d/zerotier start <friendly-name> might be a better idea than to wrap zerotier-cli.

I don't have an opinion on which script is doing the wrapping.
Although I would prefer to have separate 'verbs' for starting the service and for joining a network.

/etc/init.d/zerotier join <friendly-name> is also a possibility.

The remaining questions is then, is this a feature worthwhile to implement?

586 might be related to this also.

Proposal: https://github.com/mwarning/zerotier-openwrt/commit/224dd08f575da36acada2b4f3e38e161213bb094

Let me know what you think.

(Note: the user interface of zerotier-cli is the responsibility of the ZT devs and its user interface should not be changed externally; that is why I use the init script to fire join/leave)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kbumsik picture kbumsik  路  4Comments

nolanl picture nolanl  路  4Comments

unquietwiki picture unquietwiki  路  3Comments

paweljacewicz picture paweljacewicz  路  4Comments

coretemp picture coretemp  路  4Comments