Expose OpenCode web for secure remote access #52

Open
opened 2026-11-08 10:13:34 +00:00 by martin · 0 comments
Owner

Summary

Make the OpenCode web interface reachable when I’m away from home, while keeping access tightly restricted.

Context

See OpenCode Web documentation. The web UI is served by the OpenCode server and is password-protected; the server listens on localhost by default. Pairing uses a one-time link that expires after five minutes, and the resulting browser session lasts 30 days. OpenCode also documents an OpenTunnel-based opencode pair --remote option that exposes the server to the internet, with encrypted traffic and server-password authentication.

Evaluate this native remote option against private Tailscale access (for example, Tailscale Serve rather than Funnel) before choosing an architecture. The fact that a remote option has password protection is not by itself a reason to expose it publicly; consider the tunnel provider, threat model, and whether private tailnet access can meet the need.

Scope

  • Prefer private access through Tailscale if it meets the use case; avoid opening a direct public WAN port by default.
  • Verify how the selected OpenCode server/service is started, where it listens, and how its password is generated or supplied. Do not bind to every network interface unless the chosen network boundary and firewall rules make that safe.
  • If using OpenCode’s fixed OPENCODE_PASSWORD, inject it through the repository’s secret-management approach; never commit the secret in plaintext.
  • If public-internet exposure is considered, document the threat model and require encrypted transport, strong authentication, and appropriate network restrictions.
  • Run the service with least privilege and limit the files/workspaces and host capabilities it can access.
  • Keep the NixOS configuration declarative and document how to connect, revoke access (including the implications of the long-lived browser session), and troubleshoot it.

Acceptance criteria

  • I can reach OpenCode from outside my home through an authenticated, encrypted path.
  • Unauthenticated users cannot reach the interface, and no unnecessary public listener or port-forward is enabled.
  • The service’s permissions and exposed workspace are appropriately limited.
  • The chosen design and its security assumptions are documented, and the NixOS configuration is validated.
## Summary Make the OpenCode web interface reachable when I’m away from home, while keeping access tightly restricted. ## Context See [OpenCode Web documentation](https://opencode.ai/v2/docs/cli/web). The web UI is served by the OpenCode server and is password-protected; the server listens on localhost by default. Pairing uses a one-time link that expires after five minutes, and the resulting browser session lasts 30 days. OpenCode also documents an OpenTunnel-based `opencode pair --remote` option that exposes the server to the internet, with encrypted traffic and server-password authentication. Evaluate this native remote option against private Tailscale access (for example, Tailscale Serve rather than Funnel) before choosing an architecture. The fact that a remote option has password protection is not by itself a reason to expose it publicly; consider the tunnel provider, threat model, and whether private tailnet access can meet the need. ## Scope - Prefer private access through Tailscale if it meets the use case; avoid opening a direct public WAN port by default. - Verify how the selected OpenCode server/service is started, where it listens, and how its password is generated or supplied. Do not bind to every network interface unless the chosen network boundary and firewall rules make that safe. - If using OpenCode’s fixed `OPENCODE_PASSWORD`, inject it through the repository’s secret-management approach; never commit the secret in plaintext. - If public-internet exposure is considered, document the threat model and require encrypted transport, strong authentication, and appropriate network restrictions. - Run the service with least privilege and limit the files/workspaces and host capabilities it can access. - Keep the NixOS configuration declarative and document how to connect, revoke access (including the implications of the long-lived browser session), and troubleshoot it. ## Acceptance criteria - [ ] I can reach OpenCode from outside my home through an authenticated, encrypted path. - [ ] Unauthenticated users cannot reach the interface, and no unnecessary public listener or port-forward is enabled. - [ ] The service’s permissions and exposed workspace are appropriately limited. - [ ] The chosen design and its security assumptions are documented, and the NixOS configuration is validated.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Personal/nixos-configuration#52
No description provided.