Skip to content

Environment facts

Describe users and groups that should exist for the test. They do not need to exist on your computer. An account record, an assumed authentication result and a selected target user are separate things.

Use an object as suite.environment. Omitted observations are unknown, not automatically absent. If a rule needs an unknown account or metadata value, the test errors instead of looking it up on the host. Contradictory observations and wrong-platform facts are rejected. The binary's platform determines the account format; a platform selector does not emulate another OS.

Properties

accounts

Known existing accounts. Omission supplies no existing-account observations. Use list {} when none are needed. This does not declare every other name absent.

absentNames

[]string

Names explicitly known not to exist. Absence by name does not invent an absence observation for an unrelated identifier.

absentUIDs

Unix only. UIDs explicitly known not to exist.

absentSIDs

[]SID

Windows only. Account SIDs explicitly known not to exist.

localGroups

Windows only. Known local groups and their direct SID members, for management group checks. Account group metadata alone is not that membership evidence. No nested/domain membership expansion is performed.

absentGroupNames

[]string

Windows only. Local group names explicitly known not to exist.

Account

Each entry in environment.accounts describes one known account. Optional metadata must be supplied when a tested rule reads it; nothing here requests account creation.

name

string

Account name. Windows requires a valid local SAM account name, not a domain or Microsoft Entra identity. Unix name comparison is case-sensitive; Windows account-name matching is case-insensitive.

uid

Required on Unix; not accepted on Windows. The account UID.

sid

SID

Required on Windows; not accepted on Unix. The account SID.

displayName

string

Display name for rules that read it. There is no guessed name or host lookup.

homeDir

string

Home/profile directory for rules that read it. Supplying a path does not read, create or load that directory/profile.

shell

string

Shell metadata for rules that read it. No host shell default is consulted.

group

Unix only. Primary group. It is distinct from supplementary groups.

groups

[]Group

Supplementary groups on Unix; direct local alias metadata on Windows. An omitted list is unknown. An explicit list {} is a known empty observation.

Group

An account's primary/supplementary group metadata, used in accounts[].group and accounts[].groups[]. Windows has no primary group in this model.

name

string

Group name; on Windows, a valid local SAM group name.

gid

Required on Unix; not accepted on Windows. The group GID.

sid

SID

Required on Windows; not accepted on Unix. The local group SID.

Windows local group

Each entry in environment.localGroups describes a group and its direct members.

name

string

Local group name; comparisons are case-insensitive.

sid

SID

The group SID, distinct from an account SID in the same fixture.

members

[]SID

The complete direct member SID list. It is required when a membership check needs it. Omission is unknown; list {} means no direct members. Matching uses SIDs, not display names.

Examples

Use this object as suite.environment on Linux/macOS:

1
2
3
4
local environment = object {
  accounts = list { object { name = "alice", uid = 1001 } },
  absentNames = list { "new-account" },
}

Use this list as suite.environment.localGroups on Windows:

1
2
3
4
5
6
local localGroups = list {
  object {
    name = "bifroest-managed", sid = "S-1-5-21-1-2-3-3001",
    members = list { "S-1-5-21-1-2-3-1001" },
  },
}

Local account mapping

For a local authentication assumption, omitted mode or post-authentication means the account name is already resolved. It does not claim the configured remoteName or a native login ran.

mapped-local first evaluates the configured remoteName. Only .remote.user and supported literal/conditional expressions are available at that step; host, connection and credential fields are not supplied. An optional account must agree with the mapping. The resolved account must be a supplied existing Account for allow; unknown/absent accounts are errors. A mapped-local deny still evaluates the mapping before denying.

Management membership

In configuration templates, .authorization.user.managed refers to the authenticated account and the chosen flow's managedGroup, not the target account. For Unix it compares names: a matching primary group needs no supplementary list; otherwise the supplementary groups must be known. Windows uses the direct SID membership observations above. A known absent management group produces the same negative result as the service.

Without a local environment, this template field is present with no value (nil), not false. Applicable but unknown membership is an error. See the Local User context for the production meaning; the test supplies its observations instead of reading them.

Local target settings

Returned target fields are documented under Local target. The local loginAllowed rule is checked before target lookup or rendering; false produces decision = "deny", stage = "local-login". Missing facts or template failures remain errors. The SSH environment's loginAllowed rule is not evaluated by this scope.

For Windows local targets, every local environment in the loaded YAML must explicitly provide shellCommand and execCommandPrefix; empty lists are valid. This prevents host-dependent defaults from entering the test. See the Unix/Windows examples.