mirror of
https://github.com/fosrl/docs.git
synced 2025-05-13 05:40:41 +01:00
Add newt and gerbil basic docs
This commit is contained in:
parent
b38b4fb0b4
commit
88a9e9bebc
2 changed files with 124 additions and 0 deletions
|
@ -1 +1,69 @@
|
||||||
# Overview
|
# Overview
|
||||||
|
|
||||||
|
Gerbil is a simple WireGuard interface management server written in Go. Gerbil makes it easy to create Wireguard interfaces as well as add and remove peers with an HTTP.
|
||||||
|
|
||||||
|
Gerbil can be used stand alone with your own API, a static JSON file, or with Pangolin and Newt as part of the larger system. See documentation below:
|
||||||
|
|
||||||
|
## Preview
|
||||||
|
|
||||||
|
<img src="public/screenshots/preview.png" alt="Preview"/>
|
||||||
|
|
||||||
|
_Sample output of a Gerbil container connected to Pangolin and terminating various peers._
|
||||||
|
|
||||||
|
## Key Functions
|
||||||
|
|
||||||
|
### Setup Wireguard
|
||||||
|
|
||||||
|
A Wireguard interface will be created and configured on the local Linux machine or in the Docker container according to the values given in either a JSON config file or via the remote server. If the interface already exists it will be reconfigured.
|
||||||
|
|
||||||
|
### Manage Peers
|
||||||
|
|
||||||
|
Gerbil will create the peers defined in the config on the Wireguard interface. The HTTP API can be used to remove, create, and update peers on the interface dynamically.
|
||||||
|
|
||||||
|
### Report Bandwidth
|
||||||
|
|
||||||
|
Bytes transmitted in and out of each peer is collected every 10 seconds and incremental usage is reported via the "reportBandwidthTo" endpoint. This can be used to track data usage of each peer on the remote server.
|
||||||
|
|
||||||
|
## CLI Args
|
||||||
|
|
||||||
|
`reachableAt`: How should the remote server reach Gerbil's API?
|
||||||
|
`generateAndSaveKeyTo`: Where to save the generated Wireguard private key to persist across restarts.
|
||||||
|
`remoteConfig` (optional): Remote config location to HTTP get the JSON based config from. See `example_config.json`
|
||||||
|
`config` (optional): Local JSON file path to load config. Used if remote config is not supplied. See `example_config.json`
|
||||||
|
|
||||||
|
Note: You must use either `config` or `remoteConfig` to configure Wireguard.
|
||||||
|
|
||||||
|
`reportBandwidthTo` (optional): Remote HTTP endpoint to send peer bandwidth data
|
||||||
|
`interface` (optional): Name of the Wireguard interface created by Gerbil. Default: `wg0`
|
||||||
|
`listen` (optional): Port to listen on for HTTP server. Default: `3003`
|
||||||
|
`log-level` (optional): The log level to use. Default: INFO
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./gerbil \
|
||||||
|
--reachableAt=http://gerbil:3003 \
|
||||||
|
--generateAndSaveKeyTo=/var/config/key \
|
||||||
|
--remoteConfig=http://pangolin:3001/api/v1/gerbil/get-config \
|
||||||
|
--reportBandwidthTo=http://pangolin:3001/api/v1/gerbil/receive-bandwidth \
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: CLI args can be passed as "command" fields when using the Docker container.
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
### Container
|
||||||
|
|
||||||
|
Ensure Docker is installed.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
### Binary
|
||||||
|
|
||||||
|
Make sure to have Go 1.23.1 installed.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make local
|
||||||
|
```
|
|
@ -1 +1,57 @@
|
||||||
# Overview
|
# Overview
|
||||||
|
|
||||||
|
Newt is a fully user space [WireGuard](https://www.wireguard.com/) tunnel client and TCP/UDP proxy, designed to securely expose private resources controlled by Pangolin. By using Newt, you don't need to manage complex Wireguard tunnels and NATing to expose your resources.
|
||||||
|
|
||||||
|
Newt is used with Pangolin and Gerbil as part of the larger system. See documentation below:
|
||||||
|
|
||||||
|
## Preview
|
||||||
|
|
||||||
|
<img src="public/screenshots/preview.png" alt="Preview"/>
|
||||||
|
|
||||||
|
_Sample output of a Newt container connected to Pangolin and hosting various resource target proxies._
|
||||||
|
|
||||||
|
## Key Functions
|
||||||
|
|
||||||
|
### 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](https://github.com/WireGuard/wireguard-go/blob/master/tun/netstack/examples/http_server.go) 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 Wireguard control messages, it will use the information encoded to crate local low level TCP and UDP proxies attached to the virtual tunnel in order to relay traffic to programmed targets.
|
||||||
|
|
||||||
|
## CLI Args
|
||||||
|
|
||||||
|
`endpoint`: The endpoint where both Gerbil and Pangolin reside in order to connect to the websocket.
|
||||||
|
`id`: Newt ID generated by Pangolin to identify the client.
|
||||||
|
`secret`: A unique secret (not shared and kept private) used to authenticate the client ID with the websocket in order to receive commands.
|
||||||
|
`dns`: DNS server to use to resolve the endpoint
|
||||||
|
`log-level` (optional): The log level to use. Default: INFO
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./newt --id 31frd0uzbjvp721 --secret h51mmlknrvrwv8s4r1i210azhumt6isgbpyavxodibx1k2d6 --endpoint https://example.com
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
### Container
|
||||||
|
|
||||||
|
Ensure Docker is installed.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
### Binary
|
||||||
|
|
||||||
|
Make sure to have Go 1.23.1 installed.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make local
|
||||||
|
```
|
Loading…
Reference in a new issue