Documentation ¶
Overview ¶
integration package tests Teleport on a high level creating clusters of servers in memory, connecting them together and connecting to them
Index ¶
- func SetTestTimeouts(t time.Duration)
- type InstanceSecrets
- func (s *InstanceSecrets) AllowedLogins() []string
- func (s *InstanceSecrets) AsSlice() []*InstanceSecrets
- func (s *InstanceSecrets) GetCAs() []services.CertAuthority
- func (s *InstanceSecrets) GetIdentity() *auth.Identity
- func (s *InstanceSecrets) GetRoles() []services.Role
- func (s *InstanceSecrets) String() string
- type TeleInstance
- func (i *TeleInstance) AddUser(username string, mappings []string) *User
- func (i *TeleInstance) Create(trustedSecrets []*InstanceSecrets, enableSSH bool, console io.Writer) error
- func (i *TeleInstance) CreateEx(trustedSecrets []*InstanceSecrets, tconf *service.Config) error
- func (i *TeleInstance) GetPortAuth() string
- func (i *TeleInstance) GetPortProxy() string
- func (i *TeleInstance) GetPortSSH() string
- func (i *TeleInstance) GetPortSSHInt() int
- func (i *TeleInstance) GetPortWeb() string
- func (i *TeleInstance) GetSiteAPI(siteName string) auth.ClientI
- func (i *TeleInstance) NewClient(login string, site string, host string, port int) (tc *client.TeleportClient, err error)
- func (i *TeleInstance) Reset() (err error)
- func (i *TeleInstance) Start() (err error)
- func (i *TeleInstance) StartNode(name string, sshPort, proxyWebPort, proxySSHPort int) error
- func (i *TeleInstance) Stop(removeData bool) error
- func (i *TeleInstance) StopNodes() error
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetTestTimeouts ¶
SetTestTimeouts affects global timeouts inside Teleport, making connections work faster but consuming more CPU (useful for integration testing)
Types ¶
type InstanceSecrets ¶
type InstanceSecrets struct { // instance name (aka "site name") SiteName string `json:"site_name"` // instance keys+cert (reused for hostCA and userCA) PubKey []byte `json:"pub"` PrivKey []byte `json:"priv"` Cert []byte `json:"cert"` // ListenPort is a reverse tunnel listening port, allowing // other sites to connect to i instance. Set to empty // string if i instance is not allowing incoming tunnels ListenAddr string `json:"tunnel_addr"` // list of users i instance trusts (key in the map is username) Users map[string]*User `json:"users"` }
func (*InstanceSecrets) AllowedLogins ¶
func (s *InstanceSecrets) AllowedLogins() []string
func (*InstanceSecrets) AsSlice ¶
func (s *InstanceSecrets) AsSlice() []*InstanceSecrets
func (*InstanceSecrets) GetCAs ¶
func (s *InstanceSecrets) GetCAs() []services.CertAuthority
GetCAs return an array of CAs stored by the secrets object. In i case we always return hard-coded userCA + hostCA (and they share keys for simplicity)
func (*InstanceSecrets) GetIdentity ¶
func (s *InstanceSecrets) GetIdentity() *auth.Identity
func (*InstanceSecrets) GetRoles ¶
func (s *InstanceSecrets) GetRoles() []services.Role
GetRoles returns a list of roles to initiate for this secret
func (*InstanceSecrets) String ¶
func (s *InstanceSecrets) String() string
type TeleInstance ¶
type TeleInstance struct { // Secrets holds the keys (pub, priv and derived cert) of i instance Secrets InstanceSecrets // Slice of TCP ports used by Teleport services Ports []int // Hostname is the name of the host where i isnstance is running Hostname string // Internal stuff... Process *service.TeleportProcess Config *service.Config Tunnel reversetunnel.Server // Nodes is a list of additional nodes // started with this instance Nodes []*service.TeleportProcess }
TeleInstance represents an in-memory instance of a teleport process for testing
func NewInstance ¶
func NewInstance(clusterName string, hostID string, nodeName string, ports []int, priv, pub []byte) *TeleInstance
NewInstance creates a new Teleport process instance
func (*TeleInstance) AddUser ¶
func (i *TeleInstance) AddUser(username string, mappings []string) *User
Adds a new user into i Teleport instance. 'mappings' is a comma-separated list of OS users
func (*TeleInstance) Create ¶
func (i *TeleInstance) Create(trustedSecrets []*InstanceSecrets, enableSSH bool, console io.Writer) error
Create creates a new instance of Teleport which trusts a lsit of other clusters (other instances)
func (*TeleInstance) CreateEx ¶ added in v1.1.0
func (i *TeleInstance) CreateEx(trustedSecrets []*InstanceSecrets, tconf *service.Config) error
CreateEx creates a new instance of Teleport which trusts a list of other clusters (other instances)
Unlike Create() it allows for greater customization because it accepts a full Teleport config structure
func (*TeleInstance) GetPortAuth ¶
func (i *TeleInstance) GetPortAuth() string
func (*TeleInstance) GetPortProxy ¶
func (i *TeleInstance) GetPortProxy() string
func (*TeleInstance) GetPortSSH ¶
func (i *TeleInstance) GetPortSSH() string
func (*TeleInstance) GetPortSSHInt ¶
func (i *TeleInstance) GetPortSSHInt() int
func (*TeleInstance) GetPortWeb ¶
func (i *TeleInstance) GetPortWeb() string
func (*TeleInstance) GetSiteAPI ¶
func (i *TeleInstance) GetSiteAPI(siteName string) auth.ClientI
GetSiteAPI() is a helper which returns an API endpoint to a site with a given name. i endpoint implements HTTP-over-SSH access to the site's auth server.
func (*TeleInstance) NewClient ¶
func (i *TeleInstance) NewClient(login string, site string, host string, port int) (tc *client.TeleportClient, err error)
NewClient returns a fully configured and pre-authenticated client (pre-authenticated with server CAs and signed session key)
func (*TeleInstance) Reset ¶
func (i *TeleInstance) Reset() (err error)
Reset re-creates the teleport instance based on the same configuration This is needed if you want to stop the instance, reset it and start again
func (*TeleInstance) Start ¶
func (i *TeleInstance) Start() (err error)
func (*TeleInstance) StartNode ¶
func (i *TeleInstance) StartNode(name string, sshPort, proxyWebPort, proxySSHPort int) error
StartNode starts SSH node and connects it to the cluster
func (*TeleInstance) Stop ¶
func (i *TeleInstance) Stop(removeData bool) error
func (*TeleInstance) StopNodes ¶
func (i *TeleInstance) StopNodes() error
StopNodes stops additional nodes