Peios Learn
Documentation

Peios

Peios Peios Kernel Universal Directory Project

Developer Tools

Trail Acta Provium clackatoo CAF GCSL Pekit

Applications

Framewright

Standards and Conventions

Standards and Conventions Peios Specifications
Peios

Authentication

Single-page view · as markdown

Granting Access

Peios / Using Peios / Authentication

authd reads local machine policy to decide which privileges, integrity level, owner, and default access rules a token receives. An account's principal source supplies identity and group membership, not these grants.

The policy lives under Machine\Generic\Authn\Policy. The registry manual for that path owns the value types, defaults, and combination rules. Use authd.regman when editing it.

Match policy to an identity #

Each principal-policy subkey names a well-known identity or a literal security identifier (SID). Use the SID for a local account or group. authd does not resolve a local group name while evaluating policy.

A record named Administrators refers to the built-in group. The spelling BUILTIN\Administrators cannot be one subkey name because the backslash separates registry keys.

Avoid two subkeys that resolve to the same SID. Their grants can combine, while conflicting scalar choices can depend on evaluation order. Keep one record per identity and investigate authd's duplicate-record warnings.

Start from the complete policy #

An existing policy key is the complete source of privilege grants. Its records are not merged with an invisible set of compiled grants.

If the whole key is absent, authd uses a small compiled floor granting SeChangeNotifyPrivilege to Everyone. If the key exists but cannot be read, authd grants nothing from that fallback. Deleting a policy key is therefore not a safe way to remove all access.

The shipped authd-policy.reg supplies explicit machine defaults. It is inert until image policy applies it. Installing the file does not prove that the machine has those values.

Combining grants #

Privileges combine across the user and the applicable groups. The machine-wide DeniedPrivileges mask is applied afterward, so another group cannot restore a masked privilege.

Scalar settings do not follow that union rule. A value explicitly set on the user's record takes precedence for that value. Otherwise, integrity uses the highest configured group level. Conflicting group choices for an owner or a default discretionary access control list (DACL) produce a diagnostic and fall back rather than selecting an arbitrary group.

For example, a user record setting integrity to Low can lower the result even when a group record specifies High. A user record specifying only privileges does not suppress the groups' integrity settings.

Defaults for newly created objects #

A token's DefaultDacl supplies access rules when object creation has no explicit or inherited DACL. It is not a rewrite of objects the account already owns. Without a usable default, an object with no other DACL can receive a null DACL, which does not restrict discretionary access.

Use OWNER RIGHTS (OW) when a default DACL should name the eventual owner. CREATOR OWNER is an inheritance placeholder and does not provide the same substitution in this fallback path. The shipped policy includes a parseable default; an invalid replacement is diagnosed and omitted rather than making every sign-in fail.

After editing policy, inspect a freshly issued token with token show --all, and test a disposable object through the application that will create it. Check both inherited access and the fallback case. A successful sign-in alone does not verify the intended access rules.

Separate the access checks #

A sign-in client must pass more than the account's credential check:

  1. The socket's security descriptor must allow it to connect.
  2. AuthenticationSecurity must grant the connected token the Logon right.
  3. Its own identity must be allowed to originate the requested logon type.
  4. The target account and principal source must allow that logon and its credentials.

The LogonTypes value in a principal-policy record controls what the requesting process can originate. lps logon-types controls the account being signed in. Changing one does not change the other.

Originator policy matches the peer token's user SID, not its group memberships. A service SID used as the user of a virtual service account can match; merely carrying the SID as a group is insufficient. SYSTEM has an explicit default Logon ACE and no additional caller logon-type restriction.

Authenticate uses a separate operation right and creates no OS session or token. It shares credential verification with Logon, then discloses the requested, permitted source groups and claims. It does not interpret those claims as permission to use a Wi-Fi network or another application.

For a virtual service account, configure capability names under its literal service-SID policy record in Capabilities. peinit requests its service token from authd, which adds those SIDs as enabled token groups. The default AuthenticationSecurity descriptor maps peios.auth.authenticate and peios.auth.logon to separate operations. Neither grants disclosure by itself. Changing assignments requires a new service token, normally by restart. The registry key's security descriptor controls who can edit this policy.

