sh2/d2ypp2/docs/deploy-hardening.md
eric 0517be0ce2 Harden deploy for WireGuard ShellCrash access and multi-arch installs.
Allow trusted CIDRs (Docker/LAN/10.88.0.0/24) past ShellCrash WAN reject so the dashboard works over WG, unify CPU arch detection for amd64/arm64/armv7, and document install-time LIVE_HTTP_PROXY plus Neko NAT1TO1 fallbacks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-31 03:22:22 -05:00

60 lines
2.2 KiB
Markdown

# Deploy hardening notes (x86 / ARM)
Lessons from production deploys on Ubuntu (x86_64 and aarch64) behind Soft Router / WireGuard.
## Architecture
Install scripts detect CPU once and reuse labels:
| `uname -m` | ShellCrash `cpucore` | Docker Compose asset |
|------------|----------------------|----------------------|
| `x86_64` / `amd64` | `amd64` | `x86_64` |
| `aarch64` / `arm64` | `arm64` | `aarch64` |
| `armv7*` / `armhf` | `armv7` | `armv7` |
`harden_shellcrash_runtime` refreshes `cpucore` on every install so a copied image cannot keep the wrong binary label.
## ShellCrash dashboard blocked on WireGuard
Symptom: ShellCrash shows online and has YAML, but `http://10.88.0.x:9999/ui/` fails from WG peers while localhost works.
Cause: ShellCrash nftables WAN firewall accepts only physical LAN (`HOST_IP`) then **rejects** `7890` / `9999`. WireGuard (`10.88.0.0/24`) is not in that accept set.
Fix in tree:
- `SHELLCRASH_WG_CIDR` / `SHELLCRASH_TRUSTED_CIDRS` (see `config/system-stack.env.example`)
- `ensure_shellcrash_proxy_ports_for_docker` also opens dashboard `db_port`
- systemd drop-in `shellcrash.service.d/allow-trusted.conf` + `/usr/local/sbin/shellcrash-allow-trusted.sh` re-applies after every ShellCrash start
## Install-time proxy
When the host cannot reach Docker Hub / GitHub / PyPI directly:
```bash
export LIVE_HTTP_PROXY=http://192.168.21.36:7897
export LIVE_HTTPS_PROXY="$LIVE_HTTP_PROXY"
sudo -E bash ./install-all.sh
# then clear LIVE_* and host proxy files so runtime stays direct
```
Installer downloads for ShellCrash try with proxy and without (`--noproxy` / unset env).
## WireGuard + Neko
- Overlay address for this fleet is typically `10.88.0.0/24` via `129.204.21.129:51820`.
- `NEKO_ACCESS_MODE=remote` should use the WG address for `NEKO_WEBRTC_NAT1TO1`, not the physical LAN IP.
- `resolve_neko_nat1to1` auto-picks `wg*` / `10.88.0.x` when remote mode is set.
- Applying a WG conf also re-runs the ShellCrash trusted-CIDR hook.
## Ports to remember
| Service | Default |
|---------|---------|
| Control plane | `8001` |
| Caddy edge | `80` → `8001` |
| Homepage | `3080` (not `80`) |
| ShellCrash UI | `9999` |
| ShellCrash mixed | `7890` |
| WebTTY | `7681` |
| File Browser | `8082` |