# wg-easy home VPN — the corrected recipe

The version of this that circulates on social media (an old laptop, `INSECURE=true`, port 51821,
"make an admin account") is missing three things that stop it booting on wg-easy v14 or later.
This is the working version, plus the two facts that decide whether the whole idea is viable for
you at all.

## 1. Admin password is not an env var any more

```
docker run --rm --entrypoint node ghcr.io/wg-easy/wg-easy:latest \
  -e "console.log(require('bcryptjs').hashSync('YOURPASSWORD',12))"
```

`PASSWORD=...` makes the container refuse to start:

> DO NOT USE PASSWORD ENVIRONMENT VARIABLE. USE PASSWORD_HASH INSTEAD.

## 2. Every `$` in `.env` must be written `$$`

`env_file:` values *are* interpolated by compose. A bcrypt hash starts `$2a$12$…`, so left alone it
arrives at the server as `$2a$12$` plus blanks, `requiresPassword` comes out false, and the admin
panel ends up **unauthenticated** rather than locked. Write it as:

```
WG_HOST=<home public IP or DNS name>
PASSWORD_HASH=$$2a$$12$$<rest of the hash>
```

## 3. Do not expose port 51821

That is the admin panel. Bind it to `127.0.0.1:51821:51821` and reach it over SSH if the box is
headless: `ssh -L 51821:127.0.0.1:51821 user@box`. Only `51820/udp` goes to the internet.

## Run

```bash
docker compose up -d          # or: colima start first, on a Mac
open http://127.0.0.1:51821   # New Client → QR → WireGuard app
```

Stop: `docker compose down`.

## What it costs

Nothing but electricity and home upload bandwidth. There is no subscription, no account, and no
third party seeing the traffic. The tunnel is a 60-byte-per-packet overhead on UDP, which is why
`wg-quick` sets the interface MTU to 1420 (1500 − 80).

## The two facts that decide viability

1. **The box has to stay at home, powered and awake.** A laptop you carry to school is a server
   only during the hours you do not need it.
2. **The home connection needs a forwardable public IPv4.** Look at the WAN address in the router:
   `100.64.x.x`, `10.x.x.x` or `172.16–31.x.x` means carrier-grade NAT, and there is no port to
   forward. Public IP or a tunnel over an outbound TLS connection instead.

And a third, if the point is bypassing a filtered network: WireGuard is a fixed UDP port with a
recognisable handshake. Networks that block unknown UDP, or fingerprint the handshake, will drop it
wherever a TLS-over-443 tunnel would still work.
