> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# orbiously/zerotier

Connect the build-host to your ZeroTier network and establish a link with another ZeroTier member. If you've created managed routes in your ZeroTier network, you can use that remote ZeroTier member as a bastion/jump host.


## Commands

### connect

This command installs ZeroTier (if needed), checks that all required environement variables are set.
Then it connects the build-host (ZeroTier member) to the specified ZeroTier network.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `api-token-var` | env_var_name | ZT_API_TOKEN | Name of the nevironment variable containing the ZeroTier API token.
 |
| `full-vpn` | boolean | false | Whether or not to route all traffic through the ZeroTier network and ZeroTier remote member.
(Note: the full-vpn implementation is not recommended. See the "Caveats & limitations" section of the repository's README)
 |
| `net-id-var` | env_var_name | ZT_NET_ID | Name of the nevironment variable containing the ZeroTier network ID.
 |
| `zerotier-remote-member` | string |  | ZeroTier IP address of the ZeroTier remote member to establish a link with, and potentially use as a bastion/jump host.
 |

### disconnect

This command disconnects the build-host from the ZeroTier network, stores the ZeroTier log (if option enabled), and finally stops the ZeroTier service.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `store-settings-dump` | boolean | false | Whether or not to store the ZeroTier log file.
If set to `true`, a `zerotier.log` file will be available under the "Artifacts" tab.
 |

## Examples

### use-custom-envvars-and-store-settings-dump

Use your Zerotier network ID and ZeroTier API token stored in custom-named environment variables. Store the ZeroTier log as artifact upon disconnection.


```yaml
version: '2.1'
orbs:
  win: circleci/windows@5.0.0
  zerotier: orbiously/zerotier@1.0.0
jobs:
  for-the-win:
    executor:
      name: win/default
    steps:
      - zerotier/connect:
          api-token-var: TOKEN_SAFE_PLACE
          net-id-var: MY_ZEROTIER_NETWORK
          zerotier-remote-member: 10.244.72.250
      - run:
          command: >
            curl -s ifconfig.co

            # If you've added a managed route to the "ifconfig.co" hostname's
            IPs via the ZeroTier member with private IP "10.244.72.250"

            # then the above command will return the public IP of that ZeroTier
            member.

            #
            (https://zerotier.atlassian.net/wiki/spaces/SD/pages/224395274/Route+between+ZeroTier+and+Physical+Networks)
          name: Check apparent public IP
          shell: bash
      - run:
          command: |
            /c/progra~2/ZeroTier/One/zerotier-cli.bat listpeers
          name: List other peers in this Zerotier network
          shell: bash
      - zerotier/disconnect:
          store-log: true
workflows:
  winning:
    jobs:
      - for-the-win
```

### use-default-envvars-and-route-all-traffic-via-zerotier

Connect with your Zerotier network ID and ZeroTier API token stored in the default environment variables. Use the machine specified in `zerotier-remote-member` as a jump host to route all Internet traffic via the ZeroTier network.


```yaml
version: '2.1'
orbs:
  zerotier: orbiously/zerotier@1.0.0
jobs:
  macchiato:
    macos:
      xcode: 14.0.0
    steps:
      - zerotier/connect:
          full-vpn: true
          zerotier-remote-member: 10.147.19.3
      - run:
          command: >
            curl -s ifconfig.co

            curl -s checkip.amazonaws.com

            # If you've added a default route in ZeroTier via the ZeroTier
            member with private IP "10.147.19.3"

            # then both the above command will return the public IP of that
            ZeroTier member.

            #
            (https://zerotier.atlassian.net/wiki/spaces/SD/pages/7110693/Overriding+Default+Route+Full+Tunnel+Mode)
          name: Check apparent public IP
          shell: bash
      - zerotier/disconnect
workflows:
  macaroon:
    jobs:
      - macchiato
```