Apply changes at the right boundary #

Different settings have different refresh points:

SettingWhen authd uses itEffect on existing state
Token grantsWhen issuing a tokenExisting tokens retain their grants
AuthenticationSecurityOnce per Authenticate or Logon requestAn active conversation retains its descriptor snapshot
Service CapabilitiesWhen attesting a new service tokenRestart applies the assignment
SessionEndSecurityEach session-end permission checkA later request is checked again
LogonSocketDescriptorAuthority startupAn existing socket is not restamped by a registry edit
Source registration policySource registrationA connected source retains its accepted configuration

Keep a verified administrator route while changing policy. Validate a fresh request before assuming a registry edit has taken effect. For source configuration, read Registering a Principal Source.

Resolving Names

Peios / Using Peios / Authentication

authd resolves names, security identifiers (SIDs), and Unix identifiers through its registered principal sources. This gives clients one place to ask for the identity behind a name or number.

Names are not durable identifiers #

An account name can change or exist in more than one source. A SID names the identity itself. Store that SID when an application must remember which principal it authorized, and resolve a name for display.

For an unqualified name, authd uses configured source search order. The first matching source wins. A source that is unavailable can stop the lookup; authd does not silently choose a different person from a later source to hide the outage.

The name fields returned by this implementation use canonical bare names. Do not construct a realm-qualified name and assume it is accepted merely because a protocol field is named qualified_name.

Shadowed names #

Source order is explicit machine policy, not connection order. Lower SearchOrder values are consulted first; source names break ties. Changing that order can make the same bare name refer to a different SID.

After a successful logon, authd can warn that a later source also owns the entered name. The check uses identity queries without credentials and does not alter the granted token. Its deadline is shared across the later sources; a source that cannot answer makes the check inconclusive. Absence of a warning is not proof that a name is unique.

Investigate a warning by comparing the sources and SIDs. Do not remove an account merely because its name matches an account in another source.

Preserve failure meaning #

A lookup can report that an identity does not exist, that a source could not answer, or that the request was refused. These results require different responses. An unavailable source is not evidence that an account has been deleted.

For example, an application should keep an unresolved SID visible while reporting a lookup failure. Replacing it with a different local account or recording permanent absence would change its meaning.

Numeric identities and groups #

Sources report relative Unix identifiers. authd applies each source's configured range, checks its bounds, and returns the effective identifiers to clients. Clients should not repeat that arithmetic themselves.

Some well-known groups describe a session rather than a stored membership list. An empty member listing does not mean no token can carry that group. Likewise, a group without a Unix group identifier cannot be represented as an ordinary numeric supplementary group.

Recorded memberships can be enumerated when their source supports it. Groups such as Everyone and Authenticated Users are added by token derivation rather than stored as member lists. Groups such as Interactive and Network describe a logon, so the same account can carry different groups in two sessions. A static account-membership list cannot reconstruct every group on a running process's token.

Native and libc clients #

Native applications use the identity operations in libauth or its peios-auth Rust wrapper. They can inspect unavailable outcomes, withheld fields, and incomplete enumeration results.

The repository's name service switch (NSS) module translates libc account queries into requests on /run/ident.sock. It does not open the local principal store or provide an independent fallback database. Its libc result distinguishes an unavailable authority from an unknown account.

authd performs live source queries rather than keeping an identity cache. Do not assume an outage can be served from a previous successful lookup. For client handling, read Reading Identities.

POSIX Account Lookup

Peios / Using Peios / Authentication

libnss_peios.so.2 translates libc account queries into requests to authd's /run/ident.sock. An application using getpwuid or getgrnam receives a POSIX record derived from the same authority used by native identity clients. The module does not open lpsd's credential store.

A limited representation #

A struct passwd has no field for token claims. A numeric identifier does not carry a domain name. A group's empty member list cannot distinguish every reason that membership is not enumerable. Native applications needing these distinctions use the identity client API.

Groups derived from a logon, such as Interactive, have no ordinary static member list. Unnumbered groups are omitted from supplementary numeric groups rather than all being mapped to the fallback identity. Stored account memberships do not describe every group on a running token.

