Documentation
¶
Overview ¶
Package adminsocket serves the out-of-band admin plane: the one route the CLI posts to for password reset and API-key generation.
It exists because bbolt takes an exclusive OS file lock, so the CLI cannot open the store while the server holds it. The commands travel over HTTP to the running process instead, on a Unix socket in a 0700 directory rather than the TCP mux — the kernel's socket custody IS the security boundary, which is why these handlers require no credentials and why that is safe. main.go owns the listener; this package owns the handlers.
The three of them read one collaborator (the auth store) plus a metrics hook and were the last coherent handler cluster on Server. Everything the plane needs is in Deps: nothing here reads the live config, the live snapshot, or the main store.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthStore ¶
type AuthStore interface {
UserByUsername(ctx context.Context, username string) (user *auth.User, found bool, err error)
UpdateUser(ctx context.Context, user *auth.User) error
DeleteUserSessions(ctx context.Context, userID int64, exceptHash string) error
CreateAPIKey(ctx context.Context, key *auth.Key) error
}
AuthStore is the four writes and one read the bootstrap actions perform. Five of the auth SPI's methods, named here because this is the package that calls them.
type Deps ¶
type Deps struct {
Store AuthStore
Metrics PanicRecorder
}
Deps is what the plane needs.
type PanicRecorder ¶
type PanicRecorder interface {
RecordPanic()
}
PanicRecorder counts a recovered panic. One method: this plane installs no request-metric hook at all (see Handler).
type Plane ¶
type Plane struct {
// contains filtered or unexported fields
}
Plane serves the admin socket's single route.
func (*Plane) Handler ¶
Handler returns the admin-plane handler: a one-route mux serving POST /api/admin/bootstrap, wrapped in the same access-log/request-ID and panic-recovery middleware the TCP mux uses (the body limit is inside the handler via webhttp.DecodeBody, exactly as on the TCP plane). It installs no request-metric hook, deliberately: http_requests_total describes the public HTTP surface, and this plane is one route reachable only by a same-container process, so a series for it would carry no signal. Every http_requests_total sample therefore comes from the server's own middleware chain.
main.go serves it on a second http.Server bound to the Unix socket in the 0700 directory config.AdminSocketDir — kernel socket custody replaces the former requireLocalhost peer-address check, so the zero-credential bootstrap channel is unreachable over every TCP path (netns-sharing peers and proxied clients included). Both configured and unconfigured server modes expose it.