gojail

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2021 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//JailFlagCreate use with JailSet to create a jail
	JailFlagCreate = 0x01
	//JailFlagUpdate use with JailSet to update an existing jail
	JailFlagUpdate = 0x02
	//JailFlagAttach use with JailSet to also attach the running process to the jail
	JailFlagAttach = 0x04
	//JailFlagDying allow jails marked as dying
	JailFlagDying = 0x08
)

Variables

This section is empty.

Functions

func JailAttach

func JailAttach(jid JailID) error

JailAttach attaches the current process to the jail

func JailGetName

func JailGetName(jid JailID) (string, error)

JailGetName gets the name of the jail associated with JailID

func JailParseParametersToIovec

func JailParseParametersToIovec(parameters map[string]interface{}) ([]syscall.Iovec, error)

JailParseParametersToIovec parses a map[string]interface{} parameter set to []syscall.Iovec for use in Jail syscalls requiring []syscall.Iovec Byte slices & pointers are considered out variables and will be filled with JailGet. for setting handing over variables use strings or ints instead. gojail uses errmsg, and will error out if it's passed as a key No validation is done w.r.t. the type required by the jail parameter

func JailRemove

func JailRemove(jid JailID) error

JailRemove destroys the jail, killing all processes in it

Types

type Jail

type Jail interface {
	//Name returns the jail name
	Name() string
	//ID returns the jail ID
	ID() JailID
	//Attach attaches the current running process to the jailq
	Attach() error
	//RunIn runs a command inside the jail
	RunIn() error
	//Destroy kills all running commands in a jail and removes it from the system
	Destroy() error
	//CreateChildJail creates a Jail as a child in the current jail, incrementing max children as needed
	CreateChildJail(map[string]interface{}) (Jail, error)
}

Jail interface to interact with jails

func JailCreate

func JailCreate(jailParameters map[string]interface{}) (Jail, error)

JailCreate creates a Jail with the given parameters, no validation is done atm accepted types for interface{}: int32/*int32/uint32/*uint32/string/bool/[]byte byte slices MUST be null terminated if the OS expects a string var.

func JailGetByID

func JailGetByID(jailID JailID) (Jail, error)

JailGetByID queries the OS for Jail with jid jailID

func JailGetByName

func JailGetByName(jailName string) (Jail, error)

JailGetByName queries the OS for Jail with name jailName

type JailID

type JailID int32

JailID is used to identify jails

func JailGet

func JailGet(iovecs []syscall.Iovec, flags int) (JailID, error)

JailGet gets values for the parameters in the []syscall.Iovec

func JailGetID

func JailGetID(name string) (JailID, error)

JailGetID gets the JailID of jail with the given name

func JailSet

func JailSet(iovecs []syscall.Iovec, flags int) (JailID, error)

JailSet creates or modifies jails with paramets provided in []syscall.Iovec

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL