Documentation
¶
Overview ¶
Package web serves what people look at: the public pages at the site's root (the status pages, or a page that names the deployment), and under /console the console, Beacon's own workbench, with the pages people open from the chat (an alert's page, with its timeline and the sessions on its machines, and a session's page, with its replay). They are HTML from embedded templates on the design system @openlinkos/ui (vendored under static/ol), without a build step or a framework, served by beacon beside the API on the same port, in the configured language, readable on a phone. Every page says it runs on Beacon and links to the project (brand.go).
People sign in to the console with their Beacon account, a username and a password (console.go, accounts.go), and what the console may do is what their role allows; signing in with a pasted token is kept for one release. People manage their agents there (agentpages.go), owners manage people, and MCP clients are allowed at /oauth/authorize (oauth.go). An alert's or a session's page also opens without signing in, view-only, with a signed link (package link), which the card, the chat echoes and the API hand out, or with a bearer credential carrying the scope the matching API route needs; anything else is 404, so that a wrong or expired link reveals nothing, not even that the page exists. Text from outside Beacon reaches the pages cleaned by the bridge and is escaped by html/template on the way out; the pages carry no inline script or style, and their Content-Security-Policy allows nothing from elsewhere.
Index ¶
Constants ¶
const CSP = "default-src 'none'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self'; font-src 'self'; img-src 'self' data:; " +
"connect-src 'self'; base-uri 'none'; form-action 'self'; frame-ancestors 'none'"
CSP is the pages' Content-Security-Policy: scripts, styles and fonts from Beacon itself only (the player's terminal runs as WebAssembly, hence wasm-unsafe-eval), no inline script or style, fetches and forms to Beacon only.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Server ¶
type Server struct {
Bridge *bridge.Bridge
SSH *sshgate.Gate
Auth *api.Auth
Pages *link.Pages
Lang i18n.Lang
Location *time.Location
Log *slog.Logger
Now func() time.Time
Store *store.Store
Config *configdb.Service
Settings *config.Manager
Credentials *secrets.Service
CredentialsConfigured bool
Hooks []config.Agent
Reporting func() map[string]time.Time
Version string
DefaultWorkspace bool
// Status computes the public status pages (status.go); nil leaves them out.
Status *status.Service
Branding config.Branding
// OAuth is Beacon's authorization server for MCP clients (package oauth); nil leaves /oauth/authorize out.
OAuth *oauth.Server
// contains filtered or unexported fields
}
Server serves the pages. SSH is nil when the channel is off (session pages are then 404); Auth checks bearer tokens (nil: only signed links open pages); Pages checks the links' signatures and signs the links inside pages (nil: only tokens open pages, and pages link nowhere).
The console needs Store, where its sign-ins are kept: nil leaves it out, and only the pages opened from the chat are served. Config is the configuration Beacon holds (nil: the console's configuration page is empty), Hooks the agent hooks configured, Reporting when each probe location last wrote through the gateway (nil without a gateway), and Version Beacon's own. Branding is what the public pages say of the deployment and of Beacon.
func (*Server) Console ¶
Console reports whether the console is served (it needs the store for its sign-ins).
func (*Server) Hosts ¶
Hosts serves a status page's own host name: the page at /, its incidents under /incidents/, its JSON, feed and badges, robots.txt and the static files the page needs; nothing else of Beacon, the console, the API and MCP included, answers there. Other hosts go to next.
Source Files
¶
- accounts.go
- actions.go
- agentpages.go
- brand.go
- configpage.go
- console.go
- credentials.go
- facets.go
- home.go
- icons.go
- incident_episodes.go
- incident_sessions.go
- incidentssh.go
- lists.go
- machine_access.go
- machine_history.go
- machines.go
- maintenanceform.go
- monitorform.go
- monitors.go
- oauth.go
- outcomes.go
- overview.go
- pages.go
- response_machine.go
- session_evidence.go
- sharelinks.go
- sharelinkview.go
- shell.go
- silences.go
- status.go
- statuscomponentform.go
- statuspagecreate.go
- statuspages.go
- statusparts.go
- terminal.go
- tokens.go
- web.go
- workspace_admin.go
- workspace_alerts.go
- workspace_i18n.go
- workspace_identity.go
- workspace_machines.go
- workspace_monitoring.go
- workspaceapi.go
- workspacefiles.go
- workspacepages.go