feat(core): PAM system-user authentication backend#1317
Open
geoffjay wants to merge 10 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds PAM (system-user) authentication to
agentd-coreas a pluggable login backend alongside the existing argon2 database-password auth. This lets people log in with their OS credentials — the same system identity agents already run under viasudo -u <user>.PAM is opt-in and pluggable, not a replacement:
auth_provider:local(argon2, the default + bootstrap/superuser/test escape hatch) orpam.system_username.The only behavioral change to the login path is the credential-check branch in
login_handler; sessions, tokens, and middleware are untouched.Cross-platform (macOS + Linux)
The verifier works on both macOS (OpenPAM) and Linux (Linux-PAM) from the same code, built on raw
pam-sysbindings plus a small hand-written conversation (no bindgen/libclang). The one real ABI difference — OpenPAM passes a contiguous message array, Linux-PAM an array of pointers — is isolated in a singlecfg-gated helper. Verified at runtime on macOS against the built-inchkpasswdservice (realpam_start→ conversation →pam_authenticate→pam_endround-trip).Build & install
pamCargo feature, off by default, gated tocfg(unix). Builds without it need no PAM library.AGENTD_PAM=1 cargo xtask install-userproduces a PAM-enabledagentd-core; plaininstall-useris unchanged.--features pamon macOS and Linux.Privilege model
pam_opendirectoryverifies without root.unix_chkpwdonly verifies the caller's own account, core must run as a system service with its account in theshadowgroup (or use an SSSD-backed stack). This touches systemd unit privileges (human-approval-adjacent perdocs/planning/autonomous-pipeline-gates.md), so the installer does not apply it automatically — seedocs/pam-authentication.md.Config
AGENTD_PAM_ENABLED(master switch),AGENTD_PAM_SERVICE(defaultagentd),AGENTD_PAM_EMAIL_DOMAIN(defaultpam.local).Testing
tests/pam_smoke.rs(--ignored,--features pam) drives the real stack; wrong-password case ran green on macOS.cargo fmt --checkand clippy (default +--features pam --all-targets) pass.Note
Per the branch strategy this targets
feature/pam-auth, notmain.🤖 Generated with Claude Code