Preserve lookup failures #

The module distinguishes a record, a missing identity, a temporary source failure, and an unavailable authority. A temporary failure is not a cached answer that the account does not exist. If names stop resolving, inspect the authority and source state before changing accounts.

Before the authority is available, an application can have a valid numeric identity without a resolved display name. Display the number rather than requiring a name to perform early-boot work.

Enumeration can be incomplete when a source does not enumerate. A short getent passwd result does not establish that every other account is absent. Native callers can retain the response's incomplete-source information.

Requests and process lifetime #

A normal lookup asks for the fields needed by the libc call in one request. The authority resolves source ranges and group names; the module does not reconstruct them through a separate lookup for every member.

The client opens connections for individual lookups instead of sharing one across processes that can fork. Enumeration has its own cursor lifecycle. There is no independent identity cache or fallback account database in the module.

Peios' libc package fixes account lookup to this provider. Adding another identity source is an authority registration operation, not an nsswitch.conf entry that bypasses the authority's search order. The package's libc integration and the authd module are both required. Installing the module on another Linux system does not change that system's libc policy.

Authentication Services

Peios / Using Peios / Authentication

The authentication service set separates token creation from credential storage. authd issues tokens, while lpsd owns local accounts and checks their credentials. The service manager starts them from registry service definitions.

Readiness follows the protocol #

The authority opens its client and source sockets before reporting ready. The local source then connects to /run/psi.sock, registers, and waits for acknowledgment before reporting its own readiness.

The shipped dependency points from lpsd to authd. authd does not wait for every source before becoming ready, so authority readiness alone is not evidence that a local account can sign in.

The service definitions and registration seed have distinct purposes:

SeedPurposeApplied by
authd-service.regStart the authority with its required identity and privilegesImage or administrator policy
authd-policy.regSupply machine authentication-policy defaultsImage or administrator policy
lpsd-service.regStart the local source after the authorityImage or administrator policy
lpsd-authd-registration.regPermit the local source to register and define its rangeImage or administrator policy

These files are installed under /usr/share/regim/. Their presence does not apply their contents. A machine missing a registration seed can run the authority without accepting its intended principal source.

Keep each service's authority narrow #

authd runs with the authority needed to create tokens and establish their security state. Its package also requires the appropriate signing tier. A development binary that links successfully is not evidence that these runtime requirements have been met.

lpsd uses a distinct virtual service account. It needs access to its store and permission to emit audit events; it does not need token-creation or token-installation privileges. Its store descriptor grants access to the lpsd service identity and SYSTEM, not to every administrator.

RequiredPrivileges narrows the service token. It does not manufacture a privilege that machine policy did not grant in the first place.

Readiness is not a security-state handoff #

The authority does not connect to a directory to fetch credentials. Sources connect to it and verify credentials; local registry policy determines the grants on the resulting tokens. A source's asserted identity is constrained by its registration, including its domain and permitted foreign memberships. A source trusted to assert an administrator membership can affect local grants through that membership. Process separation does not make a compromised source harmless.

The client receives a token and profile and starts its own session. authd does not launch its shell or set up its terminal. Service attestation is a distinct request made by the service manager.

Restarting authd interrupts new conversations but does not replace tokens already held by processes. Kernel sessions survive while their token references remain. Authority readiness does not certify that every source has registered or that central access policies have been loaded: authd does not distribute those policies.

Inspect before restarting #

Use service status and diagnostic output to distinguish an authority startup failure from a source registration failure. Restarting either can interrupt authentication requests. Keep a separate working administrator route while investigating.

Read authd(8) and lpsd(8) for daemon behavior, then follow Diagnosing Authentication for common symptoms. Contributor build instructions live in the repository's docs/building.md.

The Local Principal Store

Peios / Using Peios / Authentication

lpsd keeps local identities in /var/state/lpsd/principals. The store contains the machine's domain identifier, account and group records, credential material, and allocation state. Losing it means losing the identities that existing access rules name.

