LightDM Design
What is a Display Manager?
The responsibilities of a display manager are:
- Starting and managing local instances of the X server.
- Authenticating users.
Starting and managing user sessions. Common use cases:
Starting a single X server on boot and starting a session (kiosk mode).
- Starting a single X server instance on boot, displaying a greeter GUI (username and password), and starting the user session when connected (traditional).
- Supporting multiple simultaneous logins by exposing what users are logged in, and starting new X servers for each user (user switching).
- Running a thin-client server by allowing X servers to connect using XDMCP, and connecting greeters and sessions to those X servers.
Design Goals
- Fast - The display manager should add no noticeable delay to startup time.
- Fail-safe - Failures should be handled gracefully.
- Secure - Resistant to malicious users.
- Flexible - Able to support a range of use-cases.
- Extensible - Able to support rarer use-cases though plugins.
- Simple - Configuration should be easy and the code should be simple to understand and modify.
Definitions
- Display Manager - A daemon that manages the displays on a system.
- Display - A combination of an X server, greeter and a user session.
- User session - An application that runs on a display and allows the user to run applications.
- Greeter - An application to run on a display and prompt for authentication and session options.
Requirements
Daemon:
- Able to run as as system service without user interaction
- Provide logging information for debugging
- Launch and monitor X servers
- Launch and monitor greeter applications for displays without a user session
- Launch and monitor user sessions after user is authenticated
- Authenticate users
- Provide an interface to greeter applications
- Provide an interface to user switchers
- Store a database of active displays
- Load sessions from /usr/share/xsessions
- Store session configuration in ~/.dmrc
- Support .dmrc not being readable before login
- Advertise display database to Software/ConsoleKit if available
Use PAM for authentication Session environment:
Set USER to the username
- Set HOME to users home directory
- Set SHELL to the users shell
- Set PATH to /usr/bin:/bin
- Set LANG to the users language
- Set DISPLAY to the X servers address
Set environment variables from /etc/environment Static Display Module:
Allow 0-N displays to be enabled at all time
Support automatic/timed login User Switcher Module:
Interface to switch to existing local display for a logged in user
Start new static display if user not logged in XDMCP Server Module:
Implement XDMCP protocol Module interface:
Expose display database Greeter application/interface:
User authentication
- Session choice
- Session language
- Session keyboard layout
- Logged in users
Implementation
Daemon:
- Implemented in C+GObject
Single process Greeter Interface:
D-Bus GTK+ Greeter:
Inter-process Relationships
[[!img LightDM interprocess relationships.png]