Documentation
¶
Overview ¶
Package dm is the login screen's display manager: `lys-login daemon`, run as root by its system service on a VT, shows the greeter there and starts the session a user logs in to. It needs PAM with pam_systemd and a running logind, which register each session, and lys-wm, which hosts the greeter. It replaces greetd and cage, and takes the logged-in user's changes of the login screen without polkit.
The daemon itself never authenticates or opens a session: each greeter and each login runs in a worker, `lys-login worker`, a root process of its own that holds the PAM transaction from start to end and leads the logind session pam_systemd registers. The greeter runs as the unprivileged greeter user inside lys-wm, configured as a kiosk, and speaks the greetd protocol to the daemon over a socket only it can reach, so the greeter UI is the same one that runs under greetd.
Index ¶
- Constants
- Variables
- func CheckResume(stateFD int, o Options, out io.Writer) error
- func Resume(ctx context.Context, o Options, stateFD int) error
- func Run(ctx context.Context, o Options) error
- func RunGreeter(o WorkerOptions, greeterUser string, compositor, extraEnv []string) error
- func RunSession(o WorkerOptions, rw io.ReadWriter) error
- func TakeScreenFromSplash(runtimeDir string) func()
- type Autologin
- type Options
- type Presented
- type Socket
- type SwitchRequest
- type UpgradeRequest
- type WorkerOptions
Constants ¶
const ( AutologinService = "lys-login-autologin" FingerprintService = "lys-login-fingerprint" )
const ( ResumeMode = "daemon-resume" ResumeCheckFlag = "check" ResumeStateFlag = "state-fd" )
const RuntimeDirEnv = "LYS_LOGIN_RUNTIME_DIR"
const Seat = "seat0"
Seat is the seat the display manager runs on.
Variables ¶
var ( ApplySocket = Socket[greeterconfig.Change]{dmsocket.Apply} CursorSocket = Socket[cursorrecord.Cursor]{dmsocket.Endpoint[cursorrecord.Cursor]{Name: "cursor.sock", MaxRequest: 4096, Exchange: exchangeTimeout}} SplashSocket = Socket[Presented]{dmsocket.Endpoint[Presented]{Name: "splash.sock", MaxRequest: 64, Exchange: exchangeTimeout}} UpgradeSocket = Socket[UpgradeRequest]{dmsocket.Endpoint[UpgradeRequest]{Name: "upgrade.sock", MaxRequest: 1 << 20, Exchange: upgradeExchange}} SwitchSocket = Socket[SwitchRequest]{dmsocket.Endpoint[SwitchRequest]{Name: "switch.sock", MaxRequest: 64, Exchange: exchangeTimeout}} )
StopSignals end a daemon: systemd stops one with SIGTERM and, as the service sets SendSIGHUP, SIGHUP right after it, whose default would kill the daemon before it could end the session.
Functions ¶
func Run ¶
Run shows the greeter on the VT and starts each session a user logs in to, until ctx ends. Meanwhile it takes changes of the login screen on ApplySocket from root and from the user whose session runs, and that session's cursor on CursorSocket.
func RunGreeter ¶
func RunGreeter(o WorkerOptions, greeterUser string, compositor, extraEnv []string) error
RunGreeter is the greeter's worker: it opens the greeter user's session, runs the compositor as that user, and closes the session when the compositor exits or the daemon stops the worker (SIGTERM). It must run on the process's main thread, as auth.Login says.
func RunSession ¶
func RunSession(o WorkerOptions, rw io.ReadWriter) error
RunSession is one login's worker, serving the daemon over rw: it authenticates the user the daemon names, relaying PAM's prompts, and once told to start, opens the session, runs the command as the user until it exits, and closes the session. It must run on the process's main thread, as auth.Login says.
func TakeScreenFromSplash ¶
func TakeScreenFromSplash(runtimeDir string) func()
Types ¶
type Options ¶
type Options struct {
WorkerOptions
// GreeterUser is the unprivileged account the greeter runs as.
GreeterUser string
// Compositor is the greeter's compositor command, lys-wm; the daemon
// adds its kiosk config.
Compositor []string
// Greeter is the greeter's command line, resolved once here: the
// greeter is started with all of it said, and the daemon reads the
// same config and state files.
Greeter greeter.Options
// RuntimeDir holds the greeter's socket, ApplySocket, CursorSocket
// and the kiosk config.
RuntimeDir string
// CursorDir holds the cursor records the sessions hand over.
CursorDir string
Keyboard keyboard.Sources
Autologin *Autologin
Splash string
Args []string
}
Options configure the daemon.
type Socket ¶
Socket is one of the display manager's sockets in its runtime directory, open to every local user, taking one request of type T per connection. The daemon decides by the peer's uid what it does with a request.
type SwitchRequest ¶
type SwitchRequest struct{}
type UpgradeRequest ¶
type WorkerOptions ¶
type WorkerOptions struct {
// Service is the PAM service.
Service string
// VT is the virtual terminal the sessions run on.
VT int
// Self is the lys-login program the workers and the greeter run.
Self string
// RuntimeDir holds the lock a session worker keeps while its session runs.
RuntimeDir string
Autologin bool
FingerprintService string
}
WorkerOptions are what every worker runs with.