sector-f-linux

Sector F Linux
git clone https://git.sectorflabs.com/sector-f-linux.git
Log | Files | Refs | README | LICENSE

commit 52e03c471631c9e1e2dac490c0a886409ca8dc2a
parent 8d28e21fe7e015d425b66e7e5b0f5117dd28c79f
Author: Divan Visagie <me@divanv.com>
Date:   Sat, 21 Nov 2026 00:22:58 +0100

greeter: the real backend, on greetd's socket, AccountsService and logind

system.rs: login over greetd's protocol (the password for the secret prompt, then the Patina session), the first account through AccountsService (CreateUser, SetPassword with a sha512-crypt hash, and DeleteUser if the password fails so the setup can run again), the accounts to show from /etc/passwd minus locked ones, and Restart and Shut down through logind. Without PATINA_GREETER_MOCK the greeter now uses it.

Tried for real in the VM under greetd, SELinux enforcing, the polkit rule installed: with no accounts it opened the setup, made alice and logged her into the Patina session; after logging out the login showed her, refused a wrong password with the message and let the right one in. Not tried: Restart and Shut down (they would end the VM's temporary /usr overlay), more than one PAM step, avatars from AccountsService.

Diffstat:
Mgreeter/Cargo.lock | 248+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mgreeter/Cargo.toml | 5+++++
Mgreeter/src/backend.rs | 2+-
Mgreeter/src/main.rs | 9++-------
Agreeter/src/system.rs | 238+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mgreeter/vm-try.sh | 2+-
6 files changed, 495 insertions(+), 9 deletions(-)

diff --git a/greeter/Cargo.lock b/greeter/Cargo.lock @@ -451,6 +451,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" [[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + +[[package]] name = "block2" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -482,6 +491,17 @@ dependencies = [ ] [[package]] +name = "blowfish" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32fa6a061124e37baba002e496d203e23ba3d7b73750be82dbfbc92913048a5b" +dependencies = [ + "byteorder", + "cipher", + "opaque-debug", +] + +[[package]] name = "bumpalo" version = "3.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -508,6 +528,12 @@ dependencies = [ ] [[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] name = "byteorder-lite" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -614,6 +640,15 @@ dependencies = [ ] [[package]] +name = "cipher" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +dependencies = [ + "generic-array", +] + +[[package]] name = "clipboard-win" version = "5.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -702,6 +737,15 @@ dependencies = [ ] [[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] name = "crc32fast" version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -732,6 +776,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] +name = "crypto-mac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] name = "cursor-icon" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -744,6 +798,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" [[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] name = "dirs" version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1265,6 +1328,16 @@ dependencies = [ ] [[package]] +name = "generic-array" +version = "0.14.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] name = "gethostname" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1276,6 +1349,17 @@ dependencies = [ [[package]] name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" @@ -1437,6 +1521,17 @@ dependencies = [ ] [[package]] +name = "greetd_ipc" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "700d2e5bfc91a042d1d531b46de245085c6a179debedf149aa97c7ca71492078" +dependencies = [ + "serde", + "serde_json", + "thiserror 1.0.69", +] + +[[package]] name = "guillotiere" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1517,6 +1612,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" [[package]] +name = "hmac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" +dependencies = [ + "crypto-mac", + "digest", +] + +[[package]] name = "iana-time-zone" version = "0.1.65" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1684,6 +1789,12 @@ dependencies = [ ] [[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + +[[package]] name = "jni" version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1892,6 +2003,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" [[package]] +name = "md-5" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15" +dependencies = [ + "block-buffer", + "digest", + "opaque-debug", +] + +[[package]] name = "memchr" version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2373,6 +2495,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] name = "option-ext" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2453,8 +2581,11 @@ dependencies = [ "eframe", "egui", "egui_extras", + "greetd_ipc", "image", "patina-ui", + "pwhash", + "zbus", ] [[package]] @@ -2676,6 +2807,15 @@ dependencies = [ ] [[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] name = "presser" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2706,6 +2846,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" [[package]] +name = "pwhash" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "419a3ad8fa9f9d445e69d9b185a24878ae6e6f55c96e4512f4a0e28cd3bc5c56" +dependencies = [ + "blowfish", + "byteorder", + "hmac", + "md-5", + "rand", + "sha-1", + "sha2", +] + +[[package]] name = "pxfm" version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2748,6 +2903,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" [[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] name = "range-alloc" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2993,6 +3178,19 @@ dependencies = [ ] [[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] name = "serde_repr" version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3013,6 +3211,32 @@ dependencies = [ ] [[package]] +name = "sha-1" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" +dependencies = [ + "block-buffer", + "cfg-if", + "cpufeatures", + "digest", + "opaque-debug", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer", + "cfg-if", + "cpufeatures", + "digest", + "opaque-debug", +] + +[[package]] name = "shlex" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3199,6 +3423,12 @@ dependencies = [ ] [[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] name = "svgtypes" version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3461,6 +3691,12 @@ dependencies = [ ] [[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] name = "uds_windows" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3600,6 +3836,12 @@ dependencies = [ ] [[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] name = "wasip2" version = "1.0.4+wasi-0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -4580,6 +4822,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" [[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" + +[[package]] name = "zune-core" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/greeter/Cargo.toml b/greeter/Cargo.toml @@ -14,3 +14,8 @@ patina-ui = "0.1" chrono = { version = "0.4", default-features = false, features = ["clock", "std"] } # Screenshots (`make screenshot`). image = { version = "0.25", default-features = false, features = ["png"] } +# The real system (src/system.rs): greetd's socket, AccountsService and logind over D-Bus. +greetd_ipc = { version = "0.10", features = ["sync-codec"] } +zbus = { version = "5", features = ["blocking-api"] } +# The first account's password, as the crypt(3) hash AccountsService wants. +pwhash = "1" diff --git a/greeter/src/backend.rs b/greeter/src/backend.rs @@ -1,7 +1,7 @@ //! What the greeter needs from the system, behind one trait so the screens can be developed and //! tested without greetd: who can log in, whether this is the first run, logging in, making the //! first account, and power. `Mock` stands in for all of it; the real one (greetd's socket, -//! AccountsService, logind) comes next, per ADR-0012. +//! AccountsService, logind) is in system.rs, per ADR-0012. use std::sync::Mutex; use std::time::Duration; diff --git a/greeter/src/main.rs b/greeter/src/main.rs @@ -10,6 +10,7 @@ mod model; use std::sync::Arc; use backend::{Backend, Mock}; +mod system; const USAGE: &str = "usage: patina-greeter @@ -43,13 +44,7 @@ fn main() -> eframe::Result { let backend: Arc<dyn Backend> = match std::env::var("PATINA_GREETER_MOCK").as_deref() { Ok("setup") => Arc::new(Mock::first_run()), Ok(_) => Arc::new(Mock::with_users()), - Err(_) => { - eprintln!( - "patina-greeter: the greetd backend isn't written yet; \ - PATINA_GREETER_MOCK=login or setup runs the screens on a mock" - ); - std::process::exit(2); - } + Err(_) => Arc::new(system::System::new()), }; let mut viewport = egui::ViewportBuilder::default() diff --git a/greeter/src/system.rs b/greeter/src/system.rs @@ -0,0 +1,238 @@ +//! The real backend (ADR-0012): greetd does the login, AccountsService makes the first account +//! (polkit allows it only while no human account can log in), logind does the power. + +use std::os::unix::net::UnixStream; + +use greetd_ipc::{AuthMessageType, ErrorType, Request, Response, codec::SyncCodec}; +use zbus::blocking::{Connection, Proxy}; +use zbus::zvariant::OwnedObjectPath; + +use crate::backend::{Backend, LoginError, Power, User}; + +const ACCOUNTS: &str = "org.freedesktop.Accounts"; +const ACCOUNTS_PATH: &str = "/org/freedesktop/Accounts"; +const LOGIND: &str = "org.freedesktop.login1"; + +/// The first human uid, as in /etc/login.defs. +const FIRST_UID: u32 = 1000; + +pub struct System { + /// What greetd runs for a user once they are in (the Patina session). + session: Vec<String>, +} + +impl System { + pub fn new() -> Self { + let session = std::env::var("PATINA_GREETER_SESSION") + .unwrap_or_else(|_| "patina-session --session".into()); + Self { + session: session.split_whitespace().map(String::from).collect(), + } + } + + fn bus() -> Result<Connection, String> { + Connection::system().map_err(|e| format!("the system bus: {e}")) + } + + fn proxy<'a>( + bus: &'a Connection, + dest: &'a str, + path: &'a str, + iface: &'a str, + ) -> Result<Proxy<'a>, String> { + Proxy::new(bus, dest, path, iface).map_err(|e| e.to_string()) + } + + /// Whether AccountsService says the account is locked (no password set yet). If it cannot be + /// asked, not: the login is then shown, and greetd decides. + fn locked(bus: &Connection, name: &str) -> bool { + let Ok(manager) = Self::proxy(bus, ACCOUNTS, ACCOUNTS_PATH, "org.freedesktop.Accounts") + else { + return false; + }; + let Ok(path) = manager.call::<_, _, OwnedObjectPath>("FindUserByName", &(name,)) else { + return false; + }; + Self::proxy( + bus, + ACCOUNTS, + path.as_str(), + "org.freedesktop.Accounts.User", + ) + .and_then(|u| u.get_property::<bool>("Locked").map_err(|e| e.to_string())) + .unwrap_or(false) + } + + /// Talks to greetd: the password goes in, and a session starts if it is right. + fn greetd_login(&self, user: &str, password: &str) -> Result<(), LoginError> { + let problem = |e: &dyn std::fmt::Display| LoginError::Problem(format!("greetd: {e}")); + let sock = std::env::var("GREETD_SOCK") + .map_err(|_| LoginError::Problem("not started by greetd (no GREETD_SOCK)".into()))?; + let mut stream = UnixStream::connect(sock).map_err(|e| problem(&e))?; + + Request::CreateSession { + username: user.to_string(), + } + .write_to(&mut stream) + .map_err(|e| problem(&e))?; + let mut answer = Response::read_from(&mut stream).map_err(|e| problem(&e))?; + loop { + match answer { + Response::AuthMessage { + auth_message_type, .. + } => { + // The password for a secret prompt; anything else (info, error text) is + // acknowledged with nothing. More steps (a fingerprint) are a known gap. + let reply = match auth_message_type { + AuthMessageType::Secret | AuthMessageType::Visible => { + Some(password.to_string()) + } + _ => None, + }; + Request::PostAuthMessageResponse { response: reply } + .write_to(&mut stream) + .map_err(|e| problem(&e))?; + answer = Response::read_from(&mut stream).map_err(|e| problem(&e))?; + } + Response::Success => break, + Response::Error { + error_type, + description, + } => { + Request::CancelSession.write_to(&mut stream).ok(); + return Err(match error_type { + ErrorType::AuthError => LoginError::Wrong, + ErrorType::Error => LoginError::Problem(description), + }); + } + } + } + Request::StartSession { + cmd: self.session.clone(), + env: vec![], + } + .write_to(&mut stream) + .map_err(|e| problem(&e))?; + match Response::read_from(&mut stream).map_err(|e| problem(&e))? { + Response::Success => Ok(()), + Response::Error { description, .. } => Err(LoginError::Problem(description)), + other => Err(LoginError::Problem(format!( + "unexpected answer from greetd: {other:?}" + ))), + } + } +} + +/// The human accounts in /etc/passwd: uid from 1000 below nobody's 65534, with a shell that logs in. +/// (name, full name) +fn human_accounts(passwd: &str) -> Vec<(String, String)> { + passwd + .lines() + .filter_map(|line| { + let f: Vec<&str> = line.split(':').collect(); + let uid: u32 = f.get(2)?.parse().ok()?; + let shell = f.get(6)?; + if !(FIRST_UID..60000).contains(&uid) + || shell.ends_with("nologin") + || shell.ends_with("false") + { + return None; + } + let full = f.get(4)?.split(',').next().unwrap_or(""); + Some(( + f[0].to_string(), + if full.is_empty() { f[0] } else { full }.to_string(), + )) + }) + .collect() +} + +impl Backend for System { + fn users(&self) -> Vec<User> { + let passwd = std::fs::read_to_string("/etc/passwd").unwrap_or_default(); + let bus = Self::bus().ok(); + human_accounts(&passwd) + .into_iter() + .filter(|(name, _)| bus.as_ref().is_none_or(|b| !Self::locked(b, name))) + .map(|(name, full_name)| User { name, full_name }) + .collect() + } + + fn first_run(&self) -> bool { + self.users().is_empty() + } + + fn login(&self, user: &str, password: &str) -> Result<(), LoginError> { + self.greetd_login(user, password) + } + + fn create_first_user( + &self, + full_name: &str, + username: &str, + password: &str, + ) -> Result<(), String> { + let hash = pwhash::sha512_crypt::hash(password).map_err(|e| format!("hashing: {e}"))?; + let bus = Self::bus()?; + let manager = Self::proxy(&bus, ACCOUNTS, ACCOUNTS_PATH, "org.freedesktop.Accounts")?; + // account type 1: an administrator (wheel), as the first person on a machine is. + let path: OwnedObjectPath = manager + .call("CreateUser", &(username, full_name, 1i32)) + .map_err(|e| format!("could not create the account: {e}"))?; + let user = Self::proxy( + &bus, + ACCOUNTS, + path.as_str(), + "org.freedesktop.Accounts.User", + )?; + if let Err(e) = user.call::<_, _, ()>("SetPassword", &(hash.as_str(), "")) { + // Take the half-made account back out (polkit allows it while it is locked), so + // the setup can run again. + let uid: Option<i64> = user.get_property::<u64>("Uid").ok().map(|u| u as i64); + if let Some(uid) = uid { + manager.call::<_, _, ()>("DeleteUser", &(uid, true)).ok(); + } + return Err(format!("could not set the password: {e}")); + } + Ok(()) + } + + fn power(&self, action: Power) -> Result<(), String> { + let bus = Self::bus()?; + let manager = Self::proxy( + &bus, + LOGIND, + "/org/freedesktop/login1", + "org.freedesktop.login1.Manager", + )?; + let method = match action { + Power::Reboot => "Reboot", + Power::PowerOff => "PowerOff", + }; + manager + .call::<_, _, ()>(method, &(false,)) + .map_err(|e| e.to_string()) + } +} + +#[cfg(test)] +mod tests { + use super::human_accounts; + + #[test] + fn only_people_who_can_log_in() { + let passwd = "root:x:0:0:Super:/root:/bin/bash\n\ + greetd:x:963:963:Greeter:/var/lib/greetd:/sbin/nologin\n\ + alice:x:1000:1000:Alice Example,,,:/var/home/alice:/bin/bash\n\ + bob:x:1001:1001::/var/home/bob:/bin/zsh\n\ + svc:x:1002:1002:Service:/srv:/usr/sbin/nologin\n\ + nobody:x:65534:65534:Kernel:/:/sbin/nologin\n"; + assert_eq!( + human_accounts(passwd), + vec![ + ("alice".into(), "Alice Example".into()), + ("bob".into(), "bob".into()) + ] + ); + } +} diff --git a/greeter/vm-try.sh b/greeter/vm-try.sh @@ -39,7 +39,7 @@ case "${1:-}" in < "$here/target-fedora/release/patina-greeter" ;; show) - greetd "env PATINA_GREETER_MOCK=${2:?login or setup} PATINA_GREETER_DEMO=${3:-} ${GREETER_ENV:-} cage -s -- /usr/libexec/patina-greeter" + greetd "env ${2:+PATINA_GREETER_MOCK=$2} PATINA_GREETER_DEMO=${3:-} ${GREETER_ENV:-} cage -s -- /usr/libexec/patina-greeter" ;; type) python3 "$here/vm-keys.py" "${2:?what to type}"