Documentation
¶
Overview ¶
Package proc is responsible for starting Drop sub processes. Process hierarchy of 'drop run' is:
drop run started by the user
| waits for `drop -main`
|
+- drop -main new user namespace
| sets up the network, forwards
| the PTY, supervises init
|
+- drop -init new user, mount, PID, net, IPC
| and cgroup namespaces, PID 1
| exec sandboxed program
|
+- pasta (daemonized) joins the sandbox net namespace
`drop -main` process is needed for the firewall and DNS logic to be able to join the network namespace of the sandbox. Joining a network namespace requires the process to have CAP_SYS_ADMIN in its own namespace, so the process needs to run in a new user namespace.
Technically, when firewall is not used, 'drop -main' logic could run directly in the 'drop run' process, without spawning 'drop -main'. But we keep using the same hierarchy in all cases to limit the complexity by making different Drop configurations use as similar execution paths as possible.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DropArg ¶
DropArg returns a command line argument to be passed to `drop` to start a process of a given ProcType
func Init ¶
func Init() error
Init handles init process logic for the 'drop run' command. It sets up the namespace, drops privileges and executes a command provided by the user.
func StartMain ¶
func StartMain(args ipc.SandboxArgs) error
StartMain starts a `drop -main` sub process as a child of the current process, sends args to it via a Unix socket and waits for the sub process to exit.
It also ensures the child dies if the parent process dies and forwards terminating signals to the child.