How gblach/please works
Project type and purpose
• This is a small, open-source, command-line utility that replicates a subset of sudo’s behavior.
• It provides PAM-based authentication and, upon success, forks/execs a requested command under elevated (root) privileges.
File structure
• please.c → the core C source implementing the “please” CLI.
• Makefile → build rules (compilation, linking against libpam).
• pam.d/please.* → PAM configuration snippets for various Linux/BSD distributions.
• please.1 → man-page source for usage reference.
• README.md/.rst → documentation and project description.
• COPYRIGHT → license information.
README for additional insights
• Confirms that the only “bell and whistle” is PAM authentication.
• No database or external services; purely local OS integration.
Main components
a. User (unprivileged shell)
b. please CLI binary
c. PAM framework (libpam and /etc/pam.d/please configuration)
d. OS authentication stack (e.g., /etc/shadow, PAM modules)
e. OS kernel / privilege escalation (setuid, fork/exec)
f. Child process (the target command run as root)
Relationships and interactions
1. User invokes “please <command>”
→ please CLI reads /etc/pam.d/please config
→ calls pam_start()/pam_authenticate() via libpam
→ PAM framework loads underlying modules (pam_unix)
→ kernel prompts for password, verifies credentials
→ PAM returns success or failure to please CLI
2. On success
→ please CLI calls setuid(0)/setgid(0) (binary is installed with root ownership and set-uid bit)
→ forks and execve() the requested command under effective UID=0
3. On failure
→ CLI prints error and exits
Architectural patterns and design principles
• Single Responsibility: CLI only handles authentication + exec. No logging, no caching, no policy engine.
• OS integration: Leverages existing PAM modules rather than reinventing authentication.
• Minimal attack surface: small code footprint, minimal dependencies.
Important technologies / libraries
• C standard library (libc)
• PAM library (libpam)
• POSIX calls (fork, execve, setuid)
• Makefile for build automation
• Distribution-specific PAM configs in pam.d/