profile

package
v7.0.0-...-185e5fd Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package profile handles management of the Teleport profile directory (~/.tsh).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FullProfilePath

func FullProfilePath(dir string) string

FullProfilePath returns the full path to the user profile directory. If the parameter is empty, it returns expanded "~/.tsh", otherwise returns its unmodified parameter

func GetCurrentProfileName

func GetCurrentProfileName(dir string) (name string, err error)

GetCurrentProfileName attempts to load the current profile name.

func ListProfileNames

func ListProfileNames(dir string) ([]string, error)

ListProfileNames lists all available profiles.

func SetCurrentProfileName

func SetCurrentProfileName(dir string, name string) error

SetCurrentProfileName attempts to set the current profile name.

Types

type Profile

type Profile struct {
	// WebProxyAddr is the host:port the web proxy can be accessed at.
	WebProxyAddr string `yaml:"web_proxy_addr,omitempty"`

	// SSHProxyAddr is the host:port the SSH proxy can be accessed at.
	SSHProxyAddr string `yaml:"ssh_proxy_addr,omitempty"`

	// KubeProxyAddr is the host:port the Kubernetes proxy can be accessed at.
	KubeProxyAddr string `yaml:"kube_proxy_addr,omitempty"`

	// PostgresProxyAddr is the host:port the Postgres proxy can be accessed at.
	PostgresProxyAddr string `yaml:"postgres_proxy_addr,omitempty"`

	// MySQLProxyAddr is the host:port the MySQL proxy can be accessed at.
	MySQLProxyAddr string `yaml:"mysql_proxy_addr,omitempty"`

	// Username is the Teleport username for the client.
	Username string `yaml:"user,omitempty"`

	// AuthType (like "google")
	AuthType string `yaml:"auth_type,omitempty"`

	// SiteName is equivalient to --cluster argument
	SiteName string `yaml:"cluster,omitempty"`

	// ForwardedPorts is the list of ports to forward to the target node.
	ForwardedPorts []string `yaml:"forward_ports,omitempty"`

	// DynamicForwardedPorts is a list of ports to use for dynamic port
	// forwarding (SOCKS5).
	DynamicForwardedPorts []string `yaml:"dynamic_forward_ports,omitempty"`

	// Dir is the directory of this profile.
	Dir string
}

Profile is a collection of most frequently used CLI flags for "tsh".

Profiles can be stored in a profile file, allowing TSH users to type fewer CLI args.

func FromDir

func FromDir(dir string, name string) (*Profile, error)

FromDir reads the user profile from a given directory. If dir is empty, this function defaults to the default tsh profile directory. If name is empty, this function defaults to loading the currently active profile (if any).

func (*Profile) KeyDir

func (p *Profile) KeyDir() string

KeyDir returns the path to the profile's directory.

func (*Profile) KnownHostsPath

func (p *Profile) KnownHostsPath() string

KnownHostsPath returns the path to the profile's ssh certificate authorities.

func (*Profile) Name

func (p *Profile) Name() string

Name returns the name of the profile.

func (*Profile) OldSSHCertPath

func (p *Profile) OldSSHCertPath() string

OldSSHCertPath returns the old (before v6.1) path to the profile's ssh certificate. DELETE IN 8.0.0

func (*Profile) ProxyKeyDir

func (p *Profile) ProxyKeyDir() string

ProxyKeyDir returns the path to the profile's key directory.

func (*Profile) SSHCertPath

func (p *Profile) SSHCertPath() string

SSHCertPath returns the path to the profile's ssh certificate.

func (*Profile) SSHClientConfig

func (p *Profile) SSHClientConfig() (*ssh.ClientConfig, error)

SSHClientConfig returns the profile's associated SSHClientConfig.

func (*Profile) SSHDir

func (p *Profile) SSHDir() string

SSHDir returns the path to the profile's ssh directory.

func (*Profile) SaveToDir

func (p *Profile) SaveToDir(dir string, makeCurrent bool) error

SaveToDir saves this profile to the specified directory. If makeCurrent is true, it makes this profile current.

func (*Profile) TLSCAsPath

func (p *Profile) TLSCAsPath() string

TLSCAsPath returns the path to the profile's TLS certificate authorities.

func (*Profile) TLSCertPath

func (p *Profile) TLSCertPath() string

TLSCertPath returns the path to the profile's TLS certificate.

func (*Profile) TLSConfig

func (p *Profile) TLSConfig() (*tls.Config, error)

TLSConfig returns the profile's associated TLSConfig.

func (*Profile) UserKeyPath

func (p *Profile) UserKeyPath() string

UserKeyPath returns the path to the profile's private key.

Jump to

Keyboard shortcuts

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