Documentation ¶
Index ¶
- Constants
- func ApplyConfig(ccf *GlobalCLIFlags, cfg *service.Config) (*authclient.Config, error)
- func LoadConfigFromProfile(ccf *GlobalCLIFlags, cfg *service.Config) (*authclient.Config, error)
- func Run(commands []CLICommand)
- func TryRun(commands []CLICommand, args []string) error
- func UpsertVerb(exists bool, force bool) string
- type AccessRequestCommand
- func (c *AccessRequestCommand) Approve(ctx context.Context, client auth.ClientI) error
- func (c *AccessRequestCommand) Caps(ctx context.Context, client auth.ClientI) error
- func (c *AccessRequestCommand) Create(ctx context.Context, client auth.ClientI) error
- func (c *AccessRequestCommand) Delete(ctx context.Context, client auth.ClientI) error
- func (c *AccessRequestCommand) Deny(ctx context.Context, client auth.ClientI) error
- func (c *AccessRequestCommand) Get(ctx context.Context, client auth.ClientI) error
- func (c *AccessRequestCommand) Initialize(app *kingpin.Application, config *service.Config)
- func (c *AccessRequestCommand) List(ctx context.Context, client auth.ClientI) error
- func (c *AccessRequestCommand) Review(ctx context.Context, client auth.ClientI) error
- func (c *AccessRequestCommand) TryRun(ctx context.Context, cmd string, client auth.ClientI) (match bool, err error)
- type AlertCommand
- func (c *AlertCommand) Create(ctx context.Context, client auth.ClientI) error
- func (c *AlertCommand) Initialize(app *kingpin.Application, config *service.Config)
- func (c *AlertCommand) List(ctx context.Context, client auth.ClientI) error
- func (c *AlertCommand) TryRun(ctx context.Context, cmd string, client auth.ClientI) (match bool, err error)
- type AppsCommand
- type AuthCommand
- func (a *AuthCommand) ExportAuthorities(ctx context.Context, client auth.ClientI) error
- func (a *AuthCommand) GenerateAndSignKeys(ctx context.Context, clusterAPI auth.ClientI) error
- func (a *AuthCommand) GenerateKeys(ctx context.Context) error
- func (a *AuthCommand) Initialize(app *kingpin.Application, config *service.Config)
- func (a *AuthCommand) ListAuthServers(ctx context.Context, clusterAPI auth.ClientI) error
- func (a *AuthCommand) RotateCertAuthority(ctx context.Context, client auth.ClientI) error
- func (a *AuthCommand) TryRun(ctx context.Context, cmd string, client auth.ClientI) (match bool, err error)
- type BackendStats
- type BotsCommand
- func (c *BotsCommand) AddBot(ctx context.Context, client auth.ClientI) error
- func (c *BotsCommand) Initialize(app *kingpin.Application, config *service.Config)
- func (c *BotsCommand) ListBots(ctx context.Context, client auth.ClientI) error
- func (c *BotsCommand) LockBot(ctx context.Context, client auth.ClientI) error
- func (c *BotsCommand) RemoveBot(ctx context.Context, client auth.ClientI) error
- func (c *BotsCommand) TryRun(ctx context.Context, cmd string, client auth.ClientI) (match bool, err error)
- type Bucket
- type CLICommand
- type ClusterStats
- type Counter
- type DBCommand
- type DesktopCommand
- type Event
- type GlobalCLIFlags
- type GoStats
- type Histogram
- type InventoryCommand
- func (c *InventoryCommand) Initialize(app *kingpin.Application, config *service.Config)
- func (c *InventoryCommand) Ping(ctx context.Context, client auth.ClientI) error
- func (c *InventoryCommand) Status(ctx context.Context, client auth.ClientI) error
- func (c *InventoryCommand) TryRun(ctx context.Context, cmd string, client auth.ClientI) (match bool, err error)
- type KubeCommand
- type LockCommand
- type NodeCommand
- func (c *NodeCommand) Initialize(app *kingpin.Application, config *service.Config)
- func (c *NodeCommand) Invite(ctx context.Context, client auth.ClientI) error
- func (c *NodeCommand) ListActive(ctx context.Context, clt auth.ClientI) error
- func (c *NodeCommand) TryRun(ctx context.Context, cmd string, client auth.ClientI) (match bool, err error)
- type Percentile
- type ProcessStats
- type ProxyCommand
- type RecordingsCommand
- type RemoteCluster
- type Report
- type Request
- type RequestKey
- type ResourceCollection
- type ResourceCommand
- func (rc *ResourceCommand) Create(ctx context.Context, client auth.ClientI) (err error)
- func (rc *ResourceCommand) Delete(ctx context.Context, client auth.ClientI) (err error)
- func (rc *ResourceCommand) Get(ctx context.Context, client auth.ClientI) error
- func (rc *ResourceCommand) GetAll(ctx context.Context, client auth.ClientI) error
- func (rc *ResourceCommand) GetMany(ctx context.Context, client auth.ClientI) error
- func (rc *ResourceCommand) GetRef() services.Ref
- func (rc *ResourceCommand) Initialize(app *kingpin.Application, config *service.Config)
- func (rc *ResourceCommand) IsDeleteSubcommand(cmd string) bool
- func (rc *ResourceCommand) IsForced() bool
- func (rc *ResourceCommand) TryRun(ctx context.Context, cmd string, client auth.ClientI) (match bool, err error)
- func (rc *ResourceCommand) Update(ctx context.Context, clt auth.ClientI) error
- type ResourceCreateHandler
- type ResourceKind
- type StatusCommand
- type TokensCommand
- func (c *TokensCommand) Add(ctx context.Context, client auth.ClientI) error
- func (c *TokensCommand) Del(ctx context.Context, client auth.ClientI) error
- func (c *TokensCommand) Initialize(app *kingpin.Application, config *service.Config)
- func (c *TokensCommand) List(ctx context.Context, client auth.ClientI) error
- func (c *TokensCommand) TryRun(ctx context.Context, cmd string, client auth.ClientI) (match bool, err error)
- type TopCommand
- type UserCommand
- func (u *UserCommand) Add(ctx context.Context, client auth.ClientI) error
- func (u *UserCommand) Delete(ctx context.Context, client auth.ClientI) error
- func (u *UserCommand) Initialize(app *kingpin.Application, config *service.Config)
- func (u *UserCommand) List(ctx context.Context, client auth.ClientI) error
- func (u *UserCommand) PrintResetPasswordToken(token types.UserToken, format string) error
- func (u *UserCommand) PrintResetPasswordTokenAsInvite(token types.UserToken, format string) error
- func (u *UserCommand) ResetPassword(ctx context.Context, client auth.ClientI) error
- func (u *UserCommand) TryRun(ctx context.Context, cmd string, client auth.ClientI) (match bool, err error)
- func (u *UserCommand) Update(ctx context.Context, client auth.ClientI) error
- type WatcherStats
Constants ¶
const ( GlobalHelpString = "Admin tool for the Teleport Access Plane" AddUserHelp = `` /* 621-byte string literal not displayed */ AddNodeHelp = `` /* 497-byte string literal not displayed */ ListNodesHelp = `Notes: SSH nodes send periodic heartbeat to the Auth service. This command prints the list of current online nodes. ` )
Variables ¶
This section is empty.
Functions ¶
func ApplyConfig ¶
func ApplyConfig(ccf *GlobalCLIFlags, cfg *service.Config) (*authclient.Config, error)
ApplyConfig takes configuration values from the config file and applies them to 'service.Config' object.
The returned authclient.Config has the credentials needed to dial the auth server.
func LoadConfigFromProfile ¶
func LoadConfigFromProfile(ccf *GlobalCLIFlags, cfg *service.Config) (*authclient.Config, error)
LoadConfigFromProfile applies config from ~/.tsh/ profile if it's present
func Run ¶
func Run(commands []CLICommand)
Run is the same as 'make'. It helps to share the code between different "distributions" like OSS or Enterprise
distribution: name of the Teleport distribution
func TryRun ¶
func TryRun(commands []CLICommand, args []string) error
TryRun is a helper function for Run to call - it runs a tctl command and returns an error. This is useful for testing tctl, because we can capture the returned error in tests.
func UpsertVerb ¶
UpsertVerb generates the correct string form of a verb based on the action taken
Types ¶
type AccessRequestCommand ¶
type AccessRequestCommand struct {
// contains filtered or unexported fields
}
AccessRequestCommand implements `tctl users` set of commands It implements CLICommand interface
func (*AccessRequestCommand) Initialize ¶
func (c *AccessRequestCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize allows AccessRequestCommand to plug itself into the CLI parser
type AlertCommand ¶
type AlertCommand struct {
// contains filtered or unexported fields
}
AlertCommand implements the `tctl alerts` family of commands.
func (*AlertCommand) Initialize ¶
func (c *AlertCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize allows AlertCommand to plug itself into the CLI parser
type AppsCommand ¶
type AppsCommand struct {
// contains filtered or unexported fields
}
AppsCommand implements "tctl apps" group of commands.
func (*AppsCommand) Initialize ¶
func (c *AppsCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize allows AppsCommand to plug itself into the CLI parser
type AuthCommand ¶
type AuthCommand struct {
// contains filtered or unexported fields
}
AuthCommand implements `tctl auth` group of commands
func (*AuthCommand) ExportAuthorities ¶
ExportAuthorities outputs the list of authorities in OpenSSH compatible formats If --type flag is given, only prints keys for CAs of this type, otherwise prints all keys
func (*AuthCommand) GenerateAndSignKeys ¶
GenerateAndSignKeys generates a new keypair and signs it for role
func (*AuthCommand) GenerateKeys ¶
func (a *AuthCommand) GenerateKeys(ctx context.Context) error
GenerateKeys generates a new keypair
func (*AuthCommand) Initialize ¶
func (a *AuthCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize allows TokenCommand to plug itself into the CLI parser
func (*AuthCommand) ListAuthServers ¶
ListAuthServers prints a list of connected auth servers
func (*AuthCommand) RotateCertAuthority ¶
RotateCertAuthority starts or restarts certificate authority rotation process
type BackendStats ¶
type BackendStats struct { // Read is a read latency histogram Read Histogram // BatchRead is a batch read latency histogram BatchRead Histogram // Write is a write latency histogram Write Histogram // BatchWrite is a batch write latency histogram BatchWrite Histogram // TopRequests is a collection of requests to // backend and their counts TopRequests map[RequestKey]Request // QueueSize is a queue size of the cache watcher QueueSize float64 }
BackendStats contains backend stats
func (*BackendStats) SortedTopRequests ¶
func (b *BackendStats) SortedTopRequests() []Request
SortedTopRequests returns top requests sorted either by frequency if frequency is present, or by count, if both frequency and count are identical then by name to preserve order
type BotsCommand ¶
type BotsCommand struct {
// contains filtered or unexported fields
}
func (*BotsCommand) Initialize ¶
func (c *BotsCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize sets up the "tctl bots" command.
func (*BotsCommand) ListBots ¶
ListBots writes a listing of the cluster's certificate renewal bots to standard out.
type Bucket ¶
type Bucket struct { // Count is a count of elements in the bucket Count int64 // UpperBound is an upper bound of the bucket UpperBound float64 }
Bucket is a histogram bucket
type CLICommand ¶
type CLICommand interface { // Initialize allows a caller-defined command to plug itself into CLI // argument parsing Initialize(*kingpin.Application, *service.Config) // TryRun is executed after the CLI parsing is done. The command must // determine if selectedCommand belongs to it and return match=true TryRun(ctx context.Context, selectedCommand string, c auth.ClientI) (match bool, err error) }
CLICommand interface must be implemented by every CLI command
This allows OSS and Enterprise Teleport editions to plug their own implementations of different CLI commands into the common execution framework
func Commands ¶
func Commands() []CLICommand
Commands returns the set of commands that are to oss and ent variants of tctl.
func OSSCommands ¶
func OSSCommands() []CLICommand
OSSCommands returns the oss variants of commands that use different variants for oss and ent.
type ClusterStats ¶
type ClusterStats struct { // InteractiveSessions is a number of active sessions. InteractiveSessions float64 // RemoteClusters is a list of remote clusters and their status. RemoteClusters []RemoteCluster // GenerateRequests is a number of active generate requests GenerateRequests float64 // GenerateRequestsCount is a total number of generate requests GenerateRequestsCount Counter // GenerateRequestThrottledCount is a total number of throttled generate // requests GenerateRequestsThrottledCount Counter // GenerateRequestsHistogram is a histogram of generate requests latencies GenerateRequestsHistogram Histogram }
ClusterStats contains some teleport specific stats
type Counter ¶
type Counter struct { // Freq is a key access frequency in requests per second Freq *float64 // Count is a last recorded count Count int64 }
Counter contains count and frequency
type DBCommand ¶
type DBCommand struct {
// contains filtered or unexported fields
}
DBCommand implements "tctl db" group of commands.
func (*DBCommand) Initialize ¶
func (c *DBCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize allows DBCommand to plug itself into the CLI parser.
func (*DBCommand) ListDatabases ¶
ListDatabases prints the list of database proxies that have recently sent heartbeats to the cluster.
type DesktopCommand ¶
type DesktopCommand struct {
// contains filtered or unexported fields
}
DesktopCommand implements "tctl desktop" group of commands.
func (*DesktopCommand) Initialize ¶
func (c *DesktopCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize allows DesktopCommand to plug itself into the CLI parser
func (*DesktopCommand) ListDesktop ¶
ListDesktop prints the list of desktops that have recently sent heartbeats to the cluster.
type Event ¶
type Event struct { // Resource is the resource of the event Resource string // Size is the size of the serialized event Size float64 // Counter maintains the count and the resource frequency Counter }
Event is a watcher event stats
func (Event) AverageSize ¶
AverageSize returns the average size for the event
type GlobalCLIFlags ¶
type GlobalCLIFlags struct { // Debug enables verbose logging mode to the console Debug bool // ConfigFile is the path to the Teleport configuration file ConfigFile string // ConfigString is the base64-encoded string with Teleport configuration ConfigString string // AuthServerAddr lists addresses of auth or proxy servers to connect to, AuthServerAddr []string // IdentityFilePath is the path to the identity file IdentityFilePath string // Insecure, when set, skips validation of server TLS certificate when // connecting through a proxy (specified in AuthServerAddr). Insecure bool }
GlobalCLIFlags keeps the CLI flags that apply to all tctl commands
type GoStats ¶
type GoStats struct { // Info is a runtime info (version, etc) Info string // Threads is a number of OS threads created. Threads float64 // Goroutines is a number of goroutines that currently exist. Goroutines float64 // Number of heap bytes allocated and still in use. HeapAllocBytes float64 // Number of bytes allocated and still in use. AllocBytes float64 // HeapObjects is a number of allocated objects. HeapObjects float64 }
GoStats is stats about go runtime
type Histogram ¶
type Histogram struct { // Count is a total number of elements counted Count int64 // Sum is sum of all elements counted Sum float64 // Buckets is a list of buckets Buckets []Bucket }
Histogram is a histogram with buckets
func (Histogram) AsPercentiles ¶
func (h Histogram) AsPercentiles() []Percentile
AsPercentiles interprets histogram as a bucket of percentiles and returns calculated percentiles
type InventoryCommand ¶
type InventoryCommand struct {
// contains filtered or unexported fields
}
InventoryCommand implements the `tctl inventory` family of commands.
func (*InventoryCommand) Initialize ¶
func (c *InventoryCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize allows AccessRequestCommand to plug itself into the CLI parser
type KubeCommand ¶
type KubeCommand struct {
// contains filtered or unexported fields
}
KubeCommand implements "tctl kube" group of commands.
func (*KubeCommand) Initialize ¶
func (c *KubeCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize allows KubeCommand to plug itself into the CLI parser
type LockCommand ¶
type LockCommand struct {
// contains filtered or unexported fields
}
LockCommand implements `tctl lock` group of commands.
func (*LockCommand) CreateLock ¶
CreateLock creates a lock for the main `tctl lock` command.
func (*LockCommand) Initialize ¶
func (c *LockCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize allows LockCommand to plug itself into the CLI parser.
type NodeCommand ¶
type NodeCommand struct {
// contains filtered or unexported fields
}
NodeCommand implements `tctl nodes` group of commands
func (*NodeCommand) Initialize ¶
func (c *NodeCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize allows NodeCommand to plug itself into the CLI parser
func (*NodeCommand) Invite ¶
Invite generates a token which can be used to add another SSH node to a cluster
func (*NodeCommand) ListActive ¶
ListActive retrieves the list of nodes who recently sent heartbeats to to a cluster and prints it to stdout
type Percentile ¶
type Percentile struct { // Percentile is a percentile value Percentile float64 // Value is a value of the percentile Value time.Duration }
Percentile is a latency percentile
type ProcessStats ¶
type ProcessStats struct { // CPUSecondsTotal is a total user and system CPU time spent in seconds. CPUSecondsTotal float64 // MaxFDs is the maximum number of open file descriptors. MaxFDs float64 // OpenFDs is a number of open file descriptors. OpenFDs float64 // ResidentMemoryBytes is a resident memory size in bytes. ResidentMemoryBytes float64 // StartTime is a process start time StartTime time.Time }
ProcessStats is a process statistics
type ProxyCommand ¶
type ProxyCommand struct {
// contains filtered or unexported fields
}
ProxyCommand returns information about connected proxies
func (*ProxyCommand) Initialize ¶
func (p *ProxyCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize creates the proxy command and subcommands
func (*ProxyCommand) ListProxies ¶
ListProxies prints currently connected proxies
type RecordingsCommand ¶
type RecordingsCommand struct {
// contains filtered or unexported fields
}
RecordingsCommand implements "tctl recordings" group of commands.
func (*RecordingsCommand) Initialize ¶
func (c *RecordingsCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize allows RecordingsCommand to plug itself into the CLI parser
func (*RecordingsCommand) ListRecordings ¶
type RemoteCluster ¶
type RemoteCluster struct { // Name is a cluster name Name string // Connected is true when cluster is connected Connected bool }
RemoteCluster is a remote cluster (or local cluster) connected to this cluster
func (RemoteCluster) IsConnected ¶
func (rc RemoteCluster) IsConnected() string
IsConnected returns user-friendly "connected" or "disconnected" cluster status
type Report ¶
type Report struct { // Version is a report version Version string // Timestamp is the date when this report has been generated Timestamp time.Time // Hostname is the hostname of the report Hostname string // Process contains process stats Process ProcessStats // Go contains go runtime stats Go GoStats // Backend is a backend stats Backend BackendStats // Cache is cache stats Cache BackendStats // Cluster is cluster stats Cluster ClusterStats // Watcher is watcher stats Watcher *WatcherStats }
Report is a report rendered over the data
type Request ¶
type Request struct { // Key is a request key Key RequestKey // Counter maintains the count and the key access frequency Counter }
Request is a backend request stats
type RequestKey ¶
type RequestKey struct { // Range is set when it's a range request Range bool // Key is a backend key and operation Key string }
RequestKey is a composite request Key
func (RequestKey) IsRange ¶
func (r RequestKey) IsRange() string
IsRange returns user-friendly "range" if request is a range request
type ResourceCollection ¶
type ResourceCollection interface {
// contains filtered or unexported methods
}
type ResourceCommand ¶
type ResourceCommand struct { CreateHandlers map[ResourceKind]ResourceCreateHandler // contains filtered or unexported fields }
ResourceCommand implements `tctl get/create/list` commands for manipulating Teleport resources
func (*ResourceCommand) GetRef ¶
func (rc *ResourceCommand) GetRef() services.Ref
GetRef returns the reference (basically type/name pair) of the resource the command is operating on
func (*ResourceCommand) Initialize ¶
func (rc *ResourceCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize allows ResourceCommand to plug itself into the CLI parser
func (*ResourceCommand) IsDeleteSubcommand ¶
func (rc *ResourceCommand) IsDeleteSubcommand(cmd string) bool
IsDeleteSubcommand returns 'true' if the given command is `tctl rm`
func (*ResourceCommand) IsForced ¶
func (rc *ResourceCommand) IsForced() bool
IsForced returns true if -f flag was passed
type ResourceCreateHandler ¶
ResourceCreateHandler is the generic implementation of a resource creation handler
type ResourceKind ¶
type ResourceKind string
ResourceKind is the string form of a resource, i.e. "oidc"
type StatusCommand ¶
type StatusCommand struct {
// contains filtered or unexported fields
}
StatusCommand implements `tctl token` group of commands.
func (*StatusCommand) Initialize ¶
func (c *StatusCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize allows StatusCommand to plug itself into the CLI parser.
type TokensCommand ¶
type TokensCommand struct {
// contains filtered or unexported fields
}
TokensCommand implements `tctl tokens` group of commands
func (*TokensCommand) Initialize ¶
func (c *TokensCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize allows TokenCommand to plug itself into the CLI parser
type TopCommand ¶
type TopCommand struct {
// contains filtered or unexported fields
}
TopCommand implements `tctl top` group of commands.
func (*TopCommand) Initialize ¶
func (c *TopCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize allows TopCommand to plug itself into the CLI parser.
type UserCommand ¶
type UserCommand struct {
// contains filtered or unexported fields
}
UserCommand implements `tctl users` set of commands It implements CLICommand interface
func (*UserCommand) Add ¶
Add implements `tctl users add` for the enterprise edition. Unlike the OSS version, this one requires --roles flag to be set
func (*UserCommand) Delete ¶
Delete deletes teleport user(s). User IDs are passed as a comma-separated list in UserCommand.login
func (*UserCommand) Initialize ¶
func (u *UserCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize allows UserCommand to plug itself into the CLI parser
func (*UserCommand) PrintResetPasswordToken ¶
func (u *UserCommand) PrintResetPasswordToken(token types.UserToken, format string) error
PrintResetPasswordToken prints ResetPasswordToken
func (*UserCommand) PrintResetPasswordTokenAsInvite ¶
func (u *UserCommand) PrintResetPasswordTokenAsInvite(token types.UserToken, format string) error
PrintResetPasswordTokenAsInvite prints ResetPasswordToken as Invite
func (*UserCommand) ResetPassword ¶
ResetPassword resets user password and generates a token to setup new password
type WatcherStats ¶
type WatcherStats struct { // EventSize is an event size histogram EventSize Histogram // TopEvents is a collection of resources to their events TopEvents map[string]Event // EventsPerSecond is the events per sec buffer EventsPerSecond *utils.CircularBuffer // BytesPerSecond is the bytes per sec buffer BytesPerSecond *utils.CircularBuffer }
WatcherStats contains watcher stats
func (*WatcherStats) SortedTopEvents ¶
func (b *WatcherStats) SortedTopEvents() []Event
SortedTopEvents returns top events sorted either by frequency if frequency is present, or by count, if both frequency and count are identical then by name to preserve order
Source Files ¶
- access_request_command.go
- alert_command.go
- app_command.go
- auth_command.go
- bots_command.go
- cmds.go
- collection.go
- db_command.go
- desktop_command.go
- inventory_command.go
- kube_command.go
- lock_command.go
- node_command.go
- proxy_command.go
- recordings_command.go
- resource_command.go
- status_command.go
- tctl.go
- token_command.go
- top_command.go
- usage.go
- user_command.go