chroot

package
v0.0.0-...-683b059 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package chroot implements a chroot environment that runs in a separate network namespace from the caller.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NetworkChroot

type NetworkChroot struct {
	NetEnv []string
	// contains filtered or unexported fields
}

NetworkChroot wraps the chroot variables.

func NewNetworkChroot

func NewNetworkChroot() *NetworkChroot

NewNetworkChroot creates a new chroot object.

func (*NetworkChroot) AddConfigTemplates

func (n *NetworkChroot) AddConfigTemplates(templates map[string]string)

AddConfigTemplates add a filename-content dict to the set of templates for the chroot.

func (*NetworkChroot) AddConfigValues

func (n *NetworkChroot) AddConfigValues(values map[string]interface{})

AddConfigValues add a name-value dict to the set of values for the config template.

func (*NetworkChroot) AddCopiedConfigFiles

func (n *NetworkChroot) AddCopiedConfigFiles(files []string)

AddCopiedConfigFiles add |files| to the set to be copied to the chroot.

func (*NetworkChroot) AddRootDirectories

func (n *NetworkChroot) AddRootDirectories(directories []string)

AddRootDirectories add |directories| to the set created within the chroot.

func (*NetworkChroot) AddStartupCommand

func (n *NetworkChroot) AddStartupCommand(command string)

AddStartupCommand add a command to the script run when the chroot starts up.

func (*NetworkChroot) BridgeDbusNamespaces

func (n *NetworkChroot) BridgeDbusNamespaces()

BridgeDbusNamespaces make the system DBus daemon visible inside the chroot.

func (*NetworkChroot) GetLogContents

func (n *NetworkChroot) GetLogContents(ctx context.Context, logFilePaths []string) (string, error)

GetLogContents return the logfiles from the chroot. |logFilePaths| is a list of relative paths to the chroot. An error will be returned if any file in the list does not exist.

func (*NetworkChroot) KillPidFile

func (n *NetworkChroot) KillPidFile(ctx context.Context, pidFile string, missingOk bool) error

KillPidFile kills the process belonging to |pid_file| in the chroot.

func (*NetworkChroot) RunChroot

func (n *NetworkChroot) RunChroot(ctx context.Context, args []string) error

RunChroot runs a command in a chroot, within the network namespace associated with this chroot.

func (*NetworkChroot) Shutdown

func (n *NetworkChroot) Shutdown(ctx context.Context) error

Shutdown remove the chroot filesystem in which the VPN server was running.

func (*NetworkChroot) Startup

func (n *NetworkChroot) Startup(ctx context.Context) (string, error)

Startup creates the chroot, calls patchpanel API to create a netns, starts user processes and returns the IPv4 address inside this netns.

Jump to

Keyboard shortcuts

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