tshwrap

package
v0.0.0-...-5c79d48 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TSHVarName is the name of the environment variable that can override the
	// tsh path that would otherwise be located on the $PATH.
	TSHVarName = "TSH"

	// TSHMinVersion is the minimum version of tsh that supports Machine ID
	// proxies.
	TSHMinVersion = "9.3.0"
)

Variables

This section is empty.

Functions

func CheckTSHSupported

func CheckTSHSupported(w *Wrapper) error

CheckTSHSupported checks if the current tsh supports Machine ID.

func GetDestinationDirectory

func GetDestinationDirectory(botConfig *config.BotConfig) (*config.DestinationDirectory, error)

GetDestinationDirectory attempts to select an unambiguous destination, either from CLI or YAML config. It returns an error if the selected destination is invalid.

func GetEnvForTSH

func GetEnvForTSH(destPath string) (map[string]string, error)

GetEnvForTSH returns a map of environment variables needed to properly wrap tsh so that it uses our Machine ID certificates where necessary.

func GetTSHVersion

func GetTSHVersion(w *Wrapper) (*semver.Version, error)

GetTSHVersion queries the system tsh for its version.

func LoadIdentity

func LoadIdentity(identityPath string) (*tlsca.Identity, error)

LoadIdentity loads a Teleport identity from an identityfile. Secondary bot identities are not loadable, so we'll just read the Teleport identity (which is required for tsh to function anyway).

Types

type Wrapper

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

Wrapper is a wrapper to execute `tsh` commands via a subprocess.

func New

func New() (*Wrapper, error)

New creates a new tsh wrapper. If a $TSH var is set it uses that path, otherwise looks for tsh on the OS path.

func (*Wrapper) Exec

func (w *Wrapper) Exec(env map[string]string, args ...string) error

Exec runs tsh with the given environment variables and arguments. The child process inherits stdin/stdout/stderr and runs until completion. Errors are returned per `exec.Command().Run()` semantics.

Jump to

Keyboard shortcuts

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