1 Technical_Decomp_Accounts
Miguel Jacq edited this page 2025-12-27 20:34:39 -06:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

enroll/accounts.py

UserRecord (dataclass)

Purpose: represents one “human” (non-system) user found on the machine.

Fields:

  • name, uid, gid, gecos, home, shell: parsed from /etc/passwd
  • primary_group: resolved from /etc/group by matching the users primary gid
  • supplementary_groups: any other groups where the user appears in the group member list
  • ssh_files: list of safe-to-copy SSH public material, currently only:
  • ~/.ssh/authorized_keys if it exists and isnt a symlink

Lifecycle / where its used:

Constructed in collect_non_system_users().

harvest.harvest() converts it into a plain dict list (users_list) which is stored inside the UsersSnapshot and ultimately serialized into state.json.

The actual ssh_files are also copied into artifacts/users/... as managed files (subject to ignore/exclude policy), and recorded as ManagedFile entries.

Important semantics:

  • A “human” user is determined by UID_MIN from /etc/login.defs (default 1000), and shell not being nologin/false.
  • root and nobody are explicitly skipped.