id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
23,600
gravitational/teleport
lib/client/api.go
Play
func (tc *TeleportClient) Play(ctx context.Context, namespace, sessionId string) (err error) { if namespace == "" { return trace.BadParameter(auth.MissingNamespaceError) } sid, err := session.ParseID(sessionId) if err != nil { return fmt.Errorf("'%v' is not a valid session ID (must be GUID)", sid) } // connec...
go
func (tc *TeleportClient) Play(ctx context.Context, namespace, sessionId string) (err error) { if namespace == "" { return trace.BadParameter(auth.MissingNamespaceError) } sid, err := session.ParseID(sessionId) if err != nil { return fmt.Errorf("'%v' is not a valid session ID (must be GUID)", sid) } // connec...
[ "func", "(", "tc", "*", "TeleportClient", ")", "Play", "(", "ctx", "context", ".", "Context", ",", "namespace", ",", "sessionId", "string", ")", "(", "err", "error", ")", "{", "if", "namespace", "==", "\"", "\"", "{", "return", "trace", ".", "BadParame...
// Play replays the recorded session
[ "Play", "replays", "the", "recorded", "session" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1019-L1108
23,601
gravitational/teleport
lib/client/api.go
ExecuteSCP
func (tc *TeleportClient) ExecuteSCP(ctx context.Context, cmd scp.Command) (err error) { // connect to proxy first: if !tc.Config.ProxySpecified() { return trace.BadParameter("proxy server is not specified") } proxyClient, err := tc.ConnectToProxy(ctx) if err != nil { return trace.Wrap(err) } defer proxyCli...
go
func (tc *TeleportClient) ExecuteSCP(ctx context.Context, cmd scp.Command) (err error) { // connect to proxy first: if !tc.Config.ProxySpecified() { return trace.BadParameter("proxy server is not specified") } proxyClient, err := tc.ConnectToProxy(ctx) if err != nil { return trace.Wrap(err) } defer proxyCli...
[ "func", "(", "tc", "*", "TeleportClient", ")", "ExecuteSCP", "(", "ctx", "context", ".", "Context", ",", "cmd", "scp", ".", "Command", ")", "(", "err", "error", ")", "{", "// connect to proxy first:", "if", "!", "tc", ".", "Config", ".", "ProxySpecified", ...
// ExecuteSCP executes SCP command. It executes scp.Command using // lower-level API integrations that mimic SCP CLI command behavior
[ "ExecuteSCP", "executes", "SCP", "command", ".", "It", "executes", "scp", ".", "Command", "using", "lower", "-", "level", "API", "integrations", "that", "mimic", "SCP", "CLI", "command", "behavior" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1112-L1160
23,602
gravitational/teleport
lib/client/api.go
ListNodes
func (tc *TeleportClient) ListNodes(ctx context.Context) ([]services.Server, error) { var err error // userhost is specified? that must be labels if tc.Host != "" { tc.Labels, err = ParseLabelSpec(tc.Host) if err != nil { return nil, trace.Wrap(err) } } // connect to the proxy and ask it to return a full...
go
func (tc *TeleportClient) ListNodes(ctx context.Context) ([]services.Server, error) { var err error // userhost is specified? that must be labels if tc.Host != "" { tc.Labels, err = ParseLabelSpec(tc.Host) if err != nil { return nil, trace.Wrap(err) } } // connect to the proxy and ask it to return a full...
[ "func", "(", "tc", "*", "TeleportClient", ")", "ListNodes", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "services", ".", "Server", ",", "error", ")", "{", "var", "err", "error", "\n", "// userhost is specified? that must be labels", "if", "tc"...
// ListNodes returns a list of nodes connected to a proxy
[ "ListNodes", "returns", "a", "list", "of", "nodes", "connected", "to", "a", "proxy" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1295-L1313
23,603
gravitational/teleport
lib/client/api.go
runCommand
func (tc *TeleportClient) runCommand( ctx context.Context, siteName string, nodeAddresses []string, proxyClient *ProxyClient, command []string) error { resultsC := make(chan error, len(nodeAddresses)) for _, address := range nodeAddresses { go func(address string) { var ( err error nodeSession ...
go
func (tc *TeleportClient) runCommand( ctx context.Context, siteName string, nodeAddresses []string, proxyClient *ProxyClient, command []string) error { resultsC := make(chan error, len(nodeAddresses)) for _, address := range nodeAddresses { go func(address string) { var ( err error nodeSession ...
[ "func", "(", "tc", "*", "TeleportClient", ")", "runCommand", "(", "ctx", "context", ".", "Context", ",", "siteName", "string", ",", "nodeAddresses", "[", "]", "string", ",", "proxyClient", "*", "ProxyClient", ",", "command", "[", "]", "string", ")", "error...
// runCommand executes a given bash command on a bunch of remote nodes
[ "runCommand", "executes", "a", "given", "bash", "command", "on", "a", "bunch", "of", "remote", "nodes" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1316-L1370
23,604
gravitational/teleport
lib/client/api.go
getProxySSHPrincipal
func (tc *TeleportClient) getProxySSHPrincipal() string { proxyPrincipal := tc.Config.HostLogin if tc.DefaultPrincipal != "" { proxyPrincipal = tc.DefaultPrincipal } // see if we already have a signed key in the cache, we'll use that instead if !tc.Config.SkipLocalAuth && tc.LocalAgent() != nil { signers, err ...
go
func (tc *TeleportClient) getProxySSHPrincipal() string { proxyPrincipal := tc.Config.HostLogin if tc.DefaultPrincipal != "" { proxyPrincipal = tc.DefaultPrincipal } // see if we already have a signed key in the cache, we'll use that instead if !tc.Config.SkipLocalAuth && tc.LocalAgent() != nil { signers, err ...
[ "func", "(", "tc", "*", "TeleportClient", ")", "getProxySSHPrincipal", "(", ")", "string", "{", "proxyPrincipal", ":=", "tc", ".", "Config", ".", "HostLogin", "\n", "if", "tc", ".", "DefaultPrincipal", "!=", "\"", "\"", "{", "proxyPrincipal", "=", "tc", "....
// getProxyLogin determines which SSH principal to use when connecting to proxy.
[ "getProxyLogin", "determines", "which", "SSH", "principal", "to", "use", "when", "connecting", "to", "proxy", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1391-L1408
23,605
gravitational/teleport
lib/client/api.go
ConnectToProxy
func (tc *TeleportClient) ConnectToProxy(ctx context.Context) (*ProxyClient, error) { var err error var proxyClient *ProxyClient // Use connectContext and the cancel function to signal when a response is // returned from connectToProxy. connectContext, cancel := context.WithCancel(context.Background()) go func()...
go
func (tc *TeleportClient) ConnectToProxy(ctx context.Context) (*ProxyClient, error) { var err error var proxyClient *ProxyClient // Use connectContext and the cancel function to signal when a response is // returned from connectToProxy. connectContext, cancel := context.WithCancel(context.Background()) go func()...
[ "func", "(", "tc", "*", "TeleportClient", ")", "ConnectToProxy", "(", "ctx", "context", ".", "Context", ")", "(", "*", "ProxyClient", ",", "error", ")", "{", "var", "err", "error", "\n", "var", "proxyClient", "*", "ProxyClient", "\n\n", "// Use connectContex...
// ConnectToProxy will dial to the proxy server and return a ProxyClient when // successful. If the passed in context is canceled, this function will return // a trace.ConnectionProblem right away.
[ "ConnectToProxy", "will", "dial", "to", "the", "proxy", "server", "and", "return", "a", "ProxyClient", "when", "successful", ".", "If", "the", "passed", "in", "context", "is", "canceled", "this", "function", "will", "return", "a", "trace", ".", "ConnectionProb...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1423-L1444
23,606
gravitational/teleport
lib/client/api.go
connectToProxy
func (tc *TeleportClient) connectToProxy(ctx context.Context) (*ProxyClient, error) { var err error proxyPrincipal := tc.getProxySSHPrincipal() sshConfig := &ssh.ClientConfig{ User: proxyPrincipal, HostKeyCallback: tc.HostKeyCallback, } // helper to create a ProxyClient struct makeProxyClient := ...
go
func (tc *TeleportClient) connectToProxy(ctx context.Context) (*ProxyClient, error) { var err error proxyPrincipal := tc.getProxySSHPrincipal() sshConfig := &ssh.ClientConfig{ User: proxyPrincipal, HostKeyCallback: tc.HostKeyCallback, } // helper to create a ProxyClient struct makeProxyClient := ...
[ "func", "(", "tc", "*", "TeleportClient", ")", "connectToProxy", "(", "ctx", "context", ".", "Context", ")", "(", "*", "ProxyClient", ",", "error", ")", "{", "var", "err", "error", "\n\n", "proxyPrincipal", ":=", "tc", ".", "getProxySSHPrincipal", "(", ")"...
// connectToProxy will dial to the proxy server and return a ProxyClient when // successful.
[ "connectToProxy", "will", "dial", "to", "the", "proxy", "server", "and", "return", "a", "ProxyClient", "when", "successful", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1448-L1491
23,607
gravitational/teleport
lib/client/api.go
Logout
func (tc *TeleportClient) Logout() error { err := tc.localAgent.DeleteKey() if err != nil { return trace.Wrap(err) } return nil }
go
func (tc *TeleportClient) Logout() error { err := tc.localAgent.DeleteKey() if err != nil { return trace.Wrap(err) } return nil }
[ "func", "(", "tc", "*", "TeleportClient", ")", "Logout", "(", ")", "error", "{", "err", ":=", "tc", ".", "localAgent", ".", "DeleteKey", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "trace", ".", "Wrap", "(", "err", ")", "\n", "}", "\...
// Logout removes certificate and key for the currently logged in user from // the filesystem and agent.
[ "Logout", "removes", "certificate", "and", "key", "for", "the", "currently", "logged", "in", "user", "from", "the", "filesystem", "and", "agent", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1495-L1502
23,608
gravitational/teleport
lib/client/api.go
LogoutAll
func (tc *TeleportClient) LogoutAll() error { err := tc.localAgent.DeleteKeys() if err != nil { return trace.Wrap(err) } return nil }
go
func (tc *TeleportClient) LogoutAll() error { err := tc.localAgent.DeleteKeys() if err != nil { return trace.Wrap(err) } return nil }
[ "func", "(", "tc", "*", "TeleportClient", ")", "LogoutAll", "(", ")", "error", "{", "err", ":=", "tc", ".", "localAgent", ".", "DeleteKeys", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "trace", ".", "Wrap", "(", "err", ")", "\n", "}", ...
// LogoutAll removes all certificates for all users from the filesystem // and agent.
[ "LogoutAll", "removes", "all", "certificates", "for", "all", "users", "from", "the", "filesystem", "and", "agent", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1506-L1512
23,609
gravitational/teleport
lib/client/api.go
GetTrustedCA
func (tc *TeleportClient) GetTrustedCA(ctx context.Context, clusterName string) ([]services.CertAuthority, error) { // Connect to the proxy. if !tc.Config.ProxySpecified() { return nil, trace.BadParameter("proxy server is not specified") } proxyClient, err := tc.ConnectToProxy(ctx) if err != nil { return nil, ...
go
func (tc *TeleportClient) GetTrustedCA(ctx context.Context, clusterName string) ([]services.CertAuthority, error) { // Connect to the proxy. if !tc.Config.ProxySpecified() { return nil, trace.BadParameter("proxy server is not specified") } proxyClient, err := tc.ConnectToProxy(ctx) if err != nil { return nil, ...
[ "func", "(", "tc", "*", "TeleportClient", ")", "GetTrustedCA", "(", "ctx", "context", ".", "Context", ",", "clusterName", "string", ")", "(", "[", "]", "services", ".", "CertAuthority", ",", "error", ")", "{", "// Connect to the proxy.", "if", "!", "tc", "...
// GetTrustedCA returns a list of host certificate authorities // trusted by the cluster client is authenticated with.
[ "GetTrustedCA", "returns", "a", "list", "of", "host", "certificate", "authorities", "trusted", "by", "the", "cluster", "client", "is", "authenticated", "with", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1631-L1650
23,610
gravitational/teleport
lib/client/api.go
applyProxySettings
func (tc *TeleportClient) applyProxySettings(proxySettings ProxySettings) error { // Kubernetes proxy settings. if proxySettings.Kube.Enabled && proxySettings.Kube.PublicAddr != "" && tc.KubeProxyAddr == "" { _, err := utils.ParseAddr(proxySettings.Kube.PublicAddr) if err != nil { return trace.BadParameter( ...
go
func (tc *TeleportClient) applyProxySettings(proxySettings ProxySettings) error { // Kubernetes proxy settings. if proxySettings.Kube.Enabled && proxySettings.Kube.PublicAddr != "" && tc.KubeProxyAddr == "" { _, err := utils.ParseAddr(proxySettings.Kube.PublicAddr) if err != nil { return trace.BadParameter( ...
[ "func", "(", "tc", "*", "TeleportClient", ")", "applyProxySettings", "(", "proxySettings", "ProxySettings", ")", "error", "{", "// Kubernetes proxy settings.", "if", "proxySettings", ".", "Kube", ".", "Enabled", "&&", "proxySettings", ".", "Kube", ".", "PublicAddr",...
// applyProxySettings updates configuration changes based on the advertised // proxy settings, user supplied values take precedence - will be preserved // if set
[ "applyProxySettings", "updates", "configuration", "changes", "based", "on", "the", "advertised", "proxy", "settings", "user", "supplied", "values", "take", "precedence", "-", "will", "be", "preserved", "if", "set" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1681-L1738
23,611
gravitational/teleport
lib/client/api.go
AddTrustedCA
func (tc *TeleportClient) AddTrustedCA(ca services.CertAuthority) error { err := tc.LocalAgent().AddHostSignersToCache(auth.AuthoritiesToTrustedCerts([]services.CertAuthority{ca})) if err != nil { return trace.Wrap(err) } // only host CA has TLS certificates, user CA will overwrite trusted certs // to empty fil...
go
func (tc *TeleportClient) AddTrustedCA(ca services.CertAuthority) error { err := tc.LocalAgent().AddHostSignersToCache(auth.AuthoritiesToTrustedCerts([]services.CertAuthority{ca})) if err != nil { return trace.Wrap(err) } // only host CA has TLS certificates, user CA will overwrite trusted certs // to empty fil...
[ "func", "(", "tc", "*", "TeleportClient", ")", "AddTrustedCA", "(", "ca", "services", ".", "CertAuthority", ")", "error", "{", "err", ":=", "tc", ".", "LocalAgent", "(", ")", ".", "AddHostSignersToCache", "(", "auth", ".", "AuthoritiesToTrustedCerts", "(", "...
// Adds a new CA as trusted CA for this client, used in tests
[ "Adds", "a", "new", "CA", "as", "trusted", "CA", "for", "this", "client", "used", "in", "tests" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1763-L1779
23,612
gravitational/teleport
lib/client/api.go
directLogin
func (tc *TeleportClient) directLogin(ctx context.Context, secondFactorType string, pub []byte) (*auth.SSHLoginResponse, error) { var err error var password string var otpToken string password, err = tc.AskPassword() if err != nil { return nil, trace.Wrap(err) } // only ask for a second factor if it's enabl...
go
func (tc *TeleportClient) directLogin(ctx context.Context, secondFactorType string, pub []byte) (*auth.SSHLoginResponse, error) { var err error var password string var otpToken string password, err = tc.AskPassword() if err != nil { return nil, trace.Wrap(err) } // only ask for a second factor if it's enabl...
[ "func", "(", "tc", "*", "TeleportClient", ")", "directLogin", "(", "ctx", "context", ".", "Context", ",", "secondFactorType", "string", ",", "pub", "[", "]", "byte", ")", "(", "*", "auth", ".", "SSHLoginResponse", ",", "error", ")", "{", "var", "err", ...
// directLogin asks for a password + HOTP token, makes a request to CA via proxy
[ "directLogin", "asks", "for", "a", "password", "+", "HOTP", "token", "makes", "a", "request", "to", "CA", "via", "proxy" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1786-L1816
23,613
gravitational/teleport
lib/client/api.go
ssoLogin
func (tc *TeleportClient) ssoLogin(ctx context.Context, connectorID string, pub []byte, protocol string) (*auth.SSHLoginResponse, error) { log.Debugf("samlLogin start") // ask the CA (via proxy) to sign our public key: response, err := tc.credClient.SSHAgentSSOLogin(SSHLogin{ Context: ctx, ConnectorID: c...
go
func (tc *TeleportClient) ssoLogin(ctx context.Context, connectorID string, pub []byte, protocol string) (*auth.SSHLoginResponse, error) { log.Debugf("samlLogin start") // ask the CA (via proxy) to sign our public key: response, err := tc.credClient.SSHAgentSSOLogin(SSHLogin{ Context: ctx, ConnectorID: c...
[ "func", "(", "tc", "*", "TeleportClient", ")", "ssoLogin", "(", "ctx", "context", ".", "Context", ",", "connectorID", "string", ",", "pub", "[", "]", "byte", ",", "protocol", "string", ")", "(", "*", "auth", ".", "SSHLoginResponse", ",", "error", ")", ...
// samlLogin opens browser window and uses OIDC or SAML redirect cycle with browser
[ "samlLogin", "opens", "browser", "window", "and", "uses", "OIDC", "or", "SAML", "redirect", "cycle", "with", "browser" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1819-L1832
23,614
gravitational/teleport
lib/client/api.go
u2fLogin
func (tc *TeleportClient) u2fLogin(ctx context.Context, pub []byte) (*auth.SSHLoginResponse, error) { // U2F login requires the official u2f-host executable _, err := exec.LookPath("u2f-host") if err != nil { return nil, trace.Wrap(err) } password, err := tc.AskPassword() if err != nil { return nil, trace.Wr...
go
func (tc *TeleportClient) u2fLogin(ctx context.Context, pub []byte) (*auth.SSHLoginResponse, error) { // U2F login requires the official u2f-host executable _, err := exec.LookPath("u2f-host") if err != nil { return nil, trace.Wrap(err) } password, err := tc.AskPassword() if err != nil { return nil, trace.Wr...
[ "func", "(", "tc", "*", "TeleportClient", ")", "u2fLogin", "(", "ctx", "context", ".", "Context", ",", "pub", "[", "]", "byte", ")", "(", "*", "auth", ".", "SSHLoginResponse", ",", "error", ")", "{", "// U2F login requires the official u2f-host executable", "_...
// directLogin asks for a password and performs the challenge-response authentication
[ "directLogin", "asks", "for", "a", "password", "and", "performs", "the", "challenge", "-", "response", "authentication" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1835-L1856
23,615
gravitational/teleport
lib/client/api.go
SendEvent
func (tc *TeleportClient) SendEvent(ctx context.Context, e events.EventFields) error { // Try and send the event to the eventsCh. If blocking, keep blocking until // the passed in context in canceled. select { case tc.eventsCh <- e: return nil case <-ctx.Done(): return trace.Wrap(ctx.Err()) } }
go
func (tc *TeleportClient) SendEvent(ctx context.Context, e events.EventFields) error { // Try and send the event to the eventsCh. If blocking, keep blocking until // the passed in context in canceled. select { case tc.eventsCh <- e: return nil case <-ctx.Done(): return trace.Wrap(ctx.Err()) } }
[ "func", "(", "tc", "*", "TeleportClient", ")", "SendEvent", "(", "ctx", "context", ".", "Context", ",", "e", "events", ".", "EventFields", ")", "error", "{", "// Try and send the event to the eventsCh. If blocking, keep blocking until", "// the passed in context in canceled...
// SendEvent adds a events.EventFields to the channel.
[ "SendEvent", "adds", "a", "events", ".", "EventFields", "to", "the", "channel", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1859-L1868
23,616
gravitational/teleport
lib/client/api.go
loopbackPool
func loopbackPool(proxyAddr string) *x509.CertPool { if !utils.IsLoopback(proxyAddr) { log.Debugf("not using loopback pool for remote proxy addr: %v", proxyAddr) return nil } log.Debugf("attempting to use loopback pool for local proxy addr: %v", proxyAddr) certPool := x509.NewCertPool() certPath := filepath.J...
go
func loopbackPool(proxyAddr string) *x509.CertPool { if !utils.IsLoopback(proxyAddr) { log.Debugf("not using loopback pool for remote proxy addr: %v", proxyAddr) return nil } log.Debugf("attempting to use loopback pool for local proxy addr: %v", proxyAddr) certPool := x509.NewCertPool() certPath := filepath.J...
[ "func", "loopbackPool", "(", "proxyAddr", "string", ")", "*", "x509", ".", "CertPool", "{", "if", "!", "utils", ".", "IsLoopback", "(", "proxyAddr", ")", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "proxyAddr", ")", "\n", "return", "nil", "\n", ...
// loopbackPool reads trusted CAs if it finds it in a predefined location // and will work only if target proxy address is loopback
[ "loopbackPool", "reads", "trusted", "CAs", "if", "it", "finds", "it", "in", "a", "predefined", "location", "and", "will", "work", "only", "if", "target", "proxy", "address", "is", "loopback" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1878-L1908
23,617
gravitational/teleport
lib/client/api.go
connectToSSHAgent
func connectToSSHAgent() agent.Agent { socketPath := os.Getenv(teleport.SSHAuthSock) conn, err := agentconn.Dial(socketPath) if err != nil { log.Errorf("[KEY AGENT] Unable to connect to SSH agent on socket: %q.", socketPath) return nil } log.Infof("[KEY AGENT] Connected to the system agent: %q", socketPath) ...
go
func connectToSSHAgent() agent.Agent { socketPath := os.Getenv(teleport.SSHAuthSock) conn, err := agentconn.Dial(socketPath) if err != nil { log.Errorf("[KEY AGENT] Unable to connect to SSH agent on socket: %q.", socketPath) return nil } log.Infof("[KEY AGENT] Connected to the system agent: %q", socketPath) ...
[ "func", "connectToSSHAgent", "(", ")", "agent", ".", "Agent", "{", "socketPath", ":=", "os", ".", "Getenv", "(", "teleport", ".", "SSHAuthSock", ")", "\n", "conn", ",", "err", ":=", "agentconn", ".", "Dial", "(", "socketPath", ")", "\n", "if", "err", "...
// connectToSSHAgent connects to the local SSH agent and returns a agent.Agent.
[ "connectToSSHAgent", "connects", "to", "the", "local", "SSH", "agent", "and", "returns", "a", "agent", ".", "Agent", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1911-L1921
23,618
gravitational/teleport
lib/client/api.go
Username
func Username() (string, error) { u, err := user.Current() if err != nil { return "", trace.Wrap(err) } return u.Username, nil }
go
func Username() (string, error) { u, err := user.Current() if err != nil { return "", trace.Wrap(err) } return u.Username, nil }
[ "func", "Username", "(", ")", "(", "string", ",", "error", ")", "{", "u", ",", "err", ":=", "user", ".", "Current", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "trace", ".", "Wrap", "(", "err", ")", "\n", "}", "\...
// Username returns the current user's username
[ "Username", "returns", "the", "current", "user", "s", "username" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1924-L1930
23,619
gravitational/teleport
lib/client/api.go
AskOTP
func (tc *TeleportClient) AskOTP() (token string, err error) { fmt.Printf("Enter your OTP token:\n") token, err = lineFromConsole() if err != nil { fmt.Fprintln(tc.Stderr, err) return "", trace.Wrap(err) } return token, nil }
go
func (tc *TeleportClient) AskOTP() (token string, err error) { fmt.Printf("Enter your OTP token:\n") token, err = lineFromConsole() if err != nil { fmt.Fprintln(tc.Stderr, err) return "", trace.Wrap(err) } return token, nil }
[ "func", "(", "tc", "*", "TeleportClient", ")", "AskOTP", "(", ")", "(", "token", "string", ",", "err", "error", ")", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ")", "\n", "token", ",", "err", "=", "lineFromConsole", "(", ")", "\n", "if", ...
// AskOTP prompts the user to enter the OTP token.
[ "AskOTP", "prompts", "the", "user", "to", "enter", "the", "OTP", "token", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1933-L1941
23,620
gravitational/teleport
lib/client/api.go
AskPassword
func (tc *TeleportClient) AskPassword() (pwd string, err error) { fmt.Printf("Enter password for Teleport user %v:\n", tc.Config.Username) pwd, err = passwordFromConsole() if err != nil { fmt.Fprintln(tc.Stderr, err) return "", trace.Wrap(err) } return pwd, nil }
go
func (tc *TeleportClient) AskPassword() (pwd string, err error) { fmt.Printf("Enter password for Teleport user %v:\n", tc.Config.Username) pwd, err = passwordFromConsole() if err != nil { fmt.Fprintln(tc.Stderr, err) return "", trace.Wrap(err) } return pwd, nil }
[ "func", "(", "tc", "*", "TeleportClient", ")", "AskPassword", "(", ")", "(", "pwd", "string", ",", "err", "error", ")", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "tc", ".", "Config", ".", "Username", ")", "\n", "pwd", ",", "err", "=...
// AskPassword prompts the user to enter the password
[ "AskPassword", "prompts", "the", "user", "to", "enter", "the", "password" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1944-L1953
23,621
gravitational/teleport
lib/client/api.go
passwordFromConsole
func passwordFromConsole() (string, error) { fd := syscall.Stdin state, err := terminal.GetState(int(fd)) // intercept Ctr+C and restore terminal sigCh := make(chan os.Signal, 1) closeCh := make(chan int) if err != nil { log.Warnf("failed reading terminal state: %v", err) } else { signal.Notify(sigCh, sysca...
go
func passwordFromConsole() (string, error) { fd := syscall.Stdin state, err := terminal.GetState(int(fd)) // intercept Ctr+C and restore terminal sigCh := make(chan os.Signal, 1) closeCh := make(chan int) if err != nil { log.Warnf("failed reading terminal state: %v", err) } else { signal.Notify(sigCh, sysca...
[ "func", "passwordFromConsole", "(", ")", "(", "string", ",", "error", ")", "{", "fd", ":=", "syscall", ".", "Stdin", "\n", "state", ",", "err", ":=", "terminal", ".", "GetState", "(", "int", "(", "fd", ")", ")", "\n\n", "// intercept Ctr+C and restore term...
// passwordFromConsole reads from stdin without echoing typed characters to stdout
[ "passwordFromConsole", "reads", "from", "stdin", "without", "echoing", "typed", "characters", "to", "stdout" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1956-L1982
23,622
gravitational/teleport
lib/client/api.go
lineFromConsole
func lineFromConsole() (string, error) { bytes, _, err := bufio.NewReader(os.Stdin).ReadLine() return string(bytes), err }
go
func lineFromConsole() (string, error) { bytes, _, err := bufio.NewReader(os.Stdin).ReadLine() return string(bytes), err }
[ "func", "lineFromConsole", "(", ")", "(", "string", ",", "error", ")", "{", "bytes", ",", "_", ",", "err", ":=", "bufio", ".", "NewReader", "(", "os", ".", "Stdin", ")", ".", "ReadLine", "(", ")", "\n", "return", "string", "(", "bytes", ")", ",", ...
// lineFromConsole reads a line from stdin
[ "lineFromConsole", "reads", "a", "line", "from", "stdin" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L1985-L1988
23,623
gravitational/teleport
lib/client/api.go
String
func (fp DynamicForwardedPorts) String() (retval []string) { for _, p := range fp { retval = append(retval, p.ToString()) } return retval }
go
func (fp DynamicForwardedPorts) String() (retval []string) { for _, p := range fp { retval = append(retval, p.ToString()) } return retval }
[ "func", "(", "fp", "DynamicForwardedPorts", ")", "String", "(", ")", "(", "retval", "[", "]", "string", ")", "{", "for", "_", ",", "p", ":=", "range", "fp", "{", "retval", "=", "append", "(", "retval", ",", "p", ".", "ToString", "(", ")", ")", "\...
// String returns the same string spec which can be parsed by // ParseDynamicPortForwardSpec.
[ "String", "returns", "the", "same", "string", "spec", "which", "can", "be", "parsed", "by", "ParseDynamicPortForwardSpec", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L2097-L2102
23,624
gravitational/teleport
lib/client/api.go
InsecureSkipHostKeyChecking
func InsecureSkipHostKeyChecking(host string, remote net.Addr, key ssh.PublicKey) error { return nil }
go
func InsecureSkipHostKeyChecking(host string, remote net.Addr, key ssh.PublicKey) error { return nil }
[ "func", "InsecureSkipHostKeyChecking", "(", "host", "string", ",", "remote", "net", ".", "Addr", ",", "key", "ssh", ".", "PublicKey", ")", "error", "{", "return", "nil", "\n", "}" ]
// InsecureSkipHostKeyChecking is used when the user passes in // "StrictHostKeyChecking yes".
[ "InsecureSkipHostKeyChecking", "is", "used", "when", "the", "user", "passes", "in", "StrictHostKeyChecking", "yes", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/api.go#L2137-L2139
23,625
gravitational/teleport
lib/reversetunnel/conn.go
OpenChannel
func (c *remoteConn) OpenChannel(name string, data []byte) (ssh.Channel, error) { channel, _, err := c.sconn.OpenChannel(name, data) if err != nil { return nil, trace.Wrap(err) } return channel, nil }
go
func (c *remoteConn) OpenChannel(name string, data []byte) (ssh.Channel, error) { channel, _, err := c.sconn.OpenChannel(name, data) if err != nil { return nil, trace.Wrap(err) } return channel, nil }
[ "func", "(", "c", "*", "remoteConn", ")", "OpenChannel", "(", "name", "string", ",", "data", "[", "]", "byte", ")", "(", "ssh", ".", "Channel", ",", "error", ")", "{", "channel", ",", "_", ",", "err", ":=", "c", ".", "sconn", ".", "OpenChannel", ...
// OpenChannel will open a SSH channel to the remote side.
[ "OpenChannel", "will", "open", "a", "SSH", "channel", "to", "the", "remote", "side", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/reversetunnel/conn.go#L149-L156
23,626
gravitational/teleport
lib/reversetunnel/conn.go
ChannelConn
func (c *remoteConn) ChannelConn(channel ssh.Channel) net.Conn { return utils.NewChConn(c.sconn, channel) }
go
func (c *remoteConn) ChannelConn(channel ssh.Channel) net.Conn { return utils.NewChConn(c.sconn, channel) }
[ "func", "(", "c", "*", "remoteConn", ")", "ChannelConn", "(", "channel", "ssh", ".", "Channel", ")", "net", ".", "Conn", "{", "return", "utils", ".", "NewChConn", "(", "c", ".", "sconn", ",", "channel", ")", "\n", "}" ]
// ChannelConn creates a net.Conn over a SSH channel.
[ "ChannelConn", "creates", "a", "net", ".", "Conn", "over", "a", "SSH", "channel", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/reversetunnel/conn.go#L159-L161
23,627
gravitational/teleport
lib/reversetunnel/conn.go
findAndSend
func (c *remoteConn) findAndSend() error { // Find all proxies that don't have a connection to a remote agent. If all // proxies have connections, return right away. disconnectedProxies, err := c.findDisconnectedProxies() if err != nil { return trace.Wrap(err) } if len(disconnectedProxies) == 0 { return nil ...
go
func (c *remoteConn) findAndSend() error { // Find all proxies that don't have a connection to a remote agent. If all // proxies have connections, return right away. disconnectedProxies, err := c.findDisconnectedProxies() if err != nil { return trace.Wrap(err) } if len(disconnectedProxies) == 0 { return nil ...
[ "func", "(", "c", "*", "remoteConn", ")", "findAndSend", "(", ")", "error", "{", "// Find all proxies that don't have a connection to a remote agent. If all", "// proxies have connections, return right away.", "disconnectedProxies", ",", "err", ":=", "c", ".", "findDisconnected...
// sendDiscovery requests sends special "Discovery Requests" back to the // connected agent. Discovery request consists of the proxies that are part // of the cluster, but did not receive the connection from the agent. Agent // will act on a discovery request attempting to establish connection to the // proxies that we...
[ "sendDiscovery", "requests", "sends", "special", "Discovery", "Requests", "back", "to", "the", "connected", "agent", ".", "Discovery", "request", "consists", "of", "the", "proxies", "that", "are", "part", "of", "the", "cluster", "but", "did", "not", "receive", ...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/reversetunnel/conn.go#L232-L258
23,628
gravitational/teleport
lib/reversetunnel/conn.go
findDisconnectedProxies
func (c *remoteConn) findDisconnectedProxies() ([]services.Server, error) { // Find all proxies that have connection from the remote domain. conns, err := c.accessPoint.GetTunnelConnections(c.clusterName, services.SkipValidation()) if err != nil { return nil, trace.Wrap(err) } connected := make(map[string]bool) ...
go
func (c *remoteConn) findDisconnectedProxies() ([]services.Server, error) { // Find all proxies that have connection from the remote domain. conns, err := c.accessPoint.GetTunnelConnections(c.clusterName, services.SkipValidation()) if err != nil { return nil, trace.Wrap(err) } connected := make(map[string]bool) ...
[ "func", "(", "c", "*", "remoteConn", ")", "findDisconnectedProxies", "(", ")", "(", "[", "]", "services", ".", "Server", ",", "error", ")", "{", "// Find all proxies that have connection from the remote domain.", "conns", ",", "err", ":=", "c", ".", "accessPoint",...
// findDisconnectedProxies finds proxies that do not have inbound reverse tunnel // connections.
[ "findDisconnectedProxies", "finds", "proxies", "that", "do", "not", "have", "inbound", "reverse", "tunnel", "connections", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/reversetunnel/conn.go#L262-L295
23,629
gravitational/teleport
lib/reversetunnel/conn.go
sendDiscoveryRequests
func (c *remoteConn) sendDiscoveryRequests(req discoveryRequest) error { discoveryCh, err := c.openDiscoveryChannel() if err != nil { return trace.Wrap(err) } // Marshal and send the request. If the connection failed, mark the // connection as invalid so it will be removed later. payload, err := marshalDiscove...
go
func (c *remoteConn) sendDiscoveryRequests(req discoveryRequest) error { discoveryCh, err := c.openDiscoveryChannel() if err != nil { return trace.Wrap(err) } // Marshal and send the request. If the connection failed, mark the // connection as invalid so it will be removed later. payload, err := marshalDiscove...
[ "func", "(", "c", "*", "remoteConn", ")", "sendDiscoveryRequests", "(", "req", "discoveryRequest", ")", "error", "{", "discoveryCh", ",", "err", ":=", "c", ".", "openDiscoveryChannel", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "trace", ".", ...
// sendDiscoveryRequests sends a discovery request with missing proxies.
[ "sendDiscoveryRequests", "sends", "a", "discovery", "request", "with", "missing", "proxies", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/reversetunnel/conn.go#L298-L317
23,630
gravitational/teleport
lib/reversetunnel/conn.go
TunnelAuthDialer
func TunnelAuthDialer(proxyAddr string, sshConfig *ssh.ClientConfig) auth.DialContext { return func(ctx context.Context, network string, addr string) (net.Conn, error) { // Connect to the reverse tunnel server. dialer := proxy.DialerFromEnvironment(proxyAddr) sconn, err := dialer.Dial("tcp", proxyAddr, sshConfig...
go
func TunnelAuthDialer(proxyAddr string, sshConfig *ssh.ClientConfig) auth.DialContext { return func(ctx context.Context, network string, addr string) (net.Conn, error) { // Connect to the reverse tunnel server. dialer := proxy.DialerFromEnvironment(proxyAddr) sconn, err := dialer.Dial("tcp", proxyAddr, sshConfig...
[ "func", "TunnelAuthDialer", "(", "proxyAddr", "string", ",", "sshConfig", "*", "ssh", ".", "ClientConfig", ")", "auth", ".", "DialContext", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "network", "string", ",", "addr", "string", ")", ...
// TunnelAuthDialer connects to the Auth Server through the reverse tunnel.
[ "TunnelAuthDialer", "connects", "to", "the", "Auth", "Server", "through", "the", "reverse", "tunnel", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/reversetunnel/conn.go#L341-L356
23,631
gravitational/teleport
lib/reversetunnel/conn.go
connectProxyTransport
func connectProxyTransport(sconn ssh.Conn, addr string) (net.Conn, error) { channel, _, err := sconn.OpenChannel(chanTransport, nil) if err != nil { return nil, trace.Wrap(err) } // Send a special SSH out-of-band request called "teleport-transport" // the agent on the other side will create a new TCP/IP connect...
go
func connectProxyTransport(sconn ssh.Conn, addr string) (net.Conn, error) { channel, _, err := sconn.OpenChannel(chanTransport, nil) if err != nil { return nil, trace.Wrap(err) } // Send a special SSH out-of-band request called "teleport-transport" // the agent on the other side will create a new TCP/IP connect...
[ "func", "connectProxyTransport", "(", "sconn", "ssh", ".", "Conn", ",", "addr", "string", ")", "(", "net", ".", "Conn", ",", "error", ")", "{", "channel", ",", "_", ",", "err", ":=", "sconn", ".", "OpenChannel", "(", "chanTransport", ",", "nil", ")", ...
// connectProxyTransport opens a channel over the remote tunnel and connects // to the requested host.
[ "connectProxyTransport", "opens", "a", "channel", "over", "the", "remote", "tunnel", "and", "connects", "to", "the", "requested", "host", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/reversetunnel/conn.go#L360-L387
23,632
gravitational/teleport
lib/service/service.go
Close
func (c *Connector) Close() error { if c.Client != nil { return c.Close() } return nil }
go
func (c *Connector) Close() error { if c.Client != nil { return c.Close() } return nil }
[ "func", "(", "c", "*", "Connector", ")", "Close", "(", ")", "error", "{", "if", "c", ".", "Client", "!=", "nil", "{", "return", "c", ".", "Close", "(", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Close closes resources associated with connector
[ "Close", "closes", "resources", "associated", "with", "connector" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L179-L184
23,633
gravitational/teleport
lib/service/service.go
getConnectors
func (process *TeleportProcess) getConnectors() []*Connector { process.Lock() defer process.Unlock() out := make([]*Connector, 0, len(process.connectors)) for role := range process.connectors { out = append(out, process.connectors[role]) } return out }
go
func (process *TeleportProcess) getConnectors() []*Connector { process.Lock() defer process.Unlock() out := make([]*Connector, 0, len(process.connectors)) for role := range process.connectors { out = append(out, process.connectors[role]) } return out }
[ "func", "(", "process", "*", "TeleportProcess", ")", "getConnectors", "(", ")", "[", "]", "*", "Connector", "{", "process", ".", "Lock", "(", ")", "\n", "defer", "process", ".", "Unlock", "(", ")", "\n\n", "out", ":=", "make", "(", "[", "]", "*", "...
// getConnectors returns a copy of the identities registered for auth server
[ "getConnectors", "returns", "a", "copy", "of", "the", "identities", "registered", "for", "auth", "server" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L279-L288
23,634
gravitational/teleport
lib/service/service.go
addConnector
func (process *TeleportProcess) addConnector(connector *Connector) { process.Lock() defer process.Unlock() process.connectors[connector.ClientIdentity.ID.Role] = connector }
go
func (process *TeleportProcess) addConnector(connector *Connector) { process.Lock() defer process.Unlock() process.connectors[connector.ClientIdentity.ID.Role] = connector }
[ "func", "(", "process", "*", "TeleportProcess", ")", "addConnector", "(", "connector", "*", "Connector", ")", "{", "process", ".", "Lock", "(", ")", "\n", "defer", "process", ".", "Unlock", "(", ")", "\n\n", "process", ".", "connectors", "[", "connector", ...
// addConnector adds connector to registered connectors list, // it will overwrite the connector for the same role
[ "addConnector", "adds", "connector", "to", "registered", "connectors", "list", "it", "will", "overwrite", "the", "connector", "for", "the", "same", "role" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L292-L297
23,635
gravitational/teleport
lib/service/service.go
Run
func Run(ctx context.Context, cfg Config, newTeleport NewProcess) error { if newTeleport == nil { newTeleport = newTeleportProcess } copyCfg := cfg srv, err := newTeleport(&copyCfg) if err != nil { return trace.Wrap(err, "initialization failed") } if srv == nil { return trace.BadParameter("process has retu...
go
func Run(ctx context.Context, cfg Config, newTeleport NewProcess) error { if newTeleport == nil { newTeleport = newTeleportProcess } copyCfg := cfg srv, err := newTeleport(&copyCfg) if err != nil { return trace.Wrap(err, "initialization failed") } if srv == nil { return trace.BadParameter("process has retu...
[ "func", "Run", "(", "ctx", "context", ".", "Context", ",", "cfg", "Config", ",", "newTeleport", "NewProcess", ")", "error", "{", "if", "newTeleport", "==", "nil", "{", "newTeleport", "=", "newTeleportProcess", "\n", "}", "\n", "copyCfg", ":=", "cfg", "\n",...
// Run starts teleport processes, waits for signals // and handles internal process reloads.
[ "Run", "starts", "teleport", "processes", "waits", "for", "signals", "and", "handles", "internal", "process", "reloads", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L379-L406
23,636
gravitational/teleport
lib/service/service.go
notifyParent
func (process *TeleportProcess) notifyParent() { signalPipe, err := process.importSignalPipe() if err != nil { if !trace.IsNotFound(err) { process.Warningf("Failed to import signal pipe") } process.Debugf("No signal pipe to import, must be first Teleport process.") return } defer signalPipe.Close() ctx...
go
func (process *TeleportProcess) notifyParent() { signalPipe, err := process.importSignalPipe() if err != nil { if !trace.IsNotFound(err) { process.Warningf("Failed to import signal pipe") } process.Debugf("No signal pipe to import, must be first Teleport process.") return } defer signalPipe.Close() ctx...
[ "func", "(", "process", "*", "TeleportProcess", ")", "notifyParent", "(", ")", "{", "signalPipe", ",", "err", ":=", "process", ".", "importSignalPipe", "(", ")", "\n", "if", "err", "!=", "nil", "{", "if", "!", "trace", ".", "IsNotFound", "(", "err", ")...
// notifyParent notifies parent process that this process has started // by writing to in-memory pipe used by communication channel.
[ "notifyParent", "notifies", "parent", "process", "that", "this", "process", "has", "started", "by", "writing", "to", "in", "-", "memory", "pipe", "used", "by", "communication", "channel", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L666-L699
23,637
gravitational/teleport
lib/service/service.go
adminCreds
func adminCreds() (*int, *int, error) { if runtime.GOOS != teleport.LinuxOS { return nil, nil, nil } // if the user member of adm linux group, // make audit log folder readable by admins isAdmin, err := utils.IsGroupMember(teleport.LinuxAdminGID) if err != nil { return nil, nil, trace.Wrap(err) } if !isAdmi...
go
func adminCreds() (*int, *int, error) { if runtime.GOOS != teleport.LinuxOS { return nil, nil, nil } // if the user member of adm linux group, // make audit log folder readable by admins isAdmin, err := utils.IsGroupMember(teleport.LinuxAdminGID) if err != nil { return nil, nil, trace.Wrap(err) } if !isAdmi...
[ "func", "adminCreds", "(", ")", "(", "*", "int", ",", "*", "int", ",", "error", ")", "{", "if", "runtime", ".", "GOOS", "!=", "teleport", ".", "LinuxOS", "{", "return", "nil", ",", "nil", ",", "nil", "\n", "}", "\n", "// if the user member of adm linux...
// adminCreds returns admin UID and GID settings based on the OS
[ "adminCreds", "returns", "admin", "UID", "and", "GID", "settings", "based", "on", "the", "OS" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L714-L730
23,638
gravitational/teleport
lib/service/service.go
initUploadHandler
func initUploadHandler(auditConfig services.AuditConfig) (events.UploadHandler, error) { if auditConfig.AuditSessionsURI == "" { return nil, trace.NotFound("no upload handler is setup") } uri, err := utils.ParseSessionsURI(auditConfig.AuditSessionsURI) if err != nil { return nil, trace.Wrap(err) } switch uri...
go
func initUploadHandler(auditConfig services.AuditConfig) (events.UploadHandler, error) { if auditConfig.AuditSessionsURI == "" { return nil, trace.NotFound("no upload handler is setup") } uri, err := utils.ParseSessionsURI(auditConfig.AuditSessionsURI) if err != nil { return nil, trace.Wrap(err) } switch uri...
[ "func", "initUploadHandler", "(", "auditConfig", "services", ".", "AuditConfig", ")", "(", "events", ".", "UploadHandler", ",", "error", ")", "{", "if", "auditConfig", ".", "AuditSessionsURI", "==", "\"", "\"", "{", "return", "nil", ",", "trace", ".", "NotFo...
// initUploadHandler initializes upload handler based on the config settings, // currently the only upload handler supported is S3 // the call can return trace.NotFOund if no upload handler is setup
[ "initUploadHandler", "initializes", "upload", "handler", "based", "on", "the", "config", "settings", "currently", "the", "only", "upload", "handler", "supported", "is", "S3", "the", "call", "can", "return", "trace", ".", "NotFOund", "if", "no", "upload", "handle...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L735-L775
23,639
gravitational/teleport
lib/service/service.go
initExternalLog
func initExternalLog(auditConfig services.AuditConfig) (events.IAuditLog, error) { if auditConfig.AuditTableName != "" { log.Warningf("Please note that 'audit_table_name' is deprecated and will be removed in several releases. Use audit_events_uri: '%v://%v' instead.", dynamo.GetName(), auditConfig.AuditTableName) ...
go
func initExternalLog(auditConfig services.AuditConfig) (events.IAuditLog, error) { if auditConfig.AuditTableName != "" { log.Warningf("Please note that 'audit_table_name' is deprecated and will be removed in several releases. Use audit_events_uri: '%v://%v' instead.", dynamo.GetName(), auditConfig.AuditTableName) ...
[ "func", "initExternalLog", "(", "auditConfig", "services", ".", "AuditConfig", ")", "(", "events", ".", "IAuditLog", ",", "error", ")", "{", "if", "auditConfig", ".", "AuditTableName", "!=", "\"", "\"", "{", "log", ".", "Warningf", "(", "\"", "\"", ",", ...
// initExternalLog initializes external storage, if the storage is not // setup, returns nil
[ "initExternalLog", "initializes", "external", "storage", "if", "the", "storage", "is", "not", "setup", "returns", "nil" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L779-L843
23,640
gravitational/teleport
lib/service/service.go
onExit
func (process *TeleportProcess) onExit(serviceName string, callback func(interface{})) { process.RegisterFunc(serviceName, func() error { eventC := make(chan Event) process.WaitForEvent(context.TODO(), TeleportExitEvent, eventC) select { case event := <-eventC: callback(event.Payload) } return nil }) }
go
func (process *TeleportProcess) onExit(serviceName string, callback func(interface{})) { process.RegisterFunc(serviceName, func() error { eventC := make(chan Event) process.WaitForEvent(context.TODO(), TeleportExitEvent, eventC) select { case event := <-eventC: callback(event.Payload) } return nil }) }
[ "func", "(", "process", "*", "TeleportProcess", ")", "onExit", "(", "serviceName", "string", ",", "callback", "func", "(", "interface", "{", "}", ")", ")", "{", "process", ".", "RegisterFunc", "(", "serviceName", ",", "func", "(", ")", "error", "{", "eve...
// onExit allows individual services to register a callback function which will be // called when Teleport Process is asked to exit. Usually services terminate themselves // when the callback is called
[ "onExit", "allows", "individual", "services", "to", "register", "a", "callback", "function", "which", "will", "be", "called", "when", "Teleport", "Process", "is", "asked", "to", "exit", ".", "Usually", "services", "terminate", "themselves", "when", "the", "callb...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L1160-L1170
23,641
gravitational/teleport
lib/service/service.go
newAccessCache
func (process *TeleportProcess) newAccessCache(cfg accessCacheConfig) (*cache.Cache, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } var cacheBackend backend.Backend if cfg.inMemory { mem, err := memory.New(memory.Config{ Context: process.ExitContext(), EventsOff...
go
func (process *TeleportProcess) newAccessCache(cfg accessCacheConfig) (*cache.Cache, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } var cacheBackend backend.Backend if cfg.inMemory { mem, err := memory.New(memory.Config{ Context: process.ExitContext(), EventsOff...
[ "func", "(", "process", "*", "TeleportProcess", ")", "newAccessCache", "(", "cfg", "accessCacheConfig", ")", "(", "*", "cache", ".", "Cache", ",", "error", ")", "{", "if", "err", ":=", "cfg", ".", "CheckAndSetDefaults", "(", ")", ";", "err", "!=", "nil",...
// newAccessCache returns new local cache access point
[ "newAccessCache", "returns", "new", "local", "cache", "access", "point" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L1209-L1264
23,642
gravitational/teleport
lib/service/service.go
setupCachePolicy
func (process *TeleportProcess) setupCachePolicy(in cache.SetupConfigFn) cache.SetupConfigFn { return func(c cache.Config) cache.Config { config := in(c) config.PreferRecent = cache.PreferRecent{ Enabled: process.Config.CachePolicy.Enabled, NeverExpires: process.Config.CachePolicy.NeverExpires, MaxTT...
go
func (process *TeleportProcess) setupCachePolicy(in cache.SetupConfigFn) cache.SetupConfigFn { return func(c cache.Config) cache.Config { config := in(c) config.PreferRecent = cache.PreferRecent{ Enabled: process.Config.CachePolicy.Enabled, NeverExpires: process.Config.CachePolicy.NeverExpires, MaxTT...
[ "func", "(", "process", "*", "TeleportProcess", ")", "setupCachePolicy", "(", "in", "cache", ".", "SetupConfigFn", ")", "cache", ".", "SetupConfigFn", "{", "return", "func", "(", "c", "cache", ".", "Config", ")", "cache", ".", "Config", "{", "config", ":="...
// setupCachePolicy sets up cache policy based on teleport configuration, // it is a wrapper function, that sets up configuration
[ "setupCachePolicy", "sets", "up", "cache", "policy", "based", "on", "teleport", "configuration", "it", "is", "a", "wrapper", "function", "that", "sets", "up", "configuration" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L1268-L1278
23,643
gravitational/teleport
lib/service/service.go
newLocalCacheForProxy
func (process *TeleportProcess) newLocalCacheForProxy(clt auth.ClientI, cacheName []string) (auth.AccessPoint, error) { return process.newLocalCache(clt, cache.ForProxy, cacheName) }
go
func (process *TeleportProcess) newLocalCacheForProxy(clt auth.ClientI, cacheName []string) (auth.AccessPoint, error) { return process.newLocalCache(clt, cache.ForProxy, cacheName) }
[ "func", "(", "process", "*", "TeleportProcess", ")", "newLocalCacheForProxy", "(", "clt", "auth", ".", "ClientI", ",", "cacheName", "[", "]", "string", ")", "(", "auth", ".", "AccessPoint", ",", "error", ")", "{", "return", "process", ".", "newLocalCache", ...
// newAccessPointCache returns new instance of access point configured for proxy
[ "newAccessPointCache", "returns", "new", "instance", "of", "access", "point", "configured", "for", "proxy" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L1281-L1283
23,644
gravitational/teleport
lib/service/service.go
newLocalCache
func (process *TeleportProcess) newLocalCache(clt auth.ClientI, setupConfig cache.SetupConfigFn, cacheName []string) (auth.AccessPoint, error) { // if caching is disabled, return access point if !process.Config.CachePolicy.Enabled { return clt, nil } cache, err := process.newAccessCache(accessCacheConfig{ servi...
go
func (process *TeleportProcess) newLocalCache(clt auth.ClientI, setupConfig cache.SetupConfigFn, cacheName []string) (auth.AccessPoint, error) { // if caching is disabled, return access point if !process.Config.CachePolicy.Enabled { return clt, nil } cache, err := process.newAccessCache(accessCacheConfig{ servi...
[ "func", "(", "process", "*", "TeleportProcess", ")", "newLocalCache", "(", "clt", "auth", ".", "ClientI", ",", "setupConfig", "cache", ".", "SetupConfigFn", ",", "cacheName", "[", "]", "string", ")", "(", "auth", ".", "AccessPoint", ",", "error", ")", "{",...
// newAccessPointCache returns new instance of access point
[ "newAccessPointCache", "returns", "new", "instance", "of", "access", "point" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L1286-L1300
23,645
gravitational/teleport
lib/service/service.go
registerWithAuthServer
func (process *TeleportProcess) registerWithAuthServer(role teleport.Role, eventName string) { serviceName := strings.ToLower(role.String()) process.RegisterCriticalFunc(fmt.Sprintf("register.%v", serviceName), func() error { connector, err := process.reconnectToAuthService(role) if err != nil { return trace.W...
go
func (process *TeleportProcess) registerWithAuthServer(role teleport.Role, eventName string) { serviceName := strings.ToLower(role.String()) process.RegisterCriticalFunc(fmt.Sprintf("register.%v", serviceName), func() error { connector, err := process.reconnectToAuthService(role) if err != nil { return trace.W...
[ "func", "(", "process", "*", "TeleportProcess", ")", "registerWithAuthServer", "(", "role", "teleport", ".", "Role", ",", "eventName", "string", ")", "{", "serviceName", ":=", "strings", ".", "ToLower", "(", "role", ".", "String", "(", ")", ")", "\n", "pro...
// registerWithAuthServer uses one time provisioning token obtained earlier // from the server to get a pair of SSH keys signed by Auth server host // certificate authority
[ "registerWithAuthServer", "uses", "one", "time", "provisioning", "token", "obtained", "earlier", "from", "the", "server", "to", "get", "a", "pair", "of", "SSH", "keys", "signed", "by", "Auth", "server", "host", "certificate", "authority" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L1521-L1538
23,646
gravitational/teleport
lib/service/service.go
getAdditionalPrincipals
func (process *TeleportProcess) getAdditionalPrincipals(role teleport.Role) ([]string, []string, error) { var principals []string var dnsNames []string if process.Config.Hostname != "" { principals = append(principals, process.Config.Hostname) } var addrs []utils.NetAddr switch role { case teleport.RoleProxy: ...
go
func (process *TeleportProcess) getAdditionalPrincipals(role teleport.Role) ([]string, []string, error) { var principals []string var dnsNames []string if process.Config.Hostname != "" { principals = append(principals, process.Config.Hostname) } var addrs []utils.NetAddr switch role { case teleport.RoleProxy: ...
[ "func", "(", "process", "*", "TeleportProcess", ")", "getAdditionalPrincipals", "(", "role", "teleport", ".", "Role", ")", "(", "[", "]", "string", ",", "[", "]", "string", ",", "error", ")", "{", "var", "principals", "[", "]", "string", "\n", "var", "...
// getAdditionalPrincipals returns a list of additional principals to add // to role's service certificates.
[ "getAdditionalPrincipals", "returns", "a", "list", "of", "additional", "principals", "to", "add", "to", "role", "s", "service", "certificates", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L1698-L1748
23,647
gravitational/teleport
lib/service/service.go
initAuthStorage
func (process *TeleportProcess) initAuthStorage() (bk backend.Backend, err error) { bc := &process.Config.Auth.StorageConfig process.Debugf("Using %v backend.", bc.Type) switch bc.Type { case lite.GetName(): bk, err = lite.New(context.TODO(), bc.Params) // legacy bolt backend, import all data into SQLite and re...
go
func (process *TeleportProcess) initAuthStorage() (bk backend.Backend, err error) { bc := &process.Config.Auth.StorageConfig process.Debugf("Using %v backend.", bc.Type) switch bc.Type { case lite.GetName(): bk, err = lite.New(context.TODO(), bc.Params) // legacy bolt backend, import all data into SQLite and re...
[ "func", "(", "process", "*", "TeleportProcess", ")", "initAuthStorage", "(", ")", "(", "bk", "backend", ".", "Backend", ",", "err", "error", ")", "{", "bc", ":=", "&", "process", ".", "Config", ".", "Auth", ".", "StorageConfig", "\n", "process", ".", "...
// initAuthStorage initializes the storage backend for the auth service.
[ "initAuthStorage", "initializes", "the", "storage", "backend", "for", "the", "auth", "service", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L2225-L2281
23,648
gravitational/teleport
lib/service/service.go
WaitWithContext
func (process *TeleportProcess) WaitWithContext(ctx context.Context) { local, cancel := context.WithCancel(ctx) go func() { defer cancel() process.Supervisor.Wait() }() select { case <-local.Done(): return } }
go
func (process *TeleportProcess) WaitWithContext(ctx context.Context) { local, cancel := context.WithCancel(ctx) go func() { defer cancel() process.Supervisor.Wait() }() select { case <-local.Done(): return } }
[ "func", "(", "process", "*", "TeleportProcess", ")", "WaitWithContext", "(", "ctx", "context", ".", "Context", ")", "{", "local", ",", "cancel", ":=", "context", ".", "WithCancel", "(", "ctx", ")", "\n", "go", "func", "(", ")", "{", "defer", "cancel", ...
// WaitWithContext waits until all internal services stop.
[ "WaitWithContext", "waits", "until", "all", "internal", "services", "stop", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L2296-L2306
23,649
gravitational/teleport
lib/service/service.go
StartShutdown
func (process *TeleportProcess) StartShutdown(ctx context.Context) context.Context { process.BroadcastEvent(Event{Name: TeleportExitEvent, Payload: ctx}) localCtx, cancel := context.WithCancel(ctx) go func() { defer cancel() process.Supervisor.Wait() process.Debugf("All supervisor functions are completed.") ...
go
func (process *TeleportProcess) StartShutdown(ctx context.Context) context.Context { process.BroadcastEvent(Event{Name: TeleportExitEvent, Payload: ctx}) localCtx, cancel := context.WithCancel(ctx) go func() { defer cancel() process.Supervisor.Wait() process.Debugf("All supervisor functions are completed.") ...
[ "func", "(", "process", "*", "TeleportProcess", ")", "StartShutdown", "(", "ctx", "context", ".", "Context", ")", "context", ".", "Context", "{", "process", ".", "BroadcastEvent", "(", "Event", "{", "Name", ":", "TeleportExitEvent", ",", "Payload", ":", "ctx...
// StartShutdown launches non-blocking graceful shutdown process that signals // completion, returns context that will be closed once the shutdown is done
[ "StartShutdown", "launches", "non", "-", "blocking", "graceful", "shutdown", "process", "that", "signals", "completion", "returns", "context", "that", "will", "be", "closed", "once", "the", "shutdown", "is", "done" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L2310-L2326
23,650
gravitational/teleport
lib/service/service.go
Shutdown
func (process *TeleportProcess) Shutdown(ctx context.Context) { localCtx := process.StartShutdown(ctx) // wait until parent context closes select { case <-localCtx.Done(): process.Debugf("Process completed.") } }
go
func (process *TeleportProcess) Shutdown(ctx context.Context) { localCtx := process.StartShutdown(ctx) // wait until parent context closes select { case <-localCtx.Done(): process.Debugf("Process completed.") } }
[ "func", "(", "process", "*", "TeleportProcess", ")", "Shutdown", "(", "ctx", "context", ".", "Context", ")", "{", "localCtx", ":=", "process", ".", "StartShutdown", "(", "ctx", ")", "\n", "// wait until parent context closes", "select", "{", "case", "<-", "loc...
// Shutdown launches graceful shutdown process and waits // for it to complete
[ "Shutdown", "launches", "graceful", "shutdown", "process", "and", "waits", "for", "it", "to", "complete" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L2330-L2337
23,651
gravitational/teleport
lib/service/service.go
Close
func (process *TeleportProcess) Close() error { process.BroadcastEvent(Event{Name: TeleportExitEvent}) process.Config.Keygen.Close() var errors []error localAuth := process.getLocalAuth() if localAuth != nil { errors = append(errors, process.localAuth.Close()) } if process.storage != nil { errors = append...
go
func (process *TeleportProcess) Close() error { process.BroadcastEvent(Event{Name: TeleportExitEvent}) process.Config.Keygen.Close() var errors []error localAuth := process.getLocalAuth() if localAuth != nil { errors = append(errors, process.localAuth.Close()) } if process.storage != nil { errors = append...
[ "func", "(", "process", "*", "TeleportProcess", ")", "Close", "(", ")", "error", "{", "process", ".", "BroadcastEvent", "(", "Event", "{", "Name", ":", "TeleportExitEvent", "}", ")", "\n\n", "process", ".", "Config", ".", "Keygen", ".", "Close", "(", ")"...
// Close broadcasts close signals and exits immediately
[ "Close", "broadcasts", "close", "signals", "and", "exits", "immediately" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L2340-L2356
23,652
gravitational/teleport
lib/service/service.go
initSelfSignedHTTPSCert
func initSelfSignedHTTPSCert(cfg *Config) (err error) { log.Warningf("No TLS Keys provided, using self signed certificate.") keyPath := filepath.Join(cfg.DataDir, defaults.SelfSignedKeyPath) certPath := filepath.Join(cfg.DataDir, defaults.SelfSignedCertPath) cfg.Proxy.TLSKey = keyPath cfg.Proxy.TLSCert = certPat...
go
func initSelfSignedHTTPSCert(cfg *Config) (err error) { log.Warningf("No TLS Keys provided, using self signed certificate.") keyPath := filepath.Join(cfg.DataDir, defaults.SelfSignedKeyPath) certPath := filepath.Join(cfg.DataDir, defaults.SelfSignedCertPath) cfg.Proxy.TLSKey = keyPath cfg.Proxy.TLSCert = certPat...
[ "func", "initSelfSignedHTTPSCert", "(", "cfg", "*", "Config", ")", "(", "err", "error", ")", "{", "log", ".", "Warningf", "(", "\"", "\"", ")", "\n\n", "keyPath", ":=", "filepath", ".", "Join", "(", "cfg", ".", "DataDir", ",", "defaults", ".", "SelfSig...
// initSelfSignedHTTPSCert generates and self-signs a TLS key+cert pair for https connection // to the proxy server.
[ "initSelfSignedHTTPSCert", "generates", "and", "self", "-", "signs", "a", "TLS", "key", "+", "cert", "pair", "for", "https", "connection", "to", "the", "proxy", "server", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/service.go#L2401-L2432
23,653
gravitational/teleport
lib/kube/utils/utils.go
GetKubeClient
func GetKubeClient(configPath string) (client *kubernetes.Clientset, config *rest.Config, err error) { // if path to kubeconfig was provided, init config from it if configPath != "" { config, err = clientcmd.BuildConfigFromFlags("", configPath) if err != nil { return nil, nil, trace.Wrap(err) } } else { /...
go
func GetKubeClient(configPath string) (client *kubernetes.Clientset, config *rest.Config, err error) { // if path to kubeconfig was provided, init config from it if configPath != "" { config, err = clientcmd.BuildConfigFromFlags("", configPath) if err != nil { return nil, nil, trace.Wrap(err) } } else { /...
[ "func", "GetKubeClient", "(", "configPath", "string", ")", "(", "client", "*", "kubernetes", ".", "Clientset", ",", "config", "*", "rest", ".", "Config", ",", "err", "error", ")", "{", "// if path to kubeconfig was provided, init config from it", "if", "configPath",...
// GetKubeClient returns instance of client to the kubernetes cluster // using in-cluster configuration if available and falling back to // configuration file under configPath otherwise
[ "GetKubeClient", "returns", "instance", "of", "client", "to", "the", "kubernetes", "cluster", "using", "in", "-", "cluster", "configuration", "if", "available", "and", "falling", "back", "to", "configuration", "file", "under", "configPath", "otherwise" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/kube/utils/utils.go#L16-L36
23,654
gravitational/teleport
lib/kube/utils/utils.go
GetKubeConfig
func GetKubeConfig(configPath string) (*rest.Config, error) { // if path to kubeconfig was provided, init config from it if configPath != "" { return clientcmd.BuildConfigFromFlags("", configPath) } return rest.InClusterConfig() }
go
func GetKubeConfig(configPath string) (*rest.Config, error) { // if path to kubeconfig was provided, init config from it if configPath != "" { return clientcmd.BuildConfigFromFlags("", configPath) } return rest.InClusterConfig() }
[ "func", "GetKubeConfig", "(", "configPath", "string", ")", "(", "*", "rest", ".", "Config", ",", "error", ")", "{", "// if path to kubeconfig was provided, init config from it", "if", "configPath", "!=", "\"", "\"", "{", "return", "clientcmd", ".", "BuildConfigFromF...
// GetKubeConfig returns kubernetes configuration // from configPath file or, by default reads in-cluster configuration
[ "GetKubeConfig", "returns", "kubernetes", "configuration", "from", "configPath", "file", "or", "by", "default", "reads", "in", "-", "cluster", "configuration" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/kube/utils/utils.go#L40-L46
23,655
gravitational/teleport
lib/services/provisioning.go
MustCreateProvisionToken
func MustCreateProvisionToken(token string, roles teleport.Roles, expires time.Time) ProvisionToken { t, err := NewProvisionToken(token, roles, expires) if err != nil { panic(err) } return t }
go
func MustCreateProvisionToken(token string, roles teleport.Roles, expires time.Time) ProvisionToken { t, err := NewProvisionToken(token, roles, expires) if err != nil { panic(err) } return t }
[ "func", "MustCreateProvisionToken", "(", "token", "string", ",", "roles", "teleport", ".", "Roles", ",", "expires", "time", ".", "Time", ")", "ProvisionToken", "{", "t", ",", "err", ":=", "NewProvisionToken", "(", "token", ",", "roles", ",", "expires", ")", ...
// MustCreateProvisionToken returns a new valid provision token // or panics, used in testes
[ "MustCreateProvisionToken", "returns", "a", "new", "valid", "provision", "token", "or", "panics", "used", "in", "testes" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/provisioning.go#L33-L39
23,656
gravitational/teleport
lib/services/provisioning.go
NewProvisionToken
func NewProvisionToken(token string, roles teleport.Roles, expires time.Time) (ProvisionToken, error) { t := &ProvisionTokenV2{ Kind: KindToken, Version: V2, Metadata: Metadata{ Name: token, Expires: &expires, Namespace: defaults.Namespace, }, Spec: ProvisionTokenSpecV2{ Roles: roles, ...
go
func NewProvisionToken(token string, roles teleport.Roles, expires time.Time) (ProvisionToken, error) { t := &ProvisionTokenV2{ Kind: KindToken, Version: V2, Metadata: Metadata{ Name: token, Expires: &expires, Namespace: defaults.Namespace, }, Spec: ProvisionTokenSpecV2{ Roles: roles, ...
[ "func", "NewProvisionToken", "(", "token", "string", ",", "roles", "teleport", ".", "Roles", ",", "expires", "time", ".", "Time", ")", "(", "ProvisionToken", ",", "error", ")", "{", "t", ":=", "&", "ProvisionTokenV2", "{", "Kind", ":", "KindToken", ",", ...
// NewProvisionToken returns a new instance of provision token resource
[ "NewProvisionToken", "returns", "a", "new", "instance", "of", "provision", "token", "resource" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/provisioning.go#L42-L59
23,657
gravitational/teleport
lib/services/provisioning.go
ProvisionTokensToV1
func ProvisionTokensToV1(in []ProvisionToken) []ProvisionTokenV1 { if in == nil { return nil } out := make([]ProvisionTokenV1, len(in)) for i := range in { out[i] = *in[i].V1() } return out }
go
func ProvisionTokensToV1(in []ProvisionToken) []ProvisionTokenV1 { if in == nil { return nil } out := make([]ProvisionTokenV1, len(in)) for i := range in { out[i] = *in[i].V1() } return out }
[ "func", "ProvisionTokensToV1", "(", "in", "[", "]", "ProvisionToken", ")", "[", "]", "ProvisionTokenV1", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "make", "(", "[", "]", "ProvisionTokenV1", ",", "len", "(", "in",...
// ProvisionTokensToV1 converts provision tokens to V1 list
[ "ProvisionTokensToV1", "converts", "provision", "tokens", "to", "V1", "list" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/provisioning.go#L97-L106
23,658
gravitational/teleport
lib/services/provisioning.go
ProvisionTokensFromV1
func ProvisionTokensFromV1(in []ProvisionTokenV1) []ProvisionToken { if in == nil { return nil } out := make([]ProvisionToken, len(in)) for i := range in { out[i] = in[i].V2() } return out }
go
func ProvisionTokensFromV1(in []ProvisionTokenV1) []ProvisionToken { if in == nil { return nil } out := make([]ProvisionToken, len(in)) for i := range in { out[i] = in[i].V2() } return out }
[ "func", "ProvisionTokensFromV1", "(", "in", "[", "]", "ProvisionTokenV1", ")", "[", "]", "ProvisionToken", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "make", "(", "[", "]", "ProvisionToken", ",", "len", "(", "in",...
// ProvisionTokensFromV1 converts V1 provision tokens to resource list
[ "ProvisionTokensFromV1", "converts", "V1", "provision", "tokens", "to", "resource", "list" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/provisioning.go#L109-L118
23,659
gravitational/teleport
lib/services/provisioning.go
SetRoles
func (p *ProvisionTokenV2) SetRoles(r teleport.Roles) { p.Spec.Roles = r }
go
func (p *ProvisionTokenV2) SetRoles(r teleport.Roles) { p.Spec.Roles = r }
[ "func", "(", "p", "*", "ProvisionTokenV2", ")", "SetRoles", "(", "r", "teleport", ".", "Roles", ")", "{", "p", ".", "Spec", ".", "Roles", "=", "r", "\n", "}" ]
// SetRoles sets teleport roles
[ "SetRoles", "sets", "teleport", "roles" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/provisioning.go#L149-L151
23,660
gravitational/teleport
lib/services/provisioning.go
UnmarshalProvisionToken
func UnmarshalProvisionToken(data []byte, opts ...MarshalOption) (ProvisionToken, error) { if len(data) == 0 { return nil, trace.BadParameter("missing provision token data") } cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } var h ResourceHeader err = utils.FastUnmarshal(data,...
go
func UnmarshalProvisionToken(data []byte, opts ...MarshalOption) (ProvisionToken, error) { if len(data) == 0 { return nil, trace.BadParameter("missing provision token data") } cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } var h ResourceHeader err = utils.FastUnmarshal(data,...
[ "func", "UnmarshalProvisionToken", "(", "data", "[", "]", "byte", ",", "opts", "...", "MarshalOption", ")", "(", "ProvisionToken", ",", "error", ")", "{", "if", "len", "(", "data", ")", "==", "0", "{", "return", "nil", ",", "trace", ".", "BadParameter", ...
// UnmarshalProvisionToken unmarshals provision token from JSON or YAML, // sets defaults and checks the schema
[ "UnmarshalProvisionToken", "unmarshals", "provision", "token", "from", "JSON", "or", "YAML", "sets", "defaults", "and", "checks", "the", "schema" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/provisioning.go#L281-L329
23,661
gravitational/teleport
lib/services/provisioning.go
MarshalProvisionToken
func MarshalProvisionToken(t ProvisionToken, opts ...MarshalOption) ([]byte, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } type token1 interface { V1() *ProvisionTokenV1 } type token2 interface { V2() *ProvisionTokenV2 } version := cfg.GetVersion() switch version...
go
func MarshalProvisionToken(t ProvisionToken, opts ...MarshalOption) ([]byte, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } type token1 interface { V1() *ProvisionTokenV1 } type token2 interface { V2() *ProvisionTokenV2 } version := cfg.GetVersion() switch version...
[ "func", "MarshalProvisionToken", "(", "t", "ProvisionToken", ",", "opts", "...", "MarshalOption", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "cfg", ",", "err", ":=", "collectOptions", "(", "opts", ")", "\n", "if", "err", "!=", "nil", "{", "ret...
// MarshalProvisionToken marshals provisioning token into JSON.
[ "MarshalProvisionToken", "marshals", "provisioning", "token", "into", "JSON", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/provisioning.go#L332-L360
23,662
gravitational/teleport
lib/utils/proxy/proxy.go
NewClientConnWithDeadline
func NewClientConnWithDeadline(conn net.Conn, addr string, config *ssh.ClientConfig) (*ssh.Client, error) { if config.Timeout > 0 { conn.SetReadDeadline(time.Now().Add(config.Timeout)) } c, chans, reqs, err := ssh.NewClientConn(conn, addr, config) if err != nil { return nil, err } if config.Timeout > 0 { co...
go
func NewClientConnWithDeadline(conn net.Conn, addr string, config *ssh.ClientConfig) (*ssh.Client, error) { if config.Timeout > 0 { conn.SetReadDeadline(time.Now().Add(config.Timeout)) } c, chans, reqs, err := ssh.NewClientConn(conn, addr, config) if err != nil { return nil, err } if config.Timeout > 0 { co...
[ "func", "NewClientConnWithDeadline", "(", "conn", "net", ".", "Conn", ",", "addr", "string", ",", "config", "*", "ssh", ".", "ClientConfig", ")", "(", "*", "ssh", ".", "Client", ",", "error", ")", "{", "if", "config", ".", "Timeout", ">", "0", "{", "...
// NewClientConnWithDeadline establishes new client connection with specified deadline
[ "NewClientConnWithDeadline", "establishes", "new", "client", "connection", "with", "specified", "deadline" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/proxy/proxy.go#L41-L53
23,663
gravitational/teleport
lib/utils/proxy/proxy.go
DialWithDeadline
func DialWithDeadline(network string, addr string, config *ssh.ClientConfig) (*ssh.Client, error) { conn, err := net.DialTimeout(network, addr, config.Timeout) if err != nil { return nil, err } return NewClientConnWithDeadline(conn, addr, config) }
go
func DialWithDeadline(network string, addr string, config *ssh.ClientConfig) (*ssh.Client, error) { conn, err := net.DialTimeout(network, addr, config.Timeout) if err != nil { return nil, err } return NewClientConnWithDeadline(conn, addr, config) }
[ "func", "DialWithDeadline", "(", "network", "string", ",", "addr", "string", ",", "config", "*", "ssh", ".", "ClientConfig", ")", "(", "*", "ssh", ".", "Client", ",", "error", ")", "{", "conn", ",", "err", ":=", "net", ".", "DialTimeout", "(", "network...
// DialWithDeadline works around the case when net.DialWithTimeout // succeeds, but key exchange hangs. Setting deadline on connection // prevents this case from happening
[ "DialWithDeadline", "works", "around", "the", "case", "when", "net", ".", "DialWithTimeout", "succeeds", "but", "key", "exchange", "hangs", ".", "Setting", "deadline", "on", "connection", "prevents", "this", "case", "from", "happening" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/proxy/proxy.go#L58-L64
23,664
gravitational/teleport
lib/utils/proxy/proxy.go
Dial
func (d directDial) Dial(network string, addr string, config *ssh.ClientConfig) (*ssh.Client, error) { return DialWithDeadline(network, addr, config) }
go
func (d directDial) Dial(network string, addr string, config *ssh.ClientConfig) (*ssh.Client, error) { return DialWithDeadline(network, addr, config) }
[ "func", "(", "d", "directDial", ")", "Dial", "(", "network", "string", ",", "addr", "string", ",", "config", "*", "ssh", ".", "ClientConfig", ")", "(", "*", "ssh", ".", "Client", ",", "error", ")", "{", "return", "DialWithDeadline", "(", "network", ","...
// Dial calls ssh.Dial directly.
[ "Dial", "calls", "ssh", ".", "Dial", "directly", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/proxy/proxy.go#L78-L80
23,665
gravitational/teleport
lib/utils/proxy/proxy.go
Dial
func (d proxyDial) Dial(network string, addr string, config *ssh.ClientConfig) (*ssh.Client, error) { // Build a proxy connection first. pconn, err := dialProxy(context.Background(), d.proxyHost, addr) if err != nil { return nil, trace.Wrap(err) } if config.Timeout > 0 { pconn.SetReadDeadline(time.Now().Add(co...
go
func (d proxyDial) Dial(network string, addr string, config *ssh.ClientConfig) (*ssh.Client, error) { // Build a proxy connection first. pconn, err := dialProxy(context.Background(), d.proxyHost, addr) if err != nil { return nil, trace.Wrap(err) } if config.Timeout > 0 { pconn.SetReadDeadline(time.Now().Add(co...
[ "func", "(", "d", "proxyDial", ")", "Dial", "(", "network", "string", ",", "addr", "string", ",", "config", "*", "ssh", ".", "ClientConfig", ")", "(", "*", "ssh", ".", "Client", ",", "error", ")", "{", "// Build a proxy connection first.", "pconn", ",", ...
// Dial first connects to a proxy, then uses the connection to establish a new // SSH connection.
[ "Dial", "first", "connects", "to", "a", "proxy", "then", "uses", "the", "connection", "to", "establish", "a", "new", "SSH", "connection", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/proxy/proxy.go#L105-L123
23,666
gravitational/teleport
lib/utils/proxy/proxy.go
DialerFromEnvironment
func DialerFromEnvironment(addr string) Dialer { // Try and get proxy addr from the environment. proxyAddr := getProxyAddress(addr) // If no proxy settings are in environment return regular ssh dialer, // otherwise return a proxy dialer. if proxyAddr == "" { log.Debugf("No proxy set in environment, returning di...
go
func DialerFromEnvironment(addr string) Dialer { // Try and get proxy addr from the environment. proxyAddr := getProxyAddress(addr) // If no proxy settings are in environment return regular ssh dialer, // otherwise return a proxy dialer. if proxyAddr == "" { log.Debugf("No proxy set in environment, returning di...
[ "func", "DialerFromEnvironment", "(", "addr", "string", ")", "Dialer", "{", "// Try and get proxy addr from the environment.", "proxyAddr", ":=", "getProxyAddress", "(", "addr", ")", "\n\n", "// If no proxy settings are in environment return regular ssh dialer,", "// otherwise retu...
// DialerFromEnvironment returns a Dial function. If the https_proxy or http_proxy // environment variable are set, it returns a function that will dial through // said proxy server. If neither variable is set, it will connect to the SSH // server directly.
[ "DialerFromEnvironment", "returns", "a", "Dial", "function", ".", "If", "the", "https_proxy", "or", "http_proxy", "environment", "variable", "are", "set", "it", "returns", "a", "function", "that", "will", "dial", "through", "said", "proxy", "server", ".", "If", ...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/proxy/proxy.go#L129-L141
23,667
gravitational/teleport
lib/backend/etcdbk/etcd.go
New
func New(ctx context.Context, params backend.Params) (*EtcdBackend, error) { var err error if params == nil { return nil, trace.BadParameter("missing etcd configuration") } // convert generic backend parameters structure to etcd config: var cfg *Config if err = utils.ObjectToStruct(params, &cfg); err != nil { ...
go
func New(ctx context.Context, params backend.Params) (*EtcdBackend, error) { var err error if params == nil { return nil, trace.BadParameter("missing etcd configuration") } // convert generic backend parameters structure to etcd config: var cfg *Config if err = utils.ObjectToStruct(params, &cfg); err != nil { ...
[ "func", "New", "(", "ctx", "context", ".", "Context", ",", "params", "backend", ".", "Params", ")", "(", "*", "EtcdBackend", ",", "error", ")", "{", "var", "err", "error", "\n", "if", "params", "==", "nil", "{", "return", "nil", ",", "trace", ".", ...
// New returns new instance of Etcd-powered backend
[ "New", "returns", "new", "instance", "of", "Etcd", "-", "powered", "backend" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/etcdbk/etcd.go#L168-L207
23,668
gravitational/teleport
lib/backend/etcdbk/etcd.go
KeepAlive
func (b *EtcdBackend) KeepAlive(ctx context.Context, lease backend.Lease, expires time.Time) error { if lease.ID == 0 { return trace.BadParameter("lease is not specified") } re, err := b.client.Get(ctx, prependPrefix(lease.Key), clientv3.WithSerializable(), clientv3.WithKeysOnly()) if err != nil { return conver...
go
func (b *EtcdBackend) KeepAlive(ctx context.Context, lease backend.Lease, expires time.Time) error { if lease.ID == 0 { return trace.BadParameter("lease is not specified") } re, err := b.client.Get(ctx, prependPrefix(lease.Key), clientv3.WithSerializable(), clientv3.WithKeysOnly()) if err != nil { return conver...
[ "func", "(", "b", "*", "EtcdBackend", ")", "KeepAlive", "(", "ctx", "context", ".", "Context", ",", "lease", "backend", ".", "Lease", ",", "expires", "time", ".", "Time", ")", "error", "{", "if", "lease", ".", "ID", "==", "0", "{", "return", "trace",...
// KeepAlive updates TTL on the lease ID
[ "KeepAlive", "updates", "TTL", "on", "the", "lease", "ID" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/etcdbk/etcd.go#L487-L510
23,669
gravitational/teleport
lib/backend/etcdbk/etcd.go
seconds
func seconds(ttl time.Duration) int64 { i := int64(ttl / time.Second) if i <= 0 { i = 1 } return i }
go
func seconds(ttl time.Duration) int64 { i := int64(ttl / time.Second) if i <= 0 { i = 1 } return i }
[ "func", "seconds", "(", "ttl", "time", ".", "Duration", ")", "int64", "{", "i", ":=", "int64", "(", "ttl", "/", "time", ".", "Second", ")", "\n", "if", "i", "<=", "0", "{", "i", "=", "1", "\n", "}", "\n", "return", "i", "\n", "}" ]
// seconds converts duration to seconds, rounds up to 1 second
[ "seconds", "converts", "duration", "to", "seconds", "rounds", "up", "to", "1", "second" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/etcdbk/etcd.go#L606-L612
23,670
gravitational/teleport
tool/tctl/common/auth_command.go
GenerateKeys
func (a *AuthCommand) GenerateKeys() error { keygen, err := native.New(context.TODO(), native.PrecomputeKeys(0)) if err != nil { return trace.Wrap(err) } defer keygen.Close() privBytes, pubBytes, err := keygen.GenerateKeyPair("") if err != nil { return trace.Wrap(err) } err = ioutil.WriteFile(a.genPubPath, ...
go
func (a *AuthCommand) GenerateKeys() error { keygen, err := native.New(context.TODO(), native.PrecomputeKeys(0)) if err != nil { return trace.Wrap(err) } defer keygen.Close() privBytes, pubBytes, err := keygen.GenerateKeyPair("") if err != nil { return trace.Wrap(err) } err = ioutil.WriteFile(a.genPubPath, ...
[ "func", "(", "a", "*", "AuthCommand", ")", "GenerateKeys", "(", ")", "error", "{", "keygen", ",", "err", ":=", "native", ".", "New", "(", "context", ".", "TODO", "(", ")", ",", "native", ".", "PrecomputeKeys", "(", "0", ")", ")", "\n", "if", "err",...
// GenerateKeys generates a new keypair
[ "GenerateKeys", "generates", "a", "new", "keypair" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tctl/common/auth_command.go#L219-L241
23,671
gravitational/teleport
tool/tctl/common/auth_command.go
GenerateAndSignKeys
func (a *AuthCommand) GenerateAndSignKeys(clusterApi auth.ClientI) error { switch { case a.genUser != "" && a.genHost == "": return a.generateUserKeys(clusterApi) case a.genUser == "" && a.genHost != "": return a.generateHostKeys(clusterApi) default: return trace.BadParameter("--user or --host must be specifi...
go
func (a *AuthCommand) GenerateAndSignKeys(clusterApi auth.ClientI) error { switch { case a.genUser != "" && a.genHost == "": return a.generateUserKeys(clusterApi) case a.genUser == "" && a.genHost != "": return a.generateHostKeys(clusterApi) default: return trace.BadParameter("--user or --host must be specifi...
[ "func", "(", "a", "*", "AuthCommand", ")", "GenerateAndSignKeys", "(", "clusterApi", "auth", ".", "ClientI", ")", "error", "{", "switch", "{", "case", "a", ".", "genUser", "!=", "\"", "\"", "&&", "a", ".", "genHost", "==", "\"", "\"", ":", "return", ...
// GenerateAndSignKeys generates a new keypair and signs it for role
[ "GenerateAndSignKeys", "generates", "a", "new", "keypair", "and", "signs", "it", "for", "role" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tctl/common/auth_command.go#L244-L253
23,672
gravitational/teleport
tool/tctl/common/auth_command.go
RotateCertAuthority
func (a *AuthCommand) RotateCertAuthority(client auth.ClientI) error { req := auth.RotateRequest{ Type: services.CertAuthType(a.rotateType), GracePeriod: &a.rotateGracePeriod, TargetPhase: a.rotateTargetPhase, } if a.rotateManualMode { req.Mode = services.RotationModeManual } else { req.Mode = serv...
go
func (a *AuthCommand) RotateCertAuthority(client auth.ClientI) error { req := auth.RotateRequest{ Type: services.CertAuthType(a.rotateType), GracePeriod: &a.rotateGracePeriod, TargetPhase: a.rotateTargetPhase, } if a.rotateManualMode { req.Mode = services.RotationModeManual } else { req.Mode = serv...
[ "func", "(", "a", "*", "AuthCommand", ")", "RotateCertAuthority", "(", "client", "auth", ".", "ClientI", ")", "error", "{", "req", ":=", "auth", ".", "RotateRequest", "{", "Type", ":", "services", ".", "CertAuthType", "(", "a", ".", "rotateType", ")", ",...
// RotateCertAuthority starts or restarts certificate authority rotation process
[ "RotateCertAuthority", "starts", "or", "restarts", "certificate", "authority", "rotation", "process" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tctl/common/auth_command.go#L256-L277
23,673
gravitational/teleport
lib/backend/legacy/legacy.go
CollectOptions
func CollectOptions(opts []OpOption) (*OpConfig, error) { cfg := OpConfig{} for _, o := range opts { if err := o(&cfg); err != nil { return nil, trace.Wrap(err) } } return &cfg, nil }
go
func CollectOptions(opts []OpOption) (*OpConfig, error) { cfg := OpConfig{} for _, o := range opts { if err := o(&cfg); err != nil { return nil, trace.Wrap(err) } } return &cfg, nil }
[ "func", "CollectOptions", "(", "opts", "[", "]", "OpOption", ")", "(", "*", "OpConfig", ",", "error", ")", "{", "cfg", ":=", "OpConfig", "{", "}", "\n", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "err", ":=", "o", "(", "&", "cfg", ...
// CollectOptions collects all options from functional // arg and returns config
[ "CollectOptions", "collects", "all", "options", "from", "functional", "arg", "and", "returns", "config" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/legacy/legacy.go#L96-L104
23,674
gravitational/teleport
lib/backend/legacy/legacy.go
ValidateLockTTL
func ValidateLockTTL(ttl time.Duration) error { if ttl == Forever || ttl > MaxLockDuration { return trace.BadParameter("locks cannot exceed %v", MaxLockDuration) } return nil }
go
func ValidateLockTTL(ttl time.Duration) error { if ttl == Forever || ttl > MaxLockDuration { return trace.BadParameter("locks cannot exceed %v", MaxLockDuration) } return nil }
[ "func", "ValidateLockTTL", "(", "ttl", "time", ".", "Duration", ")", "error", "{", "if", "ttl", "==", "Forever", "||", "ttl", ">", "MaxLockDuration", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ",", "MaxLockDuration", ")", "\n", "}", "\...
// ValidateLockTTL helper allows all backends to validate lock TTL parameter
[ "ValidateLockTTL", "helper", "allows", "all", "backends", "to", "validate", "lock", "TTL", "parameter" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/legacy/legacy.go#L160-L165
23,675
gravitational/teleport
lib/backend/legacy/legacy.go
TTL
func TTL(clock clockwork.Clock, t time.Time) time.Duration { if t.IsZero() { return Forever } diff := t.UTC().Sub(clock.Now().UTC()) if diff < 0 { return Forever } return diff }
go
func TTL(clock clockwork.Clock, t time.Time) time.Duration { if t.IsZero() { return Forever } diff := t.UTC().Sub(clock.Now().UTC()) if diff < 0 { return Forever } return diff }
[ "func", "TTL", "(", "clock", "clockwork", ".", "Clock", ",", "t", "time", ".", "Time", ")", "time", ".", "Duration", "{", "if", "t", ".", "IsZero", "(", ")", "{", "return", "Forever", "\n", "}", "\n", "diff", ":=", "t", ".", "UTC", "(", ")", "....
// TTL converts time to TTL from current time supplied // by provider, if t is zero, returns forever
[ "TTL", "converts", "time", "to", "TTL", "from", "current", "time", "supplied", "by", "provider", "if", "t", "is", "zero", "returns", "forever" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/legacy/legacy.go#L180-L189
23,676
gravitational/teleport
lib/backend/legacy/legacy.go
AnyTTL
func AnyTTL(clock clockwork.Clock, times ...time.Time) time.Duration { for _, t := range times { if !t.IsZero() { return TTL(clock, t) } } return Forever }
go
func AnyTTL(clock clockwork.Clock, times ...time.Time) time.Duration { for _, t := range times { if !t.IsZero() { return TTL(clock, t) } } return Forever }
[ "func", "AnyTTL", "(", "clock", "clockwork", ".", "Clock", ",", "times", "...", "time", ".", "Time", ")", "time", ".", "Duration", "{", "for", "_", ",", "t", ":=", "range", "times", "{", "if", "!", "t", ".", "IsZero", "(", ")", "{", "return", "TT...
// AnyTTL returns TTL if any of the suplied times pass expiry time // otherwise returns forever
[ "AnyTTL", "returns", "TTL", "if", "any", "of", "the", "suplied", "times", "pass", "expiry", "time", "otherwise", "returns", "forever" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/legacy/legacy.go#L193-L200
23,677
gravitational/teleport
lib/limiter/connlimiter.go
NewConnectionsLimiter
func NewConnectionsLimiter(config LimiterConfig) (*ConnectionsLimiter, error) { limiter := ConnectionsLimiter{ Mutex: &sync.Mutex{}, maxConnections: config.MaxConnections, connections: make(map[string]int64), } ipExtractor, err := utils.NewExtractor("client.ip") if err != nil { return nil, trac...
go
func NewConnectionsLimiter(config LimiterConfig) (*ConnectionsLimiter, error) { limiter := ConnectionsLimiter{ Mutex: &sync.Mutex{}, maxConnections: config.MaxConnections, connections: make(map[string]int64), } ipExtractor, err := utils.NewExtractor("client.ip") if err != nil { return nil, trac...
[ "func", "NewConnectionsLimiter", "(", "config", "LimiterConfig", ")", "(", "*", "ConnectionsLimiter", ",", "error", ")", "{", "limiter", ":=", "ConnectionsLimiter", "{", "Mutex", ":", "&", "sync", ".", "Mutex", "{", "}", ",", "maxConnections", ":", "config", ...
// NewConnectionsLimiter returns new connection limiter, in case if connection // limits are not set, they won't be tracked
[ "NewConnectionsLimiter", "returns", "new", "connection", "limiter", "in", "case", "if", "connection", "limits", "are", "not", "set", "they", "won", "t", "be", "tracked" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/limiter/connlimiter.go#L39-L58
23,678
gravitational/teleport
lib/limiter/connlimiter.go
WrapHandle
func (l *ConnectionsLimiter) WrapHandle(h http.Handler) { l.ConnLimiter.Wrap(h) }
go
func (l *ConnectionsLimiter) WrapHandle(h http.Handler) { l.ConnLimiter.Wrap(h) }
[ "func", "(", "l", "*", "ConnectionsLimiter", ")", "WrapHandle", "(", "h", "http", ".", "Handler", ")", "{", "l", ".", "ConnLimiter", ".", "Wrap", "(", "h", ")", "\n", "}" ]
// WrapHandle adds connection limiter to the handle
[ "WrapHandle", "adds", "connection", "limiter", "to", "the", "handle" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/limiter/connlimiter.go#L61-L63
23,679
gravitational/teleport
lib/limiter/connlimiter.go
AcquireConnection
func (l *ConnectionsLimiter) AcquireConnection(token string) error { l.Lock() defer l.Unlock() if l.maxConnections == 0 { return nil } numberOfConnections, exists := l.connections[token] if !exists { l.connections[token] = 1 return nil } if numberOfConnections >= l.maxConnections { return trace.LimitE...
go
func (l *ConnectionsLimiter) AcquireConnection(token string) error { l.Lock() defer l.Unlock() if l.maxConnections == 0 { return nil } numberOfConnections, exists := l.connections[token] if !exists { l.connections[token] = 1 return nil } if numberOfConnections >= l.maxConnections { return trace.LimitE...
[ "func", "(", "l", "*", "ConnectionsLimiter", ")", "AcquireConnection", "(", "token", "string", ")", "error", "{", "l", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "Unlock", "(", ")", "\n\n", "if", "l", ".", "maxConnections", "==", "0", "{", "retu...
// AcquireConnection acquires connection and bumps counter
[ "AcquireConnection", "acquires", "connection", "and", "bumps", "counter" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/limiter/connlimiter.go#L66-L86
23,680
gravitational/teleport
lib/limiter/connlimiter.go
ReleaseConnection
func (l *ConnectionsLimiter) ReleaseConnection(token string) { l.Lock() defer l.Unlock() if l.maxConnections == 0 { return } numberOfConnections, exists := l.connections[token] if !exists { log.Errorf("Trying to set negative number of connections") } else { if numberOfConnections <= 1 { delete(l.conn...
go
func (l *ConnectionsLimiter) ReleaseConnection(token string) { l.Lock() defer l.Unlock() if l.maxConnections == 0 { return } numberOfConnections, exists := l.connections[token] if !exists { log.Errorf("Trying to set negative number of connections") } else { if numberOfConnections <= 1 { delete(l.conn...
[ "func", "(", "l", "*", "ConnectionsLimiter", ")", "ReleaseConnection", "(", "token", "string", ")", "{", "l", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "Unlock", "(", ")", "\n\n", "if", "l", ".", "maxConnections", "==", "0", "{", "return", "\n"...
// ReleaseConnection decrements the counter
[ "ReleaseConnection", "decrements", "the", "counter" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/limiter/connlimiter.go#L89-L108
23,681
gravitational/teleport
lib/utils/time.go
MinTTL
func MinTTL(a, b time.Duration) time.Duration { if a == 0 { return b } if b == 0 { return a } if a < b { return a } return b }
go
func MinTTL(a, b time.Duration) time.Duration { if a == 0 { return b } if b == 0 { return a } if a < b { return a } return b }
[ "func", "MinTTL", "(", "a", ",", "b", "time", ".", "Duration", ")", "time", ".", "Duration", "{", "if", "a", "==", "0", "{", "return", "b", "\n", "}", "\n", "if", "b", "==", "0", "{", "return", "a", "\n", "}", "\n", "if", "a", "<", "b", "{"...
// MinTTL finds min non 0 TTL duration, // if both durations are 0, fails
[ "MinTTL", "finds", "min", "non", "0", "TTL", "duration", "if", "both", "durations", "are", "0", "fails" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/time.go#L11-L22
23,682
gravitational/teleport
lib/utils/time.go
ToTTL
func ToTTL(c clockwork.Clock, tm time.Time) time.Duration { now := c.Now().UTC() if tm.IsZero() || tm.Before(now) { return 0 } return tm.Sub(now) }
go
func ToTTL(c clockwork.Clock, tm time.Time) time.Duration { now := c.Now().UTC() if tm.IsZero() || tm.Before(now) { return 0 } return tm.Sub(now) }
[ "func", "ToTTL", "(", "c", "clockwork", ".", "Clock", ",", "tm", "time", ".", "Time", ")", "time", ".", "Duration", "{", "now", ":=", "c", ".", "Now", "(", ")", ".", "UTC", "(", ")", "\n", "if", "tm", ".", "IsZero", "(", ")", "||", "tm", ".",...
// ToTTL converts expiration time to TTL duration // relative to current time as provided by clock
[ "ToTTL", "converts", "expiration", "time", "to", "TTL", "duration", "relative", "to", "current", "time", "as", "provided", "by", "clock" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/time.go#L26-L32
23,683
gravitational/teleport
lib/utils/time.go
UTC
func UTC(t *time.Time) { if t == nil { return } if t.IsZero() { // to fix issue with timezones for tests *t = time.Time{} return } *t = t.UTC() }
go
func UTC(t *time.Time) { if t == nil { return } if t.IsZero() { // to fix issue with timezones for tests *t = time.Time{} return } *t = t.UTC() }
[ "func", "UTC", "(", "t", "*", "time", ".", "Time", ")", "{", "if", "t", "==", "nil", "{", "return", "\n", "}", "\n\n", "if", "t", ".", "IsZero", "(", ")", "{", "// to fix issue with timezones for tests", "*", "t", "=", "time", ".", "Time", "{", "}"...
// UTC converts time to UTC timezone
[ "UTC", "converts", "time", "to", "UTC", "timezone" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/time.go#L35-L46
23,684
gravitational/teleport
lib/auth/password.go
ChangePassword
func (s *AuthServer) ChangePassword(req services.ChangePasswordReq) error { // validate new password err := services.VerifyPassword(req.NewPassword) if err != nil { return trace.Wrap(err) } authPreference, err := s.GetAuthPreference() if err != nil { return trace.Wrap(err) } userID := req.User fn := func...
go
func (s *AuthServer) ChangePassword(req services.ChangePasswordReq) error { // validate new password err := services.VerifyPassword(req.NewPassword) if err != nil { return trace.Wrap(err) } authPreference, err := s.GetAuthPreference() if err != nil { return trace.Wrap(err) } userID := req.User fn := func...
[ "func", "(", "s", "*", "AuthServer", ")", "ChangePassword", "(", "req", "services", ".", "ChangePasswordReq", ")", "error", "{", "// validate new password", "err", ":=", "services", ".", "VerifyPassword", "(", "req", ".", "NewPassword", ")", "\n", "if", "err",...
// ChangePassword changes user passsword
[ "ChangePassword", "changes", "user", "passsword" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/password.go#L21-L58
23,685
gravitational/teleport
lib/auth/password.go
CheckPasswordWOToken
func (s *AuthServer) CheckPasswordWOToken(user string, password []byte) error { const errMsg = "invalid username or password" err := services.VerifyPassword(password) if err != nil { return trace.BadParameter(errMsg) } hash, err := s.GetPasswordHash(user) if err != nil && !trace.IsNotFound(err) { return tra...
go
func (s *AuthServer) CheckPasswordWOToken(user string, password []byte) error { const errMsg = "invalid username or password" err := services.VerifyPassword(password) if err != nil { return trace.BadParameter(errMsg) } hash, err := s.GetPasswordHash(user) if err != nil && !trace.IsNotFound(err) { return tra...
[ "func", "(", "s", "*", "AuthServer", ")", "CheckPasswordWOToken", "(", "user", "string", ",", "password", "[", "]", "byte", ")", "error", "{", "const", "errMsg", "=", "\"", "\"", "\n\n", "err", ":=", "services", ".", "VerifyPassword", "(", "password", ")...
// CheckPasswordWOToken checks just password without checking OTP tokens // used in case of SSH authentication, when token has been validated.
[ "CheckPasswordWOToken", "checks", "just", "password", "without", "checking", "OTP", "tokens", "used", "in", "case", "of", "SSH", "authentication", "when", "token", "has", "been", "validated", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/password.go#L62-L85
23,686
gravitational/teleport
lib/auth/password.go
GetOTPData
func (s *AuthServer) GetOTPData(user string) (string, []byte, error) { // get otp key from backend otpSecret, err := s.GetTOTP(user) if err != nil { return "", nil, trace.Wrap(err) } // create otp url params := map[string][]byte{"secret": []byte(otpSecret)} otpURL := utils.GenerateOTPURL("totp", user, params)...
go
func (s *AuthServer) GetOTPData(user string) (string, []byte, error) { // get otp key from backend otpSecret, err := s.GetTOTP(user) if err != nil { return "", nil, trace.Wrap(err) } // create otp url params := map[string][]byte{"secret": []byte(otpSecret)} otpURL := utils.GenerateOTPURL("totp", user, params)...
[ "func", "(", "s", "*", "AuthServer", ")", "GetOTPData", "(", "user", "string", ")", "(", "string", ",", "[", "]", "byte", ",", "error", ")", "{", "// get otp key from backend", "otpSecret", ",", "err", ":=", "s", ".", "GetTOTP", "(", "user", ")", "\n",...
// GetOTPData returns the OTP Key, Key URL, and the QR code.
[ "GetOTPData", "returns", "the", "OTP", "Key", "Key", "URL", "and", "the", "QR", "code", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/password.go#L182-L200
23,687
gravitational/teleport
lib/services/parser.go
NewWhereParser
func NewWhereParser(ctx RuleContext) (predicate.Parser, error) { return predicate.NewParser(predicate.Def{ Operators: predicate.Operators{ AND: predicate.And, OR: predicate.Or, NOT: predicate.Not, }, Functions: map[string]interface{}{ "equals": predicate.Equals, "contains": predicate.Contains, ...
go
func NewWhereParser(ctx RuleContext) (predicate.Parser, error) { return predicate.NewParser(predicate.Def{ Operators: predicate.Operators{ AND: predicate.And, OR: predicate.Or, NOT: predicate.Not, }, Functions: map[string]interface{}{ "equals": predicate.Equals, "contains": predicate.Contains, ...
[ "func", "NewWhereParser", "(", "ctx", "RuleContext", ")", "(", "predicate", ".", "Parser", ",", "error", ")", "{", "return", "predicate", ".", "NewParser", "(", "predicate", ".", "Def", "{", "Operators", ":", "predicate", ".", "Operators", "{", "AND", ":",...
// NewWhereParser returns standard parser for `where` section in access rules.
[ "NewWhereParser", "returns", "standard", "parser", "for", "where", "section", "in", "access", "rules", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/parser.go#L56-L87
23,688
gravitational/teleport
lib/services/parser.go
NewActionsParser
func NewActionsParser(ctx RuleContext) (predicate.Parser, error) { return predicate.NewParser(predicate.Def{ Operators: predicate.Operators{}, Functions: map[string]interface{}{ "log": NewLogActionFn(ctx), }, GetIdentifier: ctx.GetIdentifier, GetProperty: predicate.GetStringMapValue, }) }
go
func NewActionsParser(ctx RuleContext) (predicate.Parser, error) { return predicate.NewParser(predicate.Def{ Operators: predicate.Operators{}, Functions: map[string]interface{}{ "log": NewLogActionFn(ctx), }, GetIdentifier: ctx.GetIdentifier, GetProperty: predicate.GetStringMapValue, }) }
[ "func", "NewActionsParser", "(", "ctx", "RuleContext", ")", "(", "predicate", ".", "Parser", ",", "error", ")", "{", "return", "predicate", ".", "NewParser", "(", "predicate", ".", "Def", "{", "Operators", ":", "predicate", ".", "Operators", "{", "}", ",",...
// NewActionsParser returns standard parser for 'actions' section in access rules
[ "NewActionsParser", "returns", "standard", "parser", "for", "actions", "section", "in", "access", "rules" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/parser.go#L125-L134
23,689
gravitational/teleport
lib/services/parser.go
NewLogActionFn
func NewLogActionFn(ctx RuleContext) interface{} { l := &LogAction{ctx: ctx} writer, ok := ctx.(io.Writer) if ok && writer != nil { l.writer = writer } return l.Log }
go
func NewLogActionFn(ctx RuleContext) interface{} { l := &LogAction{ctx: ctx} writer, ok := ctx.(io.Writer) if ok && writer != nil { l.writer = writer } return l.Log }
[ "func", "NewLogActionFn", "(", "ctx", "RuleContext", ")", "interface", "{", "}", "{", "l", ":=", "&", "LogAction", "{", "ctx", ":", "ctx", "}", "\n", "writer", ",", "ok", ":=", "ctx", ".", "(", "io", ".", "Writer", ")", "\n", "if", "ok", "&&", "w...
// NewLogActionFn creates logger functions
[ "NewLogActionFn", "creates", "logger", "functions" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/parser.go#L137-L144
23,690
gravitational/teleport
lib/services/parser.go
Log
func (l *LogAction) Log(level, format string, args ...interface{}) predicate.BoolPredicate { return func() bool { ilevel, err := log.ParseLevel(level) if err != nil { ilevel = log.DebugLevel } var writer io.Writer if l.writer != nil { writer = l.writer } else { writer = log.StandardLogger().Writer...
go
func (l *LogAction) Log(level, format string, args ...interface{}) predicate.BoolPredicate { return func() bool { ilevel, err := log.ParseLevel(level) if err != nil { ilevel = log.DebugLevel } var writer io.Writer if l.writer != nil { writer = l.writer } else { writer = log.StandardLogger().Writer...
[ "func", "(", "l", "*", "LogAction", ")", "Log", "(", "level", ",", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "predicate", ".", "BoolPredicate", "{", "return", "func", "(", ")", "bool", "{", "ilevel", ",", "err", ":=", "log",...
// Log logs with specified level and formatting string with arguments
[ "Log", "logs", "with", "specified", "level", "and", "formatting", "string", "with", "arguments" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/parser.go#L154-L169
23,691
gravitational/teleport
lib/services/parser.go
String
func (ctx *Context) String() string { return fmt.Sprintf("user %v, resource: %v", ctx.User, ctx.Resource) }
go
func (ctx *Context) String() string { return fmt.Sprintf("user %v, resource: %v", ctx.User, ctx.Resource) }
[ "func", "(", "ctx", "*", "Context", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "ctx", ".", "User", ",", "ctx", ".", "Resource", ")", "\n", "}" ]
// String returns user friendly representation of this context
[ "String", "returns", "user", "friendly", "representation", "of", "this", "context" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/parser.go#L181-L183
23,692
gravitational/teleport
lib/services/parser.go
GetResource
func (ctx *Context) GetResource() (Resource, error) { if ctx.Resource == nil { return nil, trace.NotFound("resource is not set in the context") } return ctx.Resource, nil }
go
func (ctx *Context) GetResource() (Resource, error) { if ctx.Resource == nil { return nil, trace.NotFound("resource is not set in the context") } return ctx.Resource, nil }
[ "func", "(", "ctx", "*", "Context", ")", "GetResource", "(", ")", "(", "Resource", ",", "error", ")", "{", "if", "ctx", ".", "Resource", "==", "nil", "{", "return", "nil", ",", "trace", ".", "NotFound", "(", "\"", "\"", ")", "\n", "}", "\n", "ret...
// GetResource returns resource specified in the context, // returns error if not specified.
[ "GetResource", "returns", "resource", "specified", "in", "the", "context", "returns", "error", "if", "not", "specified", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/parser.go#L194-L199
23,693
gravitational/teleport
lib/services/parser.go
GetIdentifier
func (ctx *Context) GetIdentifier(fields []string) (interface{}, error) { switch fields[0] { case UserIdentifier: var user User if ctx.User == nil { user = emptyUser } else { user = ctx.User } return predicate.GetFieldByTag(user, teleport.JSON, fields[1:]) case ResourceIdentifier: var resource Reso...
go
func (ctx *Context) GetIdentifier(fields []string) (interface{}, error) { switch fields[0] { case UserIdentifier: var user User if ctx.User == nil { user = emptyUser } else { user = ctx.User } return predicate.GetFieldByTag(user, teleport.JSON, fields[1:]) case ResourceIdentifier: var resource Reso...
[ "func", "(", "ctx", "*", "Context", ")", "GetIdentifier", "(", "fields", "[", "]", "string", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "switch", "fields", "[", "0", "]", "{", "case", "UserIdentifier", ":", "var", "user", "User", "\n", ...
// GetIdentifier returns identifier defined in a context
[ "GetIdentifier", "returns", "identifier", "defined", "in", "a", "context" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/parser.go#L202-L223
23,694
gravitational/teleport
lib/secret/secret.go
ParseKey
func ParseKey(k []byte) (Key, error) { key, err := hex.DecodeString(string(k)) if err != nil { return nil, trace.Wrap(err) } return Key(key), nil }
go
func ParseKey(k []byte) (Key, error) { key, err := hex.DecodeString(string(k)) if err != nil { return nil, trace.Wrap(err) } return Key(key), nil }
[ "func", "ParseKey", "(", "k", "[", "]", "byte", ")", "(", "Key", ",", "error", ")", "{", "key", ",", "err", ":=", "hex", ".", "DecodeString", "(", "string", "(", "k", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "trace",...
// ParseKey reads in an existing hex encoded key.
[ "ParseKey", "reads", "in", "an", "existing", "hex", "encoded", "key", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/secret/secret.go#L54-L61
23,695
gravitational/teleport
lib/secret/secret.go
Seal
func (k Key) Seal(plaintext []byte) ([]byte, error) { block, err := aes.NewCipher([]byte(k)) if err != nil { return nil, trace.Wrap(err) } aesgcm, err := cipher.NewGCM(block) if err != nil { return nil, trace.Wrap(err) } nonce := make([]byte, aesgcm.NonceSize()) _, err = io.ReadFull(rand.Reader, nonce) i...
go
func (k Key) Seal(plaintext []byte) ([]byte, error) { block, err := aes.NewCipher([]byte(k)) if err != nil { return nil, trace.Wrap(err) } aesgcm, err := cipher.NewGCM(block) if err != nil { return nil, trace.Wrap(err) } nonce := make([]byte, aesgcm.NonceSize()) _, err = io.ReadFull(rand.Reader, nonce) i...
[ "func", "(", "k", "Key", ")", "Seal", "(", "plaintext", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "block", ",", "err", ":=", "aes", ".", "NewCipher", "(", "[", "]", "byte", "(", "k", ")", ")", "\n", "if", "err", ...
// Seal will encrypt then authenticate the ciphertext.
[ "Seal", "will", "encrypt", "then", "authenticate", "the", "ciphertext", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/secret/secret.go#L64-L90
23,696
gravitational/teleport
lib/secret/secret.go
Open
func (k Key) Open(ciphertext []byte) ([]byte, error) { var data sealedData err := json.Unmarshal(ciphertext, &data) if err != nil { return nil, trace.Wrap(err) } block, err := aes.NewCipher(k) if err != nil { return nil, trace.Wrap(err) } aesgcm, err := cipher.NewGCM(block) if err != nil { return nil,...
go
func (k Key) Open(ciphertext []byte) ([]byte, error) { var data sealedData err := json.Unmarshal(ciphertext, &data) if err != nil { return nil, trace.Wrap(err) } block, err := aes.NewCipher(k) if err != nil { return nil, trace.Wrap(err) } aesgcm, err := cipher.NewGCM(block) if err != nil { return nil,...
[ "func", "(", "k", "Key", ")", "Open", "(", "ciphertext", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "data", "sealedData", "\n\n", "err", ":=", "json", ".", "Unmarshal", "(", "ciphertext", ",", "&", "data", ")", "...
// Open will authenticate then decrypt the ciphertext.
[ "Open", "will", "authenticate", "then", "decrypt", "the", "ciphertext", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/secret/secret.go#L93-L117
23,697
gravitational/teleport
lib/events/forward.go
NewForwarder
func NewForwarder(cfg ForwarderConfig) (*Forwarder, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } diskLogger, err := NewDiskSessionLogger(DiskSessionLoggerConfig{ SessionID: cfg.SessionID, DataDir: cfg.DataDir, RecordSessions: cfg.RecordSessions, Names...
go
func NewForwarder(cfg ForwarderConfig) (*Forwarder, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } diskLogger, err := NewDiskSessionLogger(DiskSessionLoggerConfig{ SessionID: cfg.SessionID, DataDir: cfg.DataDir, RecordSessions: cfg.RecordSessions, Names...
[ "func", "NewForwarder", "(", "cfg", "ForwarderConfig", ")", "(", "*", "Forwarder", ",", "error", ")", "{", "if", "err", ":=", "cfg", ".", "CheckAndSetDefaults", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "trace", ".", "Wrap", "(", ...
// NewForwarder returns a new instance of session forwarder
[ "NewForwarder", "returns", "a", "new", "instance", "of", "session", "forwarder" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/forward.go#L71-L90
23,698
gravitational/teleport
lib/events/forward.go
Close
func (l *Forwarder) Close() error { l.Lock() defer l.Unlock() if l.isClosed { return nil } l.isClosed = true return l.sessionLogger.Finalize() }
go
func (l *Forwarder) Close() error { l.Lock() defer l.Unlock() if l.isClosed { return nil } l.isClosed = true return l.sessionLogger.Finalize() }
[ "func", "(", "l", "*", "Forwarder", ")", "Close", "(", ")", "error", "{", "l", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "Unlock", "(", ")", "\n", "if", "l", ".", "isClosed", "{", "return", "nil", "\n", "}", "\n", "l", ".", "isClosed", ...
// Closer releases connection and resources associated with log if any
[ "Closer", "releases", "connection", "and", "resources", "associated", "with", "log", "if", "any" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/forward.go#L104-L112
23,699
gravitational/teleport
lib/events/forward.go
WaitForDelivery
func (l *Forwarder) WaitForDelivery(ctx context.Context) error { return l.ForwardTo.WaitForDelivery(ctx) }
go
func (l *Forwarder) WaitForDelivery(ctx context.Context) error { return l.ForwardTo.WaitForDelivery(ctx) }
[ "func", "(", "l", "*", "Forwarder", ")", "WaitForDelivery", "(", "ctx", "context", ".", "Context", ")", "error", "{", "return", "l", ".", "ForwardTo", ".", "WaitForDelivery", "(", "ctx", ")", "\n", "}" ]
// WaitForDelivery waits for resources to be released and outstanding requests to // complete after calling Close method
[ "WaitForDelivery", "waits", "for", "resources", "to", "be", "released", "and", "outstanding", "requests", "to", "complete", "after", "calling", "Close", "method" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/forward.go#L241-L243