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
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
gravitational/teleport
lib/utils/socks/socks.go
writeReply
func writeReply(conn net.Conn) error { // Write success reply, similar to OpenSSH only success is written. // https://github.com/openssh/openssh-portable/blob/5d14019/channels.c#L1442-L1452 message := []byte{ socks5Version, socks5Succeeded, socks5Reserved, socks5AddressTypeIPv4, } n, err := conn.Write(mess...
go
func writeReply(conn net.Conn) error { // Write success reply, similar to OpenSSH only success is written. // https://github.com/openssh/openssh-portable/blob/5d14019/channels.c#L1442-L1452 message := []byte{ socks5Version, socks5Succeeded, socks5Reserved, socks5AddressTypeIPv4, } n, err := conn.Write(mess...
[ "func", "writeReply", "(", "conn", "net", ".", "Conn", ")", "error", "{", "// Write success reply, similar to OpenSSH only success is written.", "// https://github.com/openssh/openssh-portable/blob/5d14019/channels.c#L1442-L1452", "message", ":=", "[", "]", "byte", "{", "socks5Ve...
// Write the response to the client.
[ "Write", "the", "response", "to", "the", "client", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/socks/socks.go#L209-L238
train
gravitational/teleport
lib/utils/socks/socks.go
readByte
func readByte(conn net.Conn) (byte, error) { b := make([]byte, 1) _, err := io.ReadFull(conn, b) if err != nil { return 0, trace.Wrap(err) } return b[0], nil }
go
func readByte(conn net.Conn) (byte, error) { b := make([]byte, 1) _, err := io.ReadFull(conn, b) if err != nil { return 0, trace.Wrap(err) } return b[0], nil }
[ "func", "readByte", "(", "conn", "net", ".", "Conn", ")", "(", "byte", ",", "error", ")", "{", "b", ":=", "make", "(", "[", "]", "byte", ",", "1", ")", "\n", "_", ",", "err", ":=", "io", ".", "ReadFull", "(", "conn", ",", "b", ")", "\n", "i...
// readByte a single byte from the passed in net.Conn.
[ "readByte", "a", "single", "byte", "from", "the", "passed", "in", "net", ".", "Conn", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/socks/socks.go#L241-L249
train
gravitational/teleport
lib/utils/socks/socks.go
byteSliceContains
func byteSliceContains(a []byte, b byte) bool { for _, v := range a { if v == b { return true } } return false }
go
func byteSliceContains(a []byte, b byte) bool { for _, v := range a { if v == b { return true } } return false }
[ "func", "byteSliceContains", "(", "a", "[", "]", "byte", ",", "b", "byte", ")", "bool", "{", "for", "_", ",", "v", ":=", "range", "a", "{", "if", "v", "==", "b", "{", "return", "true", "\n", "}", "\n", "}", "\n\n", "return", "false", "\n", "}" ...
// byteSliceContains checks if the slice a contains the byte b.
[ "byteSliceContains", "checks", "if", "the", "slice", "a", "contains", "the", "byte", "b", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/socks/socks.go#L252-L260
train
gravitational/teleport
lib/shell/shell.go
GetLoginShell
func GetLoginShell(username string) (string, error) { var err error var shellcmd string shellcmd, err = getLoginShell(username) if err != nil { if !trace.IsNotFound(err) { logrus.Warnf("No shell specified for %v, using default %v.", username, DefaultShell) return DefaultShell, nil } return "", trace.Wr...
go
func GetLoginShell(username string) (string, error) { var err error var shellcmd string shellcmd, err = getLoginShell(username) if err != nil { if !trace.IsNotFound(err) { logrus.Warnf("No shell specified for %v, using default %v.", username, DefaultShell) return DefaultShell, nil } return "", trace.Wr...
[ "func", "GetLoginShell", "(", "username", "string", ")", "(", "string", ",", "error", ")", "{", "var", "err", "error", "\n", "var", "shellcmd", "string", "\n\n", "shellcmd", ",", "err", "=", "getLoginShell", "(", "username", ")", "\n", "if", "err", "!=",...
// GetLoginShell determines the login shell for a given username.
[ "GetLoginShell", "determines", "the", "login", "shell", "for", "a", "given", "username", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/shell/shell.go#L30-L44
train
gravitational/teleport
integration/helpers.go
GetRoles
func (s *InstanceSecrets) GetRoles() []services.Role { var roles []services.Role for _, ca := range s.GetCAs() { if ca.GetType() != services.UserCA { continue } role := services.RoleForCertAuthority(ca) role.SetLogins(services.Allow, s.AllowedLogins()) roles = append(roles, role) } return roles }
go
func (s *InstanceSecrets) GetRoles() []services.Role { var roles []services.Role for _, ca := range s.GetCAs() { if ca.GetType() != services.UserCA { continue } role := services.RoleForCertAuthority(ca) role.SetLogins(services.Allow, s.AllowedLogins()) roles = append(roles, role) } return roles }
[ "func", "(", "s", "*", "InstanceSecrets", ")", "GetRoles", "(", ")", "[", "]", "services", ".", "Role", "{", "var", "roles", "[", "]", "services", ".", "Role", "\n", "for", "_", ",", "ca", ":=", "range", "s", ".", "GetCAs", "(", ")", "{", "if", ...
// GetRoles returns a list of roles to initiate for this secret
[ "GetRoles", "returns", "a", "list", "of", "roles", "to", "initiate", "for", "this", "secret" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/integration/helpers.go#L231-L242
train
gravitational/teleport
integration/helpers.go
SetupUserCreds
func SetupUserCreds(tc *client.TeleportClient, proxyHost string, creds UserCreds) error { _, err := tc.AddKey(proxyHost, &creds.Key) if err != nil { return trace.Wrap(err) } err = tc.AddTrustedCA(creds.HostCA) if err != nil { return trace.Wrap(err) } return nil }
go
func SetupUserCreds(tc *client.TeleportClient, proxyHost string, creds UserCreds) error { _, err := tc.AddKey(proxyHost, &creds.Key) if err != nil { return trace.Wrap(err) } err = tc.AddTrustedCA(creds.HostCA) if err != nil { return trace.Wrap(err) } return nil }
[ "func", "SetupUserCreds", "(", "tc", "*", "client", ".", "TeleportClient", ",", "proxyHost", "string", ",", "creds", "UserCreds", ")", "error", "{", "_", ",", "err", ":=", "tc", ".", "AddKey", "(", "proxyHost", ",", "&", "creds", ".", "Key", ")", "\n",...
// SetupUserCreds sets up user credentials for client
[ "SetupUserCreds", "sets", "up", "user", "credentials", "for", "client" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/integration/helpers.go#L357-L367
train
gravitational/teleport
integration/helpers.go
SetupUser
func SetupUser(process *service.TeleportProcess, username string, roles []services.Role) error { auth := process.GetAuthServer() teleUser, err := services.NewUser(username) if err != nil { return trace.Wrap(err) } if len(roles) == 0 { role := services.RoleForUser(teleUser) role.SetLogins(services.Allow, []st...
go
func SetupUser(process *service.TeleportProcess, username string, roles []services.Role) error { auth := process.GetAuthServer() teleUser, err := services.NewUser(username) if err != nil { return trace.Wrap(err) } if len(roles) == 0 { role := services.RoleForUser(teleUser) role.SetLogins(services.Allow, []st...
[ "func", "SetupUser", "(", "process", "*", "service", ".", "TeleportProcess", ",", "username", "string", ",", "roles", "[", "]", "services", ".", "Role", ")", "error", "{", "auth", ":=", "process", ".", "GetAuthServer", "(", ")", "\n", "teleUser", ",", "e...
// SetupUser sets up user in the cluster
[ "SetupUser", "sets", "up", "user", "in", "the", "cluster" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/integration/helpers.go#L370-L405
train
gravitational/teleport
integration/helpers.go
GenerateUserCreds
func GenerateUserCreds(process *service.TeleportProcess, username string) (*UserCreds, error) { priv, pub, err := testauthority.New().GenerateKeyPair("") if err != nil { return nil, trace.Wrap(err) } a := process.GetAuthServer() sshCert, x509Cert, err := a.GenerateUserCerts(pub, username, time.Hour, teleport.Cer...
go
func GenerateUserCreds(process *service.TeleportProcess, username string) (*UserCreds, error) { priv, pub, err := testauthority.New().GenerateKeyPair("") if err != nil { return nil, trace.Wrap(err) } a := process.GetAuthServer() sshCert, x509Cert, err := a.GenerateUserCerts(pub, username, time.Hour, teleport.Cer...
[ "func", "GenerateUserCreds", "(", "process", "*", "service", ".", "TeleportProcess", ",", "username", "string", ")", "(", "*", "UserCreds", ",", "error", ")", "{", "priv", ",", "pub", ",", "err", ":=", "testauthority", ".", "New", "(", ")", ".", "Generat...
// GenerateUserCreds generates key to be used by client
[ "GenerateUserCreds", "generates", "key", "to", "be", "used", "by", "client" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/integration/helpers.go#L408-L438
train
gravitational/teleport
integration/helpers.go
StartNode
func (i *TeleInstance) StartNode(tconf *service.Config) (*service.TeleportProcess, error) { dataDir, err := ioutil.TempDir("", "cluster-"+i.Secrets.SiteName) if err != nil { return nil, trace.Wrap(err) } tconf.DataDir = dataDir authServer := utils.MustParseAddr(net.JoinHostPort(i.Hostname, i.GetPortAuth())) tc...
go
func (i *TeleInstance) StartNode(tconf *service.Config) (*service.TeleportProcess, error) { dataDir, err := ioutil.TempDir("", "cluster-"+i.Secrets.SiteName) if err != nil { return nil, trace.Wrap(err) } tconf.DataDir = dataDir authServer := utils.MustParseAddr(net.JoinHostPort(i.Hostname, i.GetPortAuth())) tc...
[ "func", "(", "i", "*", "TeleInstance", ")", "StartNode", "(", "tconf", "*", "service", ".", "Config", ")", "(", "*", "service", ".", "TeleportProcess", ",", "error", ")", "{", "dataDir", ",", "err", ":=", "ioutil", ".", "TempDir", "(", "\"", "\"", ",...
// StartNode starts a SSH node and connects it to the cluster.
[ "StartNode", "starts", "a", "SSH", "node", "and", "connects", "it", "to", "the", "cluster", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/integration/helpers.go#L603-L655
train
gravitational/teleport
integration/helpers.go
StartNodeAndProxy
func (i *TeleInstance) StartNodeAndProxy(name string, sshPort, proxyWebPort, proxySSHPort int) error { dataDir, err := ioutil.TempDir("", "cluster-"+i.Secrets.SiteName) if err != nil { return trace.Wrap(err) } tconf := service.MakeDefaultConfig() authServer := utils.MustParseAddr(net.JoinHostPort(i.Hostname, i...
go
func (i *TeleInstance) StartNodeAndProxy(name string, sshPort, proxyWebPort, proxySSHPort int) error { dataDir, err := ioutil.TempDir("", "cluster-"+i.Secrets.SiteName) if err != nil { return trace.Wrap(err) } tconf := service.MakeDefaultConfig() authServer := utils.MustParseAddr(net.JoinHostPort(i.Hostname, i...
[ "func", "(", "i", "*", "TeleInstance", ")", "StartNodeAndProxy", "(", "name", "string", ",", "sshPort", ",", "proxyWebPort", ",", "proxySSHPort", "int", ")", "error", "{", "dataDir", ",", "err", ":=", "ioutil", ".", "TempDir", "(", "\"", "\"", ",", "\"",...
// StartNodeAndProxy starts a SSH node and a Proxy Server and connects it to // the cluster.
[ "StartNodeAndProxy", "starts", "a", "SSH", "node", "and", "a", "Proxy", "Server", "and", "connects", "it", "to", "the", "cluster", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/integration/helpers.go#L659-L725
train
gravitational/teleport
integration/helpers.go
StartProxy
func (i *TeleInstance) StartProxy(cfg ProxyConfig) error { dataDir, err := ioutil.TempDir("", "cluster-"+i.Secrets.SiteName+"-"+cfg.Name) if err != nil { return trace.Wrap(err) } tconf := service.MakeDefaultConfig() authServer := utils.MustParseAddr(net.JoinHostPort(i.Hostname, i.GetPortAuth())) tconf.AuthSer...
go
func (i *TeleInstance) StartProxy(cfg ProxyConfig) error { dataDir, err := ioutil.TempDir("", "cluster-"+i.Secrets.SiteName+"-"+cfg.Name) if err != nil { return trace.Wrap(err) } tconf := service.MakeDefaultConfig() authServer := utils.MustParseAddr(net.JoinHostPort(i.Hostname, i.GetPortAuth())) tconf.AuthSer...
[ "func", "(", "i", "*", "TeleInstance", ")", "StartProxy", "(", "cfg", "ProxyConfig", ")", "error", "{", "dataDir", ",", "err", ":=", "ioutil", ".", "TempDir", "(", "\"", "\"", ",", "\"", "\"", "+", "i", ".", "Secrets", ".", "SiteName", "+", "\"", "...
// StartProxy starts another Proxy Server and connects it to the cluster.
[ "StartProxy", "starts", "another", "Proxy", "Server", "and", "connects", "it", "to", "the", "cluster", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/integration/helpers.go#L740-L802
train
gravitational/teleport
integration/helpers.go
Reset
func (i *TeleInstance) Reset() (err error) { i.Process, err = service.NewTeleport(i.Config) if err != nil { return trace.Wrap(err) } return nil }
go
func (i *TeleInstance) Reset() (err error) { i.Process, err = service.NewTeleport(i.Config) if err != nil { return trace.Wrap(err) } return nil }
[ "func", "(", "i", "*", "TeleInstance", ")", "Reset", "(", ")", "(", "err", "error", ")", "{", "i", ".", "Process", ",", "err", "=", "service", ".", "NewTeleport", "(", "i", ".", "Config", ")", "\n", "if", "err", "!=", "nil", "{", "return", "trace...
// Reset re-creates the teleport instance based on the same configuration // This is needed if you want to stop the instance, reset it and start again
[ "Reset", "re", "-", "creates", "the", "teleport", "instance", "based", "on", "the", "same", "configuration", "This", "is", "needed", "if", "you", "want", "to", "stop", "the", "instance", "reset", "it", "and", "start", "again" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/integration/helpers.go#L806-L812
train
gravitational/teleport
integration/helpers.go
AddUserWithRole
func (i *TeleInstance) AddUserWithRole(username string, role services.Role) *User { user := &User{ Username: username, Roles: []services.Role{role}, } i.Secrets.Users[username] = user return user }
go
func (i *TeleInstance) AddUserWithRole(username string, role services.Role) *User { user := &User{ Username: username, Roles: []services.Role{role}, } i.Secrets.Users[username] = user return user }
[ "func", "(", "i", "*", "TeleInstance", ")", "AddUserWithRole", "(", "username", "string", ",", "role", "services", ".", "Role", ")", "*", "User", "{", "user", ":=", "&", "User", "{", "Username", ":", "username", ",", "Roles", ":", "[", "]", "services",...
// AddUserUserWithRole adds user with assigned role
[ "AddUserUserWithRole", "adds", "user", "with", "assigned", "role" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/integration/helpers.go#L815-L822
train
gravitational/teleport
integration/helpers.go
AddUser
func (i *TeleInstance) AddUser(username string, mappings []string) *User { log.Infof("teleInstance.AddUser(%v) mapped to %v", username, mappings) if mappings == nil { mappings = make([]string, 0) } user := &User{ Username: username, AllowedLogins: mappings, } i.Secrets.Users[username] = user return us...
go
func (i *TeleInstance) AddUser(username string, mappings []string) *User { log.Infof("teleInstance.AddUser(%v) mapped to %v", username, mappings) if mappings == nil { mappings = make([]string, 0) } user := &User{ Username: username, AllowedLogins: mappings, } i.Secrets.Users[username] = user return us...
[ "func", "(", "i", "*", "TeleInstance", ")", "AddUser", "(", "username", "string", ",", "mappings", "[", "]", "string", ")", "*", "User", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "username", ",", "mappings", ")", "\n", "if", "mappings", "==", ...
// Adds a new user into i Teleport instance. 'mappings' is a comma-separated // list of OS users
[ "Adds", "a", "new", "user", "into", "i", "Teleport", "instance", ".", "mappings", "is", "a", "comma", "-", "separated", "list", "of", "OS", "users" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/integration/helpers.go#L826-L837
train
gravitational/teleport
integration/helpers.go
Start
func (i *TeleInstance) Start() error { // Build a list of expected events to wait for before unblocking based off // the configuration passed in. expectedEvents := []string{} if i.Config.Auth.Enabled { expectedEvents = append(expectedEvents, service.AuthTLSReady) } if i.Config.Proxy.Enabled { expectedEvents =...
go
func (i *TeleInstance) Start() error { // Build a list of expected events to wait for before unblocking based off // the configuration passed in. expectedEvents := []string{} if i.Config.Auth.Enabled { expectedEvents = append(expectedEvents, service.AuthTLSReady) } if i.Config.Proxy.Enabled { expectedEvents =...
[ "func", "(", "i", "*", "TeleInstance", ")", "Start", "(", ")", "error", "{", "// Build a list of expected events to wait for before unblocking based off", "// the configuration passed in.", "expectedEvents", ":=", "[", "]", "string", "{", "}", "\n", "if", "i", ".", "C...
// Start will start the TeleInstance and then block until it is ready to // process requests based off the passed in configuration.
[ "Start", "will", "start", "the", "TeleInstance", "and", "then", "block", "until", "it", "is", "ready", "to", "process", "requests", "based", "off", "the", "passed", "in", "configuration", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/integration/helpers.go#L841-L886
train
gravitational/teleport
integration/helpers.go
NewClientWithCreds
func (i *TeleInstance) NewClientWithCreds(cfg ClientConfig, creds UserCreds) (tc *client.TeleportClient, err error) { clt, err := i.NewUnauthenticatedClient(cfg) if err != nil { return nil, trace.Wrap(err) } err = SetupUserCreds(clt, i.Config.Proxy.SSHAddr.Addr, creds) if err != nil { return nil, trace.Wrap(er...
go
func (i *TeleInstance) NewClientWithCreds(cfg ClientConfig, creds UserCreds) (tc *client.TeleportClient, err error) { clt, err := i.NewUnauthenticatedClient(cfg) if err != nil { return nil, trace.Wrap(err) } err = SetupUserCreds(clt, i.Config.Proxy.SSHAddr.Addr, creds) if err != nil { return nil, trace.Wrap(er...
[ "func", "(", "i", "*", "TeleInstance", ")", "NewClientWithCreds", "(", "cfg", "ClientConfig", ",", "creds", "UserCreds", ")", "(", "tc", "*", "client", ".", "TeleportClient", ",", "err", "error", ")", "{", "clt", ",", "err", ":=", "i", ".", "NewUnauthent...
// NewClientWithCreds creates client with credentials
[ "NewClientWithCreds", "creates", "client", "with", "credentials" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/integration/helpers.go#L906-L916
train
gravitational/teleport
integration/helpers.go
StopProxy
func (i *TeleInstance) StopProxy() error { var errors []error for _, p := range i.Nodes { if p.Config.Proxy.Enabled { if err := p.Close(); err != nil { errors = append(errors, err) log.Errorf("Failed closing extra proxy: %v.", err) } if err := p.Wait(); err != nil { errors = append(errors, err...
go
func (i *TeleInstance) StopProxy() error { var errors []error for _, p := range i.Nodes { if p.Config.Proxy.Enabled { if err := p.Close(); err != nil { errors = append(errors, err) log.Errorf("Failed closing extra proxy: %v.", err) } if err := p.Wait(); err != nil { errors = append(errors, err...
[ "func", "(", "i", "*", "TeleInstance", ")", "StopProxy", "(", ")", "error", "{", "var", "errors", "[", "]", "error", "\n\n", "for", "_", ",", "p", ":=", "range", "i", ".", "Nodes", "{", "if", "p", ".", "Config", ".", "Proxy", ".", "Enabled", "{",...
// StopProxy loops over the extra nodes in a TeleInstance and stops all // nodes where the proxy server is enabled.
[ "StopProxy", "loops", "over", "the", "extra", "nodes", "in", "a", "TeleInstance", "and", "stops", "all", "nodes", "where", "the", "proxy", "server", "is", "enabled", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/integration/helpers.go#L993-L1010
train
gravitational/teleport
integration/helpers.go
StopNodes
func (i *TeleInstance) StopNodes() error { var errors []error for _, node := range i.Nodes { if err := node.Close(); err != nil { errors = append(errors, err) log.Errorf("failed closing extra node %v", err) } if err := node.Wait(); err != nil { errors = append(errors, err) log.Errorf("failed stoppin...
go
func (i *TeleInstance) StopNodes() error { var errors []error for _, node := range i.Nodes { if err := node.Close(); err != nil { errors = append(errors, err) log.Errorf("failed closing extra node %v", err) } if err := node.Wait(); err != nil { errors = append(errors, err) log.Errorf("failed stoppin...
[ "func", "(", "i", "*", "TeleInstance", ")", "StopNodes", "(", ")", "error", "{", "var", "errors", "[", "]", "error", "\n", "for", "_", ",", "node", ":=", "range", "i", ".", "Nodes", "{", "if", "err", ":=", "node", ".", "Close", "(", ")", ";", "...
// StopNodes stops additional nodes
[ "StopNodes", "stops", "additional", "nodes" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/integration/helpers.go#L1013-L1026
train
gravitational/teleport
integration/helpers.go
ServeHTTP
func (p *proxyServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { // Validate http connect parameters. if r.Method != http.MethodConnect { trace.WriteError(w, trace.BadParameter("%v not supported", r.Method)) return } if r.Host == "" { trace.WriteError(w, trace.BadParameter("host not set")) return ...
go
func (p *proxyServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { // Validate http connect parameters. if r.Method != http.MethodConnect { trace.WriteError(w, trace.BadParameter("%v not supported", r.Method)) return } if r.Host == "" { trace.WriteError(w, trace.BadParameter("host not set")) return ...
[ "func", "(", "p", "*", "proxyServer", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "// Validate http connect parameters.", "if", "r", ".", "Method", "!=", "http", ".", "MethodConnect", "{", "tr...
// ServeHTTP only accepts the CONNECT verb and will tunnel your connection to // the specified host. Also tracks the number of connections that it proxies for // debugging purposes.
[ "ServeHTTP", "only", "accepts", "the", "CONNECT", "verb", "and", "will", "tunnel", "your", "connection", "to", "the", "specified", "host", ".", "Also", "tracks", "the", "number", "of", "connections", "that", "it", "proxies", "for", "debugging", "purposes", "."...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/integration/helpers.go#L1093-L1149
train
gravitational/teleport
integration/helpers.go
Count
func (p *proxyServer) Count() int { p.Lock() defer p.Unlock() return p.count }
go
func (p *proxyServer) Count() int { p.Lock() defer p.Unlock() return p.count }
[ "func", "(", "p", "*", "proxyServer", ")", "Count", "(", ")", "int", "{", "p", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "Unlock", "(", ")", "\n", "return", "p", ".", "count", "\n", "}" ]
// Count returns the number of connections that have been proxied.
[ "Count", "returns", "the", "number", "of", "connections", "that", "have", "been", "proxied", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/integration/helpers.go#L1152-L1156
train
gravitational/teleport
integration/helpers.go
createAgent
func createAgent(me *user.User, privateKeyByte []byte, certificateBytes []byte) (*teleagent.AgentServer, string, string, error) { // create a path to the unix socket sockDir, err := ioutil.TempDir("", "int-test") if err != nil { return nil, "", "", trace.Wrap(err) } sockPath := filepath.Join(sockDir, "agent.sock...
go
func createAgent(me *user.User, privateKeyByte []byte, certificateBytes []byte) (*teleagent.AgentServer, string, string, error) { // create a path to the unix socket sockDir, err := ioutil.TempDir("", "int-test") if err != nil { return nil, "", "", trace.Wrap(err) } sockPath := filepath.Join(sockDir, "agent.sock...
[ "func", "createAgent", "(", "me", "*", "user", ".", "User", ",", "privateKeyByte", "[", "]", "byte", ",", "certificateBytes", "[", "]", "byte", ")", "(", "*", "teleagent", ".", "AgentServer", ",", "string", ",", "string", ",", "error", ")", "{", "// cr...
// createAgent creates a SSH agent with the passed in private key and // certificate that can be used in tests. This is useful so tests don't // clobber your system agent.
[ "createAgent", "creates", "a", "SSH", "agent", "with", "the", "passed", "in", "private", "key", "and", "certificate", "that", "can", "be", "used", "in", "tests", ".", "This", "is", "useful", "so", "tests", "don", "t", "clobber", "your", "system", "agent", ...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/integration/helpers.go#L1307-L1353
train
gravitational/teleport
lib/auth/native/native.go
SetClock
func SetClock(clock clockwork.Clock) KeygenOption { return func(k *Keygen) error { k.clock = clock return nil } }
go
func SetClock(clock clockwork.Clock) KeygenOption { return func(k *Keygen) error { k.clock = clock return nil } }
[ "func", "SetClock", "(", "clock", "clockwork", ".", "Clock", ")", "KeygenOption", "{", "return", "func", "(", "k", "*", "Keygen", ")", "error", "{", "k", ".", "clock", "=", "clock", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// SetClock sets the clock to use for key generation.
[ "SetClock", "sets", "the", "clock", "to", "use", "for", "key", "generation", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/native/native.go#L70-L75
train
gravitational/teleport
lib/auth/native/native.go
PrecomputeKeys
func PrecomputeKeys(count int) KeygenOption { return func(k *Keygen) error { k.precomputeCount = count return nil } }
go
func PrecomputeKeys(count int) KeygenOption { return func(k *Keygen) error { k.precomputeCount = count return nil } }
[ "func", "PrecomputeKeys", "(", "count", "int", ")", "KeygenOption", "{", "return", "func", "(", "k", "*", "Keygen", ")", "error", "{", "k", ".", "precomputeCount", "=", "count", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// PrecomputeKeys sets up a number of private keys to pre-compute // in background, 0 disables the process
[ "PrecomputeKeys", "sets", "up", "a", "number", "of", "private", "keys", "to", "pre", "-", "compute", "in", "background", "0", "disables", "the", "process" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/native/native.go#L79-L84
train
gravitational/teleport
lib/auth/native/native.go
New
func New(ctx context.Context, opts ...KeygenOption) (*Keygen, error) { ctx, cancel := context.WithCancel(ctx) k := &Keygen{ ctx: ctx, cancel: cancel, precomputeCount: PrecomputedNum, clock: clockwork.NewRealClock(), } for _, opt := range opts { if err := opt(k); err != nil {...
go
func New(ctx context.Context, opts ...KeygenOption) (*Keygen, error) { ctx, cancel := context.WithCancel(ctx) k := &Keygen{ ctx: ctx, cancel: cancel, precomputeCount: PrecomputedNum, clock: clockwork.NewRealClock(), } for _, opt := range opts { if err := opt(k); err != nil {...
[ "func", "New", "(", "ctx", "context", ".", "Context", ",", "opts", "...", "KeygenOption", ")", "(", "*", "Keygen", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithCancel", "(", "ctx", ")", "\n", "k", ":=", "&", "Keygen", "{...
// New returns a new key generator.
[ "New", "returns", "a", "new", "key", "generator", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/native/native.go#L87-L110
train
gravitational/teleport
lib/auth/native/native.go
GetNewKeyPairFromPool
func (k *Keygen) GetNewKeyPairFromPool() ([]byte, []byte, error) { select { case key := <-k.keysCh: return key.privPem, key.pubBytes, nil default: return GenerateKeyPair("") } }
go
func (k *Keygen) GetNewKeyPairFromPool() ([]byte, []byte, error) { select { case key := <-k.keysCh: return key.privPem, key.pubBytes, nil default: return GenerateKeyPair("") } }
[ "func", "(", "k", "*", "Keygen", ")", "GetNewKeyPairFromPool", "(", ")", "(", "[", "]", "byte", ",", "[", "]", "byte", ",", "error", ")", "{", "select", "{", "case", "key", ":=", "<-", "k", ".", "keysCh", ":", "return", "key", ".", "privPem", ","...
// GetNewKeyPairFromPool returns precomputed key pair from the pool.
[ "GetNewKeyPairFromPool", "returns", "precomputed", "key", "pair", "from", "the", "pool", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/native/native.go#L118-L125
train
gravitational/teleport
lib/auth/native/native.go
precomputeKeys
func (k *Keygen) precomputeKeys() { for { privPem, pubBytes, err := GenerateKeyPair("") if err != nil { log.Errorf("Unable to generate key pair: %v.", err) continue } key := keyPair{ privPem: privPem, pubBytes: pubBytes, } select { case <-k.ctx.Done(): log.Infof("Stopping key precomputat...
go
func (k *Keygen) precomputeKeys() { for { privPem, pubBytes, err := GenerateKeyPair("") if err != nil { log.Errorf("Unable to generate key pair: %v.", err) continue } key := keyPair{ privPem: privPem, pubBytes: pubBytes, } select { case <-k.ctx.Done(): log.Infof("Stopping key precomputat...
[ "func", "(", "k", "*", "Keygen", ")", "precomputeKeys", "(", ")", "{", "for", "{", "privPem", ",", "pubBytes", ",", "err", ":=", "GenerateKeyPair", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ...
// precomputeKeys continues loops forever trying to compute cache key pairs.
[ "precomputeKeys", "continues", "loops", "forever", "trying", "to", "compute", "cache", "key", "pairs", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/native/native.go#L128-L148
train
gravitational/teleport
lib/auth/native/native.go
GenerateHostCert
func (k *Keygen) GenerateHostCert(c services.HostCertParams) ([]byte, error) { if err := c.Check(); err != nil { return nil, trace.Wrap(err) } pubKey, _, _, _, err := ssh.ParseAuthorizedKey(c.PublicHostKey) if err != nil { return nil, trace.Wrap(err) } signer, err := ssh.ParsePrivateKey(c.PrivateCASigningKe...
go
func (k *Keygen) GenerateHostCert(c services.HostCertParams) ([]byte, error) { if err := c.Check(); err != nil { return nil, trace.Wrap(err) } pubKey, _, _, _, err := ssh.ParseAuthorizedKey(c.PublicHostKey) if err != nil { return nil, trace.Wrap(err) } signer, err := ssh.ParsePrivateKey(c.PrivateCASigningKe...
[ "func", "(", "k", "*", "Keygen", ")", "GenerateHostCert", "(", "c", "services", ".", "HostCertParams", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "err", ":=", "c", ".", "Check", "(", ")", ";", "err", "!=", "nil", "{", "return", "ni...
// GenerateHostCert generates a host certificate with the passed in parameters. // The private key of the CA to sign the certificate must be provided.
[ "GenerateHostCert", "generates", "a", "host", "certificate", "with", "the", "passed", "in", "parameters", ".", "The", "private", "key", "of", "the", "CA", "to", "sign", "the", "certificate", "must", "be", "provided", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/native/native.go#L181-L231
train
gravitational/teleport
lib/auth/native/native.go
GenerateUserCert
func (k *Keygen) GenerateUserCert(c services.UserCertParams) ([]byte, error) { if c.TTL < defaults.MinCertDuration { return nil, trace.BadParameter("wrong certificate TTL") } if len(c.AllowedLogins) == 0 { return nil, trace.BadParameter("allowedLogins: need allowed OS logins") } pubKey, _, _, _, err := ssh.Par...
go
func (k *Keygen) GenerateUserCert(c services.UserCertParams) ([]byte, error) { if c.TTL < defaults.MinCertDuration { return nil, trace.BadParameter("wrong certificate TTL") } if len(c.AllowedLogins) == 0 { return nil, trace.BadParameter("allowedLogins: need allowed OS logins") } pubKey, _, _, _, err := ssh.Par...
[ "func", "(", "k", "*", "Keygen", ")", "GenerateUserCert", "(", "c", "services", ".", "UserCertParams", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "c", ".", "TTL", "<", "defaults", ".", "MinCertDuration", "{", "return", "nil", ",", "tra...
// GenerateUserCert generates a host certificate with the passed in parameters. // The private key of the CA to sign the certificate must be provided.
[ "GenerateUserCert", "generates", "a", "host", "certificate", "with", "the", "passed", "in", "parameters", ".", "The", "private", "key", "of", "the", "CA", "to", "sign", "the", "certificate", "must", "be", "provided", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/native/native.go#L235-L292
train
gravitational/teleport
lib/events/s3sessions/s3handler.go
NewHandler
func NewHandler(cfg Config) (*Handler, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } h := &Handler{ Entry: log.WithFields(log.Fields{ trace.Component: teleport.Component(teleport.SchemeS3), }), Config: cfg, uploader: s3manager.NewUploader(cfg.Session), ...
go
func NewHandler(cfg Config) (*Handler, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } h := &Handler{ Entry: log.WithFields(log.Fields{ trace.Component: teleport.Component(teleport.SchemeS3), }), Config: cfg, uploader: s3manager.NewUploader(cfg.Session), ...
[ "func", "NewHandler", "(", "cfg", "Config", ")", "(", "*", "Handler", ",", "error", ")", "{", "if", "err", ":=", "cfg", ".", "CheckAndSetDefaults", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "trace", ".", "Wrap", "(", "err", ")",...
// NewHandler returns new S3 uploader
[ "NewHandler", "returns", "new", "S3", "uploader" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/s3sessions/s3handler.go#L76-L97
train
gravitational/teleport
lib/events/s3sessions/s3handler.go
Upload
func (l *Handler) Upload(ctx context.Context, sessionID session.ID, reader io.Reader) (string, error) { path := l.path(sessionID) _, err := l.uploader.UploadWithContext(ctx, &s3manager.UploadInput{ Bucket: aws.String(l.Bucket), Key: aws.String(path), Body: reader, ...
go
func (l *Handler) Upload(ctx context.Context, sessionID session.ID, reader io.Reader) (string, error) { path := l.path(sessionID) _, err := l.uploader.UploadWithContext(ctx, &s3manager.UploadInput{ Bucket: aws.String(l.Bucket), Key: aws.String(path), Body: reader, ...
[ "func", "(", "l", "*", "Handler", ")", "Upload", "(", "ctx", "context", ".", "Context", ",", "sessionID", "session", ".", "ID", ",", "reader", "io", ".", "Reader", ")", "(", "string", ",", "error", ")", "{", "path", ":=", "l", ".", "path", "(", "...
// Upload uploads object to S3 bucket, reads the contents of the object from reader // and returns the target S3 bucket path in case of successful upload.
[ "Upload", "uploads", "object", "to", "S3", "bucket", "reads", "the", "contents", "of", "the", "object", "from", "reader", "and", "returns", "the", "target", "S3", "bucket", "path", "in", "case", "of", "successful", "upload", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/s3sessions/s3handler.go#L117-L129
train
gravitational/teleport
lib/events/s3sessions/s3handler.go
Download
func (l *Handler) Download(ctx context.Context, sessionID session.ID, writer io.WriterAt) error { written, err := l.downloader.DownloadWithContext(ctx, writer, &s3.GetObjectInput{ Bucket: aws.String(l.Bucket), Key: aws.String(l.path(sessionID)), }) if err != nil { return ConvertS3Error(err) } if written =...
go
func (l *Handler) Download(ctx context.Context, sessionID session.ID, writer io.WriterAt) error { written, err := l.downloader.DownloadWithContext(ctx, writer, &s3.GetObjectInput{ Bucket: aws.String(l.Bucket), Key: aws.String(l.path(sessionID)), }) if err != nil { return ConvertS3Error(err) } if written =...
[ "func", "(", "l", "*", "Handler", ")", "Download", "(", "ctx", "context", ".", "Context", ",", "sessionID", "session", ".", "ID", ",", "writer", "io", ".", "WriterAt", ")", "error", "{", "written", ",", "err", ":=", "l", ".", "downloader", ".", "Down...
// Download downloads recorded session from S3 bucket and writes the results into writer // return trace.NotFound error is object is not found
[ "Download", "downloads", "recorded", "session", "from", "S3", "bucket", "and", "writes", "the", "results", "into", "writer", "return", "trace", ".", "NotFound", "error", "is", "object", "is", "not", "found" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/s3sessions/s3handler.go#L133-L145
train
gravitational/teleport
lib/events/s3sessions/s3handler.go
deleteBucket
func (h *Handler) deleteBucket() error { // first, list and delete all the objects in the bucket out, err := h.client.ListObjectVersions(&s3.ListObjectVersionsInput{ Bucket: aws.String(h.Bucket), }) if err != nil { return ConvertS3Error(err) } for _, ver := range out.Versions { _, err := h.client.DeleteObje...
go
func (h *Handler) deleteBucket() error { // first, list and delete all the objects in the bucket out, err := h.client.ListObjectVersions(&s3.ListObjectVersionsInput{ Bucket: aws.String(h.Bucket), }) if err != nil { return ConvertS3Error(err) } for _, ver := range out.Versions { _, err := h.client.DeleteObje...
[ "func", "(", "h", "*", "Handler", ")", "deleteBucket", "(", ")", "error", "{", "// first, list and delete all the objects in the bucket", "out", ",", "err", ":=", "h", ".", "client", ".", "ListObjectVersions", "(", "&", "s3", ".", "ListObjectVersionsInput", "{", ...
// delete bucket deletes bucket and all it's contents and is used in tests
[ "delete", "bucket", "deletes", "bucket", "and", "all", "it", "s", "contents", "and", "is", "used", "in", "tests" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/s3sessions/s3handler.go#L148-L170
train
gravitational/teleport
lib/events/s3sessions/s3handler.go
ensureBucket
func (h *Handler) ensureBucket() error { _, err := h.client.HeadBucket(&s3.HeadBucketInput{ Bucket: aws.String(h.Bucket), }) err = ConvertS3Error(err) // assumes that bucket is administered by other entity if err == nil { return nil } if !trace.IsNotFound(err) { return trace.Wrap(err) } input := &s3.Crea...
go
func (h *Handler) ensureBucket() error { _, err := h.client.HeadBucket(&s3.HeadBucketInput{ Bucket: aws.String(h.Bucket), }) err = ConvertS3Error(err) // assumes that bucket is administered by other entity if err == nil { return nil } if !trace.IsNotFound(err) { return trace.Wrap(err) } input := &s3.Crea...
[ "func", "(", "h", "*", "Handler", ")", "ensureBucket", "(", ")", "error", "{", "_", ",", "err", ":=", "h", ".", "client", ".", "HeadBucket", "(", "&", "s3", ".", "HeadBucketInput", "{", "Bucket", ":", "aws", ".", "String", "(", "h", ".", "Bucket", ...
// ensureBucket makes sure bucket exists, and if it does not, creates it
[ "ensureBucket", "makes", "sure", "bucket", "exists", "and", "if", "it", "does", "not", "creates", "it" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/s3sessions/s3handler.go#L180-L233
train
gravitational/teleport
lib/events/s3sessions/s3handler.go
ConvertS3Error
func ConvertS3Error(err error, args ...interface{}) error { if err == nil { return nil } if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case s3.ErrCodeNoSuchKey, s3.ErrCodeNoSuchBucket, s3.ErrCodeNoSuchUpload, "NotFound": return trace.NotFound(aerr.Error(), args...) case s3.ErrCodeBucketAlre...
go
func ConvertS3Error(err error, args ...interface{}) error { if err == nil { return nil } if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case s3.ErrCodeNoSuchKey, s3.ErrCodeNoSuchBucket, s3.ErrCodeNoSuchUpload, "NotFound": return trace.NotFound(aerr.Error(), args...) case s3.ErrCodeBucketAlre...
[ "func", "ConvertS3Error", "(", "err", "error", ",", "args", "...", "interface", "{", "}", ")", "error", "{", "if", "err", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "if", "aerr", ",", "ok", ":=", "err", ".", "(", "awserr", ".", "Error", ...
// ConvertS3Error wraps S3 error and returns trace equivalent
[ "ConvertS3Error", "wraps", "S3", "error", "and", "returns", "trace", "equivalent" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/s3sessions/s3handler.go#L236-L251
train
gravitational/teleport
roles.go
NewRoles
func NewRoles(in []string) (Roles, error) { var roles Roles for _, val := range in { role := Role(val) if err := role.Check(); err != nil { return nil, trace.Wrap(err) } roles = append(roles, role) } return roles, nil }
go
func NewRoles(in []string) (Roles, error) { var roles Roles for _, val := range in { role := Role(val) if err := role.Check(); err != nil { return nil, trace.Wrap(err) } roles = append(roles, role) } return roles, nil }
[ "func", "NewRoles", "(", "in", "[", "]", "string", ")", "(", "Roles", ",", "error", ")", "{", "var", "roles", "Roles", "\n", "for", "_", ",", "val", ":=", "range", "in", "{", "role", ":=", "Role", "(", "val", ")", "\n", "if", "err", ":=", "role...
// NewRoles return a list of roles from slice of strings
[ "NewRoles", "return", "a", "list", "of", "roles", "from", "slice", "of", "strings" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/roles.go#L61-L71
train
gravitational/teleport
roles.go
ParseRoles
func ParseRoles(str string) (roles Roles, err error) { for _, s := range strings.Split(str, ",") { r := Role(strings.Title(strings.ToLower(strings.TrimSpace(s)))) if err = r.Check(); err != nil { return nil, trace.Wrap(err) } roles = append(roles, r) } return roles, nil }
go
func ParseRoles(str string) (roles Roles, err error) { for _, s := range strings.Split(str, ",") { r := Role(strings.Title(strings.ToLower(strings.TrimSpace(s)))) if err = r.Check(); err != nil { return nil, trace.Wrap(err) } roles = append(roles, r) } return roles, nil }
[ "func", "ParseRoles", "(", "str", "string", ")", "(", "roles", "Roles", ",", "err", "error", ")", "{", "for", "_", ",", "s", ":=", "range", "strings", ".", "Split", "(", "str", ",", "\"", "\"", ")", "{", "r", ":=", "Role", "(", "strings", ".", ...
// ParseRoles takes a comma-separated list of roles and returns a slice // of roles, or an error if parsing failed
[ "ParseRoles", "takes", "a", "comma", "-", "separated", "list", "of", "roles", "and", "returns", "a", "slice", "of", "roles", "or", "an", "error", "if", "parsing", "failed" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/roles.go#L75-L84
train
gravitational/teleport
roles.go
Include
func (roles Roles) Include(role Role) bool { for _, r := range roles { if r == role { return true } } return false }
go
func (roles Roles) Include(role Role) bool { for _, r := range roles { if r == role { return true } } return false }
[ "func", "(", "roles", "Roles", ")", "Include", "(", "role", "Role", ")", "bool", "{", "for", "_", ",", "r", ":=", "range", "roles", "{", "if", "r", "==", "role", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
// Includes returns 'true' if a given list of roles includes a given role
[ "Includes", "returns", "true", "if", "a", "given", "list", "of", "roles", "includes", "a", "given", "role" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/roles.go#L87-L94
train
gravitational/teleport
roles.go
StringSlice
func (roles Roles) StringSlice() []string { s := make([]string, 0) for _, r := range roles { s = append(s, r.String()) } return s }
go
func (roles Roles) StringSlice() []string { s := make([]string, 0) for _, r := range roles { s = append(s, r.String()) } return s }
[ "func", "(", "roles", "Roles", ")", "StringSlice", "(", ")", "[", "]", "string", "{", "s", ":=", "make", "(", "[", "]", "string", ",", "0", ")", "\n", "for", "_", ",", "r", ":=", "range", "roles", "{", "s", "=", "append", "(", "s", ",", "r", ...
// Slice returns roles as string slice
[ "Slice", "returns", "roles", "as", "string", "slice" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/roles.go#L97-L103
train
gravitational/teleport
roles.go
Equals
func (roles Roles) Equals(other Roles) bool { if len(roles) != len(other) { return false } for _, r := range roles { if !other.Include(r) { return false } } return true }
go
func (roles Roles) Equals(other Roles) bool { if len(roles) != len(other) { return false } for _, r := range roles { if !other.Include(r) { return false } } return true }
[ "func", "(", "roles", "Roles", ")", "Equals", "(", "other", "Roles", ")", "bool", "{", "if", "len", "(", "roles", ")", "!=", "len", "(", "other", ")", "{", "return", "false", "\n", "}", "\n", "for", "_", ",", "r", ":=", "range", "roles", "{", "...
// Equals compares two sets of roles
[ "Equals", "compares", "two", "sets", "of", "roles" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/roles.go#L106-L116
train
gravitational/teleport
roles.go
Set
func (r *Role) Set(v string) error { val := Role(strings.Title(v)) if err := val.Check(); err != nil { return trace.Wrap(err) } *r = val return nil }
go
func (r *Role) Set(v string) error { val := Role(strings.Title(v)) if err := val.Check(); err != nil { return trace.Wrap(err) } *r = val return nil }
[ "func", "(", "r", "*", "Role", ")", "Set", "(", "v", "string", ")", "error", "{", "val", ":=", "Role", "(", "strings", ".", "Title", "(", "v", ")", ")", "\n", "if", "err", ":=", "val", ".", "Check", "(", ")", ";", "err", "!=", "nil", "{", "...
// Set sets the value of the role from string, used to integrate with CLI tools
[ "Set", "sets", "the", "value", "of", "the", "role", "from", "string", "used", "to", "integrate", "with", "CLI", "tools" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/roles.go#L134-L141
train
gravitational/teleport
roles.go
String
func (r *Role) String() string { switch string(*r) { case string(RoleSignup): return "User signup" case string(RoleTrustedCluster), string(LegacyClusterTokenType): return "trusted_cluster" default: return fmt.Sprintf("%v", string(*r)) } }
go
func (r *Role) String() string { switch string(*r) { case string(RoleSignup): return "User signup" case string(RoleTrustedCluster), string(LegacyClusterTokenType): return "trusted_cluster" default: return fmt.Sprintf("%v", string(*r)) } }
[ "func", "(", "r", "*", "Role", ")", "String", "(", ")", "string", "{", "switch", "string", "(", "*", "r", ")", "{", "case", "string", "(", "RoleSignup", ")", ":", "return", "\"", "\"", "\n", "case", "string", "(", "RoleTrustedCluster", ")", ",", "s...
// String returns debug-friendly representation of this role.
[ "String", "returns", "debug", "-", "friendly", "representation", "of", "this", "role", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/roles.go#L144-L153
train
gravitational/teleport
roles.go
Check
func (r *Role) Check() error { switch *r { case RoleAuth, RoleWeb, RoleNode, RoleAdmin, RoleProvisionToken, RoleTrustedCluster, LegacyClusterTokenType, RoleSignup, RoleProxy, RoleNop: return nil } return trace.BadParameter("role %v is not registered", *r) }
go
func (r *Role) Check() error { switch *r { case RoleAuth, RoleWeb, RoleNode, RoleAdmin, RoleProvisionToken, RoleTrustedCluster, LegacyClusterTokenType, RoleSignup, RoleProxy, RoleNop: return nil } return trace.BadParameter("role %v is not registered", *r) }
[ "func", "(", "r", "*", "Role", ")", "Check", "(", ")", "error", "{", "switch", "*", "r", "{", "case", "RoleAuth", ",", "RoleWeb", ",", "RoleNode", ",", "RoleAdmin", ",", "RoleProvisionToken", ",", "RoleTrustedCluster", ",", "LegacyClusterTokenType", ",", "...
// Check checks if this a a valid role value, returns nil // if it's ok, false otherwise
[ "Check", "checks", "if", "this", "a", "a", "valid", "role", "value", "returns", "nil", "if", "it", "s", "ok", "false", "otherwise" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/roles.go#L157-L166
train
gravitational/teleport
lib/backend/lite/lite.go
CheckAndSetDefaults
func (cfg *Config) CheckAndSetDefaults() error { if cfg.Path == "" && !cfg.Memory { return trace.BadParameter("specify directory path to the database using 'path' parameter") } if cfg.BufferSize == 0 { cfg.BufferSize = backend.DefaultBufferSize } if cfg.PollStreamPeriod == 0 { cfg.PollStreamPeriod = backend....
go
func (cfg *Config) CheckAndSetDefaults() error { if cfg.Path == "" && !cfg.Memory { return trace.BadParameter("specify directory path to the database using 'path' parameter") } if cfg.BufferSize == 0 { cfg.BufferSize = backend.DefaultBufferSize } if cfg.PollStreamPeriod == 0 { cfg.PollStreamPeriod = backend....
[ "func", "(", "cfg", "*", "Config", ")", "CheckAndSetDefaults", "(", ")", "error", "{", "if", "cfg", ".", "Path", "==", "\"", "\"", "&&", "!", "cfg", ".", "Memory", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "\n", "}", "\n", ...
// CheckAndSetDefaults is a helper returns an error if the supplied configuration // is not enough to connect to sqlite
[ "CheckAndSetDefaults", "is", "a", "helper", "returns", "an", "error", "if", "the", "supplied", "configuration", "is", "not", "enough", "to", "connect", "to", "sqlite" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/lite/lite.go#L94-L117
train
gravitational/teleport
lib/backend/lite/lite.go
New
func New(ctx context.Context, params backend.Params) (*LiteBackend, error) { var cfg *Config err := utils.ObjectToStruct(params, &cfg) if err != nil { return nil, trace.BadParameter("SQLite configuration is invalid: %v", err) } return NewWithConfig(ctx, *cfg) }
go
func New(ctx context.Context, params backend.Params) (*LiteBackend, error) { var cfg *Config err := utils.ObjectToStruct(params, &cfg) if err != nil { return nil, trace.BadParameter("SQLite configuration is invalid: %v", err) } return NewWithConfig(ctx, *cfg) }
[ "func", "New", "(", "ctx", "context", ".", "Context", ",", "params", "backend", ".", "Params", ")", "(", "*", "LiteBackend", ",", "error", ")", "{", "var", "cfg", "*", "Config", "\n", "err", ":=", "utils", ".", "ObjectToStruct", "(", "params", ",", "...
// New returns a new instance of sqlite backend
[ "New", "returns", "a", "new", "instance", "of", "sqlite", "backend" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/lite/lite.go#L120-L127
train
gravitational/teleport
lib/backend/lite/lite.go
NewWithConfig
func NewWithConfig(ctx context.Context, cfg Config) (*LiteBackend, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } var connectorURL string if !cfg.Memory { // Ensure that the path to the root directory exists. err := os.MkdirAll(cfg.Path, defaultDirMode) if err != ni...
go
func NewWithConfig(ctx context.Context, cfg Config) (*LiteBackend, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } var connectorURL string if !cfg.Memory { // Ensure that the path to the root directory exists. err := os.MkdirAll(cfg.Path, defaultDirMode) if err != ni...
[ "func", "NewWithConfig", "(", "ctx", "context", ".", "Context", ",", "cfg", "Config", ")", "(", "*", "LiteBackend", ",", "error", ")", "{", "if", "err", ":=", "cfg", ".", "CheckAndSetDefaults", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ...
// NewWithConfig returns a new instance of lite backend using // configuration struct as a parameter
[ "NewWithConfig", "returns", "a", "new", "instance", "of", "lite", "backend", "using", "configuration", "struct", "as", "a", "parameter" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/lite/lite.go#L131-L179
train
gravitational/teleport
lib/backend/lite/lite.go
showPragmas
func (l *LiteBackend) showPragmas() error { return l.inTransaction(l.ctx, func(tx *sql.Tx) error { row := tx.QueryRowContext(l.ctx, "PRAGMA synchronous;") var syncValue string if err := row.Scan(&syncValue); err != nil { return trace.Wrap(err) } var timeoutValue string row = tx.QueryRowContext(l.ctx, "P...
go
func (l *LiteBackend) showPragmas() error { return l.inTransaction(l.ctx, func(tx *sql.Tx) error { row := tx.QueryRowContext(l.ctx, "PRAGMA synchronous;") var syncValue string if err := row.Scan(&syncValue); err != nil { return trace.Wrap(err) } var timeoutValue string row = tx.QueryRowContext(l.ctx, "P...
[ "func", "(", "l", "*", "LiteBackend", ")", "showPragmas", "(", ")", "error", "{", "return", "l", ".", "inTransaction", "(", "l", ".", "ctx", ",", "func", "(", "tx", "*", "sql", ".", "Tx", ")", "error", "{", "row", ":=", "tx", ".", "QueryRowContext"...
// showPragmas is used to debug SQLite database connection // parameters, when called, logs some key PRAGMA values
[ "showPragmas", "is", "used", "to", "debug", "SQLite", "database", "connection", "parameters", "when", "called", "logs", "some", "key", "PRAGMA", "values" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/lite/lite.go#L205-L220
train
gravitational/teleport
lib/backend/lite/lite.go
Imported
func (l *LiteBackend) Imported(ctx context.Context) (imported bool, err error) { err = l.inTransaction(ctx, func(tx *sql.Tx) error { q, err := tx.PrepareContext(ctx, "SELECT imported from meta LIMIT 1") if err != nil { return trace.Wrap(err) } row := q.QueryRowContext(ctx) if err := row.Scan(&imported)...
go
func (l *LiteBackend) Imported(ctx context.Context) (imported bool, err error) { err = l.inTransaction(ctx, func(tx *sql.Tx) error { q, err := tx.PrepareContext(ctx, "SELECT imported from meta LIMIT 1") if err != nil { return trace.Wrap(err) } row := q.QueryRowContext(ctx) if err := row.Scan(&imported)...
[ "func", "(", "l", "*", "LiteBackend", ")", "Imported", "(", "ctx", "context", ".", "Context", ")", "(", "imported", "bool", ",", "err", "error", ")", "{", "err", "=", "l", ".", "inTransaction", "(", "ctx", ",", "func", "(", "tx", "*", "sql", ".", ...
// Imported returns true if backend already imported data from another backend
[ "Imported", "returns", "true", "if", "backend", "already", "imported", "data", "from", "another", "backend" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/lite/lite.go#L413-L429
train
gravitational/teleport
lib/backend/lite/lite.go
Import
func (l *LiteBackend) Import(ctx context.Context, items []backend.Item) error { for i := range items { if items[i].Key == nil { return trace.BadParameter("missing parameter key in item %v", i) } } err := l.inTransaction(ctx, func(tx *sql.Tx) error { q, err := tx.PrepareContext(ctx, "SELECT imported from ...
go
func (l *LiteBackend) Import(ctx context.Context, items []backend.Item) error { for i := range items { if items[i].Key == nil { return trace.BadParameter("missing parameter key in item %v", i) } } err := l.inTransaction(ctx, func(tx *sql.Tx) error { q, err := tx.PrepareContext(ctx, "SELECT imported from ...
[ "func", "(", "l", "*", "LiteBackend", ")", "Import", "(", "ctx", "context", ".", "Context", ",", "items", "[", "]", "backend", ".", "Item", ")", "error", "{", "for", "i", ":=", "range", "items", "{", "if", "items", "[", "i", "]", ".", "Key", "=="...
// Import imports elements, makes sure elements are imported only once // returns trace.AlreadyExists if elements have been imported
[ "Import", "imports", "elements", "makes", "sure", "elements", "are", "imported", "only", "once", "returns", "trace", ".", "AlreadyExists", "if", "elements", "have", "been", "imported" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/lite/lite.go#L433-L474
train
gravitational/teleport
lib/backend/lite/lite.go
getInTransaction
func (l *LiteBackend) getInTransaction(ctx context.Context, key []byte, tx *sql.Tx, item *backend.Item) error { now := l.clock.Now().UTC() q, err := tx.PrepareContext(ctx, "SELECT key, value, expires, modified FROM kv WHERE key = ? AND (expires IS NULL OR expires > ?) LIMIT 1") if err != nil { return trace.Wrap(...
go
func (l *LiteBackend) getInTransaction(ctx context.Context, key []byte, tx *sql.Tx, item *backend.Item) error { now := l.clock.Now().UTC() q, err := tx.PrepareContext(ctx, "SELECT key, value, expires, modified FROM kv WHERE key = ? AND (expires IS NULL OR expires > ?) LIMIT 1") if err != nil { return trace.Wrap(...
[ "func", "(", "l", "*", "LiteBackend", ")", "getInTransaction", "(", "ctx", "context", ".", "Context", ",", "key", "[", "]", "byte", ",", "tx", "*", "sql", ".", "Tx", ",", "item", "*", "backend", ".", "Item", ")", "error", "{", "now", ":=", "l", "...
// getInTransaction returns an item, works in transaction
[ "getInTransaction", "returns", "an", "item", "works", "in", "transaction" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/lite/lite.go#L579-L596
train
gravitational/teleport
lib/modules/modules.go
PrintVersion
func (p *defaultModules) PrintVersion() { var buf bytes.Buffer buf.WriteString(fmt.Sprintf("Teleport v%s ", teleport.Version)) buf.WriteString(fmt.Sprintf("git:%s ", teleport.Gitref)) buf.WriteString(runtime.Version()) fmt.Println(buf.String()) }
go
func (p *defaultModules) PrintVersion() { var buf bytes.Buffer buf.WriteString(fmt.Sprintf("Teleport v%s ", teleport.Version)) buf.WriteString(fmt.Sprintf("git:%s ", teleport.Gitref)) buf.WriteString(runtime.Version()) fmt.Println(buf.String()) }
[ "func", "(", "p", "*", "defaultModules", ")", "PrintVersion", "(", ")", "{", "var", "buf", "bytes", ".", "Buffer", "\n\n", "buf", ".", "WriteString", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "teleport", ".", "Version", ")", ")", "\n", "buf",...
// PrintVersion prints the Teleport version.
[ "PrintVersion", "prints", "the", "Teleport", "version", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/modules/modules.go#L85-L93
train
gravitational/teleport
lib/modules/modules.go
TraitsFromLogins
func (p *defaultModules) TraitsFromLogins(logins []string, kubeGroups []string) map[string][]string { return map[string][]string{ teleport.TraitLogins: logins, teleport.TraitKubeGroups: kubeGroups, } }
go
func (p *defaultModules) TraitsFromLogins(logins []string, kubeGroups []string) map[string][]string { return map[string][]string{ teleport.TraitLogins: logins, teleport.TraitKubeGroups: kubeGroups, } }
[ "func", "(", "p", "*", "defaultModules", ")", "TraitsFromLogins", "(", "logins", "[", "]", "string", ",", "kubeGroups", "[", "]", "string", ")", "map", "[", "string", "]", "[", "]", "string", "{", "return", "map", "[", "string", "]", "[", "]", "strin...
// TraitsFromLogins returns traits for external user based on the logins // extracted from the connector // // By default logins are treated as allowed logins user traits.
[ "TraitsFromLogins", "returns", "traits", "for", "external", "user", "based", "on", "the", "logins", "extracted", "from", "the", "connector", "By", "default", "logins", "are", "treated", "as", "allowed", "logins", "user", "traits", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/modules/modules.go#L108-L113
train
gravitational/teleport
lib/services/github.go
NewGithubConnector
func NewGithubConnector(name string, spec GithubConnectorSpecV3) GithubConnector { return &GithubConnectorV3{ Kind: KindGithubConnector, Version: V3, Metadata: Metadata{ Name: name, Namespace: defaults.Namespace, }, Spec: spec, } }
go
func NewGithubConnector(name string, spec GithubConnectorSpecV3) GithubConnector { return &GithubConnectorV3{ Kind: KindGithubConnector, Version: V3, Metadata: Metadata{ Name: name, Namespace: defaults.Namespace, }, Spec: spec, } }
[ "func", "NewGithubConnector", "(", "name", "string", ",", "spec", "GithubConnectorSpecV3", ")", "GithubConnector", "{", "return", "&", "GithubConnectorV3", "{", "Kind", ":", "KindGithubConnector", ",", "Version", ":", "V3", ",", "Metadata", ":", "Metadata", "{", ...
// NewGithubConnector creates a new Github connector from name and spec
[ "NewGithubConnector", "creates", "a", "new", "Github", "connector", "from", "name", "and", "spec" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/github.go#L63-L73
train
gravitational/teleport
lib/services/github.go
SetExpiry
func (c *GithubConnectorV3) SetExpiry(expires time.Time) { c.Metadata.SetExpiry(expires) }
go
func (c *GithubConnectorV3) SetExpiry(expires time.Time) { c.Metadata.SetExpiry(expires) }
[ "func", "(", "c", "*", "GithubConnectorV3", ")", "SetExpiry", "(", "expires", "time", ".", "Time", ")", "{", "c", ".", "Metadata", ".", "SetExpiry", "(", "expires", ")", "\n", "}" ]
// SetExpiry sets the connector expiration time
[ "SetExpiry", "sets", "the", "connector", "expiration", "time" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/github.go#L169-L171
train
gravitational/teleport
lib/services/github.go
SetTTL
func (c *GithubConnectorV3) SetTTL(clock clockwork.Clock, ttl time.Duration) { c.Metadata.SetTTL(clock, ttl) }
go
func (c *GithubConnectorV3) SetTTL(clock clockwork.Clock, ttl time.Duration) { c.Metadata.SetTTL(clock, ttl) }
[ "func", "(", "c", "*", "GithubConnectorV3", ")", "SetTTL", "(", "clock", "clockwork", ".", "Clock", ",", "ttl", "time", ".", "Duration", ")", "{", "c", ".", "Metadata", ".", "SetTTL", "(", "clock", ",", "ttl", ")", "\n", "}" ]
// SetTTL sets the connector TTL
[ "SetTTL", "sets", "the", "connector", "TTL" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/github.go#L174-L176
train
gravitational/teleport
lib/services/github.go
MapClaims
func (c *GithubConnectorV3) MapClaims(claims GithubClaims) ([]string, []string) { var logins, kubeGroups []string for _, mapping := range c.GetTeamsToLogins() { teams, ok := claims.OrganizationToTeams[mapping.Organization] if !ok { // the user does not belong to this organization continue } for _, team ...
go
func (c *GithubConnectorV3) MapClaims(claims GithubClaims) ([]string, []string) { var logins, kubeGroups []string for _, mapping := range c.GetTeamsToLogins() { teams, ok := claims.OrganizationToTeams[mapping.Organization] if !ok { // the user does not belong to this organization continue } for _, team ...
[ "func", "(", "c", "*", "GithubConnectorV3", ")", "MapClaims", "(", "claims", "GithubClaims", ")", "(", "[", "]", "string", ",", "[", "]", "string", ")", "{", "var", "logins", ",", "kubeGroups", "[", "]", "string", "\n", "for", "_", ",", "mapping", ":...
// MapClaims returns a list of logins based on the provided claims, // returns a list of logins and list of kubernetes groups
[ "MapClaims", "returns", "a", "list", "of", "logins", "based", "on", "the", "provided", "claims", "returns", "a", "list", "of", "logins", "and", "list", "of", "kubernetes", "groups" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/github.go#L243-L260
train
gravitational/teleport
lib/services/github.go
Unmarshal
func (*TeleportGithubConnectorMarshaler) Unmarshal(bytes []byte) (GithubConnector, error) { var h ResourceHeader if err := json.Unmarshal(bytes, &h); err != nil { return nil, trace.Wrap(err) } switch h.Version { case V3: var c GithubConnectorV3 if err := utils.UnmarshalWithSchema(GetGithubConnectorSchema(), ...
go
func (*TeleportGithubConnectorMarshaler) Unmarshal(bytes []byte) (GithubConnector, error) { var h ResourceHeader if err := json.Unmarshal(bytes, &h); err != nil { return nil, trace.Wrap(err) } switch h.Version { case V3: var c GithubConnectorV3 if err := utils.UnmarshalWithSchema(GetGithubConnectorSchema(), ...
[ "func", "(", "*", "TeleportGithubConnectorMarshaler", ")", "Unmarshal", "(", "bytes", "[", "]", "byte", ")", "(", "GithubConnector", ",", "error", ")", "{", "var", "h", "ResourceHeader", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "bytes", ",",...
// UnmarshalGithubConnector unmarshals Github connector from JSON
[ "UnmarshalGithubConnector", "unmarshals", "Github", "connector", "from", "JSON" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/github.go#L295-L313
train
gravitational/teleport
lib/services/github.go
Marshal
func (*TeleportGithubConnectorMarshaler) Marshal(c GithubConnector, opts ...MarshalOption) ([]byte, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } switch resource := c.(type) { case *GithubConnectorV3: if !cfg.PreserveResourceID { // avoid modifying the original obje...
go
func (*TeleportGithubConnectorMarshaler) Marshal(c GithubConnector, opts ...MarshalOption) ([]byte, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } switch resource := c.(type) { case *GithubConnectorV3: if !cfg.PreserveResourceID { // avoid modifying the original obje...
[ "func", "(", "*", "TeleportGithubConnectorMarshaler", ")", "Marshal", "(", "c", "GithubConnector", ",", "opts", "...", "MarshalOption", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "cfg", ",", "err", ":=", "collectOptions", "(", "opts", ")", "\n", ...
// MarshalGithubConnector marshals Github connector to JSON
[ "MarshalGithubConnector", "marshals", "Github", "connector", "to", "JSON" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/github.go#L316-L334
train
gravitational/teleport
lib/services/local/provisioning.go
DeleteAllTokens
func (s *ProvisioningService) DeleteAllTokens() error { startKey := backend.Key(tokensPrefix) return s.DeleteRange(context.TODO(), startKey, backend.RangeEnd(startKey)) }
go
func (s *ProvisioningService) DeleteAllTokens() error { startKey := backend.Key(tokensPrefix) return s.DeleteRange(context.TODO(), startKey, backend.RangeEnd(startKey)) }
[ "func", "(", "s", "*", "ProvisioningService", ")", "DeleteAllTokens", "(", ")", "error", "{", "startKey", ":=", "backend", ".", "Key", "(", "tokensPrefix", ")", "\n", "return", "s", ".", "DeleteRange", "(", "context", ".", "TODO", "(", ")", ",", "startKe...
// DeleteAllTokens deletes all provisioning tokens
[ "DeleteAllTokens", "deletes", "all", "provisioning", "tokens" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/provisioning.go#L66-L69
train
gravitational/teleport
lib/services/clusterconfig.go
NewClusterConfig
func NewClusterConfig(spec ClusterConfigSpecV3) (ClusterConfig, error) { cc := ClusterConfigV3{ Kind: KindClusterConfig, Version: V3, Metadata: Metadata{ Name: MetaNameClusterConfig, Namespace: defaults.Namespace, }, Spec: spec, } if err := cc.CheckAndSetDefaults(); err != nil { return nil,...
go
func NewClusterConfig(spec ClusterConfigSpecV3) (ClusterConfig, error) { cc := ClusterConfigV3{ Kind: KindClusterConfig, Version: V3, Metadata: Metadata{ Name: MetaNameClusterConfig, Namespace: defaults.Namespace, }, Spec: spec, } if err := cc.CheckAndSetDefaults(); err != nil { return nil,...
[ "func", "NewClusterConfig", "(", "spec", "ClusterConfigSpecV3", ")", "(", "ClusterConfig", ",", "error", ")", "{", "cc", ":=", "ClusterConfigV3", "{", "Kind", ":", "KindClusterConfig", ",", "Version", ":", "V3", ",", "Metadata", ":", "Metadata", "{", "Name", ...
// NewClusterConfig is a convenience wrapper to create a ClusterConfig resource.
[ "NewClusterConfig", "is", "a", "convenience", "wrapper", "to", "create", "a", "ClusterConfig", "resource", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/clusterconfig.go#L97-L112
train
gravitational/teleport
lib/services/clusterconfig.go
AuditConfigFromObject
func AuditConfigFromObject(in interface{}) (*AuditConfig, error) { var cfg AuditConfig if in == nil { return &cfg, nil } if err := utils.ObjectToStruct(in, &cfg); err != nil { return nil, trace.Wrap(err) } return &cfg, nil }
go
func AuditConfigFromObject(in interface{}) (*AuditConfig, error) { var cfg AuditConfig if in == nil { return &cfg, nil } if err := utils.ObjectToStruct(in, &cfg); err != nil { return nil, trace.Wrap(err) } return &cfg, nil }
[ "func", "AuditConfigFromObject", "(", "in", "interface", "{", "}", ")", "(", "*", "AuditConfig", ",", "error", ")", "{", "var", "cfg", "AuditConfig", "\n", "if", "in", "==", "nil", "{", "return", "&", "cfg", ",", "nil", "\n", "}", "\n", "if", "err", ...
// AuditConfigFromObject returns audit config from interface object
[ "AuditConfigFromObject", "returns", "audit", "config", "from", "interface", "object" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/clusterconfig.go#L140-L149
train
gravitational/teleport
lib/services/clusterconfig.go
SetClientIdleTimeout
func (c *ClusterConfigV3) SetClientIdleTimeout(d time.Duration) { c.Spec.ClientIdleTimeout = Duration(d) }
go
func (c *ClusterConfigV3) SetClientIdleTimeout(d time.Duration) { c.Spec.ClientIdleTimeout = Duration(d) }
[ "func", "(", "c", "*", "ClusterConfigV3", ")", "SetClientIdleTimeout", "(", "d", "time", ".", "Duration", ")", "{", "c", ".", "Spec", ".", "ClientIdleTimeout", "=", "Duration", "(", "d", ")", "\n", "}" ]
// SetClientIdleTimeout sets client idle timeout setting
[ "SetClientIdleTimeout", "sets", "client", "idle", "timeout", "setting" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/clusterconfig.go#L279-L281
train
gravitational/teleport
lib/services/clusterconfig.go
SetDisconnectExpiredCert
func (c *ClusterConfigV3) SetDisconnectExpiredCert(b bool) { c.Spec.DisconnectExpiredCert = NewBool(b) }
go
func (c *ClusterConfigV3) SetDisconnectExpiredCert(b bool) { c.Spec.DisconnectExpiredCert = NewBool(b) }
[ "func", "(", "c", "*", "ClusterConfigV3", ")", "SetDisconnectExpiredCert", "(", "b", "bool", ")", "{", "c", ".", "Spec", ".", "DisconnectExpiredCert", "=", "NewBool", "(", "b", ")", "\n", "}" ]
// SetDisconnectExpiredCert sets disconnect client with expired certificate setting
[ "SetDisconnectExpiredCert", "sets", "disconnect", "client", "with", "expired", "certificate", "setting" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/clusterconfig.go#L289-L291
train
gravitational/teleport
lib/services/clusterconfig.go
SetKeepAliveInterval
func (c *ClusterConfigV3) SetKeepAliveInterval(t time.Duration) { c.Spec.KeepAliveInterval = Duration(t) }
go
func (c *ClusterConfigV3) SetKeepAliveInterval(t time.Duration) { c.Spec.KeepAliveInterval = Duration(t) }
[ "func", "(", "c", "*", "ClusterConfigV3", ")", "SetKeepAliveInterval", "(", "t", "time", ".", "Duration", ")", "{", "c", ".", "Spec", ".", "KeepAliveInterval", "=", "Duration", "(", "t", ")", "\n", "}" ]
// SetKeepAliveInterval sets the keep-alive interval.
[ "SetKeepAliveInterval", "sets", "the", "keep", "-", "alive", "interval", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/clusterconfig.go#L299-L301
train
gravitational/teleport
lib/services/clusterconfig.go
String
func (c *ClusterConfigV3) String() string { return fmt.Sprintf("ClusterConfig(SessionRecording=%v, ClusterID=%v, ProxyChecksHostKeys=%v)", c.Spec.SessionRecording, c.Spec.ClusterID, c.Spec.ProxyChecksHostKeys) }
go
func (c *ClusterConfigV3) String() string { return fmt.Sprintf("ClusterConfig(SessionRecording=%v, ClusterID=%v, ProxyChecksHostKeys=%v)", c.Spec.SessionRecording, c.Spec.ClusterID, c.Spec.ProxyChecksHostKeys) }
[ "func", "(", "c", "*", "ClusterConfigV3", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "Spec", ".", "SessionRecording", ",", "c", ".", "Spec", ".", "ClusterID", ",", "c", ".", "Spec", ".",...
// String represents a human readable version of the cluster name.
[ "String", "represents", "a", "human", "readable", "version", "of", "the", "cluster", "name", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/clusterconfig.go#L363-L366
train
gravitational/teleport
lib/services/clusterconfig.go
GetClusterConfigSchema
func GetClusterConfigSchema(extensionSchema string) string { var clusterConfigSchema string if clusterConfigSchema == "" { clusterConfigSchema = fmt.Sprintf(ClusterConfigSpecSchemaTemplate, "") } else { clusterConfigSchema = fmt.Sprintf(ClusterConfigSpecSchemaTemplate, ","+extensionSchema) } return fmt.Sprintf...
go
func GetClusterConfigSchema(extensionSchema string) string { var clusterConfigSchema string if clusterConfigSchema == "" { clusterConfigSchema = fmt.Sprintf(ClusterConfigSpecSchemaTemplate, "") } else { clusterConfigSchema = fmt.Sprintf(ClusterConfigSpecSchemaTemplate, ","+extensionSchema) } return fmt.Sprintf...
[ "func", "GetClusterConfigSchema", "(", "extensionSchema", "string", ")", "string", "{", "var", "clusterConfigSchema", "string", "\n", "if", "clusterConfigSchema", "==", "\"", "\"", "{", "clusterConfigSchema", "=", "fmt", ".", "Sprintf", "(", "ClusterConfigSpecSchemaTe...
// GetClusterConfigSchema returns the schema with optionally injected // schema for extensions.
[ "GetClusterConfigSchema", "returns", "the", "schema", "with", "optionally", "injected", "schema", "for", "extensions", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/clusterconfig.go#L427-L435
train
gravitational/teleport
lib/services/clusterconfig.go
Unmarshal
func (t *TeleportClusterConfigMarshaler) Unmarshal(bytes []byte, opts ...MarshalOption) (ClusterConfig, error) { var clusterConfig ClusterConfigV3 if len(bytes) == 0 { return nil, trace.BadParameter("missing resource data") } cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } i...
go
func (t *TeleportClusterConfigMarshaler) Unmarshal(bytes []byte, opts ...MarshalOption) (ClusterConfig, error) { var clusterConfig ClusterConfigV3 if len(bytes) == 0 { return nil, trace.BadParameter("missing resource data") } cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } i...
[ "func", "(", "t", "*", "TeleportClusterConfigMarshaler", ")", "Unmarshal", "(", "bytes", "[", "]", "byte", ",", "opts", "...", "MarshalOption", ")", "(", "ClusterConfig", ",", "error", ")", "{", "var", "clusterConfig", "ClusterConfigV3", "\n\n", "if", "len", ...
// Unmarshal unmarshals ClusterConfig from JSON.
[ "Unmarshal", "unmarshals", "ClusterConfig", "from", "JSON", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/clusterconfig.go#L464-L499
train
gravitational/teleport
lib/services/clusterconfig.go
Marshal
func (t *TeleportClusterConfigMarshaler) Marshal(c ClusterConfig, opts ...MarshalOption) ([]byte, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } switch resource := c.(type) { case *ClusterConfigV3: if !cfg.PreserveResourceID { // avoid modifying the original object ...
go
func (t *TeleportClusterConfigMarshaler) Marshal(c ClusterConfig, opts ...MarshalOption) ([]byte, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } switch resource := c.(type) { case *ClusterConfigV3: if !cfg.PreserveResourceID { // avoid modifying the original object ...
[ "func", "(", "t", "*", "TeleportClusterConfigMarshaler", ")", "Marshal", "(", "c", "ClusterConfig", ",", "opts", "...", "MarshalOption", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "cfg", ",", "err", ":=", "collectOptions", "(", "opts", ")", "\n"...
// Marshal marshals ClusterConfig to JSON.
[ "Marshal", "marshals", "ClusterConfig", "to", "JSON", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/clusterconfig.go#L502-L520
train
gravitational/teleport
lib/utils/ver.go
CheckVersions
func CheckVersions(clientVersion string, minClientVersion string) error { clientSemver, err := semver.NewVersion(clientVersion) if err != nil { return trace.Wrap(err, "unsupported version format, need semver format: %q, e.g 1.0.0", clientVersion) } minClientSemver, err := semver.NewVersion(minClientVersion) ...
go
func CheckVersions(clientVersion string, minClientVersion string) error { clientSemver, err := semver.NewVersion(clientVersion) if err != nil { return trace.Wrap(err, "unsupported version format, need semver format: %q, e.g 1.0.0", clientVersion) } minClientSemver, err := semver.NewVersion(minClientVersion) ...
[ "func", "CheckVersions", "(", "clientVersion", "string", ",", "minClientVersion", "string", ")", "error", "{", "clientSemver", ",", "err", ":=", "semver", ".", "NewVersion", "(", "clientVersion", ")", "\n", "if", "err", "!=", "nil", "{", "return", "trace", "...
// CheckVersions compares client and server versions and makes sure that the // client version is greater than or equal to the minimum version supported // by the server.
[ "CheckVersions", "compares", "client", "and", "server", "versions", "and", "makes", "sure", "that", "the", "client", "version", "is", "greater", "than", "or", "equal", "to", "the", "minimum", "version", "supported", "by", "the", "server", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/ver.go#L30-L51
train
gravitational/teleport
lib/srv/exec.go
NewExecRequest
func NewExecRequest(ctx *ServerContext, command string) (Exec, error) { // It doesn't matter what mode the cluster is in, if this is a Teleport node // return a local *localExec. if ctx.srv.Component() == teleport.ComponentNode { return &localExec{ Ctx: ctx, Command: command, }, nil } // When in rec...
go
func NewExecRequest(ctx *ServerContext, command string) (Exec, error) { // It doesn't matter what mode the cluster is in, if this is a Teleport node // return a local *localExec. if ctx.srv.Component() == teleport.ComponentNode { return &localExec{ Ctx: ctx, Command: command, }, nil } // When in rec...
[ "func", "NewExecRequest", "(", "ctx", "*", "ServerContext", ",", "command", "string", ")", "(", "Exec", ",", "error", ")", "{", "// It doesn't matter what mode the cluster is in, if this is a Teleport node", "// return a local *localExec.", "if", "ctx", ".", "srv", ".", ...
// NewExecRequest creates a new local or remote Exec.
[ "NewExecRequest", "creates", "a", "new", "local", "or", "remote", "Exec", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/exec.go#L78-L104
train
gravitational/teleport
lib/srv/exec.go
Wait
func (e *localExec) Wait() (*ExecResult, error) { if e.Cmd.Process == nil { e.Ctx.Errorf("no process") } // wait for the command to complete, then figure out if the command // successfully exited or if it exited in failure execResult, err := collectLocalStatus(e.Cmd, e.Cmd.Wait()) // emit the result of execut...
go
func (e *localExec) Wait() (*ExecResult, error) { if e.Cmd.Process == nil { e.Ctx.Errorf("no process") } // wait for the command to complete, then figure out if the command // successfully exited or if it exited in failure execResult, err := collectLocalStatus(e.Cmd, e.Cmd.Wait()) // emit the result of execut...
[ "func", "(", "e", "*", "localExec", ")", "Wait", "(", ")", "(", "*", "ExecResult", ",", "error", ")", "{", "if", "e", ".", "Cmd", ".", "Process", "==", "nil", "{", "e", ".", "Ctx", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// w...
// Wait will block while the command executes.
[ "Wait", "will", "block", "while", "the", "command", "executes", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/exec.go#L175-L188
train
gravitational/teleport
lib/srv/exec.go
Wait
func (r *remoteExec) Wait() (*ExecResult, error) { // block until the command is finished and then figure out if the command // successfully exited or if it exited in failure execResult, err := r.collectRemoteStatus(r.session.Wait()) // emit the result of execution to the audit log emitExecAuditEvent(r.ctx, r.com...
go
func (r *remoteExec) Wait() (*ExecResult, error) { // block until the command is finished and then figure out if the command // successfully exited or if it exited in failure execResult, err := r.collectRemoteStatus(r.session.Wait()) // emit the result of execution to the audit log emitExecAuditEvent(r.ctx, r.com...
[ "func", "(", "r", "*", "remoteExec", ")", "Wait", "(", ")", "(", "*", "ExecResult", ",", "error", ")", "{", "// block until the command is finished and then figure out if the command", "// successfully exited or if it exited in failure", "execResult", ",", "err", ":=", "r...
// Wait will block while the command executes then return the result as well // as emit an event to the Audit Log.
[ "Wait", "will", "block", "while", "the", "command", "executes", "then", "return", "the", "result", "as", "well", "as", "emit", "an", "event", "to", "the", "Audit", "Log", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/exec.go#L448-L457
train
gravitational/teleport
lib/srv/exec.go
parseSecureCopy
func parseSecureCopy(path string) (string, string, bool, error) { parts := strings.Fields(path) if len(parts) == 0 { return "", "", false, trace.BadParameter("no executable found") } // Look for the -t flag, it indicates that an upload occurred. The other // flags do no matter for now. action := events.SCPActi...
go
func parseSecureCopy(path string) (string, string, bool, error) { parts := strings.Fields(path) if len(parts) == 0 { return "", "", false, trace.BadParameter("no executable found") } // Look for the -t flag, it indicates that an upload occurred. The other // flags do no matter for now. action := events.SCPActi...
[ "func", "parseSecureCopy", "(", "path", "string", ")", "(", "string", ",", "string", ",", "bool", ",", "error", ")", "{", "parts", ":=", "strings", ".", "Fields", "(", "path", ")", "\n", "if", "len", "(", "parts", ")", "==", "0", "{", "return", "\"...
// parseSecureCopy will parse a command and return if it's secure copy or not.
[ "parseSecureCopy", "will", "parse", "a", "command", "and", "return", "if", "it", "s", "secure", "copy", "or", "not", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/exec.go#L602-L631
train
gravitational/teleport
lib/client/identity.go
MakeIdentityFile
func MakeIdentityFile(filePath string, key *Key, format IdentityFileFormat, certAuthorities []services.CertAuthority) (err error) { const ( // the files and the dir will be created with these permissions: fileMode = 0600 dirMode = 0700 ) if filePath == "" { return trace.BadParameter("identity location is n...
go
func MakeIdentityFile(filePath string, key *Key, format IdentityFileFormat, certAuthorities []services.CertAuthority) (err error) { const ( // the files and the dir will be created with these permissions: fileMode = 0600 dirMode = 0700 ) if filePath == "" { return trace.BadParameter("identity location is n...
[ "func", "MakeIdentityFile", "(", "filePath", "string", ",", "key", "*", "Key", ",", "format", "IdentityFileFormat", ",", "certAuthorities", "[", "]", "services", ".", "CertAuthority", ")", "(", "err", "error", ")", "{", "const", "(", "// the files and the dir wi...
// MakeIdentityFile takes a username + their credentials and saves them to disk // in a specified format
[ "MakeIdentityFile", "takes", "a", "username", "+", "their", "credentials", "and", "saves", "them", "to", "disk", "in", "a", "specified", "format" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/identity.go#L62-L127
train
gravitational/teleport
lib/events/filesessions/fileuploader.go
CheckAndSetDefaults
func (s *Config) CheckAndSetDefaults() error { if s.Directory == "" { return trace.BadParameter("missing parameter Directory") } if !utils.IsDir(s.Directory) { return trace.BadParameter("path %q does not exist or is not a directory", s.Directory) } return nil }
go
func (s *Config) CheckAndSetDefaults() error { if s.Directory == "" { return trace.BadParameter("missing parameter Directory") } if !utils.IsDir(s.Directory) { return trace.BadParameter("path %q does not exist or is not a directory", s.Directory) } return nil }
[ "func", "(", "s", "*", "Config", ")", "CheckAndSetDefaults", "(", ")", "error", "{", "if", "s", ".", "Directory", "==", "\"", "\"", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "!", "utils", ".", "IsDir"...
// CheckAndSetDefaults checks and sets default values of file handler config
[ "CheckAndSetDefaults", "checks", "and", "sets", "default", "values", "of", "file", "handler", "config" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/filesessions/fileuploader.go#L41-L49
train
gravitational/teleport
lib/events/filesessions/fileuploader.go
NewHandler
func NewHandler(cfg Config) (*Handler, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } h := &Handler{ Entry: log.WithFields(log.Fields{ trace.Component: teleport.Component(teleport.SchemeFile), }), Config: cfg, } return h, nil }
go
func NewHandler(cfg Config) (*Handler, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } h := &Handler{ Entry: log.WithFields(log.Fields{ trace.Component: teleport.Component(teleport.SchemeFile), }), Config: cfg, } return h, nil }
[ "func", "NewHandler", "(", "cfg", "Config", ")", "(", "*", "Handler", ",", "error", ")", "{", "if", "err", ":=", "cfg", ".", "CheckAndSetDefaults", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "trace", ".", "Wrap", "(", "err", ")",...
// NewHandler returns new file sessions handler
[ "NewHandler", "returns", "new", "file", "sessions", "handler" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/filesessions/fileuploader.go#L52-L64
train
gravitational/teleport
lib/events/filesessions/fileuploader.go
Download
func (l *Handler) Download(ctx context.Context, sessionID session.ID, writer io.WriterAt) error { path := l.path(sessionID) _, err := os.Stat(filepath.Dir(path)) f, err := os.Open(path) if err != nil { return trace.ConvertSystemError(err) } defer f.Close() _, err = io.Copy(writer.(io.Writer), f) if err != nil...
go
func (l *Handler) Download(ctx context.Context, sessionID session.ID, writer io.WriterAt) error { path := l.path(sessionID) _, err := os.Stat(filepath.Dir(path)) f, err := os.Open(path) if err != nil { return trace.ConvertSystemError(err) } defer f.Close() _, err = io.Copy(writer.(io.Writer), f) if err != nil...
[ "func", "(", "l", "*", "Handler", ")", "Download", "(", "ctx", "context", ".", "Context", ",", "sessionID", "session", ".", "ID", ",", "writer", "io", ".", "WriterAt", ")", "error", "{", "path", ":=", "l", ".", "path", "(", "sessionID", ")", "\n", ...
// Download downloads session recording from storage, in case of file handler reads the // file from local directory
[ "Download", "downloads", "session", "recording", "from", "storage", "in", "case", "of", "file", "handler", "reads", "the", "file", "from", "local", "directory" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/filesessions/fileuploader.go#L82-L95
train
gravitational/teleport
lib/events/filesessions/fileuploader.go
Upload
func (l *Handler) Upload(ctx context.Context, sessionID session.ID, reader io.Reader) (string, error) { path := l.path(sessionID) f, err := os.Create(path) if err != nil { return "", trace.ConvertSystemError(err) } defer f.Close() _, err = io.Copy(f, reader) if err != nil { return "", trace.Wrap(err) } ret...
go
func (l *Handler) Upload(ctx context.Context, sessionID session.ID, reader io.Reader) (string, error) { path := l.path(sessionID) f, err := os.Create(path) if err != nil { return "", trace.ConvertSystemError(err) } defer f.Close() _, err = io.Copy(f, reader) if err != nil { return "", trace.Wrap(err) } ret...
[ "func", "(", "l", "*", "Handler", ")", "Upload", "(", "ctx", "context", ".", "Context", ",", "sessionID", "session", ".", "ID", ",", "reader", "io", ".", "Reader", ")", "(", "string", ",", "error", ")", "{", "path", ":=", "l", ".", "path", "(", "...
// Upload uploads session recording to file storage, in case of file handler, // writes the file to local directory
[ "Upload", "uploads", "session", "recording", "to", "file", "storage", "in", "case", "of", "file", "handler", "writes", "the", "file", "to", "local", "directory" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/filesessions/fileuploader.go#L99-L111
train
gravitational/teleport
tool/tctl/common/token_command.go
List
func (c *TokenCommand) List(client auth.ClientI) error { tokens, err := client.GetTokens() if err != nil { return trace.Wrap(err) } if len(tokens) == 0 { fmt.Println("No active tokens found.") return nil } // Sort by expire time. sort.Slice(tokens, func(i, j int) bool { return tokens[i].Expiry().Unix() < ...
go
func (c *TokenCommand) List(client auth.ClientI) error { tokens, err := client.GetTokens() if err != nil { return trace.Wrap(err) } if len(tokens) == 0 { fmt.Println("No active tokens found.") return nil } // Sort by expire time. sort.Slice(tokens, func(i, j int) bool { return tokens[i].Expiry().Unix() < ...
[ "func", "(", "c", "*", "TokenCommand", ")", "List", "(", "client", "auth", ".", "ClientI", ")", "error", "{", "tokens", ",", "err", ":=", "client", ".", "GetTokens", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "trace", ".", "Wrap", "("...
// List is called to execute "tokens ls" command.
[ "List", "is", "called", "to", "execute", "tokens", "ls", "command", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tctl/common/token_command.go#L173-L207
train
gravitational/teleport
tool/tctl/common/token_command.go
calculateCAPin
func calculateCAPin(client auth.ClientI) (string, error) { localCA, err := client.GetClusterCACert() if err != nil { return "", trace.Wrap(err) } tlsCA, err := tlsca.ParseCertificatePEM(localCA.TLSCA) if err != nil { return "", trace.Wrap(err) } return utils.CalculateSPKI(tlsCA), nil }
go
func calculateCAPin(client auth.ClientI) (string, error) { localCA, err := client.GetClusterCACert() if err != nil { return "", trace.Wrap(err) } tlsCA, err := tlsca.ParseCertificatePEM(localCA.TLSCA) if err != nil { return "", trace.Wrap(err) } return utils.CalculateSPKI(tlsCA), nil }
[ "func", "calculateCAPin", "(", "client", "auth", ".", "ClientI", ")", "(", "string", ",", "error", ")", "{", "localCA", ",", "err", ":=", "client", ".", "GetClusterCACert", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "tr...
// calculateCAPin returns the SPKI pin for the local cluster.
[ "calculateCAPin", "returns", "the", "SPKI", "pin", "for", "the", "local", "cluster", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tctl/common/token_command.go#L210-L221
train
gravitational/teleport
lib/backend/sanitize.go
isKeySafe
func isKeySafe(s []byte) bool { return whitelistPattern.Match(s) && !blacklistPattern.Match(s) }
go
func isKeySafe(s []byte) bool { return whitelistPattern.Match(s) && !blacklistPattern.Match(s) }
[ "func", "isKeySafe", "(", "s", "[", "]", "byte", ")", "bool", "{", "return", "whitelistPattern", ".", "Match", "(", "s", ")", "&&", "!", "blacklistPattern", ".", "Match", "(", "s", ")", "\n", "}" ]
// isKeySafe checks if the passed in key conforms to whitelist
[ "isKeySafe", "checks", "if", "the", "passed", "in", "key", "conforms", "to", "whitelist" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/sanitize.go#L40-L42
train
gravitational/teleport
lib/client/weblogin.go
Check
func (r SSOLoginConsoleReq) Check() error { if r.RedirectURL == "" { return trace.BadParameter("missing RedirectURL") } if len(r.PublicKey) == 0 { return trace.BadParameter("missing PublicKey") } if r.ConnectorID == "" { return trace.BadParameter("missing ConnectorID") } return nil }
go
func (r SSOLoginConsoleReq) Check() error { if r.RedirectURL == "" { return trace.BadParameter("missing RedirectURL") } if len(r.PublicKey) == 0 { return trace.BadParameter("missing PublicKey") } if r.ConnectorID == "" { return trace.BadParameter("missing ConnectorID") } return nil }
[ "func", "(", "r", "SSOLoginConsoleReq", ")", "Check", "(", ")", "error", "{", "if", "r", ".", "RedirectURL", "==", "\"", "\"", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "len", "(", "r", ".", "PublicKe...
// Check makes sure that the request is valid
[ "Check", "makes", "sure", "that", "the", "request", "is", "valid" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/weblogin.go#L60-L71
train
gravitational/teleport
lib/client/weblogin.go
NewCredentialsClient
func NewCredentialsClient(proxyAddr string, insecure bool, pool *x509.CertPool) (*CredentialsClient, error) { log := logrus.WithFields(logrus.Fields{ trace.Component: teleport.ComponentClient, }) log.Debugf("HTTPS client init(proxyAddr=%v, insecure=%v)", proxyAddr, insecure) // validate proxyAddr: host, port, e...
go
func NewCredentialsClient(proxyAddr string, insecure bool, pool *x509.CertPool) (*CredentialsClient, error) { log := logrus.WithFields(logrus.Fields{ trace.Component: teleport.ComponentClient, }) log.Debugf("HTTPS client init(proxyAddr=%v, insecure=%v)", proxyAddr, insecure) // validate proxyAddr: host, port, e...
[ "func", "NewCredentialsClient", "(", "proxyAddr", "string", ",", "insecure", "bool", ",", "pool", "*", "x509", ".", "CertPool", ")", "(", "*", "CredentialsClient", ",", "error", ")", "{", "log", ":=", "logrus", ".", "WithFields", "(", "logrus", ".", "Field...
// NewCredentialsClient creates a new client to the HTTPS web proxy.
[ "NewCredentialsClient", "creates", "a", "new", "client", "to", "the", "HTTPS", "web", "proxy", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/weblogin.go#L253-L294
train
gravitational/teleport
lib/client/weblogin.go
SSHAgentLogin
func (c *CredentialsClient) SSHAgentLogin(ctx context.Context, user string, password string, otpToken string, pubKey []byte, ttl time.Duration, compatibility string) (*auth.SSHLoginResponse, error) { re, err := c.clt.PostJSON(ctx, c.clt.Endpoint("webapi", "ssh", "certs"), CreateSSHCertReq{ User: user, Pas...
go
func (c *CredentialsClient) SSHAgentLogin(ctx context.Context, user string, password string, otpToken string, pubKey []byte, ttl time.Duration, compatibility string) (*auth.SSHLoginResponse, error) { re, err := c.clt.PostJSON(ctx, c.clt.Endpoint("webapi", "ssh", "certs"), CreateSSHCertReq{ User: user, Pas...
[ "func", "(", "c", "*", "CredentialsClient", ")", "SSHAgentLogin", "(", "ctx", "context", ".", "Context", ",", "user", "string", ",", "password", "string", ",", "otpToken", "string", ",", "pubKey", "[", "]", "byte", ",", "ttl", "time", ".", "Duration", ",...
// SSHAgentLogin is used by tsh to fetch local user credentials.
[ "SSHAgentLogin", "is", "used", "by", "tsh", "to", "fetch", "local", "user", "credentials", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/weblogin.go#L400-L420
train
gravitational/teleport
lib/client/weblogin.go
HostCredentials
func (c *CredentialsClient) HostCredentials(ctx context.Context, req auth.RegisterUsingTokenRequest) (*auth.PackedKeys, error) { resp, err := c.clt.PostJSON(ctx, c.clt.Endpoint("webapi", "host", "credentials"), req) if err != nil { return nil, trace.Wrap(err) } var packedKeys *auth.PackedKeys err = json.Unmarsh...
go
func (c *CredentialsClient) HostCredentials(ctx context.Context, req auth.RegisterUsingTokenRequest) (*auth.PackedKeys, error) { resp, err := c.clt.PostJSON(ctx, c.clt.Endpoint("webapi", "host", "credentials"), req) if err != nil { return nil, trace.Wrap(err) } var packedKeys *auth.PackedKeys err = json.Unmarsh...
[ "func", "(", "c", "*", "CredentialsClient", ")", "HostCredentials", "(", "ctx", "context", ".", "Context", ",", "req", "auth", ".", "RegisterUsingTokenRequest", ")", "(", "*", "auth", ".", "PackedKeys", ",", "error", ")", "{", "resp", ",", "err", ":=", "...
// HostCredentials is used to fetch host credentials for a node.
[ "HostCredentials", "is", "used", "to", "fetch", "host", "credentials", "for", "a", "node", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/weblogin.go#L508-L521
train
gravitational/teleport
lib/services/local/access.go
DeleteAllRoles
func (s *AccessService) DeleteAllRoles() error { return s.DeleteRange(context.TODO(), backend.Key(rolesPrefix), backend.RangeEnd(backend.Key(rolesPrefix))) }
go
func (s *AccessService) DeleteAllRoles() error { return s.DeleteRange(context.TODO(), backend.Key(rolesPrefix), backend.RangeEnd(backend.Key(rolesPrefix))) }
[ "func", "(", "s", "*", "AccessService", ")", "DeleteAllRoles", "(", ")", "error", "{", "return", "s", ".", "DeleteRange", "(", "context", ".", "TODO", "(", ")", ",", "backend", ".", "Key", "(", "rolesPrefix", ")", ",", "backend", ".", "RangeEnd", "(", ...
// DeleteAllRoles deletes all roles
[ "DeleteAllRoles", "deletes", "all", "roles" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/access.go#L40-L42
train
gravitational/teleport
lib/services/local/access.go
GetRoles
func (s *AccessService) GetRoles() ([]services.Role, error) { result, err := s.GetRange(context.TODO(), backend.Key(rolesPrefix), backend.RangeEnd(backend.Key(rolesPrefix)), backend.NoLimit) if err != nil { return nil, trace.Wrap(err) } out := make([]services.Role, 0, len(result.Items)) for _, item := range resu...
go
func (s *AccessService) GetRoles() ([]services.Role, error) { result, err := s.GetRange(context.TODO(), backend.Key(rolesPrefix), backend.RangeEnd(backend.Key(rolesPrefix)), backend.NoLimit) if err != nil { return nil, trace.Wrap(err) } out := make([]services.Role, 0, len(result.Items)) for _, item := range resu...
[ "func", "(", "s", "*", "AccessService", ")", "GetRoles", "(", ")", "(", "[", "]", "services", ".", "Role", ",", "error", ")", "{", "result", ",", "err", ":=", "s", ".", "GetRange", "(", "context", ".", "TODO", "(", ")", ",", "backend", ".", "Key"...
// GetRoles returns a list of roles registered with the local auth server
[ "GetRoles", "returns", "a", "list", "of", "roles", "registered", "with", "the", "local", "auth", "server" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/access.go#L45-L61
train
gravitational/teleport
lib/services/local/access.go
CreateRole
func (s *AccessService) CreateRole(role services.Role) error { value, err := services.GetRoleMarshaler().MarshalRole(role) if err != nil { return trace.Wrap(err) } item := backend.Item{ Key: backend.Key(rolesPrefix, role.GetName(), paramsPrefix), Value: value, Expires: role.Expiry(), } _, err = s....
go
func (s *AccessService) CreateRole(role services.Role) error { value, err := services.GetRoleMarshaler().MarshalRole(role) if err != nil { return trace.Wrap(err) } item := backend.Item{ Key: backend.Key(rolesPrefix, role.GetName(), paramsPrefix), Value: value, Expires: role.Expiry(), } _, err = s....
[ "func", "(", "s", "*", "AccessService", ")", "CreateRole", "(", "role", "services", ".", "Role", ")", "error", "{", "value", ",", "err", ":=", "services", ".", "GetRoleMarshaler", "(", ")", ".", "MarshalRole", "(", "role", ")", "\n", "if", "err", "!=",...
// CreateRole creates a role on the backend.
[ "CreateRole", "creates", "a", "role", "on", "the", "backend", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/access.go#L64-L81
train
gravitational/teleport
lib/services/local/access.go
GetRole
func (s *AccessService) GetRole(name string) (services.Role, error) { if name == "" { return nil, trace.BadParameter("missing role name") } item, err := s.Get(context.TODO(), backend.Key(rolesPrefix, name, paramsPrefix)) if err != nil { if trace.IsNotFound(err) { return nil, trace.NotFound("role %v is not fo...
go
func (s *AccessService) GetRole(name string) (services.Role, error) { if name == "" { return nil, trace.BadParameter("missing role name") } item, err := s.Get(context.TODO(), backend.Key(rolesPrefix, name, paramsPrefix)) if err != nil { if trace.IsNotFound(err) { return nil, trace.NotFound("role %v is not fo...
[ "func", "(", "s", "*", "AccessService", ")", "GetRole", "(", "name", "string", ")", "(", "services", ".", "Role", ",", "error", ")", "{", "if", "name", "==", "\"", "\"", "{", "return", "nil", ",", "trace", ".", "BadParameter", "(", "\"", "\"", ")",...
// GetRole returns a role by name
[ "GetRole", "returns", "a", "role", "by", "name" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/access.go#L105-L118
train
gravitational/teleport
lib/services/local/access.go
DeleteRole
func (s *AccessService) DeleteRole(name string) error { if name == "" { return trace.BadParameter("missing role name") } err := s.Delete(context.TODO(), backend.Key(rolesPrefix, name, paramsPrefix)) if err != nil { if trace.IsNotFound(err) { return trace.NotFound("role %q is not found", name) } } return ...
go
func (s *AccessService) DeleteRole(name string) error { if name == "" { return trace.BadParameter("missing role name") } err := s.Delete(context.TODO(), backend.Key(rolesPrefix, name, paramsPrefix)) if err != nil { if trace.IsNotFound(err) { return trace.NotFound("role %q is not found", name) } } return ...
[ "func", "(", "s", "*", "AccessService", ")", "DeleteRole", "(", "name", "string", ")", "error", "{", "if", "name", "==", "\"", "\"", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "\n", "}", "\n", "err", ":=", "s", ".", "Delete"...
// DeleteRole deletes a role from the backend
[ "DeleteRole", "deletes", "a", "role", "from", "the", "backend" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/local/access.go#L121-L132
train
gravitational/teleport
lib/auth/auth_with_roles.go
hasRemoteBuiltinRole
func (a *AuthWithRoles) hasRemoteBuiltinRole(name string) bool { if _, ok := a.checker.(RemoteBuiltinRoleSet); !ok { return false } if !a.checker.HasRole(name) { return false } return true }
go
func (a *AuthWithRoles) hasRemoteBuiltinRole(name string) bool { if _, ok := a.checker.(RemoteBuiltinRoleSet); !ok { return false } if !a.checker.HasRole(name) { return false } return true }
[ "func", "(", "a", "*", "AuthWithRoles", ")", "hasRemoteBuiltinRole", "(", "name", "string", ")", "bool", "{", "if", "_", ",", "ok", ":=", "a", ".", "checker", ".", "(", "RemoteBuiltinRoleSet", ")", ";", "!", "ok", "{", "return", "false", "\n", "}", "...
// hasRemoteBuiltinRole checks the type of the role set returned and the name. // Returns true if role set is remote builtin and the name matches.
[ "hasRemoteBuiltinRole", "checks", "the", "type", "of", "the", "role", "set", "returned", "and", "the", "name", ".", "Returns", "true", "if", "role", "set", "is", "remote", "builtin", "and", "the", "name", "matches", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/auth_with_roles.go#L98-L107
train
gravitational/teleport
lib/auth/auth_with_roles.go
RotateExternalCertAuthority
func (a *AuthWithRoles) RotateExternalCertAuthority(ca services.CertAuthority) error { if ca == nil { return trace.BadParameter("missing certificate authority") } ctx := &services.Context{User: a.user, Resource: ca} if err := a.actionWithContext(ctx, defaults.Namespace, services.KindCertAuthority, services.VerbRo...
go
func (a *AuthWithRoles) RotateExternalCertAuthority(ca services.CertAuthority) error { if ca == nil { return trace.BadParameter("missing certificate authority") } ctx := &services.Context{User: a.user, Resource: ca} if err := a.actionWithContext(ctx, defaults.Namespace, services.KindCertAuthority, services.VerbRo...
[ "func", "(", "a", "*", "AuthWithRoles", ")", "RotateExternalCertAuthority", "(", "ca", "services", ".", "CertAuthority", ")", "error", "{", "if", "ca", "==", "nil", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "\n", "}", "\n", "ctx"...
// RotateExternalCertAuthority rotates external certificate authority, // this method is called by a remote trusted cluster and is used to update // only public keys and certificates of the certificate authority.
[ "RotateExternalCertAuthority", "rotates", "external", "certificate", "authority", "this", "method", "is", "called", "by", "a", "remote", "trusted", "cluster", "and", "is", "used", "to", "update", "only", "public", "keys", "and", "certificates", "of", "the", "certi...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/auth_with_roles.go#L181-L190
train
gravitational/teleport
lib/auth/auth_with_roles.go
UpsertCertAuthority
func (a *AuthWithRoles) UpsertCertAuthority(ca services.CertAuthority) error { if ca == nil { return trace.BadParameter("missing certificate authority") } ctx := &services.Context{User: a.user, Resource: ca} if err := a.actionWithContext(ctx, defaults.Namespace, services.KindCertAuthority, services.VerbCreate); e...
go
func (a *AuthWithRoles) UpsertCertAuthority(ca services.CertAuthority) error { if ca == nil { return trace.BadParameter("missing certificate authority") } ctx := &services.Context{User: a.user, Resource: ca} if err := a.actionWithContext(ctx, defaults.Namespace, services.KindCertAuthority, services.VerbCreate); e...
[ "func", "(", "a", "*", "AuthWithRoles", ")", "UpsertCertAuthority", "(", "ca", "services", ".", "CertAuthority", ")", "error", "{", "if", "ca", "==", "nil", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "\n", "}", "\n", "ctx", ":="...
// UpsertCertAuthority updates existing cert authority or updates the existing one.
[ "UpsertCertAuthority", "updates", "existing", "cert", "authority", "or", "updates", "the", "existing", "one", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/auth_with_roles.go#L193-L205
train
gravitational/teleport
lib/auth/auth_with_roles.go
UpsertNodes
func (a *AuthWithRoles) UpsertNodes(namespace string, servers []services.Server) error { if err := a.action(namespace, services.KindNode, services.VerbCreate); err != nil { return trace.Wrap(err) } if err := a.action(namespace, services.KindNode, services.VerbUpdate); err != nil { return trace.Wrap(err) } retu...
go
func (a *AuthWithRoles) UpsertNodes(namespace string, servers []services.Server) error { if err := a.action(namespace, services.KindNode, services.VerbCreate); err != nil { return trace.Wrap(err) } if err := a.action(namespace, services.KindNode, services.VerbUpdate); err != nil { return trace.Wrap(err) } retu...
[ "func", "(", "a", "*", "AuthWithRoles", ")", "UpsertNodes", "(", "namespace", "string", ",", "servers", "[", "]", "services", ".", "Server", ")", "error", "{", "if", "err", ":=", "a", ".", "action", "(", "namespace", ",", "services", ".", "KindNode", "...
// UpsertNodes bulk upserts nodes into the backend.
[ "UpsertNodes", "bulk", "upserts", "nodes", "into", "the", "backend", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/auth_with_roles.go#L327-L335
train
gravitational/teleport
lib/auth/auth_with_roles.go
filterNodes
func (a *AuthWithRoles) filterNodes(nodes []services.Server) ([]services.Server, error) { // For certain built-in roles, continue to allow full access and return // the full set of nodes to not break existing clusters during migration. // // In addition, allow proxy (and remote proxy) to access all nodes for it's ...
go
func (a *AuthWithRoles) filterNodes(nodes []services.Server) ([]services.Server, error) { // For certain built-in roles, continue to allow full access and return // the full set of nodes to not break existing clusters during migration. // // In addition, allow proxy (and remote proxy) to access all nodes for it's ...
[ "func", "(", "a", "*", "AuthWithRoles", ")", "filterNodes", "(", "nodes", "[", "]", "services", ".", "Server", ")", "(", "[", "]", "services", ".", "Server", ",", "error", ")", "{", "// For certain built-in roles, continue to allow full access and return", "// the...
// filterNodes filters nodes based off the role of the logged in user.
[ "filterNodes", "filters", "nodes", "based", "off", "the", "role", "of", "the", "logged", "in", "user", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/auth_with_roles.go#L448-L489
train
gravitational/teleport
lib/auth/auth_with_roles.go
DeleteProxy
func (a *AuthWithRoles) DeleteProxy(name string) error { if err := a.action(defaults.Namespace, services.KindProxy, services.VerbDelete); err != nil { return trace.Wrap(err) } return a.authServer.DeleteProxy(name) }
go
func (a *AuthWithRoles) DeleteProxy(name string) error { if err := a.action(defaults.Namespace, services.KindProxy, services.VerbDelete); err != nil { return trace.Wrap(err) } return a.authServer.DeleteProxy(name) }
[ "func", "(", "a", "*", "AuthWithRoles", ")", "DeleteProxy", "(", "name", "string", ")", "error", "{", "if", "err", ":=", "a", ".", "action", "(", "defaults", ".", "Namespace", ",", "services", ".", "KindProxy", ",", "services", ".", "VerbDelete", ")", ...
// DeleteProxy deletes proxy by name
[ "DeleteProxy", "deletes", "proxy", "by", "name" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/auth_with_roles.go#L604-L609
train
gravitational/teleport
lib/auth/auth_with_roles.go
DeleteNamespace
func (a *AuthWithRoles) DeleteNamespace(name string) error { if err := a.action(defaults.Namespace, services.KindNamespace, services.VerbDelete); err != nil { return trace.Wrap(err) } return a.authServer.DeleteNamespace(name) }
go
func (a *AuthWithRoles) DeleteNamespace(name string) error { if err := a.action(defaults.Namespace, services.KindNamespace, services.VerbDelete); err != nil { return trace.Wrap(err) } return a.authServer.DeleteNamespace(name) }
[ "func", "(", "a", "*", "AuthWithRoles", ")", "DeleteNamespace", "(", "name", "string", ")", "error", "{", "if", "err", ":=", "a", ".", "action", "(", "defaults", ".", "Namespace", ",", "services", ".", "KindNamespace", ",", "services", ".", "VerbDelete", ...
// DeleteNamespace deletes namespace by name
[ "DeleteNamespace", "deletes", "namespace", "by", "name" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/auth_with_roles.go#L1163-L1168
train
gravitational/teleport
lib/auth/auth_with_roles.go
DeleteRole
func (a *AuthWithRoles) DeleteRole(name string) error { if err := a.action(defaults.Namespace, services.KindRole, services.VerbDelete); err != nil { return trace.Wrap(err) } return a.authServer.DeleteRole(name) }
go
func (a *AuthWithRoles) DeleteRole(name string) error { if err := a.action(defaults.Namespace, services.KindRole, services.VerbDelete); err != nil { return trace.Wrap(err) } return a.authServer.DeleteRole(name) }
[ "func", "(", "a", "*", "AuthWithRoles", ")", "DeleteRole", "(", "name", "string", ")", "error", "{", "if", "err", ":=", "a", ".", "action", "(", "defaults", ".", "Namespace", ",", "services", ".", "KindRole", ",", "services", ".", "VerbDelete", ")", ";...
// DeleteRole deletes role by name
[ "DeleteRole", "deletes", "role", "by", "name" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/auth_with_roles.go#L1210-L1215
train
gravitational/teleport
lib/auth/auth_with_roles.go
GetClusterConfig
func (a *AuthWithRoles) GetClusterConfig(opts ...services.MarshalOption) (services.ClusterConfig, error) { if err := a.action(defaults.Namespace, services.KindClusterConfig, services.VerbRead); err != nil { return nil, trace.Wrap(err) } return a.authServer.GetClusterConfig(opts...) }
go
func (a *AuthWithRoles) GetClusterConfig(opts ...services.MarshalOption) (services.ClusterConfig, error) { if err := a.action(defaults.Namespace, services.KindClusterConfig, services.VerbRead); err != nil { return nil, trace.Wrap(err) } return a.authServer.GetClusterConfig(opts...) }
[ "func", "(", "a", "*", "AuthWithRoles", ")", "GetClusterConfig", "(", "opts", "...", "services", ".", "MarshalOption", ")", "(", "services", ".", "ClusterConfig", ",", "error", ")", "{", "if", "err", ":=", "a", ".", "action", "(", "defaults", ".", "Names...
// GetClusterConfig gets cluster level configuration.
[ "GetClusterConfig", "gets", "cluster", "level", "configuration", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/auth_with_roles.go#L1218-L1223
train
gravitational/teleport
lib/auth/auth_with_roles.go
DeleteClusterConfig
func (a *AuthWithRoles) DeleteClusterConfig() error { if err := a.action(defaults.Namespace, services.KindClusterConfig, services.VerbDelete); err != nil { return trace.Wrap(err) } return a.authServer.DeleteClusterConfig() }
go
func (a *AuthWithRoles) DeleteClusterConfig() error { if err := a.action(defaults.Namespace, services.KindClusterConfig, services.VerbDelete); err != nil { return trace.Wrap(err) } return a.authServer.DeleteClusterConfig() }
[ "func", "(", "a", "*", "AuthWithRoles", ")", "DeleteClusterConfig", "(", ")", "error", "{", "if", "err", ":=", "a", ".", "action", "(", "defaults", ".", "Namespace", ",", "services", ".", "KindClusterConfig", ",", "services", ".", "VerbDelete", ")", ";", ...
// DeleteClusterConfig deletes cluster config
[ "DeleteClusterConfig", "deletes", "cluster", "config" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/auth_with_roles.go#L1226-L1231
train
gravitational/teleport
lib/auth/auth_with_roles.go
DeleteClusterName
func (a *AuthWithRoles) DeleteClusterName() error { if err := a.action(defaults.Namespace, services.KindClusterName, services.VerbDelete); err != nil { return trace.Wrap(err) } return a.authServer.DeleteClusterName() }
go
func (a *AuthWithRoles) DeleteClusterName() error { if err := a.action(defaults.Namespace, services.KindClusterName, services.VerbDelete); err != nil { return trace.Wrap(err) } return a.authServer.DeleteClusterName() }
[ "func", "(", "a", "*", "AuthWithRoles", ")", "DeleteClusterName", "(", ")", "error", "{", "if", "err", ":=", "a", ".", "action", "(", "defaults", ".", "Namespace", ",", "services", ".", "KindClusterName", ",", "services", ".", "VerbDelete", ")", ";", "er...
// DeleteClusterName deletes cluster name
[ "DeleteClusterName", "deletes", "cluster", "name" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/auth_with_roles.go#L1234-L1239
train