fbi-proxy 1.12.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -21
- package/dist/cli.js +32 -0
- package/package.json +1 -1
- package/release/fbi-proxy-windows-arm64.exe +0 -0
- package/release/fbi-proxy-windows-x64.exe +0 -0
- package/ts/auth/setupWizard.ts +48 -0
package/README.md
CHANGED
|
@@ -11,42 +11,50 @@ FBI-Proxy provides easy HTTPS access to your local services with intelligent dom
|
|
|
11
11
|
|
|
12
12
|
### Current Features ✅
|
|
13
13
|
|
|
14
|
-
- **
|
|
14
|
+
- **One-command HTTPS gateway**: `bunx fbi-proxy --with-caddy --with-auth --provider snolab --domain fbi.com` brings up Caddy (auto-downloaded), fbi-auth (Firebase-backed Google sign-in), and the Rust proxy together — zero config needed on `.fbi.com`.
|
|
15
|
+
- **Rule-based Domain Routing** via `routes.yaml`:
|
|
15
16
|
- Port-based routing (e.g., `3000.fbi.com` → `localhost:3000`)
|
|
16
17
|
- Host--Port routing (e.g., `api--3001.fbi.com` → `api:3001`)
|
|
17
18
|
- Subdomain routing with Host headers (e.g., `admin.app.fbi.com` → `app:80`)
|
|
18
19
|
- Direct host forwarding (e.g., `myserver.fbi.com` → `myserver:80`)
|
|
19
|
-
-
|
|
20
|
-
- **
|
|
21
|
-
- **
|
|
22
|
-
- **
|
|
23
|
-
- **
|
|
24
|
-
- **
|
|
25
|
-
- **
|
|
20
|
+
- Placeholder syntax (`{name}`, `{name:int}`, `{name:slug}`, `{name:multi}`) for custom rules — see [docs/routing.md](docs/routing.md)
|
|
21
|
+
- **HTTPS Upstreams**: Targets with an `https://` prefix connect to upstream over TLS (Mozilla webpki roots).
|
|
22
|
+
- **WebSocket Support**: Full WebSocket forwarding (`ws://` and `wss://`) for all routing patterns.
|
|
23
|
+
- **Auth Gateway**: Google OAuth / Firebase Auth / zero-config snolab default IdP — JWT cookie scoped to `Domain=.your-domain` for cross-subdomain SSO. Audit log at `~/.config/fbi-proxy/audit.log`.
|
|
24
|
+
- **High Performance**: Built with Rust for optimal performance and low resource usage.
|
|
25
|
+
- **Easy Setup**: Simple one-command installation and startup.
|
|
26
|
+
- **Docker Support**: Available as a Docker image for containerized deployments.
|
|
27
|
+
- **Flexible Configuration**: Environment variables, CLI options, and `routes.yaml` overrides.
|
|
28
|
+
- **Cross-Platform**: Pre-built binaries for macOS, Linux, and Windows (x64 + arm64).
|
|
29
|
+
- **Integration Ready**: Compatible with reverse proxies like Caddy for HTTPS (and bundles its own `--with-caddy` automation).
|
|
26
30
|
|
|
27
31
|
## Roadmap
|
|
28
32
|
|
|
29
33
|
### Shipped ✅
|
|
30
34
|
|
|
31
|
-
- [x] **Auto Caddy Setup**
|
|
35
|
+
- [x] **Auto Caddy Setup** — One-command bootstrap that generates a Caddyfile for the chosen domain and supervises Caddy alongside fbi-proxy and fbi-auth (`bunx fbi-proxy --with-caddy --with-auth --domain example.dev`). Caddy binary is auto-downloaded from GitHub Releases on first run (SHA-512 verified against the release's `checksums.txt`), cached at `~/.fbi-proxy/bin/caddy`. Set `FBI_CADDY_AUTO_DOWNLOAD=false` to opt out.
|
|
36
|
+
- [x] **Auth Gateway** — Google OAuth, Firebase Auth, and a **zero-config snolab default IdP** (Firebase-based, live on `fbi.com`). Cookie-based SSO across `*.your-domain`. Sliding-window refresh, configurable threshold, JSONL audit log at `~/.config/fbi-proxy/audit.log`. See [lib/fbi-auth/docs/setup.md](lib/fbi-auth/docs/setup.md) and [lib/fbi-auth/docs/snolab.md](lib/fbi-auth/docs/snolab.md).
|
|
37
|
+
- [x] **Rule-based Routing** — `routes.yaml` with placeholder syntax (`{name}`, `{name:int}`, `{name:slug}`, `{name:multi}`). DNS-passthrough, k8s, Docker, and PR-preview recipes in [docs/routing.md](docs/routing.md). Override the bundled defaults with `--routes` or `FBI_PROXY_ROUTES`.
|
|
38
|
+
- [x] **HTTPS Upstream Support** — Route target with an `https://` prefix triggers TLS to upstream via `hyper-rustls` + Mozilla webpki roots. Backward compatible — plain `host:port` still uses HTTP. WebSocket upgrades flip to `wss://` automatically.
|
|
39
|
+
- [x] **Cross-platform Releases** — Every push builds six platforms in parallel (linux x64/arm64, macOS x64/arm64, windows x64/arm64). See [docs/cross-compile-tradeoffs.html](docs/cross-compile-tradeoffs.html).
|
|
32
40
|
|
|
33
41
|
### Next Up 🚧
|
|
34
42
|
|
|
35
|
-
- [ ] **Custom Domain Wizard**
|
|
36
|
-
- [ ] **
|
|
37
|
-
- [ ] **
|
|
38
|
-
- [ ] **
|
|
39
|
-
- [ ] **
|
|
40
|
-
- [ ] **Health Checks** - Simple upstream service availability monitoring
|
|
43
|
+
- [ ] **Custom Domain Wizard polish** — Print the DNS A-records to add (`*.example.dev → <ip>`) and a Caddyfile-with-DNS-01 sample for Cloudflare during `--reconfigure` on a non-fbi.com domain
|
|
44
|
+
- [ ] **Hot Reload** — Watch `routes.yaml` and recompile rules without a restart
|
|
45
|
+
- [ ] **Metrics** — `/varz`-style counters: requests, 2xx/4xx/5xx, upstream-connect-failures, sessions-issued, sessions-refreshed (Prometheus format)
|
|
46
|
+
- [ ] **Health Checks** — Active upstream liveness probes, not just per-request failure detection
|
|
47
|
+
- [ ] **Cloudflare Tunnel / ngrok Integration** — Expose `*.your-domain` publicly without owning a static IP
|
|
41
48
|
|
|
42
49
|
### Future Improvements 🔮
|
|
43
50
|
|
|
44
|
-
- [ ] **Load Balancing**
|
|
45
|
-
- [ ] **
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
-
|
|
51
|
+
- [ ] **Load Balancing** — Round-robin between multiple upstream targets for one route
|
|
52
|
+
- [ ] **Custom Headers per route** — Beyond `Host:`, add response headers or rewrite request headers
|
|
53
|
+
|
|
54
|
+
### Won't do
|
|
55
|
+
|
|
56
|
+
- ~~**Built-in HTTPS via rustls + ACME**~~ — Caddy already does this very well, and the `--with-caddy` UX is one extra flag. Adding another ACME client to the Rust binary is more code, more attack surface, and another implementation of a solved problem. Caddy stays the canonical TLS path.
|
|
57
|
+
- ~~**SQLite session storage**~~ — JWT + `sessionSecret` rotation covers the threat model for fbi-proxy's intended scale (solo / small-team self-hosted). See [revoking sessions](lib/fbi-auth/docs/setup.md#revoking-sessions).
|
|
50
58
|
|
|
51
59
|
## Routing Examples
|
|
52
60
|
|
package/dist/cli.js
CHANGED
|
@@ -5529,8 +5529,40 @@ async function runWizard(prompter, opts) {
|
|
|
5529
5529
|
prompter.print("Config preview:");
|
|
5530
5530
|
prompter.print(JSON.stringify(redact(cfg), null, 2));
|
|
5531
5531
|
prompter.print("");
|
|
5532
|
+
if (cleanDomain !== "fbi.com") {
|
|
5533
|
+
printCustomDomainHints(prompter, cleanDomain);
|
|
5534
|
+
}
|
|
5532
5535
|
return cfg;
|
|
5533
5536
|
}
|
|
5537
|
+
function printCustomDomainHints(prompter, domain) {
|
|
5538
|
+
prompter.print("─── Custom-domain DNS + TLS hints ───");
|
|
5539
|
+
prompter.print("");
|
|
5540
|
+
prompter.print(`Your domain is '${domain}' (not the default fbi.com).`);
|
|
5541
|
+
prompter.print(`You'll need DNS A-records pointing the wildcard + sso host`);
|
|
5542
|
+
prompter.print(`at the public IP of the machine running fbi-proxy:`);
|
|
5543
|
+
prompter.print("");
|
|
5544
|
+
prompter.print(` *.${domain} A <your-public-ip>`);
|
|
5545
|
+
prompter.print(` sso.${domain} A <your-public-ip> (covered by the wildcard,`);
|
|
5546
|
+
prompter.print(` but call it out explicitly)`);
|
|
5547
|
+
prompter.print("");
|
|
5548
|
+
prompter.print(`For wildcard TLS via Let's Encrypt you need DNS-01 (HTTP-01`);
|
|
5549
|
+
prompter.print(`can't issue wildcards). With Cloudflare DNS:`);
|
|
5550
|
+
prompter.print("");
|
|
5551
|
+
prompter.print(` 1. Create a Cloudflare API token with Zone:DNS:Edit on '${domain}'.`);
|
|
5552
|
+
prompter.print(` 2. Export it: CLOUDFLARE_API_TOKEN=...`);
|
|
5553
|
+
prompter.print(` 3. Run with --with-caddy --tls-mode auto. fbi-proxy will generate`);
|
|
5554
|
+
prompter.print(` a Caddyfile that uses Caddy's cloudflare DNS plugin:`);
|
|
5555
|
+
prompter.print("");
|
|
5556
|
+
prompter.print(` *.${domain} {`);
|
|
5557
|
+
prompter.print(` tls { dns cloudflare {env.CLOUDFLARE_API_TOKEN} }`);
|
|
5558
|
+
prompter.print(` reverse_proxy 127.0.0.1:{$FBI_PROXY_PORT}`);
|
|
5559
|
+
prompter.print(` }`);
|
|
5560
|
+
prompter.print("");
|
|
5561
|
+
prompter.print(`If you're just testing locally without public DNS, point your`);
|
|
5562
|
+
prompter.print(`/etc/hosts at 127.0.0.1 and pass --tls-mode internal — Caddy will`);
|
|
5563
|
+
prompter.print(`use its local CA (the cert won't be trusted by other machines).`);
|
|
5564
|
+
prompter.print("");
|
|
5565
|
+
}
|
|
5534
5566
|
function redact(c) {
|
|
5535
5567
|
return {
|
|
5536
5568
|
...c,
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
package/ts/auth/setupWizard.ts
CHANGED
|
@@ -133,9 +133,57 @@ export async function runWizard(
|
|
|
133
133
|
prompter.print(JSON.stringify(redact(cfg), null, 2));
|
|
134
134
|
prompter.print("");
|
|
135
135
|
|
|
136
|
+
if (cleanDomain !== "fbi.com") {
|
|
137
|
+
printCustomDomainHints(prompter, cleanDomain);
|
|
138
|
+
}
|
|
139
|
+
|
|
136
140
|
return cfg;
|
|
137
141
|
}
|
|
138
142
|
|
|
143
|
+
function printCustomDomainHints(prompter: WizardPrompter, domain: string) {
|
|
144
|
+
prompter.print("─── Custom-domain DNS + TLS hints ───");
|
|
145
|
+
prompter.print("");
|
|
146
|
+
prompter.print(`Your domain is '${domain}' (not the default fbi.com).`);
|
|
147
|
+
prompter.print(`You'll need DNS A-records pointing the wildcard + sso host`);
|
|
148
|
+
prompter.print(`at the public IP of the machine running fbi-proxy:`);
|
|
149
|
+
prompter.print("");
|
|
150
|
+
prompter.print(` *.${domain} A <your-public-ip>`);
|
|
151
|
+
prompter.print(
|
|
152
|
+
` sso.${domain} A <your-public-ip> (covered by the wildcard,`,
|
|
153
|
+
);
|
|
154
|
+
prompter.print(
|
|
155
|
+
` but call it out explicitly)`,
|
|
156
|
+
);
|
|
157
|
+
prompter.print("");
|
|
158
|
+
prompter.print(`For wildcard TLS via Let's Encrypt you need DNS-01 (HTTP-01`);
|
|
159
|
+
prompter.print(`can't issue wildcards). With Cloudflare DNS:`);
|
|
160
|
+
prompter.print("");
|
|
161
|
+
prompter.print(
|
|
162
|
+
` 1. Create a Cloudflare API token with Zone:DNS:Edit on '${domain}'.`,
|
|
163
|
+
);
|
|
164
|
+
prompter.print(` 2. Export it: CLOUDFLARE_API_TOKEN=...`);
|
|
165
|
+
prompter.print(
|
|
166
|
+
` 3. Run with --with-caddy --tls-mode auto. fbi-proxy will generate`,
|
|
167
|
+
);
|
|
168
|
+
prompter.print(` a Caddyfile that uses Caddy's cloudflare DNS plugin:`);
|
|
169
|
+
prompter.print("");
|
|
170
|
+
prompter.print(` *.${domain} {`);
|
|
171
|
+
prompter.print(` tls { dns cloudflare {env.CLOUDFLARE_API_TOKEN} }`);
|
|
172
|
+
prompter.print(` reverse_proxy 127.0.0.1:{$FBI_PROXY_PORT}`);
|
|
173
|
+
prompter.print(` }`);
|
|
174
|
+
prompter.print("");
|
|
175
|
+
prompter.print(
|
|
176
|
+
`If you're just testing locally without public DNS, point your`,
|
|
177
|
+
);
|
|
178
|
+
prompter.print(
|
|
179
|
+
`/etc/hosts at 127.0.0.1 and pass --tls-mode internal — Caddy will`,
|
|
180
|
+
);
|
|
181
|
+
prompter.print(
|
|
182
|
+
`use its local CA (the cert won't be trusted by other machines).`,
|
|
183
|
+
);
|
|
184
|
+
prompter.print("");
|
|
185
|
+
}
|
|
186
|
+
|
|
139
187
|
function redact(c: AuthConfigShape): AuthConfigShape {
|
|
140
188
|
return {
|
|
141
189
|
...c,
|