ZTNET - Self-Hosted ZeroTier network controller.
Bug Report
·
Feature Request
·
Ask a Question
ZTNET is a robust and versatile ZeroTier controller application designed to ease the management of ZeroTier networks. Crafted with state-of-the-art technologies like T3-Stack with Next.js, Prisma, tRPC, TypeScript, Tailwind CSS, and DaisyUI, it streamlines the process of creating, updating, and overseeing your ZeroTier networks.
With a rich palette of features, and an intuitive user interface, ZTNET embodies a paradigm shift in network management experience. It elegantly handles the complexity, letting you focus on what you do best.
🍬 ZeroTier Central API Support
ZTNET integrates seamlessly with the ZeroTier Central API, allowing for enhanced management and configuration capabilities directly from our interface.
🌍 Multi-Language Support
The app supports English, Spanish (ES), Norwegian (NO), and Chinese (ZH) languages for user convenience and inclusivity.
🛠️ Multi-Architecture Support
Designed for versatility, ZTNET supports multiple architectures - ARM64 and AMD64. This ensures compatibility across a wide range of devices and systems.
🌐 ZeroTier Network Management
Seamlessly create, modify, and oversee multiple ZeroTier networks.
💻 Node Monitoring
Effortlessly track network status and monitor connected nodes.
🔗 Intuitive Node Operations
Simply add or remove nodes from your networks with just a few clicks.
⚙️ Configurable Network Settings
Easily adjust IP ranges, routes, Flow-Rules and access control settings according to your needs.
📡 DNS and Multicast Configuration
Customize DNS and Multicast settings for each network to optimize performance.
📍 IP Assignment Pool Management
Handle IP assignment pools with a user-friendly UI for effective management.
🔀 Auto-Assign IP Functionality
Benefit from the convenience of automatic IP assignment.
🔒 Network Privacy Controls
Ensure the confidentiality of your network with private network settings.
📧 Email Invitations
Easily invite members to your network with the integrated email feature.
Skip the hassle of cloning the repository. Simply create a docker-compose.yml
file on your machine and populate it as follows:
version: "3.1"
services:
postgres:
image: postgres:15.2-alpine
container_name: postgres
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ztnet
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- app-network
zerotier:
image: zyclonite/zerotier:1.10.6
hostname: zerotier
container_name: zerotier
restart: unless-stopped
volumes:
- zerotier:/var/lib/zerotier-one
cap_add:
- NET_ADMIN
- SYS_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
networks:
- app-network
ports:
- "9993:9993/udp"
environment:
- ZT_OVERRIDE_LOCAL_CONF=true
- ZT_ALLOW_MANAGEMENT_FROM=172.31.255.0/29
ztnet:
image: sinamics/ztnet:latest
container_name: ztnet
working_dir: /app
volumes:
- zerotier:/var/lib/zerotier-one:ro
restart: unless-stopped
ports:
- 3000:3000
environment:
ZT_ADDR: http://zerotier:9993
# ZT_SECRET: (content of authtoken.secret) # only used if custom ZT_ADDR is specified.
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
NEXTAUTH_URL: "http://localhost:3000"
NEXTAUTH_SECRET: "random_secret"
networks:
- app-network
links:
- postgres
depends_on:
- postgres
- zerotier
volumes:
zerotier:
postgres-data:
networks:
app-network:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.31.255.0/29
To launch ZTNET, execute the following command in your docker-compose.yml
directory:
docker-compose up -d
This action pulls necessary images, initializes the containers, and activates the services.
Visit http://localhost:3000
to access the ZTNET web interface.
As an administrator, you possess unique capabilities not available to regular users. This includes the ability to view all registered accounts on the controller.
Please note that while admins have visibility over registered accounts, they cannot interact with or modify other users' networks directly. Each network's configuration and data remain exclusive to the respective user account, maintaining privacy and security for all users.
The docker-compose.yml
file includes several environment variables that you can customize based on your needs. Here is a description of each variable:
POSTGRES_HOST
: The hostname of the PostgreSQL service.POSTGRES_PORT
: The port number for the PostgreSQL service.POSTGRES_USER
: The username for the PostgreSQL database.POSTGRES_PASSWORD
: The password for the PostgreSQL database user.POSTGRES_DB
: The name of the PostgreSQL database.NEXTAUTH_URL
: The URL for NextAuth authentication.NEXTAUTH_SECRET
: The secret key for NextAuth authentication.
These are system environment variables used by the ZeroTier service and should not be changed:
ZT_OVERRIDE_LOCAL_CONF
: Allows overriding local ZeroTier configuration.ZT_ALLOW_MANAGEMENT_FROM
: Defines the IP range allowed to access the ZeroTier management interface.ZT_ADDR
: The address of the ZeroTier service.
To change any of these values, update the corresponding environment variable in the docker-compose.yml
file.
This project welcomes contributions. To ensure smooth collaboration, please follow the steps below:
- Before submitting a PR, make sure to run the linter and tests to check for any errors. You can do this by running the following commands in your terminal:
npm run lint
andnpm run test
- Install Visual Studio Code and the Remote Development Extension Pack.
- Clone this repository.
- Open the repository in Visual Studio Code.
- Select Remote-Containers: Open Folder in Container... from the Command Palette (F1).
- Select Reopen in Container when prompted.
- Once the container is running, hit (F1) and type Task to open the task menu.
- Select Install dependencies packages to install all the dependencies.
- Select Start Development Server to start the development server.
- Open browser and go to
http://localhost:3000
.
NOTE: Hot reloading on Windows may not be as performant as on other operating systems. If you encounter sluggish hot reloading, consider setting the environment variable WATCHPACK_POLLING=true. However, for optimal performance, we strongly suggest utilizing the Windows Subsystem for Linux (WSL) to develop your application. This approach will provide a swift and seamless hot reload experience, allowing you to focus on coding rather than waiting for the application to reload.
To start development, first, clone the repository:
git clone https://github.com/yourusername/ztnet.git cd ztnet
Create a .env
file in the root of the project and set the necessary environment variables:
POSTGRES_HOST
=localhostPOSTGRES_PORT
=5432POSTGRES_USER
=postgresPOSTGRES_PASSWORD
=postgresPOSTGRES_DB
=ztnetNEXTAUTH_URL
=http://localhost:3000NEXTAUTH_SECRET
="your_nextauth_secret"MIGRATE_POSTGRES_DB
="shaddow_ztnet"MIGRATE_DATABASE_URL
="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:${POSTGRES_PORT}/${MIGRATE_POSTGRES_DB}?schema=public" You need to run the following command to create the database:
npx prisma db push
Now start the development server:
npm run dev
Please note that while this application aims to make managing ZeroTier networks easier, it is provided "as is" without any warranties or guarantees of any kind. As the user, you assume all responsibility for its use. Always ensure you have adequate backups and understanding of any changes you make to your network configurations. This includes understanding that the first registered user will be granted administrative privileges.