jailer

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupJailDir

func CleanupJailDir(dir string) error

func Run

func Run() error

Types

type Device

type Device struct {
	Path string // Path to the device in the jail
	Mode uint32 // Mode of the device
	Dev  uint64 // Device number
}

type Jail

type Jail struct {
	// contains filtered or unexported fields
}

func CreateJail

func CreateJail(jailer string, jailConfig JailConfig, opts ...Opt) (*Jail, error)

func (Jail) AddBlockDevice

func (j Jail) AddBlockDevice(device string) error

func (*Jail) Command

func (j *Jail) Command(cmd string, args ...string) *exec.Cmd

func (Jail) CopyFile

func (j Jail) CopyFile(src, dst string, mode uint32) error

func (Jail) CreateFile

func (j Jail) CreateFile(path string, mode uint32) (*os.File, error)
func (j Jail) HardLink(src string, dst string, readonly bool) error

func (Jail) Mkdir

func (j Jail) Mkdir(dir string) error

func (Jail) MkdirAll

func (j Jail) MkdirAll(dir string) error

func (Jail) MknodAndOwn

func (j Jail) MknodAndOwn(device string, mode uint32, dev uint64) error

type JailConfig

type JailConfig struct {
	Uid     int
	Gid     int
	NewRoot string
}

type JailerConfig

type JailerConfig struct {
	Uid       int
	Gid       int
	NewRoot   string
	Netns     string
	NewPid    bool
	Command   []string
	NoFiles   int
	Fsize     int
	MountProc bool
	Cgroup    string
}

type Opt

type Opt func(*options) error

func WithBinary

func WithBinary(src string, dst string) Opt

func WithBlockDevice

func WithBlockDevice(device string) Opt

func WithCgroup

func WithCgroup(cgroup string) Opt

func WithCopyFile

func WithCopyFile(src string, dst string, mode uint32) Opt
func WithHardLink(src string, dst string, readonly bool) Opt

func WithKVM

func WithKVM() Opt

func WithMountProc

func WithMountProc() Opt

func WithNetNs

func WithNetNs(netns string) Opt

func WithNewPidNS

func WithNewPidNS() Opt

func WithResourceLimits

func WithResourceLimits(noFiles, fsize int) Opt

func WithTUN

func WithTUN() Opt

func WithURandom

func WithURandom() Opt

Jump to

Keyboard shortcuts

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