############################################################################## # p4sudo.cfg — P4Sudo Configuration File # Location: /p4/common/site/config/p4sudo.cfg # # Format version: 1 # # This is an annotated reference/example configuration file for P4Sudo. # Copy this file to /p4/common/site/config/p4sudo.cfg and customize for # your site. # # FILE SECURITY: # This file must be readable by the p4broker process user and writable # ONLY by root or the SDP 'perforce' OS user. A world-writable config # is a critical security vulnerability. # # Recommended permissions: # chown perforce:perforce /p4/common/site/config/p4sudo.cfg # chmod 640 /p4/common/site/config/p4sudo.cfg # ############################################################################## [settings] # Directory containing site-defined command scripts. # Scripts must be owned by a trusted OS user (root or perforce), not by # the p4broker process user. command_dir = /p4/common/site/p4sudo/commands # Operational log — records invocations and outcomes. log = /p4/common/site/p4sudo/logs/p4sudo.log # Audit log — immutable record of allow/deny decisions with timestamps. # Never delete or modify entries in place; use log rotation with archiving. audit_log = /p4/common/site/p4sudo/logs/audit.log # The P4PORT of the p4d server (NOT the broker port). # Used by the runtime to execute elevated commands. p4port = ssl:perforce:1666 # The P4Sudo service account username. This account must: # - Hold minimum necessary P4 permissions for the commands it runs. # - NOT appear in [rules] section (prevents privilege escalation via # self-reference). # - Have a long-lived / non-expiring broker-side ticket. p4sudo_user = p4sudo-svc # Maximum number of arguments accepted per invocation (safety limit). max_args = 20 # Timeout in seconds for site-defined command scripts. script_timeout = 300 # Set to true to enable verbose debug logging (operational log only). # Do not leave enabled in production. debug = false [commands] # Format for each command entry: # # .type = script | native # .script = /absolute/path/to/script.sh # required if type=script # .description = One-line description # .usage = p4 sudo # .ui_def = /absolute/path/to/.ui.yaml # optional; required # for commands that expose a web UI form with typed fields, # grouped inputs, required/optional field definitions, and # template token mappings. See doc/mkblackbelt.ui.yaml # for an annotated example. # # NATIVE COMMANDS: # Standard p4 commands (e.g. 'protect', 'depot', 'group') do NOT require # a [commands] entry. They can be referenced directly in [rules] by their # bare name. A [commands] entry for a native command is optional and only # needed to supply custom help text. # # SCRIPT COMMANDS: # Site-defined commands that are backed by a local script. The runtime # will call the script with the validated argument list. Scripts must # treat all input as untrusted. mkproj.type = script mkproj.script = /p4/common/site/p4sudo/commands/mkproj.sh mkproj.description = Create a new project depot, mainline stream, and default group permissions. mkproj.usage = p4 sudo mkproj [--template