Files
wirecon/README.md
T

70 lines
2.8 KiB
Markdown

# wirecon
WireGuard tunnel between a **rootless-Docker** internet host and an **unprivileged Alpine LXC** on Proxmox, with Caddy reverse-proxying inbound traffic into the LXC's LAN. Tuned for flaky uplinks (Telekom DSL/LTE Hybrid) with a fast-reconnect watchdog and structured logging.
```
internet Telekom Hybrid (DSL+LTE)
clients ──► Docker host ══════ wg0 (UDP 51820) ══════ LXC ──► 192.168.1.0/24
(Caddy + (Alpine + kernel WG
wireguard-go, + OpenRC watchdog
rootless) & monitor)
```
## Install
### Proxmox side — one-liner (creates the LXC from scratch)
Run on the **Proxmox host** as root:
```
curl -fsSL https://git.d4nn13.de/d4nn13/wirecon/raw/branch/main/proxmox/create-lxc.sh | bash
```
Defaults: Alpine template (latest), hostname `concad`, 1 core, 256 MiB RAM, 2 GiB disk, DHCP on `vmbr0`, auto-picked VMID. The script creates the container, applies the `/dev/net/tun` passthrough, starts it, and chains into the in-LXC bootstrap which clones the repo and runs `lxc/install.sh`. Override defaults via env vars:
```
HOSTNAME=tunbox MEMORY=512 STORAGE=fast-nvme \
bash -c "$(curl -fsSL https://git.d4nn13.de/d4nn13/wirecon/raw/branch/main/proxmox/create-lxc.sh)"
```
### Finishing up
Edit `/etc/wireguard/wg0.conf` (keys, endpoint, LAN iface in `PostUp`), optionally tune `/etc/wirecon/wirecon.conf`, then:
```
rc-update add wg-quick.wg0 default && rc-service wg-quick.wg0 start
rc-update add wirecon-watchdog default && rc-service wirecon-watchdog start
rc-update add wirecon-monitor default && rc-service wirecon-monitor start
tail -F /var/log/wirecon-watchdog.log /var/log/wirecon-monitor.log
```
### Docker side (internet host)
Rootless Docker daemon already running:
```
git clone https://git.d4nn13.de/d4nn13/wirecon.git
cd wirecon/docker
cp wg/config/wg0.conf.example wg/config/wg0.conf # fill in keys
# edit proxy/Caddyfile for your sites
docker compose up -d --build
```
Host prereqs:
- `/dev/net/tun` readable by the rootless user
- `sysctl net.ipv4.ip_unprivileged_port_start=80` if you want 80/443 bound directly
## Layout
```
docker/ rootless-Docker stack: wg (wireguard-go) + Caddy sharing netns
lxc/ Alpine installer, OpenRC services, watchdog/monitor/MTU-probe
proxmox/ host-side LXC creator + tun-passthrough snippet
```
## Tuning
- **MTU** — default `1280`. Run `/usr/local/bin/wirecon-mtu-probe.sh` inside the LXC to find the real path MTU; update `MTU =` on both peers.
- **Watchdog** (`/etc/wirecon/wirecon.conf`): `HANDSHAKE_MAX_AGE`, `PING_LOSS_THRESHOLD`, `FAIL_STREAK_THRESHOLD`, `WATCHDOG_INTERVAL`.
- **Logs** — structured `key=value` lines in `/var/log/wirecon-*.log`; grep-friendly.