Compare commits

...

21 Commits
v1.2.0 ... main

Author SHA1 Message Date
Conventional Changelog Action
fd8043c501 chore 🤖: Release v1.2.4 [skip ci] 2025-10-26 17:37:00 +00:00
Josh Jacobs
5e6beb973b chore: enhance Docker build workflow with additional options
- Added provenance and sbom options set to false.
- Configured outputs for registry with specified compression settings.
2025-10-26 17:32:09 +00:00
Josh Jacobs
6666a5bc6c chore: set non-interactive mode for Docker builds
- Added ENV DEBIAN_FRONTEND=noninteractive to the Dockerfile to streamline the build process.
2025-10-26 17:00:22 +00:00
Josh Jacobs
d7b7ff961c chore: update Docker build workflow to version 1.16.0-2
- Updated the VERSION argument in the docker-build.yml file from 1.12.2 to 1.16.0-2.
2025-10-26 16:57:58 +00:00
Josh Jacobs
e02ffe1f36 chore: update Dockerfile to specify adduser version 2025-10-26 16:54:31 +00:00
Josh Jacobs
afd5d5e7ae chore: update Dockerfile to version 1.16.0-2
- Updated the VERSION argument from 1.12.2 to 1.16.0-2 for the ZeroTier package.
2025-10-26 16:50:31 +00:00
Josh Jacobs
86864780ec chore: update Dockerfile to use Debian 13.1 and update package versions
- Changed base image from Debian 12.6 to Debian 13.1.
- Updated package versions for ca-certificates, curl, procps, iptables, and openssl.
- Enhanced shell command syntax for improved error handling.
2025-10-26 16:40:11 +00:00
Conventional Changelog Action
57afc23fd7 chore 🤖: Release v1.2.3 [skip ci] 2025-10-26 16:28:50 +00:00
Josh Jacobs
ab60a1c20e chore: adjust Docker build workflow to conditionally push images 2025-10-26 16:24:01 +00:00
Josh Jacobs
e0c38935ba Merge branch 'main' of github.com:dangeroustech/ZeroTierBridge 2025-10-26 16:21:53 +00:00
Conventional Changelog Action
b4e2f4c92a chore 🤖: Release v1.2.2 [skip ci] 2025-10-26 16:19:47 +00:00
Josh Jacobs
57390dc7c1 chore: standardize Dockerfile syntax for clarity 2025-10-26 16:19:28 +00:00
4fd71dafa3 Merge pull request #36 from dangeroustech/general-updates
General Best Practise Updates
2025-10-26 16:17:36 +00:00
Josh Jacobs
e0cd6af05f chore: enhance Dockerfile architecture detection for ZeroTier installation
- Improved architecture detection logic to support additional ARM variants (armhf, armv7).
- Added error handling for unsupported architectures.
- Updated download command to provide clearer output during the installation process.

No functional changes intended; enhances robustness and maintainability of the Dockerfile.
2025-10-26 15:54:34 +00:00
Josh Jacobs
2756d3b0c8 chore: harden compose + entrypoint; docs refresh; ignore artifacts; dependabot
- docker-compose.yml.example: drop privileged; add cap_add (NET_ADMIN, NET_RAW) and sysctls; quote env vars
- entrypoint.sh: add strict mode + traps; wait for service; idempotent iptables; graceful shutdown
- README.md: update to multi-arch + non-privileged run guidance; fix examples
- .gitignore: ignore sbom.spdx.json and results.sarif
- .github/dependabot.yml: monitor Dockerfiles weekly

No functional changes intended; improves security, robustness, and maintainability.
2025-10-26 15:50:49 +00:00
Josh Jacobs
efd0c51fcf chore: add .gitignore to exclude SBOM and SARIF files from version control 2025-10-26 15:48:16 +00:00
Josh Jacobs
07d0fe437e chore: remove SARIF and SPDX files from the repository to streamline project structure and reduce unnecessary artifacts 2025-10-26 15:46:14 +00:00
Conventional Changelog Action
be8a266eb4 chore 🤖: Release v1.2.1 [skip ci] 2025-10-26 15:42:35 +00:00
Josh Jacobs
9ab36f2593 ci: simplify multi-arch build, add cache & concurrency; fix release token
- Add workflow-level concurrency to avoid overlapping releases
- Enable BuildKit cache (GHA) for faster Docker builds
- Simplify to a single multi-arch build (linux/amd64, linux/arm64)
  - Remove digest export/upload and manifest merge steps
  - Push manifest directly from buildx with tag `latest`
- Fix GitHub Release token casing to use `secrets.GITHUB_TOKEN`
- Update Dockerfile to use TARGETARCH for correct package selection
  - Pass VERSION consistently; write version to image

No functional change to runtime behavior expected; improves speed, reliability, and maintainability of the release pipeline.
2025-10-26 15:38:44 +00:00
Josh Jacobs
aa8459d5e7 Merge branch 'main' of github.com:dangeroustech/ZeroTierBridge 2025-10-26 15:26:46 +00:00
Josh Jacobs
2e84ed575c refactor(workflow): rename MergeRefs job to clarify purpose 2025-10-26 15:26:41 +00:00
11 changed files with 112 additions and 99774 deletions