The lpsd-service.reg seed declares /var/state/lpsd as the required lpsd-state entry under Machine\System\Init\ProvisionedPaths. peinit creates the directory before phase 2, owned by lpsd's service SID, with a protected inheritable descriptor granting full control to that SID and SYSTEM. The image or installer must supply /var/state; peinit does not create unnamed parents.

Identity survives names #

The machine domain is generated when a missing store is provisioned. Accounts and local groups receive relative identifiers from one counter, starting at 1000. Deleted identifiers are not reused.

A local security identifier (SID) combines the domain and relative identifier. Recreating the same account name in a fresh store therefore does not restore the old SID or the access granted to it.

Well-known group identities are defined separately. The store records memberships in them rather than inventing a local copy of their identity.

Do not bake a provisioned store into an image intended to create independent machines. Copying the store copies its domain and account identities; giving the machines different hostnames does not change those SIDs.

The stored Unix identifiers are relative. authd applies the source's configured numeric range when issuing tokens and answering lookups. lps displays the effective numbers. A dash in its UID column indicates that no usable source range was assigned; it is not evidence that the account lacks a SID.

Credential material stays protected #

The store holds password verifiers rather than plaintext passwords, along with enrolled public keys and credential policies. Password verifiers are still sensitive: a stolen copy can be used to guess passwords offline.

The lpsd virtual service account owns the credential file. Its protected discretionary access control list (DACL) grants full access to that service identity and SYSTEM. Administrator membership alone has no direct grant.

Do not widen the descriptor to make an account-management script work. Use the daemon's administrative interface, which checks the caller and keeps a single writer responsible for the store.

The password verifiers use Argon2id and retain their cost parameters. A change to the parameters for newly set passwords does not rewrite existing verifiers. Privileges and integrity levels are absent from the store: those come from machine policy.

Optional NT compatibility material #

Machine\Software\Lpsd StoreNtHashes controls an additional NT hash for password accounts. It defaults to REG_DWORD 1 during compatibility development. Argon2id remains present. The NT hash supports MSCHAPv2 and NTLMv2, which SMB file sharing uses; it is password-equivalent material and substantially cheaper to attack offline than Argon2id. The store has access-control protection, without an additional credential-encryption layer. Protect offline copies too.

BackfillNtHashes, under the same key, separately defaults to 1. When both settings are enabled, a successful password check can populate a missing NT hash while the verified password is transiently available. This is maintenance, without another sign-in step or sign-in failure if the save fails. Existing Argon2 records cannot be converted without the password. MSCHAPv2 or NTLMv2 success itself cannot perform this backfill.

Setting StoreNtHashes to 0 disables NT-based verification and creation, removes live NT material and attempts to save that removal. Old backups are unaffected. Inspect lpsd.credential.maintained for a failed save; memory remains disabled while durable cleanup is retried on later activity. Malformed or unreadable settings disable legacy use without requesting deletion. Changes are watched live and checked before source operations; multi-value reads are not an atomic Registry snapshot.

Password set/change updates the verifiers together under current policy. Password removal removes both. Password-policy restrictions apply to PAP, MSCHAPv2, and NTLMv2 alike. Pending proofs and backfill check credential versions to reject a password reset during the exchange. NT derivation uses exact UTF-16LE with no normalization; legacy non-UTF-8 password bytes retain Argon2 verification but cannot acquire NT material through this conversion.

lps show NAME reports whether NT material is present. No administrative, identity, or authentication API returns the stored NT hash. An authorized MSCHAPv2 authentication returns only its exchange-specific server proof, and an NTLMv2 one only its exchange-specific session key.

Administrative requests #

lps reaches /run/lpsd/admin.sock; it never edits the file. The socket's descriptor and the daemon's peer-token check admit SYSTEM and enabled Administrators membership. A deny-only administrator group does not grant access. Making the Unix mode more permissive does not repair a KACS denial.

Each connection carries one administrative request and its reply. The daemon checks the peer before reading a request and bounds reads and writes. For a refused connection, inspect the socket descriptor and the caller's token before changing either service configuration or account data.

Use the identity interface for general account lookup and the self-service interface for the caller's own account. These do not require widening the administrative socket. The public libauth client does not expose local administrative operations; lps and the repository's administrative client implement that separate protocol.

