Skip to content

Latest commit

 

History

History
220 lines (138 loc) · 6.5 KB

README.rst

File metadata and controls

220 lines (138 loc) · 6.5 KB

ztcli-async

ztcli-async is a thin async Python client wrapper for the zerotier-cli node API (mainly based on zerotier-client and the ZeroTier API doc).

GitHub GitHub tag (latest SemVer, including pre-release) https://travis-ci.org/freepn/ztcli-async.svg?branch=master Open Issues Pull Requests Code Climate maintainability

Getting Started

This is a Python thin client interface to the zerotier JSON API, only some of which is exposed by the zerotier-cli command-line interface. New packages are available for Debian and Ubuntu, and the latest can be installed on Gentoo using the ebuilds in this portage overlay.

Prerequisites

A supported linux distribution, mainly something that uses either .ebuilds (eg, Gentoo or funtoo) or .deb packages, starting with at least Ubuntu xenial or Debian stretch (see the above PPA package repo on Launchpad).

For the latter, make sure you have the add-apt-repository command installed and then add the PPA:

$ sudo apt-get install software-properties-common
$ sudo add-apt-repository -y -s ppa:nerdboy/embedded

Note

Since the package series currently published are for xenial/bionic the second command above will need to be manually corrected afterwards if installing on Debian.

To install on Debian you can use the above method, but you will need to edit the file under sources.d and set the distro to xenial and then run the update command:

$ sudo apt-get update

If you get a key error you will also need to manually import the PPA signing key like so:

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <PPA_KEY>

where <PPA_KEY> is the key shown in the launchpad PPA page under "Adding this PPA to your system", eg, 41113ed57774ed19 for Embedded device ppa.

Dev Install

As long as you have git and at least Python 3.5, then the "easy" dev install is to clone this repository and install the latest zerotier package (there are packages in the PPA and Gentoo overlay). Check the version of zerotier in the main portage tree; you will need at least version 1.4.6:0.

Do the usual install dance, either:

# emerge zerotier

or:

$ sudo apt-get install zerotier-one

After cloning this repository, you can try running the example scripts from the source tree; if you have already installed this package, the examples should run from any directory, otherwise you'll need to copy the file you want to run to the top-level source tree first.

Without installing ztcli-async, first install the two package dependencies listed below, then install zerotier and make sure the service has started. You can check the zerotier client state with:

$ sudo zerotier-cli info

which should respond with:

200 info <your ID> 1.4.6 ONLINE

If the above is working, you can try one of the examples:

$ git clone https://github.com/freepn/ztcli-async
$ cd ztcli-async
$ cp examples/pprint_data.py .
$ sudo python3 pprint_data.py

Note

By default you will not have correct permissions to access the local zerotier node directly, due to the permissions on zerotier identity files. You can either prefix the commands with sudo, or add a usr ACL (for your local user) to the authtoken.secret file.

Standards and Coding Style

Currently pep8 and flake8 are the only tests besides some CI code analysis checks for complexity and security issues (we try to keep the "cognitive complexity" low when possible).

User Install / Deployment

Use the latest ztcli-async package for your Linux distro and hardware architecture; all arch-specific packages should support at least the following:

  • armhf/arm
  • aarch64/arm64
  • x86_64/amd64
  • i686/x86

Software Stack and Tool Dependencies

Versioning

We use SemVer for versioning. For the versions available, see the releases on this repository.

Contributing

Please read CONTRIBUTING.rst for details on our code of conduct, and the process for submitting pull requests to us.

Authors

  • Stephen Arnold - Current implementation and packaging - freepn
  • Fabian Affolter - Original implementation - fabaff

License

This project is licensed under the MIT license - see the LICENSE file for details.

Acknowledgments

  • Thanks to Fabian for the clean original client implementation and inspiration
  • Thanks to the ZeroTier project for providing the network virtualization engine