Fluxion::Executor::Sudo
Rewrites privileged commands and resolves their targets.
Two rules, both about not trusting PATH for anything that runs as root:
- A privileged effect always becomes
sudo -n -- <target> ....-nmeans it can never sit waiting for a password on a terminal nobody is watching; authentication happens once, up front, through the preflight. - The target is resolved to a real path under a root-owned system
directory. Otherwise a writable directory earlier on
PATHwould decide what runs as root.
Constants
SUDO_PATHS = ["/usr/bin/sudo", "/bin/sudo"]
SYSTEM_DIRECTORIES = ["/usr/bin", "/usr/sbin", "/bin", "/sbin"]
Directories trusted to hold executables Fluxion will run as root.
Instance methods
available?
Sourceexecutable
SourceTurns a sudo ... marker into the command actually executed.
Resolves an executable to a real path Fluxion is willing to run as root.
Refuses anything outside the system directories, anything not owned by root, and anything group- or other-writable — including every directory on the way to it, since a writable parent means the file can be swapped.
validate_with_password_argv
Validates a password read from the user, with the prompt suppressed because Fluxion has already drawn its own.