Locking settings with a policy
An organization can decide some settings for everyone on its computers: how soon the screen locks, how updates arrive, what the firewall lets through, where software comes from, how people sign in, which apps they get or can’t run, who can sign in from elsewhere and more. Luft applies the decided values and refuses every attempt to change them, from Settings, the luft command or a script alike. Settings shows such a setting as it is, can’t change it, and says the organization manages it. System › About says who manages the computer and lists, in plain words, everything the organization decided.
Policy files
Section titled “Policy files”Policy lives in TOML files in two folders:
| Folder | For |
|---|---|
/usr/share/luft/policy.d |
An image built from Luft’s, with the policy baked in. It’s part of the signed, read-only image, so nobody on the computer can change it. |
/etc/luft/policy.d |
A local administrator’s policy for one computer |
Only files ending in .toml count. Within each folder they’re read in name order, so name them with a number in front, such as 10-updates.toml. The files in /etc are read first and those in /usr/share after them, and a value set by a later file replaces the same value from an earlier one, key by key. The image therefore has the last word: a local administrator can decide what the image leaves open, but not undo what it decided.
A file with a mistake, such as a key Luft doesn’t know or a value of the wrong kind, is left out as a whole. Check a file before adding it, and see what the computer’s policy decides now, with the luft command:
luft policy check 10-updates.toml # every unknown key and wrong value, by its full keyluft policy # each decided value and the file that decides itluft policy check exits with 3 when the file would be left out. luft policy also lists the files it leaves out and why, and --json prints both for scripts. The services name left-out files in the system journal too (journalctl -b | grep 'Leaving out the policy').
Changes count at once. Every service that applies the policy follows both folders while it runs, and the services that only start when needed are started when a policy folder changes, so a new file takes effect within a moment, in running sessions too.
To ship policy in your own Luft, put the files in your repository’s policy folder.
A computer that joined your organization keeps your policy in /etc/luft/policy.d/90-organization.toml, and the parts with passwords and keyfiles in 91-organization-private.toml, which only root can read. Joining writes both, and a newer signed policy replaces them.
A key left out stays each person’s choice.
[organization]name = "Acme" # shown in Settings as "Managed by Acme"
[screen-lock]enabled = true # lock the screen when it turns offscreen-off = 300 # seconds without input before the screen turns off, 0 for neverlock-after = 0 # seconds after the screen turns off before it locks
[updates]schedule = "daily" # "daily", "weekly" or "never"download = true # download and stage updates found on schedulechannel = "stable" # "stable" or "nightly"image = "registry.acme.example/luft/acme:1-pilot" # the image to follow, in place of the channel
[firewall]home-networks = false # every network counts as publicpublic-access = false # nothing is reachable from public networksopen-ports = false # no ports opened for services without an app
[software]system-packages = false # no adding system packages, from Fedora or as .rpm filespackage-sources = false # no adding software sourcesapp-sources = ["schelf-store", "flathub"] # where apps may come from: "schelf-store", "flathub", "appimage", "ubuntu"
[developer]tools = false # Developer tools stays off, or on with true
[extensions]unreviewed = false # extensions nobody reviewed don't run, approved ones included
[encryption]required = true # Luft's disk has to be encrypted
[accounts]add = false # nobody adds accountsadministrators = false # nobody is made an administratorautomatic-sign-in = false
[remote-login]allowed = false # remote login stays offpasswords = false # remote login only takes keys
[nearby-sharing]visible-to = "your-devices" # "no-one", "your-devices" or "everyone"
[crash-reports]send = "never" # "always" or "never"
[sign-in]ways = ["smart-card", "security-key"] # the only ways people sign in: "security-key", "smart-card", "fingerprint", "password"password-off = false # nobody turns off their passwordsecurity-keys = ["cb69481e-8ff7-4039-93ec-0a2729a154a8"] # only these models of security key, by AAGUIDkey-attestation = true # keys prove their model with their maker's certificatekey-attestation-roots = ["""-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----"""] # your own keys' authorities, besides the makers the FIDO Alliance listscard-issuers = ["""-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----"""] # only smart cards these authorities issuedtaken-out = "sign-out" # taking out the card that signed someone in: "lock" or "sign-out"administrators = ["security-key", "smart-card"] # the only ways administrators confirm it's them
[usb]protection = "no-drives" # "off", "while-locked", "no-drives" or "known-only"read-only = true # USB drives can be read but not written
[erase]allowed = "no-one" # who can erase everything: "everyone", "administrators" or "no-one"
[devices]camera = falsemicrophone = falsebluetooth = false
[screen-capture]screenshots = falserecording = false # recording the screen, and sharing it with apps
[[network.wifi]]name = "Acme"password = "correct horse battery staple" # leave out for an open networkhidden = false
[[network.profiles]] # any other connection, such as a VPN, as a NetworkManager keyfilename = "Acme VPN"keyfile = """[connection]id=Acme VPNtype=wireguard..."""
[certificates]authorities = ["""-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----"""]
[[printers]]name = "Second floor"address = "ipp://printer.acme.example/ipp/print"
[appearance]wallpaper = "/usr/share/backgrounds/acme.jpg"
[region]time-zone = "Europe/Tirane"language = "sq_AL.UTF-8"
[settings]hidden = ["bluetooth", "network/vpn"] # pages Settings doesn't show
[apps]hidden = ["com.lantharos.terminal"] # gone from Start, search and Open withblocked = ["org.mozilla.firefox"] # doesn't run for anyone but administratorsinstalled = ["com.lantharos.easel", "flathub:org.libreoffice.LibreOffice"] # every account gets thesedownloaded = false # only the computer's own apps run
[kiosk] # see Kiosks and one-app accountsaccount = "kiosk"app = "com.acme.Signage"reset-after = 300reset-at = "03:00"
[one-app]accounts = ["front-desk"]apps = ["com.acme.Pos"]file-picker = "documents"Keep Wi-Fi passwords and connection keyfiles in a file of their own that only root can read, such as 50-networks.toml with mode 600. The computer still applies it, and the rest of the policy stays readable to the people using the computer.
Keys that only take something away, such as everything under firewall, accounts, remote-login, devices and screen-capture, software’s two switches, extensions.unreviewed and sign-in.password-off, are on unless a file turns them off; turning one on again has nothing to lock.
Pages in settings.hidden are named as in Settings’ links, such as bluetooth, privacy, network/vpn or security/remote-login. Apps are named by their app ID, which is the name of their launcher without .desktop.
nearby-sharing.visible-to decides who can find the computer in Post. Post has no idea of an organization: it knows the devices each person paired, so "your-devices" is the closest it comes to keeping sharing inside the organization.
What each key does
Section titled “What each key does”| Keys | On the computer |
|---|---|
organization |
Settings says “Managed by” and the name |
screen-lock |
The screen locks and turns off as decided, and people can’t change it |
updates |
Updates are checked for, downloaded and staged as decided. A computer on another channel, or following another image than image, moves to it at its next check, keeping its standard or NVIDIA image. It only moves to an image it already requires a signature for, such as your own. |
firewall |
With home-networks off, no network counts as home. With public-access off, what’s allowed everywhere only opens on home networks. With open-ports off, ports opened for services stay closed. |
software |
Adding system packages or software sources is refused, and apps only install from the sources listed. What was added earlier stays. |
developer |
Developer tools is on or off, and stays that way |
extensions |
Only extensions from the store run |
encryption |
Turning encryption off is refused. A computer whose TPM unlocks the disk encrypts itself, with a recovery key an administrator can show in Settings; one without such a TPM needs someone to turn encryption on in Settings. |
accounts |
Nobody adds accounts or makes administrators, and the login screen doesn’t sign anyone in by itself |
remote-login |
Remote login, or signing in to it with a password, is off and stays off |
nearby-sharing |
Who can find the computer in Post |
crash-reports |
Reports are always or never sent, and nobody is asked |
sign-in |
Only the listed ways sign anyone in, and Settings only adds those. A person who has none of them yet still signs in with their password until they add one, so nobody is locked out. Keys and cards the policy doesn’t allow stop counting, including ones added earlier. With password-off = false, nobody can turn off their password. |
sign-in.key-attestation |
A security key is only added once it proves its model: its maker’s certificate, listed for that model by the FIDO Alliance, or one of key-attestation-roots, must vouch for it. Models the FIDO Alliance reports as revoked or broken into are refused, also when they’re reported after the key was added. Keys added before this was on stop counting until they’re added again, and Settings says so beside them. |
sign-in.taken-out |
Taking out the smart card someone signed in with, or a key whose Lock when this key is taken out is on, locks their sessions or signs them out |
sign-in.administrators |
Administrator prompts and sudo only take these ways. An administrator who has none of them yet still confirms with their password until they add one. |
usb |
USB protection stays in the mode decided. With read-only, USB drives plugged in afterwards can be read but not changed. |
erase |
Erase everything is open to anyone at the computer, only to administrators, which is how Luft starts, or to nobody |
devices |
Cameras and microphones can’t be opened by anyone but root, and Bluetooth stays off |
screen-capture |
Screenshots, screen recording and sharing the screen or a window with apps are refused |
network |
Every account gets these Wi-Fi networks and connections. They show in Settings without a way to change or forget them. |
certificates |
Every program trusts these certificate authorities |
printers |
These printers are added as soon as the computer reaches them |
appearance |
Everyone, and the login screen, gets this wallpaper |
region |
The time zone and the language are fixed, for every account and the login screen |
settings |
Settings doesn’t show these pages, and search and links don’t find them |
apps.hidden |
The apps are gone from Start, search and Open with, but still run |
apps.blocked |
The apps are hidden too, and don’t run for anyone but administrators, however they’re started: from a terminal, through the dynamic loader, or as a Flatpak the person installed themselves. Schelf won’t install them. |
apps.installed |
Each account gets these apps when it signs in, and gets them back after removing them |
apps.downloaded |
With false, only the computer’s own programs run for anyone but administrators: Luft and its system packages, and Flatpaks installed for everyone. Programs in home folders, /tmp and other folders people can change don’t, however they’re started: downloaded, copied, built, run through the dynamic loader or as a script. Schelf installs nothing for one account, so apps from schelf.store, AppImages, Flatpaks installed for one person and apps.installed don’t run either, nor the browser and store apps Luft gives each account; put the apps people need in your own Luft or install them as Flatpaks for everyone. |
kiosk |
The computer signs the account in by itself into a kiosk that shows only the app or site, and starts it over clean as decided. See Kiosks and one-app accounts. |
one-app |
These accounts only get the apps listed, Settings for Wi-Fi and sound, and files in Documents or none |
What a policy can’t stop
Section titled “What a policy can’t stop”Two keys are conveniences rather than locks. AccountsService asks for one permission to add, remove and change other people’s accounts, so either accounts key denies all three there; and root, which administrators can become, adds accounts with useradd regardless. software.app-sources is kept by Schelf, the install window and the schelf command, but each person can install apps into their own account without them, with flatpak --user or by running an AppImage, unless apps.downloaded is off.
apps.blocked holds back the app as it’s installed: Luft’s own apps by their folder, Flatpaks by their app ID wherever they’re installed, and other apps by the program their launcher starts, or its folder when it has one of its own. Someone who copies such a program elsewhere can still run that copy unless apps.downloaded is off. Even then, a script handed to one of the system’s interpreters, such as sh script.sh or python3 script.py, runs, since the interpreter only reads it, and so does code a program writes into its own memory. Screenshots and recording are refused by the desktop, which is the only thing that can see the screen, but nothing keeps a phone camera away from it.
How each service enforces its keys is in How policy is enforced.