jail package

import "go.sbk.wtf/runj/jail"

Index

func AwaitFifoOpen

AwaitFifoOpen waits for a runj-entrypoint process to open the fifo passed to it. The fifo is used to indicate when runj-entrypoint should start the process inside the jail.

func CleanupEntrypoint

CleanupEntrypoint sends a SIGTERM to the PID recorded in the state file. This function returns with no error even if the process is not running or cannot be signaled.

func ExecEntrypoint

ExecEntrypoint execs a runj-entrypoint process in order to start a secondary process inside the jail.

The process's configuration (cwd, and in the future user/umask/rlimits/...) is persisted to the state directory and read back by runj-entrypoint once it is inside the jail, rather than being passed on runj-entrypoint's argument or environment contract. Because this function exec(2)s into runj-entrypoint, the pid is preserved, so runj-entrypoint can find the file with getpid(2). See docs/entrypoint-process-config.md for the rationale.

Note: this API is unstable; expect it to change.

func IsRunning

IsRunning attempts to determine whether a given jail is running. This is accomplished by looking to see whether the jail's primary pid (passed as an argument) is still active and by whether there are any processes present in the jail. This function is best-effort, racy, and subject to change. It currently depends on the host's "ps" command.

func Kill

Kill sends a signal to a process in a jail

func KillAll

KillAll sends a signal to all processes in a jail

func Mount

Mount mounts the mounts

func MoveVNetInterfaces

func SetupEntrypoint

SetupEntrypoint starts a runj-entrypoint process, which is used to start processes inside the jail.

When used to start the jail's init process, runj-entrypoint will later be signalled through `runj start` to run the specified program in the jail. This indirection is necessary so that the STDIO for `runj create` or the supplied console socket is directed to that process.

When used to start a secondary process inside the jail, the waiting step is skipped and runj-entrypoint will immediately proceed to create the process as soon as STDIO is configured.

Note: this API is unstable; expect it to change. The init process's configuration (cwd, and in the future user/umask/rlimits/...) is not passed here: runj-entrypoint reads it back from the persisted config.json once it is inside the jail. See docs/entrypoint-process-config.md.

func Unmount

Unmount attempts to unmount all mounts present in the spec. If multiple errors occur, Unmount returns the first.

type CreateAllowParams

type CreateParams

CreateParams is a limited subset of the parameters available in jail.conf(5) for use with jail(8).

type ID

ID identifies jails

func (ID) String

type Jail

Jail represents an existing jail

func Create

func FromName

FromName queries the OS for a jail with the specified name

type VNetMove

Source Files

entrypoint.go jail.go kill.go mount.go params.go ps.go syscall.go vnet.go