-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split configuration in global and per-network sections. This change breaks existing configurations. The following per-network settings are available: * allow_managed * allow_global * allow_default * allow_dns See https://docs.zerotier.com/config/#network-specific-configuration Signed-off-by: Óscar García Amor <[email protected]> Reviewed-by: Moritz Warning <[email protected]>
- Loading branch information
Showing
4 changed files
with
108 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,39 @@ | ||
|
||
config zerotier sample_config | ||
config zerotier 'global' | ||
# Sets whether ZeroTier is enabled or not | ||
option enabled 0 | ||
|
||
# persistent configuration folder (for ZT controller mode) | ||
# Sets the ZeroTier listening port (default 9993; set to 0 for random) | ||
#option port '9993' | ||
# Client secret (leave blank to generate a secret on first run) | ||
option secret '' | ||
# Path of the optional file local.conf (see documentation at | ||
# https://docs.zerotier.com/config#local-configuration-options) | ||
#option local_conf_path '/etc/zerotier.conf' | ||
# Persistent configuration directory (to perform other configurations such | ||
# as controller mode or moons, etc.) | ||
#option config_path '/etc/zerotier' | ||
# copy <config_path> to RAM to prevent writing to flash (for ZT controller mode) | ||
# Copy the contents of the persistent configuration directory to memory | ||
# instead of linking it, this avoids writing to flash | ||
#option copy_config_path '1' | ||
|
||
#option port '9993' | ||
|
||
# path to the local.conf | ||
#option local_conf '/etc/zerotier.conf' | ||
# Network configuration, you can have as many configurations as networks you | ||
# want to join (the network name is optional) | ||
config network 'mynet' | ||
# Identifier of the network you wish to join | ||
option id '8056c2e21c000001' | ||
# Network configuration parameters (all are optional, if not indicated the | ||
# default values are set, see documentation at | ||
# https://docs.zerotier.com/config/#network-specific-configuration) | ||
option allow_managed '1' | ||
option allow_global '0' | ||
option allow_default '0' | ||
option allow_dns '0' | ||
|
||
# Generate secret on first start | ||
option secret '' | ||
# Example of a second network (unnamed as it is optional) | ||
#config network | ||
# option id '1234567890123456' | ||
# option allow_managed '1' | ||
# option allow_global '0' | ||
# option allow_default '0' | ||
# option allow_dns '0' | ||
|
||
# Join a public network called Earth | ||
list join '8056c2e21c000001' | ||
#list join '<other_network>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Convert the join list into networks | ||
nets=$(uci -q get zerotier.@zerotier[0].join) | ||
|
||
if [ -n "$nets" ]; then | ||
for net in ${nets}; do | ||
sid=$(uci add zerotier network) | ||
uci set zerotier.${sid}.id=${net} | ||
done | ||
uci delete zerotier.@zerotier[0].join | ||
|
||
# Rename local conf (only if defined) | ||
uci -q rename zerotier.@zerotier[0].local_conf='local_conf_path' || true | ||
|
||
# Rename configuration to global | ||
uci rename zerotier.@zerotier[0]='global' | ||
|
||
# Commit all changes | ||
uci commit zerotier | ||
fi |