Documentation ¶
Index ¶
- Constants
- type AzureInstaller
- type AzureInstances
- type AzureRunRequest
- type EC2Instance
- type EC2Instances
- type Fetcher
- func MatchersToAzureInstanceFetchers(matchers []types.AzureMatcher, clients azureClientGetter) []Fetcher
- func MatchersToEC2InstanceFetchers(ctx context.Context, matchers []types.AWSMatcher, clients cloud.Clients) ([]Fetcher, error)
- func MatchersToGCPInstanceFetchers(matchers []types.GCPMatcher, gcpClient gcp.InstancesClient) []Fetcher
- type GCPInstaller
- type GCPInstances
- type GCPRunRequest
- type Instances
- type Option
- type SSMInstaller
- type SSMInstallerConfig
- type SSMRunRequest
- type Watcher
Constants ¶
const ( // ParamToken is the name of the invite token parameter sent in the SSM Document ParamToken = "token" // ParamScriptName is the name of the Teleport install script sent in the SSM Document ParamScriptName = "scriptName" // ParamSSHDConfigPath is the path to the OpenSSH config file sent in the SSM Document ParamSSHDConfigPath = "sshdConfigPath" )
const ( // AWSInstanceStateName represents the state of the AWS EC2 // instance - (pending | running | shutting-down | terminated | stopping | stopped ) // https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html // Used for filtering instances for automatic EC2 discovery AWSInstanceStateName = "instance-state-name" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AzureInstaller ¶
AzureInstaller handles running commands that install Teleport on Azure virtual machines.
func (*AzureInstaller) Run ¶
func (ai *AzureInstaller) Run(ctx context.Context, req AzureRunRequest) error
Run runs a command on a set of virtual machines and then blocks until the commands have completed.
type AzureInstances ¶
type AzureInstances struct { // Region is the Azure region where the instances are located. Region string // SubscriptionID is the subscription ID for the instances. SubscriptionID string // ResourceGroup is the resource group for the instances. ResourceGroup string // ScriptName is the name of the script to execute on the instances to // install Teleport. ScriptName string // PublicProxyAddr is the address of the proxy the discovered node should use // to connect to the cluster. PublicProxyAddr string // Parameters are the parameters passed to the installation script. Parameters []string // Instances is a list of discovered Azure virtual machines. Instances []*armcompute.VirtualMachine // ClientID is the client ID of the managed identity to use for installation. ClientID string }
AzureInstances contains information about discovered Azure virtual machines.
func (*AzureInstances) MakeEvents ¶
func (instances *AzureInstances) MakeEvents() map[string]*usageeventsv1.ResourceCreateEvent
MakeEvents generates MakeEvents for these instances.
type AzureRunRequest ¶
type AzureRunRequest struct { Client azure.RunCommandClient Instances []*armcompute.VirtualMachine Params []string Region string ResourceGroup string ScriptName string PublicProxyAddr string ClientID string }
AzureRunRequest combines parameters for running commands on a set of Azure virtual machines.
type EC2Instance ¶
EC2Instance represents an AWS EC2 instance that has been discovered.
func ToEC2Instances ¶
func ToEC2Instances(insts []*ec2.Instance) []EC2Instance
ToEC2Instances converts aws []*ec2.Instance to []EC2Instance
type EC2Instances ¶
type EC2Instances struct { // Region is the AWS region where the instances are located. Region string // DocumentName is the SSM document that should be executed on the EC2 // instances. DocumentName string // Parameters are parameters passed to the SSM document. Parameters map[string]string // AccountID is the AWS account the instances belong to. AccountID string // Instances is a list of discovered EC2 instances Instances []EC2Instance // Rotation is set so instances dont get filtered out for already // existing in the teleport instance Rotation bool }
EC2Instances contains information required to send SSM commands to EC2 instances
func (*EC2Instances) MakeEvents ¶
func (instances *EC2Instances) MakeEvents() map[string]*usageeventsv1.ResourceCreateEvent
MakeEvents generates ResourceCreateEvents for these instances.
func (*EC2Instances) ServerInfos ¶
func (i *EC2Instances) ServerInfos() ([]types.ServerInfo, error)
ServerInfos creates a ServerInfo resource for each discovered instance.
type Fetcher ¶
type Fetcher interface { // GetInstances gets a list of cloud instances. GetInstances(ctx context.Context, rotation bool) ([]Instances, error) // GetMatchingInstances finds Instances from the list of nodes // that the fetcher matches. GetMatchingInstances(nodes []types.Server, rotation bool) ([]Instances, error) }
Fetcher fetches instances from a particular cloud provider.
func MatchersToAzureInstanceFetchers ¶
func MatchersToAzureInstanceFetchers(matchers []types.AzureMatcher, clients azureClientGetter) []Fetcher
MatchersToAzureInstanceFetchers converts a list of Azure VM Matchers into a list of Azure VM Fetchers.
func MatchersToEC2InstanceFetchers ¶
func MatchersToEC2InstanceFetchers(ctx context.Context, matchers []types.AWSMatcher, clients cloud.Clients) ([]Fetcher, error)
MatchersToEC2InstanceFetchers converts a list of AWS EC2 Matchers into a list of AWS EC2 Fetchers.
func MatchersToGCPInstanceFetchers ¶
func MatchersToGCPInstanceFetchers(matchers []types.GCPMatcher, gcpClient gcp.InstancesClient) []Fetcher
MatchersToGCPInstanceFetchers converts a list of GCP GCE Matchers into a list of GCP GCE Fetchers.
type GCPInstaller ¶
GCPInstaller handles running commands that install Teleport on GCP virtual machines.
func (*GCPInstaller) Run ¶
func (gi *GCPInstaller) Run(ctx context.Context, req GCPRunRequest) error
Run runs a command on a set of virtual machines and then blocks until the commands have completed.
type GCPInstances ¶
type GCPInstances struct { // Zone is the instances' zone. Zone string // ProjectID is the instances' project ID. ProjectID string // ScriptName is the name of the script to execute on the instances to // install Teleport. ScriptName string // PublicProxyAddr is the address of the proxy the discovered node should use // to connect to the cluster. PublicProxyAddr string // Parameters are the parameters passed to the installation script Parameters []string // Instances is a list of discovered GCP virtual machines. Instances []*gcp.Instance }
GCPInstances contains information about discovered GCP virtual machines.
func (*GCPInstances) MakeEvents ¶
func (instances *GCPInstances) MakeEvents() map[string]*usageeventsv1.ResourceCreateEvent
MakeEvents generates MakeEvents for these instances.
type GCPRunRequest ¶
type GCPRunRequest struct { Client gcp.InstancesClient Instances []*gcp.Instance Params []string Zone string ProjectID string ScriptName string PublicProxyAddr string }
GCPRunRequest combines parameters for running commands on a set of GCP virtual machines.
type Instances ¶
type Instances struct { EC2 *EC2Instances Azure *AzureInstances GCP *GCPInstances }
Instances contains information about discovered cloud instances from any provider.
type Option ¶
type Option func(*Watcher)
Option is a functional option for the Watcher.
func WithPollInterval ¶
WithPollInterval sets the interval at which the watcher will fetch instances from AWS.
func WithTriggerFetchC ¶
func WithTriggerFetchC(triggerFetchC <-chan struct{}) Option
WithTriggerFetchC sets a poll trigger to manual start a resource polling.
type SSMInstaller ¶
type SSMInstaller struct {
SSMInstallerConfig
}
SSMInstaller handles running SSM commands that install Teleport on EC2 instances.
func NewSSMInstaller ¶
func NewSSMInstaller(cfg SSMInstallerConfig) *SSMInstaller
NewSSMInstaller returns a new instance of the SSM installer that installs Teleport on EC2 instances.
func (*SSMInstaller) Run ¶
func (si *SSMInstaller) Run(ctx context.Context, req SSMRunRequest) error
Run executes the SSM document and then blocks until the command has completed.
type SSMInstallerConfig ¶
SSMInstallerConfig represents configuration for an SSM install script executor.
type SSMRunRequest ¶
type SSMRunRequest struct { // DocumentName is the name of the SSM document to run. DocumentName string // SSM is an SSM API client. SSM ssmiface.SSMAPI // Instances is the list of instances that will have the SSM // document executed on them. Instances []EC2Instance // Params is a list of parameters to include when executing the // SSM document. Params map[string]string // Region is the region instances are present in, used in audit // events. Region string // AccountID is the AWS account being used to execute the SSM document. AccountID string }
SSMRunRequest combines parameters for running SSM commands on a set of EC2 instances.
type Watcher ¶
type Watcher struct { // InstancesC can be used to consume newly discovered instances. InstancesC chan Instances // contains filtered or unexported fields }
Watcher allows callers to discover cloud instances matching specified filters.
func NewAzureWatcher ¶
func NewAzureWatcher(ctx context.Context, fetchersFn func() []Fetcher, opts ...Option) (*Watcher, error)
NewAzureWatcher creates a new Azure watcher instance.
func NewEC2Watcher ¶
func NewEC2Watcher(ctx context.Context, fetchersFn func() []Fetcher, missedRotation <-chan []types.Server, opts ...Option) (*Watcher, error)
NewEC2Watcher creates a new EC2 watcher instance.