The Local Principal Administration specification defines message formats. Event names and fields belong to lpsd.evman; a successful no-op is not evidence that a change event will be emitted.

Replacement and failures #

Changes replace the whole store. lpsd creates a protected temporary file, writes and synchronizes it, renames it over the old file, and synchronizes the containing directory. Protection is established before credential bytes are written.

A successful administrative reply follows the save. A lost reply leaves the caller uncertain whether a submitted change took effect. Read back inspectable state before repeating it.

A storage error also needs investigation. In particular, failure to synchronize the directory after replacement can leave changed on-disk state even though the request reports failure. Do not assume every reported failure proves that both memory and disk retain the previous state. Stop further administrative changes and investigate the storage failure before relying on either view.

Format compatibility #

The credential-binding source reads formats 4 through 7 and writes format 7. Format 4 loads with empty group descriptions. Older password records load without NT material. Each password has an opaque reference and revision; replacement retains its reference and rotates its revision. NT-hash backfill, purging NT material, account enablement, and metadata edits do not rotate it.

Loading an older format assigns these bindings and atomically saves format 7 before exposing the store. A failed migration prevents startup. This is a specific compatibility range, not a promise that every release can read its predecessor's store. Preserve an offline copy before upgrade: older builds cannot read format 7.

Check format compatibility before replacing lpsd with an older build. Preserve the original store and its security metadata during any planned upgrade or recovery.

Missing and unreadable are different #

A missing store means an unprovisioned machine. lpsd creates a domain and an empty store, without creating an account.

An existing store that is corrupt, unreadable, or in an unsupported format causes startup to fail. lpsd does not silently replace it with an empty store. Do not delete the file to clear that error: preserve it for diagnosis and recovery.

The daemon and state paths are documented in lpsd(8).

Authentication Events

Peios / Using Peios / Authentication

Authentication events record what the authority and local source decided. They complement diagnostic logs: a source checking a credential and an authority delivering a token are separate outcomes.

Follow the decision that matters #

Use the event belonging to the stage you are investigating:

  • authd.logon.attempted: the authority's outcome for a logon conversation, including whether a granted token reached the client.
  • authd.service.attested: a request for a service identity and the authority's decision.
  • authd.session.ended: the outcome of a session-end request.
  • lpsd.credential.verified: the local source's credential check.
  • lpsd account, group, and credential events: changes to the local store and credential material.

A successful credential check alone does not prove that the authority granted a logon or that the client started a usable session. Inspect the authority result and client diagnostics as well.

Use the catalog for exact fields #

The canonical event definitions are authd.evman and lpsd.evman, shipped under /usr/share/evman/. Read them with evman for exact fields, tiers, and outcome meanings. The source copies live under docs/ in the authd repository.

For example, the authority's logon event omits the proposed account name on failure. Input supplied by a caller is not an authenticated identity. On success, the event identifies the granted principal by its security identifier (SID).

Interpret incomplete evidence #

An authority refusal, a transport failure, and a token that could not be delivered are different outcomes. Preserve the recorded reason rather than converting all of them into an incorrect-password count.

Event absence is not proof that nothing happened. Access to records, emission policy for configurable tiers, and collection failures can affect what you can see. Check service diagnostics when a required record could not be emitted.

Do not add credential values to diagnostic messages to investigate a failure. Account and session identifiers, operation names, and the documented outcome fields provide the correlation data.

Registering a Principal Source

Peios / Using Peios / Authentication

Register a principal source when authd must accept identities from that service. A source connects to authd; the authority does not discover or trust it merely because its process is running.

Before you start #

Check these prerequisites:

  • Use an authorized machine-configuration route.
  • Preserve an existing administrator session.
  • Confirm that the source implements the Principal Source Interface and runs with the service identity named by its registration.

For the shipped local source, the supplied lpsd-authd-registration.reg seed describes the expected configuration. Review that seed and authd.regman before applying image policy.

Configure and verify registration #