View File

@@ -9,3 +9,12 @@ updates:
- dependencies
- github-actions
- package-ecosystem: docker
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 10
labels:
- dependencies
- docker

View File

@@ -13,6 +13,10 @@ permissions:
security-events: write
statuses: read
concurrency:
group: docker-release-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
branches:
@@ -28,11 +32,6 @@ jobs:
Docker_Build:
name: Docker Build And Release
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
arch: [amd64, arm64]
version: [1.12.2]
steps:
- name: Checkout Repository
uses: actions/checkout@v5
@@ -44,6 +43,7 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Login to Registry
if: github.event_name != 'pull_request'
id: login
uses: docker/login-action@v3
with:
@@ -57,44 +57,24 @@ jobs:
with:
context: .
build-args: |
ARCH=${{ matrix.arch }}
VERSION=${{ matrix.version }}
push: true
platforms: linux/${{ matrix.arch }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true
VERSION=1.16.0-2
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64
tags: ${{ env.REGISTRY_IMAGE }}:latest
provenance: false
sbom: false
outputs: type=registry,compression=zstd,compression-level=6,oci-mediatypes=true,force-compression=true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Export Digests
run: |
mkdir -p /tmp/digests
digest="${{ steps.docker_build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v5
with:
name: digests-${{ matrix.arch }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
overwrite: true
MergeRefs:
name: Do The Horrible Merge Thing
name: Publish Multi-Arch Image And Release
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs:
- Docker_Build
steps:
- name: Download digests
uses: actions/download-artifact@v6
with:
pattern: digests-*
path: /tmp/digests
merge-multiple: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Registry
id: login
uses: docker/login-action@v3
@@ -103,25 +83,6 @@ jobs:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
# set latest tag for default branch
# https://github.com/docker/metadata-action#latest-tag
type=raw,value=latest,enable={{is_default_branch}}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
- name: Generate SBOM
uses: anchore/sbom-action@v0
id: sbom
@@ -167,7 +128,7 @@ jobs:
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
View File

@@ -0,0 +1,2 @@
sbom.spdx.json
results.sarif

View File

@@ -1,3 +1,19 @@
## [1.2.4](https://github.com/dangeroustech/ZeroTierBridge/compare/v1.2.3...v1.2.4) (2025-10-26)
## [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)

View File

@@ -1,20 +1,36 @@
FROM debian:12.6 as stage
ARG PACKAGE_BASEURL=https://download.zerotier.com/debian/bookworm/pool/main/z/zerotier-one
ARG ARCH=amd64
ARG VERSION=1.12.2
FROM debian:13.1 AS stage
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DEBIAN_FRONTEND=noninteractive
ARG PACKAGE_BASEURL=https://download.zerotier.com/debian/trixie/pool/main/z/zerotier-one
ARG TARGETARCH
ARG VERSION=1.16.0-2
RUN apt-get update -qq && apt-get install -qq --no-install-recommends -y \
ca-certificates=20230311+deb12u1 \
curl=7.88.1-10+deb12u14
RUN curl -sSL -o zerotier-one.deb "${PACKAGE_BASEURL}/zerotier-one_${VERSION}_${ARCH}.deb"
ca-certificates=20250419 \
curl=8.14.1-2
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:12.6
FROM debian:13.1
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DEBIAN_FRONTEND=noninteractive
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=2:4.0.2-3 \
iptables=1.8.9-2 \
openssl=3.0.17-1~deb12u3 \
adduser=3.152 \
procps=2:4.0.4-9 \
iptables=1.8.11-2 \
openssl=3.5.1-1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN dpkg -i zerotier-one.deb && rm -f zerotier-one.deb

View File

@@ -20,21 +20,21 @@ 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.
Easiest way to bring up is via Docker Compose. Rename `docker-compose.yml.example` to `docker-compose.yml` and run `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 change the environment variable in the `docker-compose.yml` file and run `), 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_1 NETWORK_2 -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
@@ -42,8 +42,6 @@ If you would like the container to retain the same ZeroTier client ID on reboot,
`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.
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.

View File

@@ -5,11 +5,15 @@ services:
container_name: zerotierbridge
image: registry.dangerous.tech/dangeroustech/zerotierbridge
restart: always
privileged: true
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
ZT_NETWORKS: "NETWORK_ID_1 NETWORK_ID_2 NETWORK_ID_3"
ZT_BRIDGE: "true"
volumes:
zt_config:

View File

@@ -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"

View File

@@ -1,3 +1,3 @@
{
"version": "1.2.0"
"version": "1.2.4"
}

View File

@@ -1,16 +0,0 @@
{
"version": "2.1.0",
"$schema": "https://json.schemastore.org/sarif-2.1.0-rtm.5.json",
"runs": [
{
"tool": {
"driver": {
"name": "Grype",
"version": "0.63.0",
"informationUri": "https://github.com/anchore/grype"
}
},
"results": []
}
]
}

File diff suppressed because it is too large Load Diff