# Porting Software

---

# Identity and Service Adapters

_Peios / Developing for Peios / Porting Software_

> Locate the Peios services behind familiar POSIX identity, name-resolution, and trust interfaces.

A familiar library interface does not imply the same configuration source as
another Linux distribution. Peios connects account lookup, hostname lookup,
and certificate trust to their owning services.

## Account lookup and authentication

The authd [NSS adapter](/peios/using-peios/authentication/libc-identity.md) translates
POSIX account queries into the authority's identity protocol. Peios' libc
package fixes the account providers; it does not use an `/etc/passwd`
fallback or an independently configured source order. Shadow queries do not
expose credential verifiers.

UID 0 is the numeric projection of SYSTEM, not an account named `root` that
must be looked up before boot can proceed. Native authorization uses tokens
and security identifiers. A numeric name-service record is a compatibility
view rather than the complete security state.

Authentication uses [authd
conversations](/peios/developing-for-peios/authentication-client/conversations.md). Applications
integrate with that interface instead of configuring a PAM stack. Account
lookup and credential verification remain separate operations.

## Hostname lookup

The network name-service provider sends hostname queries to
[resolvd](/peios/using-peios/network-configuration/name-resolution.md). Static names and resolver policy
belong to that service's configuration. Editing a separate `/etc/hosts` file
or a `files dns` provider chain does not configure Peios' fixed host lookup
path.

This does not make every libc database fixed. Consult the libc package for
databases outside the account and hostname integration before assuming the
same behavior.

## Certificate trust

[trustd](/peios/using-peios/certificate-trust/overview.md) combines supplied certificate roots with
machine trust decisions and produces the [compatibility
files](/peios/using-peios/certificate-trust/the-compat-files.md) consumed by TLS libraries. Those files
are generated output, even where their paths match another distribution.

Use the trust service's supported configuration for an enduring change.
Adding a certificate directly to a generated file can be undone by the next
refresh. Permission to modify trust policy is separate from permission to
read the resulting certificate bundle.

---

# Porting Identity and IPC

_Peios / Developing for Peios / Porting Software_

> Replace Linux identity assumptions with Peios token and object contracts when porting services.

Review authority decisions separately from compatibility display. Peios
exposes
Linux UIDs, GIDs, mode bits, and capability interfaces so programs can
operate,
but those values do not describe the full security token or descriptor.

## Replace credential assumptions

Do not authorize a request solely because `geteuid()` or `SO_PEERCRED` reports
zero. A numeric projection omits claims, groups, privileges, restrictions,
impersonation level, and process trust. Cosmetic credentials can also differ
from the token. Name-service lookup helps display identities; it does not
create or authenticate them.

Do not treat successful `setuid()` as a privilege drop. Without the relevant
Peios privilege it is a silent no-op; the privileged identity-swap path is
unimplemented and fails. Setuid-bit exec has different cosmetic behavior.
Use a correctly scoped service token or the supported token API, and verify
the effective identity. The [setuid
reference](/kernel/internals/kacs/linux-credentials/setuid-behaviour.md)
also covers `setfsuid`, `access`, exec, and the absence of a general `uid0`
helper.

The kernel neutralizes conflicting Linux DAC decisions through its
[capability switchboard](/kernel/internals/kacs/linux-credentials/dac-neutralisation.md).
Some capabilities are allowed for compatibility, some map to Peios privileges,
and some are denied. The displayed capability mask is not an independent
source of authority. Removing Linux capabilities or assigning file capability
xattrs is not a substitute for controlling Peios token privileges.

Filesystem-facing projected identity also matters to quotas, remote servers,
and stacking filesystems. Preserve that distinction when diagnosing a local
success followed by a remote refusal. Peios does not make a remote server
understand a local descriptor automatically.

## Choose a channel with the required identity

| Channel | Identity and authority boundary |
|---|---|
| Unix stream or seqpacket socket | Native peer-token transport can bind local identity to the connection and conveyed requests. |
| Unix datagram | Identity is conveyed per message; do not use a connection register as its substitute. |
| TCP, UDP, or VSOCK | No local kernel attestation of the remote principal, including loopback IP traffic. Use an explicit authentication protocol. |
| Pipe or FIFO | Bytes and descriptor/file authority; no per-request token identity. |
| System V or POSIX queue | Object permissions protect use; payload and projected notification identity do not authenticate a principal. |
| Shared memory | Mapping and handle permissions; no identity attached to each memory write. |
| Netlink | Kernel-bound operations use the kernel's sender/opener checks; this is not a generic peer-token channel. |

A FIFO cannot replace an identity-carrying request/response named-pipe API.
Use a Unix socket with the native token protocol. `SCM_RIGHTS` delegates a
handle; token attestation is a different contract. Bind a received request to
its received token before concurrent work changes the socket's latest peer
state. The [SDK token guide](/peios/developing-for-peios/sdk-access-control/working-with-tokens.md)
and [socket identity reference](/kernel/internals/kacs/network-objects/socket-identity.md)
define capture, impersonation, and transport limits.

## Protect objects and their names

System V objects carry descriptors, and mode changes do not replace those
descriptors. Their numeric keys, abstract socket names, and shared-memory
names remain claim-on-create namespaces. Create exclusively where appropriate
and treat a pre-existing name as a condition to investigate, not proof of the
expected server. Prefer service-owned directories and authenticate the peer.

The [System V reference](/kernel/internals/kacs/system-v-ipc/objects-and-their-descriptors.md)
defines creation policy and descriptor operations by object kind and ID.
A restricted caller is not categorically refused every object created by its
parent: the complete descriptor and restricting identity determine the result.

Existing descriptors and mappings can retain authority after a policy change.
Replacing a name or tightening a descriptor does not remove another process's
old mapping. Design revocation and shutdown explicitly rather than promising
that a permissions edit retracts already-delivered data.

## Keep diagnostic provenance

Linux process accounting remains a compatibility facility, gated through its
capability-to-privilege mapping. Native KMES/eventd records carry Peios
identity
and process correlation, subject to each producer's schema and delivery
limits. Do not promise that every Linux accounting field has a native event
counterpart. Audit metadata and signal sender crumbs are observations, not
credentials to reuse for authorization.
