Shellbox
Library and server for containerized shell execution
|
A command without file handling. More...
Public Member Functions | |
__construct (UnboxedExecutor $executor) | |
External callers should typically use UnboxedExecutor::createCommand() | |
execute () | |
Execute the command with the current executor. | |
Public Member Functions inherited from Shellbox\Command\Command | |
params (... $args) | |
Adds parameters to the command. | |
unsafeParams (... $args) | |
Adds unsafe parameters to the command. | |
replaceParams (... $args) | |
Replace the whole command with the given set of arguments. | |
unsafeCommand (string $command) | |
Replace the whole command string with something else. | |
cpuTimeLimit ( $limit) | |
Set the CPU time limit, that is, the amount of time the process spends in the running state. | |
wallTimeLimit ( $limit) | |
Set the wall clock time limit, that is, the amount of real time the process may run for. | |
memoryLimit ( $limit) | |
Set the memory limit in bytes. | |
fileSizeLimit ( $limit) | |
Set the maximum file size that the command may create. | |
environment (array $environment) | |
Sets environment variables which should be added to the executed command environment. | |
stdin (string $stdin) | |
Sends the provided input to the command. | |
passStdin (bool $yesno=true) | |
Controls whether stdin is passed through to the command, so that the user can interact with the command when it is run in CLI mode. | |
includeStderr (bool $includeStderr=true) | |
Controls whether stderr should be included in stdout, including errors from wrappers. | |
forwardStderr (bool $yesno=true) | |
If this is set to true, text written to stderr by the command will be passed through to PHP's stderr. | |
logStderr (bool $yesno=true) | |
When enabled, text sent to stderr will be logged with a level of 'error'. | |
useLogPipe (bool $yesno=true) | |
Open FD 3 as a pipe and pass the write side to the command. | |
workingDirectory (string $path) | |
Set the working directory under which the command will be run. | |
procOpenOptions (array $options) | |
Set special options to proc_open(). | |
disableNetwork (bool $yesno=true) | |
Disable networking, if possible. | |
disabledSyscalls (array $syscalls) | |
Specify the set of disabled syscalls. | |
firejailDefaultSeccomp (bool $yesno=true) | |
Enable/disable the default Firejail seccomp filter. | |
noNewPrivs (bool $yesno=true) | |
Enable the no_new_privs attribute to prevent privilege escalation via setuid executables and similar. | |
privateUserNamespace (bool $yesno=true) | |
Use a private user namespace. | |
privateDev (bool $yesno=true) | |
Create a private /dev mount. | |
allowPath (... $paths) | |
If called, the files/directories that are allowed will certainly be available to the shell command. | |
allowedPaths (array $paths) | |
Replace the list of allowed paths. | |
disallowPath (... $paths) | |
Disallow the specified paths so that the command cannot access them. | |
disallowedPaths (array $paths) | |
Replace the list of disallowed paths. | |
disableSandbox (bool $yesno=true) | |
Disable firejail and similar sandboxes. | |
getClientData () | |
Get command parameters for JSON serialization by the client. | |
setClientData ( $data) | |
Set command parameters using a data array created by getClientData() | |
getCommandString () | |
Get the current command string. | |
getCpuTimeLimit () | |
Get the CPU limit. | |
getWallTimeLimit () | |
Get the wall clock time limit. | |
getMemoryLimit () | |
Get the memory limit. | |
getFileSizeLimit () | |
Get the file size limit. | |
getEnvironment () | |
Get the environment. | |
getStdin () | |
Get the text to be passed to stdin. | |
getPassStdin () | |
Get whether to pass through stdin. | |
getIncludeStderr () | |
Get whether to duplicate stderr to stdout. | |
getLogStderr () | |
Get whether to log text seen on stderr. | |
getForwardStderr () | |
Get whether to forward the command's stderr to the parent's stderr. | |
getUseLogPipe () | |
Get whether to enable the log pipe. | |
getWorkingDirectory () | |
getProcOpenOptions () | |
Get the additional proc_open() options. | |
getDisableNetwork () | |
Get whether to disable external networking. | |
getDisabledSyscalls () | |
Get the list of disabled syscalls. | |
getFirejailDefaultSeccomp () | |
Get whether to use firejail's default seccomp filter. | |
getNoNewPrivs () | |
Get whether to enable the no_new_privs process attribute. | |
getPrivateUserNamespace () | |
Get whether to use a private user namespace. | |
getPrivateDev () | |
Get whether to mount a private /dev filesystem. | |
getAllowedPaths () | |
Get the allowed paths. | |
getDisallowedPaths () | |
Get the disallowed paths. | |
getDisableSandbox () | |
Get whether to disable firejail and similar sandboxes. | |
getSyntaxInfo () | |
Parse the current command string. | |
Protected Attributes | |
$executor | |
A command without file handling.
This is almost the same as Command, except with a type-hinted executor.
Shellbox\Command\UnboxedCommand::__construct | ( | UnboxedExecutor | $executor | ) |
External callers should typically use UnboxedExecutor::createCommand()
UnboxedExecutor | $executor |
Shellbox\Command\UnboxedCommand::execute | ( | ) |
Execute the command with the current executor.