Skip to content

Commit dca56a0

Browse files
authored
README improvements and fixes (#93)
1 parent 3ac754f commit dca56a0

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

README.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ A **Wiretap Client** is any machine running the [Wireguard](https://www.wireguar
6767
* The machine receiving the initial connection (the Client by default) must be able to listen for UDP connections on a port that the initiating machine can connect to.
6868

6969
> [!NOTE]
70-
> By default the Server initiates the handshake to the Client because the Server is more likely to have outbound UDP allowed through a firewall than inbound UDP, but the reverse is easily configurable.
70+
> By default the Server initiates the handshake to the Client because the Server is more likely to have outbound UDP allowed through a firewall than inbound UDP, but the reverse is easily configurable with [Outbound Connections](#outbound-connections)
7171
7272
While not ideal, Wiretap can work with TCP instead of UDP. See the experimental [TCP Tunneling](#tcp-tunneling) section for more info.
7373

@@ -78,15 +78,15 @@ While not ideal, Wiretap can work with TCP instead of UDP. See the experimental
7878
3. Copy the server command output that best suits the Server OS and run it on the Server machine
7979
4. On the Client, run `sudo wg-quick up ./wiretap_relay.conf && sudo wg-quick up ./wiretap.conf` create the associated Wireguard interfaces
8080
5. Confirm the handshake completed for both configs by running `sudo wg show` on the Client
81-
6. (Optional) Add more servers and clients as needed with the `wiretap add` command
81+
6. (Optional) Add more Servers and Clients as needed with the `wiretap add` command
8282

8383
See the [Usage section](#Usage) for more details.
8484

8585
# Installation
8686

87-
No installation of Wiretap is required. Just grab a binary from the [releases](https://github.com/sandialabs/wiretap/releases) page. You may need two different binaries if the OS/ARCH are different on the client and server machines.
87+
No installation of Wiretap is required. Just grab a binary from the [releases](https://github.com/sandialabs/wiretap/releases) page. You may need two different binaries if the OS/ARCH are different on the Client and Server machines.
8888

89-
If you want to compile it yourself or can't find the OS/ARCH you're looking for, install Go (>=1.23.3) from https://go.dev/dl/ and use the provided [Makefile](./src/Makefile).
89+
If you want to compile it yourself or can't find the OS/ARCH you're looking for, install the latest Go from https://go.dev/dl/ and use the provided [Makefile](./src/Makefile).
9090

9191
# How it Works
9292

@@ -163,8 +163,7 @@ On the Client machine, run Wiretap's `configure` command to generate starting co
163163
* `--routes` is the equivalent of WireGuard's `AllowedIPs` setting. This tells the Client to route traffic that matches these IP ranges through Wiretap.
164164

165165
> [!IMPORTANT]
166-
> By default the listening port will be configured to be the same as the port specified in the `--endpoint IP:port`. This can be overwritten using the `--port` argument.
167-
> If creating an outbound connection, by default the listening port will be configured to be the same as the port specified in the `--outbound-endpoint IP:port`. This can be overwritten using the `--sport` argument.
166+
> By default the Client listening port will be the same port specified in the `--endpoint IP:port`. This can be overwritten using the `--port` argument. If creating an outbound connection, the default Server listening port will be the same port specified in the `--outbound-endpoint IP:port` unless overwritten with the `--sport` argument. Both ports otherwise have a default of 51820.
168167
169168
Following the example in the diagram:
170169
```bash
@@ -253,7 +252,7 @@ There are two other ways to pass arguments to the Server:
253252
2. The legacy method of passing command line arguments (`--endpoint 7.3.3.1:1337 ...`). Be aware that this method exposes the arguments to other users on the system. A compromised private key can be used to connect to the Client as a peer and/or decrypt traffic
254253

255254
> [!NOTE]
256-
> The wiretap_server.conf file uses a notation unique to Wiretap. It cannot be used to start a server with `wg-quick` or other generic Wireguard tools.
255+
> The wiretap_server.conf file uses a notation unique to Wiretap. It cannot be used to start a Wireguard server with `wg-quick` or other generic Wireguard tools.
257256
258257
Confirm that the Relay interfaces on the Client and Server have successfully completed a handshake. The Client should see successful handshakes in whatever WireGuard interface is running. If using the command-line tools, check with `sudo wg show`. By default the E2EE handshake will not occur until the Client sends data, so you may need to attempt to use the connection (e.g. `ping` an IP in the associated `--routes`) to trigger the handshake process.
259258

@@ -304,9 +303,9 @@ The `add server` command is meant to extend the Wiretap network to reach new are
304303
> [!WARNING]
305304
> Due to the way new Clients are added to existing networks, all Servers must be deployed *before* adding additional Clients. Added Clients won't be able to access Servers deployed after they were added. Additionally, if a Wiretap Server process exits or dies for any reason it will not remember any added Clients when you restart it.
306305
307-
If you want to attach a new Server to an existing Server (rather than the Client) you must also specify the existing Server's API address in your `add server` command using the `--server-address` argument; this API address **must** reference the same existing Server that the new Server will connect to via the `--endpoint` IP:port or else the new connection will fail. You can view Server API addresses using the `status` command.
306+
If you want to attach a new Server to an existing Server (rather than the Client) you must also specify the existing Server's API address in your `add server` command using the `--server-address` argument; this API address **must** reference the same existing Server that the new Server will connect to via the `--endpoint` IP:port (or `--outbound-endpoint`) or else the new connection will fail. You can view existing Server API addresses using the `status` command or by inspecting the configuration files.
308307

309-
In this example, we will connect to the server that has API address `::2`, which is listening on `10.0.0.2:51820`:
308+
In this example, we will connect to the Server that has API address `::2`, which is listening on `10.0.0.2:51820`:
310309

311310
```bash
312311
./wiretap add server --server-address ::2 --endpoint 10.0.0.2:51820 --routes 10.0.1.0/24
@@ -407,7 +406,7 @@ Now the Client can reach `10.0.0.0/24` and `10.0.1.0/24`. From here you can atta
407406
The `add client` command can be used to share access to the Wiretap network with others.
408407

409408
> [!WARNING]
410-
> All servers must be deployed *before* adding additional clients. Additionally, if a Wiretap Server process exits or dies for any reason it will not remember any added Clients when you restart it.
409+
> All servers must be deployed *before* adding additional Clients. Additionally, if a Wiretap Server process exits or dies for any reason it will not remember any added Clients when you restart it.
411410
412411
Adding a new Client is very similar to the other commands. It will generate a `wiretapX.conf` and `wiretap_relayX.conf` for sharing, where X is an incrementing number. Make sure that all of the first-hop Servers (any Server directly attached to the original Client) can reach or be reached by the new Client or else the new Client won't have access to that chain of Servers. Once you get the endpoint information from whoever will be running the new Client (the IP and port they will listen on), run:
413412

@@ -463,7 +462,7 @@ Endpoint = 172.17.0.3:51821
463462

464463
---
465464

466-
Send these files and have the recipient import them into WireGuard to have access to everything in the Wiretap network! By default the routes (AllowedIPs) are copied over to the new client configs, but can be modified by the recipient as needed.
465+
Send these files and have the recipient import them into WireGuard to have access to everything in the Wiretap network! By default the routes (AllowedIPs) are copied over to the new Client configs, but can be modified by the recipient as needed.
467466

468467
## Expose (Port Forwarding)
469468

@@ -479,15 +478,15 @@ You can expose a port on the Client to IPs in Wiretap's `routes` list by using t
479478
Now all existing Wiretap Servers will bind listeners on port 8080/tcp and proxy connections from that port to your local Client machine on port 80/tcp. By default this uses IPv6, so make sure any exposed services listening on the Client support IPv6 as well. To configure Wiretap to only use IPv4, use the `configure` command's `--disable-ipv6` option.
480479

481480
> [!WARNING]
482-
> If a Wiretap server process exits or dies for any reason it will not remember ports it was previously exposing. You will need to re-expose any ports you configured with this command.
481+
> If a Wiretap Server process exits or dies for any reason it will not remember ports it was previously exposing. You will need to re-expose any ports you configured with this command.
483482
484483
To dynamically expose all ports on the Client using SOCKS5:
485484

486485
```
487486
./wiretap expose --dynamic --remote 8080
488487
```
489488

490-
All servers will spin up a SOCKS5 server on port 8080 and proxy traffic to your local machine. It and can be used like this:
489+
All Servers will spin up a SOCKS5 server on port 8080 and proxy traffic to your local machine. It and can be used like this:
491490

492491
```
493492
curl -x socks5://<server-ip>:8080 http://<any-ip>:80
@@ -526,8 +525,9 @@ Use `./wiretap expose remove` with the same arguments used in `expose` to delete
526525
- Reverse Port Forward
527526
* Application
528527
- API internal to Wiretap for dynamic configuration
529-
- Chain servers together to tunnel traffic through an arbitrary number of machines
530-
- Add clients after deployment for multi-user support
528+
- Chain Servers together to tunnel traffic through an arbitrary number of machines
529+
- Add Clients after deployment for multi-user support
530+
- Access services running on the 127.0.0.1 interface of Servers
531531

532532
# Demo
533533

@@ -544,7 +544,7 @@ Sometimes you want to access multiple ports on the Server itself that are bound
544544

545545
When running the `configure` or `add server` commands, you can specify a `--localhost-ip <IPv4 address>` argument. For example:
546546
```bash
547-
./wiretap configure --endpoint 7.3.3.1:1337 --routes 10.0.0.0/24 -i 192.168.137.137
547+
./wiretap configure --endpoint 7.3.3.1:1337 --routes 10.0.0.0/24 --localhost-ip 192.168.137.137
548548
```
549549
Any packets received by this Server through the Wiretap network with this target destination address (`192.168.137.137` in this example) will be re-routed to the Server host's `127.0.0.1` loopback address instead, with replies routed back to the Client appropriately. The specified address will also be added as a route (with a `/32` mask) to the Client config file to ensure traffic generated with this destination is routed through the Wiretap network.
550550

@@ -578,6 +578,7 @@ If you have *no* outbound or inbound UDP access, you can still use Wiretap, but
578578
>
579579
> WireGuard explicitly does not support tunneling over TCP, due to the classically terrible network performance of tunneling TCP-over-TCP. Rather, transforming WireGuard's UDP packets into TCP is the job of an upper layer of obfuscation (see previous point), and can be accomplished by projects like [udptunnel](https://github.com/rfc1036/udptunnel) and [udp2raw](https://github.com/wangyu-/udp2raw-tunnel).
580580
581+
### Chisel
581582
Another great tool that has similar cross-platform capabilities to Wiretap is [Chisel](https://github.com/jpillora/chisel). We can use chisel to forward a UDP port to the remote system over TCP. To use:
582583

583584
Run `chisel server` on the Wiretap Client, specifying a TCP listening port that the Wiretap Server can reach:
@@ -596,11 +597,12 @@ In this example, we're connecting chisel to the listener on 8080 (on the Wiretap
596597
- `61820` is the localhost port on the Wiretap Server that will be forwarded back to the Wiretap Client.
597598
- `51820` is the port where the Wiretap Client is listening
598599

599-
Finally, run Wiretap on the remote server system, using the forwarded localhost port in the `--endpoint` argument:
600+
Finally, start a Wiretap Server on the remote system, using the forwarded localhost port in the `--endpoint` argument:
600601
```bash
601602
WIRETAP_RELAY_INTERFACE_PRIVATEKEY=<key> WIRETAP_RELAY_PEER_PUBLICKEY=<key> WIRETAP_E2EE_INTERFACE_PRIVATEKEY=<key> WIRETAP_E2EE_PEER_PUBLICKEY=<key> WIRETAP_E2EE_PEER_ENDPOINT=172.16.0.1:51821 ./wiretap serve --endpoint localhost:61820
602603
```
603604

605+
### SOCAT
604606
Alternatively, if SOCAT is available on the Server and Client (or a machine that can be reached by them) you can use that to establish a UDP-over-TCP connection.
605607

606608
On the Server:
@@ -618,7 +620,7 @@ Then start the wiretap Server with the `--endpoint localhost:61820` argument.
618620
## Add Clients To Any Server
619621

620622
> [!NOTE]
621-
> Clients added to arbitrary servers do not currently have the same capabilities as clients added to first-hop servers (the default)
623+
> Clients added to arbitrary Servers do not currently have the same capabilities as Clients added to first-hop Servers (the default)
622624
623625
Clients can be attached to any Server in the network by using the `--server-address <api-address>` argument when running `wiretap add client`. This allows a Client on a different network than the first Client to still gain access to all of the Wiretap network's routes. However, the new Client will not be able to access any Servers that are part of a different chain connected to the first Client.
624626

0 commit comments

Comments
 (0)