Follow these steps:

  1. Under Machine\Software\Authd\Sources, create or review the subkey for the source's service name. For the local source, that name is lpsd.

  2. Verify that the service's token carries the corresponding service security identifier (SID). The subkey name identifies the permitted service; a source cannot establish its identity by claiming that name in a message.

  3. Choose the source's numeric range and search order. If a fixed identity domain is required, configure its expected domain SID. Follow the types and constraints in the registry manual rather than copying another machine's generated domain.

  4. Start or deliberately reconnect the source through service management after the authority is ready. Inspect its service status and diagnostics for an accepted registration.

  5. Verify a lookup and a fresh permitted sign-in for an account from that source. A process that exists but has not registered cannot satisfy authentication requests.

For lpsd, readiness is reported after authd acknowledges registration. Its service definition therefore depends on authd, not the reverse.

Keep identity and membership authority distinct #

A source's declared domain limits which identities it can assert. Numeric range checks also prevent its relative identifiers from escaping into another source's range.

MayAssertForeignMemberships concerns group membership assertions. It does not authorize the source to authenticate identities in another domain. Grant it only where the source is trusted to provide those memberships; the local source has that role in the shipped configuration.

An absent or unusable Unix ID range does not cause authd to guess one. The unconfigured projection uses the fallback identity number. Verify the configured range before relying on numeric identity lookup.

Changing a registered source #

authd reads the allowlist during registration. A live registered source retains its accepted domain, range, search order, and membership grants. Editing or deleting its registry entry does not immediately revoke that connection.

Plan reconnection when changing those settings. Reconnecting cannot change a source domain already recorded during the running authd process's lifetime. A source interruption can make identity queries and sign-ins unavailable, so use an access route that does not depend on the source being changed.

The exact registry values belong to Machine\Software\Authd\Sources in authd.regman; shared protocol requirements belong to the Principal Source Interface specification.

Diagnosing Authentication

Peios / Using Peios / Authentication

Diagnose the stage that failed before changing account or machine policy. A denied credential, a refused socket connection, and an unavailable principal source are different failures.

Before you start #

Prepare the investigation:

  • Keep a working administrator session open.
  • Record the operation, account, client, and error text. Do not copy passwords or private keys into a log.
  • Use read-only checks before restarting a service or changing policy.

Locate the failing stage #

Follow these steps:

  1. Check whether the authority and local source are ready:

    svctl status authd
    svctl status lpsd
    
  2. From an authorized administrator session, inspect the target account with lps show <name>. Check its state, logon types, credential policy, and available credential material.

  3. Compare the failing operation with the symptom table. Inspect the relevant service diagnostics or event record before making a change.

  4. Make one justified change through the appropriate interface, then repeat a fresh request through the original client.

Match the symptom #

The symptom identifies a useful next check:

SymptomCheckDo not infer
lps cannot connectlpsd readiness and the admin socket's descriptorUnix mode bits alone determine access
lps refuses the callerThe caller's active administrator membership or SYSTEM identityExecuting an administration command grants its rights
Sign-in source unavailableRegistration, source readiness, and connection diagnosticsThe account does not exist
Credentials refusedAccount state, permitted logon type, policy, and supplied proofEvery refusal reveals whether the name exists
Key works but console failsWhether the account is key-onlyTerminal login supports SSH key proof
Sign-in succeeds but home failsRecorded path, parent directory, owner, and descriptorAnother sign-in will repair an existing directory
Registry edit appears ineffectiveThat setting's refresh boundaryEvery setting is reread on each request

Separate connection permission from operation permission #

Reaching /run/logon.sock does not authorize a client to originate every kind of logon. The authority checks the connected caller and the requested operation. Similarly, reaching the self-service socket does not authorize an operation on someone else's account.

For originator refusals, inspect Authentication Policy. For registration failures, inspect Registering a Principal Source.

Handle failed changes carefully #

If a connection is lost after an account change was submitted, inspect the state before retrying. The operation might already have succeeded. If the daemon reports a storage failure, preserve its diagnostics and investigate the filesystem before making further account changes.

Do not delete the principal store to repair a startup failure. Read The Local Principal Store for why replacing it changes the machine's identities.

Check the result #

A successful status query or account listing is only one part of the check. Verify a fresh sign-in through the intended route and confirm the resulting access before closing the administrator session used for repair.

Peios Learn — documentation for Peios software.

Built with Trail.