netfoundry / ziti_router_auto_enroll

5 stars 1 forks source link

Ziti Router Auto Enroll

Pylint

This Python script automates the process of downloading, configuring and enrolling an OpenZiti router. The script takes care of generating the configuration file with custom options, downloading binaries from github, handling the enrollment process, and setting up local DNS settings if needed.

Requirements

Running compiled binary

Main Features

  1. Automated enrollment: The script can enroll a Ziti edge router using a provided JWT or by connecting to the controller to create a new router.
  2. Configuration generation: The script generates a configuration file using Jinja2 templates, with support for customizing various settings.
  3. Binary install: The script will download and extract the ziti binaries allowing you to choose an install path or the default /opt/ziti.
  4. DNS handling: The script can configure the system's DNS settings based on the operating system if tunnel is enabled, currently supporting Ubuntu.
  5. Re-Registering: The script can be used on a system already registered & will stop the services before proceeding with the re-registration process.

Examples

./ziti_router_auto_enroll {paste JWT here} OR ./ziti_router_auto_enroll --jwt enrollment.txt

./ziti_router_auto_enroll --jwt enrollment.txt --assumePublic

./ziti_router_auto_enroll --jwt enrollment.txt --autoTunnelListener

Main Options

One positional argument, a jwt string which is optional.(enrollment_jwt)

Install Options

Configuration Options

Router Identity Paths

Controller options

Proxy options

Metrics Options

Edge Options

API Proxy Options

Link Options

Listeners Options

Web Options

HA Options

Router Creation Options

Create a new router on the controller before enrollment:

Passing arguments values

Besides passing in every argument with a --argumentName you can also use:

:heavy_exclamation_mark: When using environment variables make sure to use sudo -E when running the command

You can pass any argument vi OS Environmental variables. All argument are in all UPPER case.

:warning: Passing in links, listeners, tunnelers, webs is not supported. Passing a list of lists with environment is messy. Use the json or yaml instead.

Example: export CONTROLLERFABRICPORT=6262 Example: `export CSRSANSDNS="name1,name2,name3"

Using parameter file

You can pass any argument vi paramter files. Json or Yaml format is supported. The file extension needs to be .json or .yaml/.yml

Example Json:

{
  "controllerFabricPort": 6262
  "csrSansIp": ["1.1.1.1","2.2.2.2"],
  "proxyListeners": [["0.0.0.0:123","my_ntp_service"],["0.0.0.0:5631","mydbconn_service"]]
}

Example Yaml:

controllerFabricPort: 6262
csrSansIp:
  - 1.1.1.1
  - 2.2.2.2
proxyListeners:
  - ["0.0.0.0:123", "myntp"]
  - ["0.0.0.0:5631", "mydb"]