Preview

Newt interface preview
How Newt Works
Registers with Pangolin
Using the Newt ID and a secret, the client will make HTTP requests to Pangolin to receive a session token. Using that token, it will connect to a websocket and maintain that connection. Control messages will be sent over the websocket.Receives WireGuard Control Messages
When Newt receives WireGuard control messages, it will use the information encoded (endpoint, public key) to bring up a WireGuard tunnel using netstack fully in user space. It will ping over the tunnel to ensure the peer on the Gerbil side is brought up.Receives Proxy Control Messages
When Newt receives proxy control messages, it will use the information encoded to create a local low level TCP and UDP proxies attached to the virtual tunnel in order to relay traffic to programmed targets.Configuration Arguments
Newt ID generated by Pangolin to identify the client.Example:
31frd0uzbjvp721A unique secret used to authenticate the client ID with the websocket.Example:
h51mmlknrvrwv8s4r1i210azhumt6isgbpyavxodibx1k2d6Keep this secret private and secure. It’s used for authentication.
The endpoint where both Gerbil and Pangolin reside for websocket connections.Example:
https://pangolin.example.comMTU for the internal WireGuard interface.Default:
1280DNS server to use for resolving the endpoint.Default:
8.8.8.8The log level to use for Newt output.Options:
DEBUG, INFO, WARN, ERROR, FATALDefault: INFOInterval for pinging the server.Default:
3sTimeout for each ping.Default:
5sSet the Docker socket path for container discovery integration.Example:
/var/run/docker.sockValidate the container target is on the same network as the Newt process.Default:
falseCheck if connection to WireGuard server (Pangolin) is ok. Creates a file if ok, removes it if not ok. Can be used with Docker healthcheck to restart Newt.Example:
/tmp/healthyScript to be called when targets are added or removed.Example:
/path/to/updown.shClient certificate (p12 or pfx) for mutual TLS (mTLS) authentication.Example:
/path/to/client.p12Enable WireGuard server mode to accept incoming Olm client connections.Default:
falsePath to save generated private key (used with accept-clients).Example:
/var/keyUse native WireGuard interface when accepting clients (requires WireGuard kernel module and Linux, must run as root).Default:
false (uses userspace netstack)Name of the WireGuard interface (used with native mode).Default:
newtKeep the WireGuard interface after shutdown (used with native mode).Default:
falseEnvironment Variables
All CLI arguments can be set using environment variables as an alternative to command line flags. Environment variables are particularly useful when running Newt in containerized environments.Endpoint of your Pangolin server (equivalent to
--endpoint)Newt ID generated by Pangolin (equivalent to
--id)Newt secret for authentication (equivalent to
--secret)MTU for the internal WireGuard interface (equivalent to
--mtu)Default: 1280DNS server to use for resolving the endpoint (equivalent to
--dns)Default: 8.8.8.8Log level (equivalent to
--log-level)Default: INFOPath to Docker socket for container discovery (equivalent to
--docker-socket)Interval for pinging the server (equivalent to
--ping-interval)Default: 3sTimeout for each ping (equivalent to
--ping-timeout)Default: 5sPath to updown script for target add/remove events (equivalent to
--updown)Path to client certificate for mTLS (equivalent to
--tls-client-cert)Validate container targets are on same network (equivalent to
--docker-enforce-network-validation)Default: falsePath to health file for connection monitoring (equivalent to
--health-file)Enable WireGuard server mode (equivalent to
--accept-clients)Default: falsePath to save generated private key (equivalent to
--generateAndSaveKeyTo)Use native WireGuard interface (Linux only, equivalent to
--native)Default: falseName of the WireGuard interface (equivalent to
--interface)Default: newtKeep the WireGuard interface after shutdown (equivalent to
--keep-interface)Default: falseLoad the config JSON from this file instead of in the home folder.
When both environment variables and CLI arguments are provided, CLI arguments take precedence.
Basic Configuration Examples
Binary Example
Docker Compose with Environment Variables (Recommended)
docker-compose.yml
Docker Compose with CLI Arguments
docker-compose.yml
Advanced Features
Accept Client Connections
When the--accept-clients flag is enabled (or ACCEPT_CLIENTS=true environment variable is set), Newt operates as a WireGuard server that can accept incoming client connections from other devices. This enables peer-to-peer connectivity through the Newt instance.
Client Tunneling Modes
Newt supports two WireGuard tunneling modes:Userspace Mode (Default)
By default, Newt uses a fully userspace WireGuard implementation using netstack. This mode:- Does not require root privileges
- Works on all supported platforms (Linux, Windows, macOS)
- Does not require WireGuard kernel module to be installed
- Runs entirely in userspace - no system network interface is created
- Is containerization-friendly - works seamlessly in Docker containers
This is the recommended mode for most deployments, especially containerized environments.
Native Mode (Linux only)
When using the--native flag or setting USE_NATIVE_INTERFACE=true, Newt uses the native WireGuard kernel module. This mode:
- Requires root privileges to create and manage network interfaces
- Only works on Linux with the WireGuard kernel module installed
- Creates a real network interface (e.g.,
newt0) on the system - May offer better performance for high-throughput scenarios
- Requires proper network permissions and may conflict with existing network configurations
Native mode requires Linux with WireGuard kernel module and must run as root.
Native Mode Requirements
To use native mode:- Run on a Linux system
- Install the WireGuard kernel module
- Run Newt as root (
sudo) - Ensure the system allows creation of network interfaces
docker-compose.yml
Docker Socket Integration
Newt can integrate with the Docker socket to provide remote inspection of Docker containers. This allows Pangolin to query and retrieve detailed information about containers running on the Newt client, including metadata, network configuration, port mappings, and more. Configuration: You can specify the Docker socket path using the--docker-socket CLI argument or by setting the DOCKER_SOCKET environment variable. On most Linux systems the socket is /var/run/docker.sock. When deploying Newt as a container, you need to mount the host socket as a volume for the Newt container to access it.
docker-compose.yml
If the Docker socket is not available or accessible, Newt will gracefully disable Docker integration and continue normal operation.
Hostnames vs IPs
When the Docker Socket Integration is used, depending on the network which Newt is run with, either the hostname (generally considered the container name) or the IP address of the container will be sent to Pangolin:- Running in Network Mode ‘host’: IP addresses will be used
- Running in Network Mode ‘bridge’: IP addresses will be used
- Running in docker-compose without a network specification: Docker compose creates a network for the compose by default, hostnames will be used
- Running on docker-compose with defined network: Hostnames will be used
Docker Enforce Network Validation
When run as a Docker container, Newt can validate that the target being provided is on the same network as the Newt container and only return containers directly accessible by Newt. Validation will be carried out against either the hostname/IP Address and the Port number to ensure the running container is exposing the ports to Newt.If the Newt container is run with a network mode of
host, this feature will not work. Running in host mode causes the container to share its resources with the host machine, making it impossible to retrieve specific host container information for network validation.false by default. It can be enabled via setting the --docker-enforce-network-validation CLI argument or by setting the DOCKER_ENFORCE_NETWORK_VALIDATION environment variable.
Updown Scripts
You can pass in an updown script for Newt to call when it is adding or removing a target:Returning a string from the script in the format of a target (
ip:dst so 10.0.0.1:8080) will override the target and use this value instead to proxy.You can look at
updown.py as a reference script to get started!mTLS Authentication
Newt supports mutual TLS (mTLS) authentication if the server has been configured to request a client certificate. Requirements:- Only PKCS12 (.p12 or .pfx) file format is accepted
- The PKCS12 file must contain:
- Private key
- Public certificate
- CA certificate
- Encrypted PKCS12 files are currently not supported
docker-compose.yml
Get your
id and secret from the Pangolin dashboard when creating a Newt client.
