tshwrap

package
v11.3.3 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.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 GetDestination

func GetDestination(botConfig *config.BotConfig, cf *config.CLIConf) (*config.DestinationConfig, error)

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

func GetDestinationPath

func GetDestinationPath(destination *config.DestinationConfig) (string, error)

GetDestinationPath returns a path to a filesystem destination.

func GetEnvForTSH

func GetEnvForTSH(destination *config.DestinationConfig) (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 GetIdentityTemplate

func GetIdentityTemplate(destination *config.DestinationConfig) (*config.TemplateIdentity, error)

GetIdentityTemplate returns the identity template for the given destination. This is a required template so it _should_ never fail.

func GetTLSCATemplate

func GetTLSCATemplate(destination *config.DestinationConfig) (*config.TemplateTLSCAs, error)

GetTLSCATemplate returns the TLS CA template for the given destination. It's a required template so this should never fail.

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