Documentation ¶
Index ¶
- Constants
- func Run(commands []CLICommand)
- func UpsertVerb(exists bool, force bool) string
- type AccessRequestCommand
- func (c *AccessRequestCommand) Approve(client auth.ClientI) error
- func (c *AccessRequestCommand) Create(client auth.ClientI) error
- func (c *AccessRequestCommand) Delete(client auth.ClientI) error
- func (c *AccessRequestCommand) Deny(client auth.ClientI) error
- func (c *AccessRequestCommand) Initialize(app *kingpin.Application, config *service.Config)
- func (c *AccessRequestCommand) List(client auth.ClientI) error
- func (c *AccessRequestCommand) PrintAccessRequests(client auth.ClientI, reqs []services.AccessRequest, format string) error
- func (c *AccessRequestCommand) TryRun(cmd string, client auth.ClientI) (match bool, err error)
- type AuthCommand
- func (a *AuthCommand) ExportAuthorities(client auth.ClientI) error
- func (a *AuthCommand) GenerateAndSignKeys(clusterApi auth.ClientI) error
- func (a *AuthCommand) GenerateKeys() error
- func (a *AuthCommand) Initialize(app *kingpin.Application, config *service.Config)
- func (a *AuthCommand) RotateCertAuthority(client auth.ClientI) error
- func (a *AuthCommand) TryRun(cmd string, client auth.ClientI) (match bool, err error)
- type BackendStats
- type Bucket
- type CLICommand
- type ClusterStats
- type Counter
- type GlobalCLIFlags
- type GoStats
- type Histogram
- type NodeCommand
- type Percentile
- type ProcessStats
- type RemoteCluster
- type Report
- type Request
- type RequestKey
- type ResourceCollection
- type ResourceCommand
- func (rc *ResourceCommand) Create(client auth.ClientI) error
- func (rc *ResourceCommand) Delete(client auth.ClientI) (err error)
- func (rc *ResourceCommand) Get(client auth.ClientI) error
- func (rc *ResourceCommand) GetAll(client auth.ClientI) error
- func (rc *ResourceCommand) GetMany(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(cmd string, client auth.ClientI) (match bool, err error)
- type ResourceCreateHandler
- type ResourceKind
- type StatusCommand
- type TokenCommand
- func (c *TokenCommand) Add(client auth.ClientI) error
- func (c *TokenCommand) Del(client auth.ClientI) error
- func (c *TokenCommand) Initialize(app *kingpin.Application, config *service.Config)
- func (c *TokenCommand) List(client auth.ClientI) error
- func (c *TokenCommand) TryRun(cmd string, client auth.ClientI) (match bool, err error)
- type TopCommand
- type UserCommand
- func (u *UserCommand) Add(client auth.ClientI) error
- func (u *UserCommand) Delete(client auth.ClientI) error
- func (u *UserCommand) Initialize(app *kingpin.Application, config *service.Config)
- func (u *UserCommand) List(client auth.ClientI) error
- func (u *UserCommand) PrintSignupURL(client auth.ClientI, token string, ttl time.Duration, format string) error
- func (u *UserCommand) TryRun(cmd string, client auth.ClientI) (match bool, err error)
- func (u *UserCommand) Update(client auth.ClientI) error
Constants ¶
const ( GlobalHelpString = "CLI Admin tool for the Teleport Auth service. Runs on a host where Teleport Auth is running." AddUserHelp = `` /* 621-byte string literal not displayed */ AddNodeHelp = `` /* 501-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 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 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) Approve ¶
func (c *AccessRequestCommand) Approve(client auth.ClientI) error
func (*AccessRequestCommand) Create ¶
func (c *AccessRequestCommand) Create(client auth.ClientI) error
func (*AccessRequestCommand) Delete ¶
func (c *AccessRequestCommand) Delete(client auth.ClientI) error
func (*AccessRequestCommand) Initialize ¶
func (c *AccessRequestCommand) Initialize(app *kingpin.Application, config *service.Config)
Initialize allows AccessRequestCommand to plug itself into the CLI parser
func (*AccessRequestCommand) PrintAccessRequests ¶
func (c *AccessRequestCommand) PrintAccessRequests(client auth.ClientI, reqs []services.AccessRequest, format string) error
PrintAccessRequests prints access requests
type AuthCommand ¶
type AuthCommand struct {
// contains filtered or unexported fields
}
AuthCommand implements `tctl auth` group of commands
func (*AuthCommand) ExportAuthorities ¶
func (a *AuthCommand) ExportAuthorities(client auth.ClientI) error
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 ¶
func (a *AuthCommand) GenerateAndSignKeys(clusterApi auth.ClientI) error
GenerateAndSignKeys generates a new keypair and signs it for role
func (*AuthCommand) GenerateKeys ¶
func (a *AuthCommand) GenerateKeys() 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) RotateCertAuthority ¶
func (a *AuthCommand) RotateCertAuthority(client auth.ClientI) error
RotateCertAuthority starts or restarts certificate authority rotation process
type BackendStats ¶
type BackendStats struct { // Read is a read latency historgram 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 otherwise
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(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
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 specifc 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 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 servers to connect to AuthServerAddr []string // IdentityFilePath is the path to the identity file IdentityFilePath string }
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 // Buckets is a list of buckets Buckets []Bucket }
Histogram is a histogram with buckets
func (Histogram) AsPercentiles ¶
func (h Histogram) AsPercentiles() []Percentile
AsPercentiles interprets historgram as a bucket of percentiles and returns calculated percentiles
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 ¶
func (c *NodeCommand) Invite(client auth.ClientI) error
Invite generates a token which can be used to add another SSH node to a cluster
func (*NodeCommand) ListActive ¶
func (c *NodeCommand) ListActive(client auth.ClientI) error
ListActive retreives 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 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 }
Report is a report rendered over the data
type Request ¶
type Request struct { // Key is a request key Key RequestKey // Freq is a key access frequency Freq *float64 // Count is a last recorded count Count int64 }
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) Create ¶
func (rc *ResourceCommand) Create(client auth.ClientI) error
Create updates or inserts one or many resources
func (*ResourceCommand) Delete ¶
func (rc *ResourceCommand) Delete(client auth.ClientI) (err error)
Delete deletes resource by name
func (*ResourceCommand) Get ¶
func (rc *ResourceCommand) Get(client auth.ClientI) error
Get prints one or many resources of a certain type
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 ¶
type ResourceCreateHandler func(auth.ClientI, services.UnknownResource) error
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 TokenCommand ¶
type TokenCommand struct {
// contains filtered or unexported fields
}
TokenCommand implements `tctl token` group of commands
func (*TokenCommand) Add ¶
func (c *TokenCommand) Add(client auth.ClientI) error
Add is called to execute "tokens add ..." command.
func (*TokenCommand) Del ¶
func (c *TokenCommand) Del(client auth.ClientI) error
Del is called to execute "tokens del ..." command.
func (*TokenCommand) Initialize ¶
func (c *TokenCommand) 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 token` 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 ¶
func (u *UserCommand) Add(client auth.ClientI) error
Add creates a new sign-up token and prints a token URL to stdout. A user is not created until he visits the sign-up URL and completes the process
func (*UserCommand) Delete ¶
func (u *UserCommand) Delete(client auth.ClientI) error
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) List ¶
func (u *UserCommand) List(client auth.ClientI) error
List prints all existing user accounts
func (*UserCommand) PrintSignupURL ¶
func (u *UserCommand) PrintSignupURL(client auth.ClientI, token string, ttl time.Duration, format string) error
PrintSignupURL prints signup URL