Giter Club home page Giter Club logo

bash_cli_zt's Introduction

bash_cli_zt

Status: Actively supported. I'm going to continue supporting this application through 2025. I'd suggest using the new program go_cli_zt - https://github.com/thedunston/go_cli_zt - which supports Windows and Linux and has a basic web GUI, as well.

License: GMU GPL v3.0

If you want a nice GUI progrm: zeroui- https://github.com/dec0dOS/zero-ui - has a very nice interface. I have an instance running, but always default to the commandline so I continue using my bash scripts. I installed UserLand on my Pixel, installed zerotier, and my bash scripts and it worked quite well.

Here are some YouTube videos I created on using ZeroTier:

Here is a project I was working on to create a ZT controller manager for some basic tasks using Bash since I tend to use the commandline a lot.

It includes:

  1. Creating networks, autogenerating private networks or manual network selection.
  2. Listing all networks
  3. Deleting networks
  4. Peer management including listing all peers, authorized peers, and unauthorized with the option to authorize a peer.
  5. Deleting a peer from the ZT network is not possible so a hack I use is to set the peer to unathorized and set the IP to 127.0.0.100. That is only used when listing members under Peer Management so those don't display in the output.
  6. Editing ACLs using a format I created. Still needs to support more rules...I just don't use many that require it.

Requirements:

  • curl
  • jq
  • ipcalc

ipcalc is used to manage the creation of network settings, check for valid masks, etc. for the IP Pool Assignments.

jq is used to create the JSON object for most queries. I'll get around to doing it for all queries. It is mixed because as I was learning the ZT api, I used manual queries and then started using jq the more I learned how to use it.

If you receive an error that "columns" is not found, then install bsdmainutils.

Usage. You need to run this as root to access the files needed for access to your ZT Controller:

sudo bash ztnetworks.bash

Features:

  • Create networks
  • Update network description, IP assignments and manage routes
  • Edit ACLs using custom format only for IPv4
  • Manage Peers
  • Add node names and description

I teach full-time and working on my doctorate degree so will work on this as I have time. I hope it helps someone and folks contribute code.

-duane

[email protected]

bash_cli_zt's People

Contributors

learnsia avatar thedunston avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

bash_cli_zt's Issues

Error When Create new ZT Network

Hello My Name is Pug
When I Create New ZT Network
I Enter Description for the network

Error
ztnetwork.bash: line 45: zerotire-cli:command not found
cat: /var/lib/zerotire-one/authtoken.secret: No such file or directory
Network was not created. Press Enter to finish

Thank in advance
If you don't understand what I'm typing, I'm sorry, I'm not good at English.

Create your own planet file `world.bin` (After watching "Private ZeroTier Network on the Public Internet")

It is possible to create your own planet file, however this requires editing the ZeroTire sources and compiling your own world.bin file, and later including it in the .deb, .rpm, ... private package of the ZeroTire distribution.

Here are the steps I used to create my own Planets file.

  1. Download ZeroTier from Github:
git clone https://github.com/zerotier/ZeroTierOne.git

Go to the world folder at ZeroTierOne/attic/world

cd ZeroTierOne/attic/world

Edit the mkworld.cpp file. Delete the IP addresses of the ZeroTier controllers and add your own.

In the file identity.public Identity for roots.back().identity = Identity...

vi mkworld.cpp

// Alice
roots.push_back(World::Root());
roots.back().identity = Identity("abXXXXXcd:0:04xxxxxxxxxxxxxxxxxxxxxxxxxxxbc");
roots.back().stableEndpoints.push_back(InetAddress("XX.XX.XX.XX/9993")); // Kyiv

Run

source ./build.sh

If ubuntu bash: c++: command not found

apt-get install gcc g++

Run the mkworld file

./mkworld

A new world.bin file should be created. This will be the file that all your nodes need.
Copy the world.bin file to the ZeroTier-One folder (works on Linux)

cp world.bin /var/lib/zerotier-one/planet

Checking Peer to

root@zt-moon:/home/ubuntu/ZeroTierOne/attic/world# /sbin/zerotier-cli listpeers
200 listpeers <ztaddr> <path> <latency> <version> <role>
200 listpeers 3feXXX258 192.168.88.27/9993;14100;14099 2 1.4.0 LEAF
200 listpeers 61dXCXXcb 50.7.73.34/9993;3990;3812 178 - PLANET
200 listpeers 62XXXXe71 50.7.252.138/9993;3990;3737 253 - PLANET
200 listpeers 6eXXXX3e 192.168.88.26/21136;7371;7370 0 1.4.0 LEAF
200 listpeers 778XXXX190 103.195.103.66/9993;3990;3853 137 - PLANET
200 listpeers 99XXXXdb7 195.181.173.159/9993;3990;3948 42 - PLANET
200 listpeers d0XXXX4ef 192.168.88.24/21140;9263;9263 -1 1.6.5 LEAF

Restart Zero Tier

systemctl restart zerotier-one.service

Checking Peer After

root@zt-moon:/home/ubuntu/ZeroTierOne/attic/world# /sbin/zerotier-cli listpeers
200 listpeers <ztaddr> <path> <latency> <version> <role>
200 listpeers 3fXXXXXX58 192.168.88.27/34526;27;26 1 1.4.0 LEAF
200 listpeers 6eXXXXXX3e 192.168.88.26/21136;1959;1959 1 1.4.0 LEAF
200 listpeers d0XXXXXXef 192.168.88.24/21141;5077;977 3 1.6.5 LEAF

Moving The Controller

Hi Duane,

I backed up all my /var/lib/zerotier-one folder and moved it to a new container. When I run the bash ztnetworks.bash it doesnt see my old configs and networks. I have made sure that bsdmainutils, jq, curl, ipcalc etc are all loaded as dependencies.

I have tried to change all permissions to zerotier-one and made sure zerotier has a tun port active in the lxc container.

Are there any specific permissions that are needed to get the script to read the controller, peers and moon files that have been restored?

any guidance or thoughts are greatly appreciated.

Error when assigning IP range to a network

Installed on almalinux8. When creating a new network, if asked to autogenerate the ip range, or manually enter the first usable IP and cdir, , we get this:

Would you like to autogenerate an IP range? [Y|n] or Enter to return to main menu: y

Start IP:
End IP:
Network:
Are the above settings okay? [Y|n]y
Error adding the network settings. Press Enter to finish

Disabling selinux made no difference.

Thank in advance!
David

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.