hostop

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 10 Imported by: 1

Documentation

Overview

Package hostop contains an interface to represent the execution of atomic host operations at a higher privilege.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HostPidNamespace added in v0.0.5

func HostPidNamespace() (bool, error)

HostPidNamespace checks whether the current process is using host's PID namespace.

func InsideContainer

func InsideContainer() bool

InsideContainer checks whether the current process is being executed inside of a container.

Types

type HostOp

type HostOp interface {
	// Do executes the action at a privileged context at the host.
	Do(action func() error) error
}

func NewMountHostOp

func NewMountHostOp(opts ...HostOpOption) HostOp

type HostOpOption added in v0.1.0

type HostOpOption func(*hostOpOpts)

func WithAssumeContainer added in v0.1.0

func WithAssumeContainer() HostOpOption

WithAssumeContainer ensures that HostOp always assume it is being executed from inside a container, and therefore attempts the necessary privilege escalations.

func WithAssumeHost added in v0.1.0

func WithAssumeHost() HostOpOption

WithAssumeHost ensures that HostOp always assume that it is being executed directly in the host.

func WithContainerDetection added in v0.1.0

func WithContainerDetection() HostOpOption

WithContainerDetection ensures that HostOp tries to auto detect whether or not the code is being executed from inside a container.

func WithLogger added in v0.1.0

func WithLogger(logger logr.Logger) HostOpOption

WithLogger sets a logger to be used whilst executing operations.

type NsTypeName

type NsTypeName string
const (
	Mount NsTypeName = "ns/mnt"
)

Jump to

Keyboard shortcuts

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