Documentation
¶
Overview ¶
Package onboarding serves the plain-HTTP onboarding listener: a page that explains how to trust the local CA on each platform, the CA certificate in DER, PEM and iOS profile form, QR codes for this server's HTTPS URLs and invite landing pages. Every other path is redirected to HTTPS. It sets no cookies and exposes no API.
Index ¶
Constants ¶
const ContentSecurityPolicy = "default-src 'none'; style-src 'self'; img-src 'self'; " +
"base-uri 'none'; form-action 'none'; frame-ancestors 'none'"
ContentSecurityPolicy of every onboarding response: the page needs only its stylesheet and the QR image, and works without JavaScript.
Variables ¶
This section is empty.
Functions ¶
func IsFirefox ¶
IsFirefox reports whether ua is Firefox, which on Linux keeps its own certificate store.
Types ¶
type OS ¶
type OS string
OS is a device platform the onboarding page has trust steps for.
type Options ¶
type Options struct {
// InstanceName returns the display name; nil or "" means "bubbles".
InstanceName func() string
// CA returns the local CA, or nil when the server uses a
// bring-your-own certificate (then no CA is offered for download).
CA func() *tlsca.CA
// HTTPSPort is the port the HTTPS listener is bound to.
HTTPSPort int
// URLs returns this server's HTTPS base URLs, best first, for example
// "https://192.168.1.20:28225/".
URLs func() []string
// Hosts returns the extra host names and addresses this server answers
// to (its certificate SANs); QR codes are only drawn for these and for
// the hosts in URLs.
Hosts func() []string
// AllowedCIDRs returns extra source ranges admitted besides private and
// loopback addresses; nil means none.
AllowedCIDRs func() []netip.Prefix
// RegistrationOpen reports whether sign-up is open right now; nil means
// unknown and the page says nothing about sign-up.
RegistrationOpen func() bool
// Tailnet returns the server's HTTPS address on its Tailscale MagicDNS
// name and whether that address has a publicly trusted certificate
// (--tailscale-cert), so no CA install is needed for it; "" when the
// name is not usable. Nil means none.
Tailnet func() (url string, trusted bool)
// Logger receives template errors; nil discards them.
Logger *slog.Logger
}
Options configure the onboarding handler.