dm

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: MIT, MIT Imports: 42 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const (
	AutologinService   = "lys-login-autologin"
	FingerprintService = "lys-login-fingerprint"
)
View Source
const (
	ResumeMode      = "daemon-resume"
	ResumeCheckFlag = "check"
	ResumeStateFlag = "state-fd"
)
View Source
const RuntimeDirEnv = "LYS_LOGIN_RUNTIME_DIR"
View Source
const Seat = "seat0"

Seat is the seat the display manager runs on.

Variables

View Source
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 CheckResume

func CheckResume(stateFD int, o Options, out io.Writer) error

func Resume

func Resume(ctx context.Context, o Options, stateFD int) error

func Run

func Run(ctx context.Context, o Options) error

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 Autologin

type Autologin struct {
	User    string
	Session auth.Session
}

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 Presented

type Presented struct{}

type Socket

type Socket[T any] struct{ dmsocket.Endpoint[T] }

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 UpgradeRequest struct {
	Exec string   `json:"exec"`
	Args []string `json:"args"`
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL