mirror of
https://github.com/dangeroustech/ZeroTierBridge.git
synced 2025-12-06 09:06:58 +00:00
Compare commits
59 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57afc23fd7 | ||
|
|
ab60a1c20e | ||
|
|
e0c38935ba | ||
|
|
b4e2f4c92a | ||
|
|
57390dc7c1 | ||
| 4fd71dafa3 | |||
|
|
e0cd6af05f | ||
|
|
2756d3b0c8 | ||
|
|
efd0c51fcf | ||
|
|
07d0fe437e | ||
|
|
be8a266eb4 | ||
|
|
9ab36f2593 | ||
|
|
aa8459d5e7 | ||
|
|
2e84ed575c | ||
|
|
efc5c3aadb | ||
|
|
96ebbf805d | ||
|
|
7d643e3ff6 | ||
|
|
07cefedf03 | ||
|
|
9a725ba61f | ||
|
|
c82c86099a | ||
|
|
13f56130ca | ||
|
|
6a3d0a9f23 | ||
|
|
b08ce9f821 | ||
|
|
e987eeb8f4 | ||
|
|
85cd3af0ff | ||
|
|
3c0a4bb93e | ||
|
|
8a260aebd1 | ||
|
|
4d565215c5 | ||
|
|
a831772404 | ||
|
|
7ad182fba6 | ||
|
|
fbdc16952c | ||
|
|
704859e91a | ||
|
|
63e3bea752 | ||
|
|
fdd8bbbdda | ||
| 546eeac920 | |||
|
|
ffea17e8e8 | ||
| b144c39680 | |||
| a48a9286a2 | |||
| 511a78b182 | |||
| 2d7d9c7f3b | |||
| 46ee60cbc9 | |||
| bca9ec3df7 | |||
| 5cd683cb7a | |||
| 8d550748cd | |||
| f8d73263fd | |||
| 2c987a3bbe | |||
| be55349cef | |||
| 593036c8ad | |||
|
|
74c33dff3e | ||
| aab5c079dc | |||
|
|
344e30a1f0 | ||
| d3f10891c8 | |||
|
|
7eb72f78f3 | ||
| 6e3c2690fc | |||
|
|
b651c5f8e9 | ||
| 9908f656e7 | |||
| 977df48644 | |||
| fed1c28602 | |||
| b5e79ae24d |
20
.github/dependabot.yml
vendored
Normal file
20
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
open-pull-requests-limit: 10
|
||||
labels:
|
||||
- dependencies
|
||||
- github-actions
|
||||
|
||||
- package-ecosystem: docker
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
open-pull-requests-limit: 10
|
||||
labels:
|
||||
- dependencies
|
||||
- docker
|
||||
|
||||
84
.github/workflows/docker-build.yml
vendored
84
.github/workflows/docker-build.yml
vendored
@@ -1,17 +1,40 @@
|
||||
name: Publish Docker Image
|
||||
permissions:
|
||||
actions: read
|
||||
checks: read
|
||||
contents: write
|
||||
deployments: read
|
||||
issues: read
|
||||
discussions: read
|
||||
packages: read
|
||||
pages: read
|
||||
pull-requests: read
|
||||
repository-projects: read
|
||||
security-events: write
|
||||
statuses: read
|
||||
|
||||
concurrency:
|
||||
group: docker-release-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
push:
|
||||
branches:
|
||||
- "main"
|
||||
- main
|
||||
|
||||
env:
|
||||
REGISTRY_IMAGE: registry.dangerous.tech/dangeroustech/zerotierbridge
|
||||
|
||||
jobs:
|
||||
DockerBuildAndRelease:
|
||||
Docker_Build:
|
||||
name: Docker Build And Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
@@ -20,20 +43,42 @@ jobs:
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Registry
|
||||
id: registry_push
|
||||
if: github.event_name != 'pull_request'
|
||||
id: login
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: registry.dangerous.tech
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and Push
|
||||
- name: Build
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v5
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: registry.dangerous.tech/dangeroustech/zerotierbridge:latest
|
||||
build-args: |
|
||||
VERSION=1.12.2
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ${{ env.REGISTRY_IMAGE }}:latest
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
|
||||
MergeRefs:
|
||||
name: Publish Multi-Arch Image And Release
|
||||
if: github.ref == 'refs/heads/main'
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- Docker_Build
|
||||
steps:
|
||||
- name: Login to Registry
|
||||
id: login
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: registry.dangerous.tech
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Generate SBOM
|
||||
uses: anchore/sbom-action@v0
|
||||
@@ -46,36 +91,41 @@ jobs:
|
||||
output-file: ./sbom.spdx.json
|
||||
|
||||
- name: Scan SBOM
|
||||
uses: anchore/scan-action@v3
|
||||
uses: anchore/scan-action@v7
|
||||
id: scan
|
||||
with:
|
||||
sbom: sbom.spdx.json
|
||||
severity-cutoff: medium
|
||||
fail-build: false
|
||||
only-fixed: true
|
||||
|
||||
- name: upload Anchore scan SARIF report
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
uses: github/codeql-action/upload-sarif@v4
|
||||
with:
|
||||
sarif_file: ${{ steps.scan.outputs.sarif }}
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Changelog
|
||||
uses: TriPSs/conventional-changelog-action@v3
|
||||
uses: TriPSs/conventional-changelog-action@v6
|
||||
id: changelog
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
git-message: "chore 🤖: Release {version} [skip ci]"
|
||||
output-file: "CHANGELOG.md"
|
||||
tag-prefix: "v"
|
||||
fallback-version: "1.0.0"
|
||||
git-message: "chore 🤖: Release {version}"
|
||||
output-file: CHANGELOG.md
|
||||
tag-prefix: v
|
||||
fallback-version: 1.0.0
|
||||
release-count: 0 # preserve all versions in changelog
|
||||
skip-on-empty: false # otherwise we don't publish fixes
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
uses: softprops/action-gh-release@v2
|
||||
id: release
|
||||
if: ${{ steps.changelog.outputs.skipped == 'false' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.github_token }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ steps.changelog.outputs.tag }}
|
||||
name: ${{ steps.changelog.outputs.tag }}
|
||||
|
||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
sbom.spdx.json
|
||||
results.sarif
|
||||
78
CHANGELOG.md
78
CHANGELOG.md
@@ -1,3 +1,81 @@
|
||||
## [1.2.3](https://github.com/dangeroustech/ZeroTierBridge/compare/v1.2.2...v1.2.3) (2025-10-26)
|
||||
|
||||
|
||||
|
||||
## [1.2.2](https://github.com/dangeroustech/ZeroTierBridge/compare/v1.2.1...v1.2.2) (2025-10-26)
|
||||
|
||||
|
||||
|
||||
## [1.2.1](https://github.com/dangeroustech/ZeroTierBridge/compare/v1.2.0...v1.2.1) (2025-10-26)
|
||||
|
||||
|
||||
|
||||
# [1.2.0](https://github.com/dangeroustech/ZeroTierBridge/compare/v1.1.2...v1.2.0) (2025-10-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **workflow:** update artifact naming and handling in docker-build.yml ([96ebbf8](https://github.com/dangeroustech/ZeroTierBridge/commit/96ebbf805d2cb3bb4089a5a0dc70114e3c16cc1b))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **docker:** add health check to Dockerfile for zerotier-cli ([7d643e3](https://github.com/dangeroustech/ZeroTierBridge/commit/7d643e3ff6c0683d335baae5138ceef475cd37c3))
|
||||
|
||||
|
||||
|
||||
## [1.1.2](https://github.com/dangeroustech/ZeroTierBridge/compare/v1.1.1...v1.1.2) (2023-10-18)
|
||||
|
||||
|
||||
|
||||
## [1.1.1](https://github.com/dangeroustech/ZeroTierBridge/compare/v1.1.0...v1.1.1) (2023-10-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 401 ([bca9ec3](https://github.com/dangeroustech/ZeroTierBridge/commit/bca9ec3df76f9c6ea114e099dd9317c58489d0b2))
|
||||
* correct deps ([be55349](https://github.com/dangeroustech/ZeroTierBridge/commit/be55349cefbf291a9ce4233e65a785dad4ec3830))
|
||||
* correct multiplatform builds ([593036c](https://github.com/dangeroustech/ZeroTierBridge/commit/593036c8ad8099a3a4e7b1ac9b1dcfbdb8e04a98))
|
||||
* push by digest again ([8d55074](https://github.com/dangeroustech/ZeroTierBridge/commit/8d550748cde552ef5552e02770842d4e91f99253))
|
||||
* push by digest is breaking things ([2c987a3](https://github.com/dangeroustech/ZeroTierBridge/commit/2c987a3bbe0492aaf22b26e446cb7d96a6c9115d))
|
||||
* re-setup buildx ([f8d7326](https://github.com/dangeroustech/ZeroTierBridge/commit/f8d73263fdfd328ad38a77ff381e93bd8bda5750))
|
||||
* remove tag to hopefully fix digest pushing ([5cd683c](https://github.com/dangeroustech/ZeroTierBridge/commit/5cd683cb7a83e37eb5b4717309d672f35b256c25))
|
||||
* set latest tag ([46ee60c](https://github.com/dangeroustech/ZeroTierBridge/commit/46ee60cbc9091e93f977701a771ba9ce0216e5d1))
|
||||
|
||||
|
||||
|
||||
# [1.1.0](https://github.com/dangeroustech/ZeroTierBridge/compare/v1.0.13...v1.1.0) (2023-09-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* multi-platform builds ([aab5c07](https://github.com/dangeroustech/ZeroTierBridge/commit/aab5c079dcd559b7c3123aa72d02f7691827083e))
|
||||
|
||||
|
||||
|
||||
## [1.0.13](https://github.com/dangeroustech/ZeroTierBridge/compare/v1.0.12...v1.0.13) (2023-09-22)
|
||||
|
||||
|
||||
|
||||
## [1.0.12](https://github.com/dangeroustech/ZeroTierBridge/compare/v1.0.11...v1.0.12) (2023-09-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* correct double message ([6e3c269](https://github.com/dangeroustech/ZeroTierBridge/commit/6e3c2690fc612e42c1d2818cc8d4bdfb9d5e39ba))
|
||||
|
||||
|
||||
|
||||
## [1.0.11](https://github.com/dangeroustech/ZeroTierBridge/compare/v1.0.10...v1.0.11) (2023-09-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* only alert on CVEs that have a fix ([977df48](https://github.com/dangeroustech/ZeroTierBridge/commit/977df48644e0a7112dc25f9f04afa6d84ce87db9))
|
||||
* pull correct deb package ([fed1c28](https://github.com/dangeroustech/ZeroTierBridge/commit/fed1c2860230d39aeb80178c79697c1c41fed23d))
|
||||
|
||||
|
||||
|
||||
## [1.0.10](https://github.com/dangeroustech/ZeroTierBridge/compare/v1.0.9...v1.0.10) (2023-09-22)
|
||||
|
||||
|
||||
|
||||
31
Dockerfile
31
Dockerfile
@@ -1,19 +1,36 @@
|
||||
FROM debian:buster as stage
|
||||
ARG PACKAGE_BASEURL=https://download.zerotier.com/debian/buster/pool/main/z/zerotier-one
|
||||
ARG ARCH=amd64
|
||||
FROM debian:12.6 AS stage
|
||||
ARG PACKAGE_BASEURL=https://download.zerotier.com/debian/bookworm/pool/main/z/zerotier-one
|
||||
ARG TARGETARCH
|
||||
ARG VERSION=1.12.2
|
||||
RUN apt-get update -qq && apt-get install -qq --no-install-recommends -y ca-certificates curl
|
||||
RUN curl -sSL -o zerotier-one.deb "${PACKAGE_BASEURL}/zerotier-one_${VERSION}_${ARCH}.deb"
|
||||
RUN apt-get update -qq && apt-get install -qq --no-install-recommends -y \
|
||||
ca-certificates=20230311+deb12u1 \
|
||||
curl=7.88.1-10+deb12u14
|
||||
RUN set -e; \
|
||||
DETECTED_ARCH="${TARGETARCH:-}"; \
|
||||
if [ -z "$DETECTED_ARCH" ]; then DETECTED_ARCH="$(dpkg --print-architecture)"; fi; \
|
||||
case "$DETECTED_ARCH" in \
|
||||
amd64|x86_64) ARCH_MAPPING=amd64 ;; \
|
||||
arm64|aarch64) ARCH_MAPPING=arm64 ;; \
|
||||
armhf|armv7*) ARCH_MAPPING=armhf ;; \
|
||||
*) echo "Unsupported architecture: $DETECTED_ARCH" >&2; exit 1 ;; \
|
||||
esac; \
|
||||
echo "Downloading ZeroTier: arch=$ARCH_MAPPING version=$VERSION"; \
|
||||
curl -fsSL -o zerotier-one.deb "${PACKAGE_BASEURL}/zerotier-one_${VERSION}_${ARCH_MAPPING}.deb"
|
||||
|
||||
FROM debian:buster
|
||||
FROM debian:12.6
|
||||
ARG VERSION
|
||||
RUN mkdir /app
|
||||
WORKDIR /app
|
||||
COPY --from=stage zerotier-one.deb .
|
||||
RUN apt-get update -qq && apt-get install -qq --no-install-recommends -y procps iptables openssl \
|
||||
RUN apt-get update -qq && apt-get install -qq --no-install-recommends -y \
|
||||
procps=2:4.0.2-3 \
|
||||
iptables=1.8.9-2 \
|
||||
openssl=3.0.17-1~deb12u3 \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN dpkg -i zerotier-one.deb && rm -f zerotier-one.deb
|
||||
RUN echo "${VERSION}" >/etc/zerotier-version
|
||||
COPY entrypoint.sh entrypoint.sh
|
||||
RUN chmod 755 entrypoint.sh
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 CMD sh -c 'zerotier-cli info 2>/dev/null | grep -q ONLINE'
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
26
README.md
26
README.md
@@ -6,7 +6,7 @@ A container to provide out-of-the-box bridging functionality to a ZeroTier netwo
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Docker running as your logged in user (i.e. not having to run `sudo docker-compose xyz`) - [Linux instructions here](https://docs.docker.com/engine/install/linux-postinstall/)
|
||||
- Docker running as your logged in user (if `docker ps` runs then you're good, if not follow the link ->) - [Linux instructions here](https://docs.docker.com/engine/install/linux-postinstall/)
|
||||
|
||||
### ZeroTier UI Changes
|
||||
|
||||
@@ -20,36 +20,28 @@ You also need to add a static route into ZeroTier so that the traffic is routed
|
||||
|
||||
### Docker Compose
|
||||
|
||||
**You need to edit the `ZT_NETWORKS` and `ARCH` variable in the `docker-compose.yml` file first to add your networks and make sure your acrhitecture is correct (see [this page](http://download.zerotier.com/debian/buster/pool/main/z/zerotier-one/) for examples, usually either amd64 or arm64)**
|
||||
Edit the `ZT_NETWORKS` variable in `docker-compose.yml` to add your networks. Multi-arch images are published automatically; no architecture changes are needed.
|
||||
|
||||
Easy one-liner for Docker Compose:
|
||||
Easiest way to bring up is via Docker Compose. Rename `docker-compose.yml.example` to `docker-compose.yml` and run `docker compose up -d`.
|
||||
|
||||
`docker-compose build && docker-compose up -d`
|
||||
|
||||
If you want to disable bridging, set `ZT_BRIDGE=false`. This can be done after the initial networks have been joined (just rebuild the container), as the ZeroTier config persists but IPTables forwarding is done on each container startup.
|
||||
If you want to disable bridging, set `ZT_BRIDGE=false`. This can be done after the initial networks have been joined (just change the environment variable in the `docker-compose.yml` file and restart), as the ZeroTier config persists but IPTables forwarding is done on each container startup.
|
||||
|
||||
### OG Docker
|
||||
|
||||
`docker build -t zerotierbridge .`
|
||||
|
||||
`docker run --privileged -e ZT_NETWORKS=NETWORK_ID_HERE -e ZT_BRIDGE=true zerotierbridge:latest`
|
||||
`docker run --cap-add NET_ADMIN --cap-add NET_RAW --sysctl net.ipv4.ip_forward=1 -e ZT_NETWORKS="NETWORK_1 NETWORK_2" -e ZT_BRIDGE=true zerotierbridge:latest`
|
||||
|
||||
Add your network ID(s) into the `ZT_NETWORKS` argument, space separated.
|
||||
|
||||
Disable bridging by passing `ZT_BRIDGE=false`. This can be done after the initial networks have been joined (just rebuild the container), as the ZeroTier config persists but IPTables forwarding is done on each container startup.
|
||||
Disable bridging by passing `ZT_BRIDGE=false`. This can be done after the initial networks have been joined (just restart the container), as the ZeroTier config persists but IPTables forwarding is done on each container startup.
|
||||
|
||||
#### Persistent Storage
|
||||
|
||||
If you would like the container to retain the same ZeroTier client ID on reboot, attach a volume as per the below.
|
||||
|
||||
`docker run --privileged -e ZT_NETWORKS=NETWORK_ID_HERE ZT_BRIDGE=true --volume zt1:/var/lib/zerotier-one/ zerotierbridge:latest`
|
||||
`docker run --privileged -e ZT_NETWORKS=NETWORK_ID_HERE ZT_BRIDGE=true -v zt_config:/var/lib/zerotier-one/ zerotierbridge:latest`
|
||||
|
||||
#### Caveat: Architecture
|
||||
#### Notes
|
||||
|
||||
If you need to run this on a device with different architecture (a raspberry pi, for instance), then just edit line 3 of the Dockerfile.
|
||||
|
||||
If you were using a Raspberry Pi 4, you would change this to `ARCH=arm64` and the container will pull the correct ZeroTier installer.
|
||||
|
||||
## TODO
|
||||
|
||||
- Add kubernetes deployment YAML
|
||||
If your host requires additional privileges for networking, you may need to add device and capabilities in your runtime configuration. The provided Docker Compose example includes `cap_add: [NET_ADMIN, NET_RAW]` and `sysctls` for IP forwarding.
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
zerotierbridge:
|
||||
container_name: zerotierbridge
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
ARCH: amd64
|
||||
VERSION: 1.12.2
|
||||
restart: always
|
||||
privileged: true
|
||||
volumes:
|
||||
- zt_config:/var/lib/zerotier-one
|
||||
environment:
|
||||
- ZT_NETWORKS=NETWORK_ID_1 NETWORK_ID_2 NETWORK_ID_3
|
||||
- ZT_BRIDGE=true
|
||||
volumes:
|
||||
zt_config:
|
||||
19
docker-compose.yml.example
Normal file
19
docker-compose.yml.example
Normal file
@@ -0,0 +1,19 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
zerotierbridge:
|
||||
container_name: zerotierbridge
|
||||
image: registry.dangerous.tech/dangeroustech/zerotierbridge
|
||||
restart: always
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
- NET_RAW
|
||||
sysctls:
|
||||
net.ipv4.ip_forward: "1"
|
||||
volumes:
|
||||
- zt_config:/var/lib/zerotier-one
|
||||
environment:
|
||||
ZT_NETWORKS: "NETWORK_ID_1 NETWORK_ID_2 NETWORK_ID_3"
|
||||
ZT_BRIDGE: "true"
|
||||
volumes:
|
||||
zt_config:
|
||||
@@ -1,15 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
grepzt() {
|
||||
(find /proc -name exe | xargs -I{} readlink {}) 2>/dev/null | grep -q zerotier-one
|
||||
return $?
|
||||
set -eu
|
||||
|
||||
terminate() {
|
||||
# Try to terminate zerotier-one gracefully
|
||||
if [ -n "${ZT_PID:-}" ]; then
|
||||
kill -TERM "$ZT_PID" 2>/dev/null || true
|
||||
wait "$ZT_PID" 2>/dev/null || true
|
||||
fi
|
||||
}
|
||||
trap terminate INT TERM
|
||||
|
||||
echo "starting zerotier"
|
||||
setsid /usr/sbin/zerotier-one &
|
||||
ZT_PID=$!
|
||||
|
||||
while ! grepzt
|
||||
do
|
||||
# Wait for zerotier to be responsive
|
||||
until zerotier-cli info >/dev/null 2>&1; do
|
||||
echo "zerotier hasn't started, waiting a second"
|
||||
sleep 1
|
||||
done
|
||||
@@ -17,34 +24,34 @@ done
|
||||
# Set IPTables to allow NATting
|
||||
sysctl -w net.ipv4.ip_forward=1 > /dev/null
|
||||
|
||||
echo "joining networks: $ZT_NETWORKS"
|
||||
echo "joining networks: ${ZT_NETWORKS:-}"
|
||||
|
||||
for n in $ZT_NETWORKS
|
||||
do
|
||||
for n in ${ZT_NETWORKS:-}; do
|
||||
echo "joining $n"
|
||||
|
||||
while ! zerotier-cli join "$n"
|
||||
do
|
||||
until zerotier-cli join "$n"; do
|
||||
echo "joining $n failed; trying again in 1s"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
if [ "$ZT_BRIDGE" = "true" ]
|
||||
then
|
||||
echo "Configuring iptables on $(zerotier-cli get $n portDeviceName)"
|
||||
PHY_IFACE=eth0; ZT_IFACE=$(zerotier-cli get $n portDeviceName)
|
||||
if [ "${ZT_BRIDGE:-true}" = "true" ]; then
|
||||
ZT_IFACE=$(zerotier-cli get "$n" portDeviceName)
|
||||
PHY_IFACE=eth0
|
||||
echo "Configuring iptables on ${ZT_IFACE}"
|
||||
|
||||
iptables -t nat -A POSTROUTING -o $PHY_IFACE -j MASQUERADE
|
||||
iptables -t nat -A POSTROUTING -o $ZT_IFACE -j MASQUERADE
|
||||
iptables -A FORWARD -i $PHY_IFACE -o $ZT_IFACE -j ACCEPT
|
||||
iptables -A FORWARD -i $ZT_IFACE -o $PHY_IFACE -j ACCEPT
|
||||
# idempotent rules
|
||||
iptables -t nat -C POSTROUTING -o "$PHY_IFACE" -j MASQUERADE 2>/dev/null || iptables -t nat -A POSTROUTING -o "$PHY_IFACE" -j MASQUERADE
|
||||
iptables -t nat -C POSTROUTING -o "$ZT_IFACE" -j MASQUERADE 2>/dev/null || iptables -t nat -A POSTROUTING -o "$ZT_IFACE" -j MASQUERADE
|
||||
iptables -C FORWARD -i "$PHY_IFACE" -o "$ZT_IFACE" -j ACCEPT 2>/dev/null || iptables -A FORWARD -i "$PHY_IFACE" -o "$ZT_IFACE" -j ACCEPT
|
||||
iptables -C FORWARD -i "$ZT_IFACE" -o "$PHY_IFACE" -j ACCEPT 2>/dev/null || iptables -A FORWARD -i "$ZT_IFACE" -o "$PHY_IFACE" -j ACCEPT
|
||||
fi
|
||||
done
|
||||
|
||||
# Give ZT a second realise it's online
|
||||
# Give ZT a second to realise it's online
|
||||
sleep 10
|
||||
|
||||
# Print Client Info
|
||||
echo "$(zerotier-cli info)"
|
||||
zerotier-cli info || true
|
||||
|
||||
sleep infinity
|
||||
# Keep the container running while zerotier-one is alive
|
||||
wait "$ZT_PID"
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"version": "1.0.10"
|
||||
"version": "1.2.3"
|
||||
}
|
||||
6883
results.sarif
6883
results.sarif
File diff suppressed because it is too large
Load Diff
94855
sbom.spdx.json
94855
sbom.spdx.json
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user