id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
24,000
gravitational/teleport
lib/services/server.go
MarshalServers
func (*TeleportServerMarshaler) MarshalServers(s []Server) ([]byte, error) { bytes, err := utils.FastMarshal(s) if err != nil { return nil, trace.Wrap(err) } return bytes, nil }
go
func (*TeleportServerMarshaler) MarshalServers(s []Server) ([]byte, error) { bytes, err := utils.FastMarshal(s) if err != nil { return nil, trace.Wrap(err) } return bytes, nil }
[ "func", "(", "*", "TeleportServerMarshaler", ")", "MarshalServers", "(", "s", "[", "]", "Server", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "bytes", ",", "err", ":=", "utils", ".", "FastMarshal", "(", "s", ")", "\n", "if", "err", "!=", "n...
// MarshalServers is used to marshal multiple servers to their binary // representation.
[ "MarshalServers", "is", "used", "to", "marshal", "multiple", "servers", "to", "their", "binary", "representation", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/server.go#L726-L733
24,001
gravitational/teleport
lib/web/ui/cluster.go
NewAvailableClusters
func NewAvailableClusters(currentClusterName string, remoteClusters []reversetunnel.RemoteSite) *AvailableClusters { out := AvailableClusters{} for _, item := range remoteClusters { cluster := Cluster{ Name: item.GetName(), LastConnected: item.GetLastConnected(), Status: item.GetStatus(), ...
go
func NewAvailableClusters(currentClusterName string, remoteClusters []reversetunnel.RemoteSite) *AvailableClusters { out := AvailableClusters{} for _, item := range remoteClusters { cluster := Cluster{ Name: item.GetName(), LastConnected: item.GetLastConnected(), Status: item.GetStatus(), ...
[ "func", "NewAvailableClusters", "(", "currentClusterName", "string", ",", "remoteClusters", "[", "]", "reversetunnel", ".", "RemoteSite", ")", "*", "AvailableClusters", "{", "out", ":=", "AvailableClusters", "{", "}", "\n", "for", "_", ",", "item", ":=", "range"...
// NewAvailableClusters returns all available clusters
[ "NewAvailableClusters", "returns", "all", "available", "clusters" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/ui/cluster.go#L45-L66
24,002
gravitational/teleport
lib/backend/legacy/import.go
Import
func Import(ctx context.Context, importer Importer, newExporter NewExporterFunc) error { log := logrus.WithFields(logrus.Fields{ trace.Component: teleport.Component(teleport.ComponentMigrate), }) err := func() error { imported, err := importer.Imported(ctx) if err != nil { return trace.Wrap(err) } if im...
go
func Import(ctx context.Context, importer Importer, newExporter NewExporterFunc) error { log := logrus.WithFields(logrus.Fields{ trace.Component: teleport.Component(teleport.ComponentMigrate), }) err := func() error { imported, err := importer.Imported(ctx) if err != nil { return trace.Wrap(err) } if im...
[ "func", "Import", "(", "ctx", "context", ".", "Context", ",", "importer", "Importer", ",", "newExporter", "NewExporterFunc", ")", "error", "{", "log", ":=", "logrus", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "trace", ".", "Component", ":", "te...
// Import imports backend data into importer unless importer has already // imported data. If Importer has no imported data yet, exporter will // not be initialized. This function can be called many times on the // same importer. Importer will be closed if import has failed.
[ "Import", "imports", "backend", "data", "into", "importer", "unless", "importer", "has", "already", "imported", "data", ".", "If", "Importer", "has", "no", "imported", "data", "yet", "exporter", "will", "not", "be", "initialized", ".", "This", "function", "can...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/legacy/import.go#L39-L74
24,003
gravitational/teleport
lib/service/info.go
writeDebugInfo
func writeDebugInfo(w io.Writer) { fmt.Fprintf(w, "Runtime stats\n") runtimeStats(w) fmt.Fprintf(w, "Memory stats\n") memStats(w) fmt.Fprintf(w, "Goroutines\n") goroutineDump(w) }
go
func writeDebugInfo(w io.Writer) { fmt.Fprintf(w, "Runtime stats\n") runtimeStats(w) fmt.Fprintf(w, "Memory stats\n") memStats(w) fmt.Fprintf(w, "Goroutines\n") goroutineDump(w) }
[ "func", "writeDebugInfo", "(", "w", "io", ".", "Writer", ")", "{", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\n", "\"", ")", "\n", "runtimeStats", "(", "w", ")", "\n\n", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\n", "\"", ")", "\n", "m...
// writeDebugInfo writes debugging information // about this process
[ "writeDebugInfo", "writes", "debugging", "information", "about", "this", "process" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/info.go#L33-L42
24,004
gravitational/teleport
lib/multiplexer/wrappers.go
Read
func (c *Conn) Read(p []byte) (int, error) { return c.reader.Read(p) }
go
func (c *Conn) Read(p []byte) (int, error) { return c.reader.Read(p) }
[ "func", "(", "c", "*", "Conn", ")", "Read", "(", "p", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "return", "c", ".", "reader", ".", "Read", "(", "p", ")", "\n", "}" ]
// Read reads from connection
[ "Read", "reads", "from", "connection" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/multiplexer/wrappers.go#L39-L41
24,005
gravitational/teleport
lib/multiplexer/wrappers.go
LocalAddr
func (c *Conn) LocalAddr() net.Addr { if c.proxyLine != nil { return &c.proxyLine.Destination } return c.Conn.LocalAddr() }
go
func (c *Conn) LocalAddr() net.Addr { if c.proxyLine != nil { return &c.proxyLine.Destination } return c.Conn.LocalAddr() }
[ "func", "(", "c", "*", "Conn", ")", "LocalAddr", "(", ")", "net", ".", "Addr", "{", "if", "c", ".", "proxyLine", "!=", "nil", "{", "return", "&", "c", ".", "proxyLine", ".", "Destination", "\n", "}", "\n", "return", "c", ".", "Conn", ".", "LocalA...
// LocalAddr returns local address of the connection
[ "LocalAddr", "returns", "local", "address", "of", "the", "connection" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/multiplexer/wrappers.go#L44-L49
24,006
gravitational/teleport
lib/multiplexer/wrappers.go
RemoteAddr
func (c *Conn) RemoteAddr() net.Addr { if c.proxyLine != nil { return &c.proxyLine.Source } return c.Conn.RemoteAddr() }
go
func (c *Conn) RemoteAddr() net.Addr { if c.proxyLine != nil { return &c.proxyLine.Source } return c.Conn.RemoteAddr() }
[ "func", "(", "c", "*", "Conn", ")", "RemoteAddr", "(", ")", "net", ".", "Addr", "{", "if", "c", ".", "proxyLine", "!=", "nil", "{", "return", "&", "c", ".", "proxyLine", ".", "Source", "\n", "}", "\n", "return", "c", ".", "Conn", ".", "RemoteAddr...
// RemoteAddr returns remote address of the connection
[ "RemoteAddr", "returns", "remote", "address", "of", "the", "connection" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/multiplexer/wrappers.go#L52-L57
24,007
gravitational/teleport
lib/multiplexer/wrappers.go
Accept
func (l *Listener) Accept() (net.Conn, error) { select { case <-l.context.Done(): return nil, trace.ConnectionProblem(nil, "listener is closed") case conn := <-l.connC: if conn == nil { return nil, trace.ConnectionProblem(nil, "listener is closed") } return conn, nil } }
go
func (l *Listener) Accept() (net.Conn, error) { select { case <-l.context.Done(): return nil, trace.ConnectionProblem(nil, "listener is closed") case conn := <-l.connC: if conn == nil { return nil, trace.ConnectionProblem(nil, "listener is closed") } return conn, nil } }
[ "func", "(", "l", "*", "Listener", ")", "Accept", "(", ")", "(", "net", ".", "Conn", ",", "error", ")", "{", "select", "{", "case", "<-", "l", ".", "context", ".", "Done", "(", ")", ":", "return", "nil", ",", "trace", ".", "ConnectionProblem", "(...
// Accept accepts connections from parent multiplexer listener
[ "Accept", "accepts", "connections", "from", "parent", "multiplexer", "listener" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/multiplexer/wrappers.go#L84-L94
24,008
gravitational/teleport
lib/services/identity.go
Equals
func (i *ExternalIdentity) Equals(other *ExternalIdentity) bool { return i.ConnectorID == other.ConnectorID && i.Username == other.Username }
go
func (i *ExternalIdentity) Equals(other *ExternalIdentity) bool { return i.ConnectorID == other.ConnectorID && i.Username == other.Username }
[ "func", "(", "i", "*", "ExternalIdentity", ")", "Equals", "(", "other", "*", "ExternalIdentity", ")", "bool", "{", "return", "i", ".", "ConnectorID", "==", "other", ".", "ConnectorID", "&&", "i", ".", "Username", "==", "other", ".", "Username", "\n", "}"...
// Equals returns true if this identity equals to passed one
[ "Equals", "returns", "true", "if", "this", "identity", "equals", "to", "passed", "one" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/identity.go#L257-L259
24,009
gravitational/teleport
lib/services/identity.go
Check
func (r *GithubAuthRequest) Check() error { if r.ConnectorID == "" { return trace.BadParameter("missing ConnectorID") } if r.StateToken == "" { return trace.BadParameter("missing StateToken") } if len(r.PublicKey) != 0 { _, _, _, _, err := ssh.ParseAuthorizedKey(r.PublicKey) if err != nil { return trace...
go
func (r *GithubAuthRequest) Check() error { if r.ConnectorID == "" { return trace.BadParameter("missing ConnectorID") } if r.StateToken == "" { return trace.BadParameter("missing StateToken") } if len(r.PublicKey) != 0 { _, _, _, _, err := ssh.ParseAuthorizedKey(r.PublicKey) if err != nil { return trace...
[ "func", "(", "r", "*", "GithubAuthRequest", ")", "Check", "(", ")", "error", "{", "if", "r", ".", "ConnectorID", "==", "\"", "\"", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "r", ".", "StateToken", "==...
// Check makes sure the request is valid
[ "Check", "makes", "sure", "the", "request", "is", "valid" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/identity.go#L320-L337
24,010
gravitational/teleport
lib/services/identity.go
Swap
func (s SortedLoginAttempts) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
go
func (s SortedLoginAttempts) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
[ "func", "(", "s", "SortedLoginAttempts", ")", "Swap", "(", "i", ",", "j", "int", ")", "{", "s", "[", "i", "]", ",", "s", "[", "j", "]", "=", "s", "[", "j", "]", ",", "s", "[", "i", "]", "\n", "}" ]
// Swap swaps two attempts
[ "Swap", "swaps", "two", "attempts" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/identity.go#L491-L493
24,011
gravitational/teleport
lib/services/identity.go
LastFailed
func LastFailed(x int, attempts []LoginAttempt) bool { var failed int for i := len(attempts) - 1; i >= 0; i-- { if !attempts[i].Success { failed++ } else { return false } if failed >= x { return true } } return false }
go
func LastFailed(x int, attempts []LoginAttempt) bool { var failed int for i := len(attempts) - 1; i >= 0; i-- { if !attempts[i].Success { failed++ } else { return false } if failed >= x { return true } } return false }
[ "func", "LastFailed", "(", "x", "int", ",", "attempts", "[", "]", "LoginAttempt", ")", "bool", "{", "var", "failed", "int", "\n", "for", "i", ":=", "len", "(", "attempts", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", "{", "if", "!", "att...
// LastFailed calculates last x successive attempts are failed
[ "LastFailed", "calculates", "last", "x", "successive", "attempts", "are", "failed" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/identity.go#L496-L509
24,012
gravitational/teleport
lib/web/terminal.go
NewTerminal
func NewTerminal(req TerminalRequest, authProvider AuthProvider, ctx *SessionContext) (*TerminalHandler, error) { // Make sure whatever session is requested is a valid session. _, err := session.ParseID(string(req.SessionID)) if err != nil { return nil, trace.BadParameter("sid: invalid session id") } if req.Lo...
go
func NewTerminal(req TerminalRequest, authProvider AuthProvider, ctx *SessionContext) (*TerminalHandler, error) { // Make sure whatever session is requested is a valid session. _, err := session.ParseID(string(req.SessionID)) if err != nil { return nil, trace.BadParameter("sid: invalid session id") } if req.Lo...
[ "func", "NewTerminal", "(", "req", "TerminalRequest", ",", "authProvider", "AuthProvider", ",", "ctx", "*", "SessionContext", ")", "(", "*", "TerminalHandler", ",", "error", ")", "{", "// Make sure whatever session is requested is a valid session.", "_", ",", "err", "...
// NewTerminal creates a web-based terminal based on WebSockets and returns a // new TerminalHandler.
[ "NewTerminal", "creates", "a", "web", "-", "based", "terminal", "based", "on", "WebSockets", "and", "returns", "a", "new", "TerminalHandler", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/terminal.go#L84-L121
24,013
gravitational/teleport
lib/web/terminal.go
Close
func (t *TerminalHandler) Close() error { // Close the websocket connection to the client web browser. if t.ws != nil { t.ws.Close() } // Close the SSH connection to the remote node. if t.sshSession != nil { t.sshSession.Close() } // If the terminal handler was closed (most likely due to the *SessionContex...
go
func (t *TerminalHandler) Close() error { // Close the websocket connection to the client web browser. if t.ws != nil { t.ws.Close() } // Close the SSH connection to the remote node. if t.sshSession != nil { t.sshSession.Close() } // If the terminal handler was closed (most likely due to the *SessionContex...
[ "func", "(", "t", "*", "TerminalHandler", ")", "Close", "(", ")", "error", "{", "// Close the websocket connection to the client web browser.", "if", "t", ".", "ws", "!=", "nil", "{", "t", ".", "ws", ".", "Close", "(", ")", "\n", "}", "\n\n", "// Close the S...
// Close the websocket stream.
[ "Close", "the", "websocket", "stream", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/terminal.go#L191-L207
24,014
gravitational/teleport
lib/web/terminal.go
handler
func (t *TerminalHandler) handler(ws *websocket.Conn) { // Create a Teleport client, if not able to, show the reason to the user in // the terminal. tc, err := t.makeClient(ws) if err != nil { er := t.writeError(err, ws) if er != nil { t.log.Warnf("Unable to send error to terminal: %v: %v.", err, er) } r...
go
func (t *TerminalHandler) handler(ws *websocket.Conn) { // Create a Teleport client, if not able to, show the reason to the user in // the terminal. tc, err := t.makeClient(ws) if err != nil { er := t.writeError(err, ws) if er != nil { t.log.Warnf("Unable to send error to terminal: %v: %v.", err, er) } r...
[ "func", "(", "t", "*", "TerminalHandler", ")", "handler", "(", "ws", "*", "websocket", ".", "Conn", ")", "{", "// Create a Teleport client, if not able to, show the reason to the user in", "// the terminal.", "tc", ",", "err", ":=", "t", ".", "makeClient", "(", "ws"...
// handler is the main websocket loop. It creates a Teleport client and then // pumps raw events and audit events back to the client until the SSH session // is complete.
[ "handler", "is", "the", "main", "websocket", "loop", ".", "It", "creates", "a", "Teleport", "client", "and", "then", "pumps", "raw", "events", "and", "audit", "events", "back", "to", "the", "client", "until", "the", "SSH", "session", "is", "complete", "." ...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/terminal.go#L212-L236
24,015
gravitational/teleport
lib/web/terminal.go
streamTerminal
func (t *TerminalHandler) streamTerminal(ws *websocket.Conn, tc *client.TeleportClient) { defer t.terminalCancel() // Establish SSH connection to the server. This function will block until // either an error occurs or it completes successfully. err := tc.SSH(t.terminalContext, t.params.InteractiveCommand, false) ...
go
func (t *TerminalHandler) streamTerminal(ws *websocket.Conn, tc *client.TeleportClient) { defer t.terminalCancel() // Establish SSH connection to the server. This function will block until // either an error occurs or it completes successfully. err := tc.SSH(t.terminalContext, t.params.InteractiveCommand, false) ...
[ "func", "(", "t", "*", "TerminalHandler", ")", "streamTerminal", "(", "ws", "*", "websocket", ".", "Conn", ",", "tc", "*", "client", ".", "TeleportClient", ")", "{", "defer", "t", ".", "terminalCancel", "(", ")", "\n\n", "// Establish SSH connection to the ser...
// streamTerminal opens a SSH connection to the remote host and streams // events back to the web client.
[ "streamTerminal", "opens", "a", "SSH", "connection", "to", "the", "remote", "host", "and", "streams", "events", "back", "to", "the", "web", "client", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/terminal.go#L288-L320
24,016
gravitational/teleport
lib/web/terminal.go
streamEvents
func (t *TerminalHandler) streamEvents(ws *websocket.Conn, tc *client.TeleportClient) { for { select { // Send push events that come over the events channel to the web client. case event := <-tc.EventsChannel(): data, err := json.Marshal(event) if err != nil { t.log.Errorf("Unable to marshal audit even...
go
func (t *TerminalHandler) streamEvents(ws *websocket.Conn, tc *client.TeleportClient) { for { select { // Send push events that come over the events channel to the web client. case event := <-tc.EventsChannel(): data, err := json.Marshal(event) if err != nil { t.log.Errorf("Unable to marshal audit even...
[ "func", "(", "t", "*", "TerminalHandler", ")", "streamEvents", "(", "ws", "*", "websocket", ".", "Conn", ",", "tc", "*", "client", ".", "TeleportClient", ")", "{", "for", "{", "select", "{", "// Send push events that come over the events channel to the web client.",...
// streamEvents receives events over the SSH connection and forwards them to // the web client.
[ "streamEvents", "receives", "events", "over", "the", "SSH", "connection", "and", "forwards", "them", "to", "the", "web", "client", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/terminal.go#L324-L366
24,017
gravitational/teleport
lib/web/terminal.go
windowChange
func (t *TerminalHandler) windowChange(params *session.TerminalParams) error { if t.sshSession == nil { return nil } _, err := t.sshSession.SendRequest( sshutils.WindowChangeRequest, false, ssh.Marshal(sshutils.WinChangeReqParams{ W: uint32(params.W), H: uint32(params.H), })) if err != nil { t.lo...
go
func (t *TerminalHandler) windowChange(params *session.TerminalParams) error { if t.sshSession == nil { return nil } _, err := t.sshSession.SendRequest( sshutils.WindowChangeRequest, false, ssh.Marshal(sshutils.WinChangeReqParams{ W: uint32(params.W), H: uint32(params.H), })) if err != nil { t.lo...
[ "func", "(", "t", "*", "TerminalHandler", ")", "windowChange", "(", "params", "*", "session", ".", "TerminalParams", ")", "error", "{", "if", "t", ".", "sshSession", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "_", ",", "err", ":=", "t", "....
// windowChange is called when the browser window is resized. It sends a // "window-change" channel request to the server.
[ "windowChange", "is", "called", "when", "the", "browser", "window", "is", "resized", ".", "It", "sends", "a", "window", "-", "change", "channel", "request", "to", "the", "server", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/terminal.go#L370-L387
24,018
gravitational/teleport
lib/web/terminal.go
writeError
func (t *TerminalHandler) writeError(err error, ws *websocket.Conn) error { // Replace \n with \r\n so the message correctly aligned. r := strings.NewReplacer("\r\n", "\r\n", "\n", "\r\n") errMessage := r.Replace(err.Error()) _, err = t.write([]byte(errMessage), ws) if err != nil { return trace.Wrap(err) } re...
go
func (t *TerminalHandler) writeError(err error, ws *websocket.Conn) error { // Replace \n with \r\n so the message correctly aligned. r := strings.NewReplacer("\r\n", "\r\n", "\n", "\r\n") errMessage := r.Replace(err.Error()) _, err = t.write([]byte(errMessage), ws) if err != nil { return trace.Wrap(err) } re...
[ "func", "(", "t", "*", "TerminalHandler", ")", "writeError", "(", "err", "error", ",", "ws", "*", "websocket", ".", "Conn", ")", "error", "{", "// Replace \\n with \\r\\n so the message correctly aligned.", "r", ":=", "strings", ".", "NewReplacer", "(", "\"", "\...
// writeError displays an error in the terminal window.
[ "writeError", "displays", "an", "error", "in", "the", "terminal", "window", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/terminal.go#L390-L400
24,019
gravitational/teleport
lib/web/terminal.go
resolveServerHostPort
func resolveServerHostPort(servername string, existingServers []services.Server) (string, int, error) { // If port is 0, client wants us to figure out which port to use. var defaultPort = 0 if servername == "" { return "", defaultPort, trace.BadParameter("empty server name") } // Check if servername is UUID. ...
go
func resolveServerHostPort(servername string, existingServers []services.Server) (string, int, error) { // If port is 0, client wants us to figure out which port to use. var defaultPort = 0 if servername == "" { return "", defaultPort, trace.BadParameter("empty server name") } // Check if servername is UUID. ...
[ "func", "resolveServerHostPort", "(", "servername", "string", ",", "existingServers", "[", "]", "services", ".", "Server", ")", "(", "string", ",", "int", ",", "error", ")", "{", "// If port is 0, client wants us to figure out which port to use.", "var", "defaultPort", ...
// resolveServerHostPort parses server name and attempts to resolve hostname // and port.
[ "resolveServerHostPort", "parses", "server", "name", "and", "attempts", "to", "resolve", "hostname", "and", "port", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/terminal.go#L404-L436
24,020
gravitational/teleport
lib/web/terminal.go
Write
func (w *terminalStream) Write(data []byte) (n int, err error) { return w.terminal.write(data, w.ws) }
go
func (w *terminalStream) Write(data []byte) (n int, err error) { return w.terminal.write(data, w.ws) }
[ "func", "(", "w", "*", "terminalStream", ")", "Write", "(", "data", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "return", "w", ".", "terminal", ".", "write", "(", "data", ",", "w", ".", "ws", ")", "\n", "}" ]
// Write wraps the data bytes in a raw envelope and sends.
[ "Write", "wraps", "the", "data", "bytes", "in", "a", "raw", "envelope", "and", "sends", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/terminal.go#L544-L546
24,021
gravitational/teleport
lib/web/terminal.go
SetReadDeadline
func (w *terminalStream) SetReadDeadline(t time.Time) error { return w.ws.SetReadDeadline(t) }
go
func (w *terminalStream) SetReadDeadline(t time.Time) error { return w.ws.SetReadDeadline(t) }
[ "func", "(", "w", "*", "terminalStream", ")", "SetReadDeadline", "(", "t", "time", ".", "Time", ")", "error", "{", "return", "w", ".", "ws", ".", "SetReadDeadline", "(", "t", ")", "\n", "}" ]
// SetReadDeadline sets the network read deadline on the underlying websocket.
[ "SetReadDeadline", "sets", "the", "network", "read", "deadline", "on", "the", "underlying", "websocket", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/terminal.go#L555-L557
24,022
gravitational/teleport
lib/kube/proxy/forwarder.go
NewForwarder
func NewForwarder(cfg ForwarderConfig) (*Forwarder, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } creds, err := getKubeCreds(cfg.KubeconfigPath) if err != nil { return nil, trace.Wrap(err) } clusterSessions, err := ttlmap.New(defaults.ClientCacheSize) if err != ni...
go
func NewForwarder(cfg ForwarderConfig) (*Forwarder, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } creds, err := getKubeCreds(cfg.KubeconfigPath) if err != nil { return nil, trace.Wrap(err) } clusterSessions, err := ttlmap.New(defaults.ClientCacheSize) if err != ni...
[ "func", "NewForwarder", "(", "cfg", "ForwarderConfig", ")", "(", "*", "Forwarder", ",", "error", ")", "{", "if", "err", ":=", "cfg", ".", "CheckAndSetDefaults", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "trace", ".", "Wrap", "(", ...
// NewForwarder returns new instance of Kubernetes request // forwarding proxy.
[ "NewForwarder", "returns", "new", "instance", "of", "Kubernetes", "request", "forwarding", "proxy", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/kube/proxy/forwarder.go#L144-L187
24,023
gravitational/teleport
lib/kube/proxy/forwarder.go
authenticate
func (f *Forwarder) authenticate(req *http.Request) (*authContext, error) { const accessDeniedMsg = "[00] access denied" var isRemoteUser bool userTypeI := req.Context().Value(auth.ContextUser) switch userTypeI.(type) { case auth.LocalUser: case auth.RemoteUser: isRemoteUser = true default: f.Warningf("Den...
go
func (f *Forwarder) authenticate(req *http.Request) (*authContext, error) { const accessDeniedMsg = "[00] access denied" var isRemoteUser bool userTypeI := req.Context().Value(auth.ContextUser) switch userTypeI.(type) { case auth.LocalUser: case auth.RemoteUser: isRemoteUser = true default: f.Warningf("Den...
[ "func", "(", "f", "*", "Forwarder", ")", "authenticate", "(", "req", "*", "http", ".", "Request", ")", "(", "*", "authContext", ",", "error", ")", "{", "const", "accessDeniedMsg", "=", "\"", "\"", "\n\n", "var", "isRemoteUser", "bool", "\n", "userTypeI",...
// authenticate function authenticates request
[ "authenticate", "function", "authenticates", "request" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/kube/proxy/forwarder.go#L274-L321
24,024
gravitational/teleport
lib/kube/proxy/forwarder.go
portForward
func (f *Forwarder) portForward(ctx *authContext, w http.ResponseWriter, req *http.Request, p httprouter.Params) (interface{}, error) { f.Debugf("Port forward: %v. req headers: %v", req.URL.String(), req.Header) sess, err := f.getOrCreateClusterSession(*ctx) if err != nil { return nil, trace.Wrap(err) } if err ...
go
func (f *Forwarder) portForward(ctx *authContext, w http.ResponseWriter, req *http.Request, p httprouter.Params) (interface{}, error) { f.Debugf("Port forward: %v. req headers: %v", req.URL.String(), req.Header) sess, err := f.getOrCreateClusterSession(*ctx) if err != nil { return nil, trace.Wrap(err) } if err ...
[ "func", "(", "f", "*", "Forwarder", ")", "portForward", "(", "ctx", "*", "authContext", ",", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ",", "p", "httprouter", ".", "Params", ")", "(", "interface", "{", "}", ",", "er...
// portForward starts port forwarding to the remote cluster
[ "portForward", "starts", "port", "forwarding", "to", "the", "remote", "cluster" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/kube/proxy/forwarder.go#L568-L619
24,025
gravitational/teleport
lib/kube/proxy/forwarder.go
catchAll
func (f *Forwarder) catchAll(ctx *authContext, w http.ResponseWriter, req *http.Request) (interface{}, error) { sess, err := f.getOrCreateClusterSession(*ctx) if err != nil { return nil, trace.Wrap(err) } if err := f.setupForwardingHeaders(ctx, sess, req); err != nil { return nil, trace.Wrap(err) } sess.forwa...
go
func (f *Forwarder) catchAll(ctx *authContext, w http.ResponseWriter, req *http.Request) (interface{}, error) { sess, err := f.getOrCreateClusterSession(*ctx) if err != nil { return nil, trace.Wrap(err) } if err := f.setupForwardingHeaders(ctx, sess, req); err != nil { return nil, trace.Wrap(err) } sess.forwa...
[ "func", "(", "f", "*", "Forwarder", ")", "catchAll", "(", "ctx", "*", "authContext", ",", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "sess", ",", "err", ":="...
// catchAll forwards all HTTP requests to the target k8s API server
[ "catchAll", "forwards", "all", "HTTP", "requests", "to", "the", "target", "k8s", "API", "server" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/kube/proxy/forwarder.go#L655-L665
24,026
gravitational/teleport
lib/kube/proxy/forwarder.go
UpdateClientActivity
func (t *trackingConn) UpdateClientActivity() { t.Lock() defer t.Unlock() t.lastActive = t.clock.Now().UTC() }
go
func (t *trackingConn) UpdateClientActivity() { t.Lock() defer t.Unlock() t.lastActive = t.clock.Now().UTC() }
[ "func", "(", "t", "*", "trackingConn", ")", "UpdateClientActivity", "(", ")", "{", "t", ".", "Lock", "(", ")", "\n", "defer", "t", ".", "Unlock", "(", ")", "\n", "t", ".", "lastActive", "=", "t", ".", "clock", ".", "Now", "(", ")", ".", "UTC", ...
// UpdateClientActivity sets last recorded client activity
[ "UpdateClientActivity", "sets", "last", "recorded", "client", "activity" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/kube/proxy/forwarder.go#L778-L782
24,027
gravitational/teleport
lib/kube/proxy/forwarder.go
getOrCreateRequestContext
func (f *Forwarder) getOrCreateRequestContext(key string) (context.Context, context.CancelFunc) { f.Lock() defer f.Unlock() ctx, ok := f.activeRequests[key] if ok { return ctx, nil } ctx, cancel := context.WithCancel(context.TODO()) f.activeRequests[key] = ctx return ctx, func() { cancel() f.Lock() defe...
go
func (f *Forwarder) getOrCreateRequestContext(key string) (context.Context, context.CancelFunc) { f.Lock() defer f.Unlock() ctx, ok := f.activeRequests[key] if ok { return ctx, nil } ctx, cancel := context.WithCancel(context.TODO()) f.activeRequests[key] = ctx return ctx, func() { cancel() f.Lock() defe...
[ "func", "(", "f", "*", "Forwarder", ")", "getOrCreateRequestContext", "(", "key", "string", ")", "(", "context", ".", "Context", ",", "context", ".", "CancelFunc", ")", "{", "f", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "Unlock", "(", ")", "\n...
// getOrCreateRequestContext creates a new certificate request for a given context, // if there is no active CSR request in progress, or returns an existing one. // if the new context has been created, cancel function is returned as a // second argument. Caller should call this function to signal that CSR has been // c...
[ "getOrCreateRequestContext", "creates", "a", "new", "certificate", "request", "for", "a", "given", "context", "if", "there", "is", "no", "active", "CSR", "request", "in", "progress", "or", "returns", "an", "existing", "one", ".", "if", "the", "new", "context",...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/kube/proxy/forwarder.go#L936-L951
24,028
gravitational/teleport
lib/multiplexer/proxyline.go
String
func (p *ProxyLine) String() string { return fmt.Sprintf("PROXY %s %s %s %d %d\r\n", p.Protocol, p.Source.IP.String(), p.Destination.IP.String(), p.Source.Port, p.Destination.Port) }
go
func (p *ProxyLine) String() string { return fmt.Sprintf("PROXY %s %s %s %d %d\r\n", p.Protocol, p.Source.IP.String(), p.Destination.IP.String(), p.Source.Port, p.Destination.Port) }
[ "func", "(", "p", "*", "ProxyLine", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\\r", "\\n", "\"", ",", "p", ".", "Protocol", ",", "p", ".", "Source", ".", "IP", ".", "String", "(", ")", ",", "p", ".", ...
// String returns on-the wire string representation of the proxy line
[ "String", "returns", "on", "-", "the", "wire", "string", "representation", "of", "the", "proxy", "line" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/multiplexer/proxyline.go#L55-L57
24,029
gravitational/teleport
lib/multiplexer/proxyline.go
ReadProxyLine
func ReadProxyLine(reader *bufio.Reader) (*ProxyLine, error) { line, err := reader.ReadString('\n') if err != nil { return nil, trace.Wrap(err) } if !strings.HasSuffix(line, proxyCRLF) { return nil, trace.BadParameter("expected CRLF in proxy protocol, got something else") } tokens := strings.Split(line[:len(l...
go
func ReadProxyLine(reader *bufio.Reader) (*ProxyLine, error) { line, err := reader.ReadString('\n') if err != nil { return nil, trace.Wrap(err) } if !strings.HasSuffix(line, proxyCRLF) { return nil, trace.BadParameter("expected CRLF in proxy protocol, got something else") } tokens := strings.Split(line[:len(l...
[ "func", "ReadProxyLine", "(", "reader", "*", "bufio", ".", "Reader", ")", "(", "*", "ProxyLine", ",", "error", ")", "{", "line", ",", "err", ":=", "reader", ".", "ReadString", "(", "'\\n'", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ...
// ReadProxyLine reads proxy line protocol from the reader
[ "ReadProxyLine", "reads", "proxy", "line", "protocol", "from", "the", "reader" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/multiplexer/proxyline.go#L60-L100
24,030
gravitational/teleport
lib/service/state.go
newProcessState
func newProcessState(process *TeleportProcess) *processState { return &processState{ process: process, recoveryTime: process.Clock.Now(), currentState: stateOK, } }
go
func newProcessState(process *TeleportProcess) *processState { return &processState{ process: process, recoveryTime: process.Clock.Now(), currentState: stateOK, } }
[ "func", "newProcessState", "(", "process", "*", "TeleportProcess", ")", "*", "processState", "{", "return", "&", "processState", "{", "process", ":", "process", ",", "recoveryTime", ":", "process", ".", "Clock", ".", "Now", "(", ")", ",", "currentState", ":"...
// newProcessState returns a new FSM that tracks the state of the Teleport process.
[ "newProcessState", "returns", "a", "new", "FSM", "that", "tracks", "the", "state", "of", "the", "Teleport", "process", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/state.go#L46-L52
24,031
gravitational/teleport
lib/service/state.go
Process
func (f *processState) Process(event Event) { switch event.Name { // Ready event means Teleport has started successfully. case TeleportReadyEvent: atomic.StoreInt64(&f.currentState, stateOK) f.process.Infof("Detected that service started and joined the cluster successfully.") // If a degraded event was received...
go
func (f *processState) Process(event Event) { switch event.Name { // Ready event means Teleport has started successfully. case TeleportReadyEvent: atomic.StoreInt64(&f.currentState, stateOK) f.process.Infof("Detected that service started and joined the cluster successfully.") // If a degraded event was received...
[ "func", "(", "f", "*", "processState", ")", "Process", "(", "event", "Event", ")", "{", "switch", "event", ".", "Name", "{", "// Ready event means Teleport has started successfully.", "case", "TeleportReadyEvent", ":", "atomic", ".", "StoreInt64", "(", "&", "f", ...
// Process updates the state of Teleport.
[ "Process", "updates", "the", "state", "of", "Teleport", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/state.go#L55-L83
24,032
gravitational/teleport
lib/utils/addr.go
Host
func (a *NetAddr) Host() string { host, _, err := net.SplitHostPort(a.Addr) if err != nil { return a.Addr } return host }
go
func (a *NetAddr) Host() string { host, _, err := net.SplitHostPort(a.Addr) if err != nil { return a.Addr } return host }
[ "func", "(", "a", "*", "NetAddr", ")", "Host", "(", ")", "string", "{", "host", ",", "_", ",", "err", ":=", "net", ".", "SplitHostPort", "(", "a", ".", "Addr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "a", ".", "Addr", "\n", "}", "...
// Host returns host part of address without port
[ "Host", "returns", "host", "part", "of", "address", "without", "port" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/addr.go#L42-L48
24,033
gravitational/teleport
lib/utils/addr.go
Port
func (a *NetAddr) Port(defaultPort int) int { _, port, err := net.SplitHostPort(a.Addr) if err != nil { return defaultPort } porti, err := strconv.Atoi(port) if err != nil { return defaultPort } return porti }
go
func (a *NetAddr) Port(defaultPort int) int { _, port, err := net.SplitHostPort(a.Addr) if err != nil { return defaultPort } porti, err := strconv.Atoi(port) if err != nil { return defaultPort } return porti }
[ "func", "(", "a", "*", "NetAddr", ")", "Port", "(", "defaultPort", "int", ")", "int", "{", "_", ",", "port", ",", "err", ":=", "net", ".", "SplitHostPort", "(", "a", ".", "Addr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "defaultPort", ...
// Port returns defaultPort if no port is set or is invalid, // the real port otherwise
[ "Port", "returns", "defaultPort", "if", "no", "port", "is", "set", "or", "is", "invalid", "the", "real", "port", "otherwise" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/addr.go#L52-L62
24,034
gravitational/teleport
lib/utils/addr.go
Equals
func (a *NetAddr) Equals(other NetAddr) bool { return a.Addr == other.Addr && a.AddrNetwork == other.AddrNetwork && a.Path == other.Path }
go
func (a *NetAddr) Equals(other NetAddr) bool { return a.Addr == other.Addr && a.AddrNetwork == other.AddrNetwork && a.Path == other.Path }
[ "func", "(", "a", "*", "NetAddr", ")", "Equals", "(", "other", "NetAddr", ")", "bool", "{", "return", "a", ".", "Addr", "==", "other", ".", "Addr", "&&", "a", ".", "AddrNetwork", "==", "other", ".", "AddrNetwork", "&&", "a", ".", "Path", "==", "oth...
// Equals returns true if address is equal to other
[ "Equals", "returns", "true", "if", "address", "is", "equal", "to", "other" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/addr.go#L65-L67
24,035
gravitational/teleport
lib/utils/addr.go
IsLocal
func (a *NetAddr) IsLocal() bool { host, _, err := net.SplitHostPort(a.Addr) if err != nil { return false } return IsLocalhost(host) }
go
func (a *NetAddr) IsLocal() bool { host, _, err := net.SplitHostPort(a.Addr) if err != nil { return false } return IsLocalhost(host) }
[ "func", "(", "a", "*", "NetAddr", ")", "IsLocal", "(", ")", "bool", "{", "host", ",", "_", ",", "err", ":=", "net", ".", "SplitHostPort", "(", "a", ".", "Addr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n", "retu...
// IsLocal returns true if this is a local address
[ "IsLocal", "returns", "true", "if", "this", "is", "a", "local", "address" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/addr.go#L70-L76
24,036
gravitational/teleport
lib/utils/addr.go
IsEmpty
func (a *NetAddr) IsEmpty() bool { return a.Addr == "" && a.AddrNetwork == "" && a.Path == "" }
go
func (a *NetAddr) IsEmpty() bool { return a.Addr == "" && a.AddrNetwork == "" && a.Path == "" }
[ "func", "(", "a", "*", "NetAddr", ")", "IsEmpty", "(", ")", "bool", "{", "return", "a", ".", "Addr", "==", "\"", "\"", "&&", "a", ".", "AddrNetwork", "==", "\"", "\"", "&&", "a", ".", "Path", "==", "\"", "\"", "\n", "}" ]
// IsEmpty returns true if address is empty
[ "IsEmpty", "returns", "true", "if", "address", "is", "empty" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/addr.go#L84-L86
24,037
gravitational/teleport
lib/utils/addr.go
MarshalYAML
func (a *NetAddr) MarshalYAML() (interface{}, error) { url := url.URL{Scheme: a.AddrNetwork, Host: a.Addr, Path: a.Path} return strings.TrimLeft(url.String(), "/"), nil }
go
func (a *NetAddr) MarshalYAML() (interface{}, error) { url := url.URL{Scheme: a.AddrNetwork, Host: a.Addr, Path: a.Path} return strings.TrimLeft(url.String(), "/"), nil }
[ "func", "(", "a", "*", "NetAddr", ")", "MarshalYAML", "(", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "url", ":=", "url", ".", "URL", "{", "Scheme", ":", "a", ".", "AddrNetwork", ",", "Host", ":", "a", ".", "Addr", ",", "Path", ":...
// MarshalYAML defines how a network address should be marshalled to a string
[ "MarshalYAML", "defines", "how", "a", "network", "address", "should", "be", "marshalled", "to", "a", "string" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/addr.go#L104-L107
24,038
gravitational/teleport
lib/utils/addr.go
UnmarshalYAML
func (a *NetAddr) UnmarshalYAML(unmarshal func(interface{}) error) error { var addr string err := unmarshal(&addr) if err != nil { return err } parsedAddr, err := ParseAddr(addr) if err != nil { return err } *a = *parsedAddr return nil }
go
func (a *NetAddr) UnmarshalYAML(unmarshal func(interface{}) error) error { var addr string err := unmarshal(&addr) if err != nil { return err } parsedAddr, err := ParseAddr(addr) if err != nil { return err } *a = *parsedAddr return nil }
[ "func", "(", "a", "*", "NetAddr", ")", "UnmarshalYAML", "(", "unmarshal", "func", "(", "interface", "{", "}", ")", "error", ")", "error", "{", "var", "addr", "string", "\n", "err", ":=", "unmarshal", "(", "&", "addr", ")", "\n", "if", "err", "!=", ...
// UnmarshalYAML defines how a string can be unmarshalled into a network address
[ "UnmarshalYAML", "defines", "how", "a", "string", "can", "be", "unmarshalled", "into", "a", "network", "address" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/addr.go#L110-L124
24,039
gravitational/teleport
lib/utils/addr.go
MustParseAddr
func MustParseAddr(a string) *NetAddr { addr, err := ParseAddr(a) if err != nil { panic(fmt.Sprintf("failed to parse %v: %v", a, err)) } return addr }
go
func MustParseAddr(a string) *NetAddr { addr, err := ParseAddr(a) if err != nil { panic(fmt.Sprintf("failed to parse %v: %v", a, err)) } return addr }
[ "func", "MustParseAddr", "(", "a", "string", ")", "*", "NetAddr", "{", "addr", ",", "err", ":=", "ParseAddr", "(", "a", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "a", ",", "err", ")", "...
// MustParseAddr parses the provided string into NetAddr or panics on an error
[ "MustParseAddr", "parses", "the", "provided", "string", "into", "NetAddr", "or", "panics", "on", "an", "error" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/addr.go#L162-L168
24,040
gravitational/teleport
lib/utils/addr.go
FromAddr
func FromAddr(a net.Addr) NetAddr { return NetAddr{AddrNetwork: a.Network(), Addr: a.String()} }
go
func FromAddr(a net.Addr) NetAddr { return NetAddr{AddrNetwork: a.Network(), Addr: a.String()} }
[ "func", "FromAddr", "(", "a", "net", ".", "Addr", ")", "NetAddr", "{", "return", "NetAddr", "{", "AddrNetwork", ":", "a", ".", "Network", "(", ")", ",", "Addr", ":", "a", ".", "String", "(", ")", "}", "\n", "}" ]
// FromAddr returns NetAddr from golang standard net.Addr
[ "FromAddr", "returns", "NetAddr", "from", "golang", "standard", "net", ".", "Addr" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/addr.go#L171-L173
24,041
gravitational/teleport
lib/utils/addr.go
JoinAddrSlices
func JoinAddrSlices(a []NetAddr, b []NetAddr) []NetAddr { if len(a)+len(b) == 0 { return nil } out := make([]NetAddr, 0, len(a)+len(b)) out = append(out, a...) out = append(out, b...) return out }
go
func JoinAddrSlices(a []NetAddr, b []NetAddr) []NetAddr { if len(a)+len(b) == 0 { return nil } out := make([]NetAddr, 0, len(a)+len(b)) out = append(out, a...) out = append(out, b...) return out }
[ "func", "JoinAddrSlices", "(", "a", "[", "]", "NetAddr", ",", "b", "[", "]", "NetAddr", ")", "[", "]", "NetAddr", "{", "if", "len", "(", "a", ")", "+", "len", "(", "b", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "make...
// JoinAddrSlices joins two addr slices and returns a resulting slice
[ "JoinAddrSlices", "joins", "two", "addr", "slices", "and", "returns", "a", "resulting", "slice" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/addr.go#L176-L184
24,042
gravitational/teleport
lib/utils/addr.go
DialAddrFromListenAddr
func DialAddrFromListenAddr(listenAddr NetAddr) NetAddr { if listenAddr.IsEmpty() { return listenAddr } return NetAddr{Addr: ReplaceLocalhost(listenAddr.Addr, "127.0.0.1")} }
go
func DialAddrFromListenAddr(listenAddr NetAddr) NetAddr { if listenAddr.IsEmpty() { return listenAddr } return NetAddr{Addr: ReplaceLocalhost(listenAddr.Addr, "127.0.0.1")} }
[ "func", "DialAddrFromListenAddr", "(", "listenAddr", "NetAddr", ")", "NetAddr", "{", "if", "listenAddr", ".", "IsEmpty", "(", ")", "{", "return", "listenAddr", "\n", "}", "\n", "return", "NetAddr", "{", "Addr", ":", "ReplaceLocalhost", "(", "listenAddr", ".", ...
// DialAddrFromListenAddr returns dial address from listen address
[ "DialAddrFromListenAddr", "returns", "dial", "address", "from", "listen", "address" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/addr.go#L204-L209
24,043
gravitational/teleport
lib/utils/addr.go
Addresses
func (nl *NetAddrList) Addresses() []string { var ns []string for _, n := range *nl { ns = append(ns, n.FullAddress()) } return ns }
go
func (nl *NetAddrList) Addresses() []string { var ns []string for _, n := range *nl { ns = append(ns, n.FullAddress()) } return ns }
[ "func", "(", "nl", "*", "NetAddrList", ")", "Addresses", "(", ")", "[", "]", "string", "{", "var", "ns", "[", "]", "string", "\n", "for", "_", ",", "n", ":=", "range", "*", "nl", "{", "ns", "=", "append", "(", "ns", ",", "n", ".", "FullAddress"...
// Addresses returns a slice of strings converted from the addresses
[ "Addresses", "returns", "a", "slice", "of", "strings", "converted", "from", "the", "addresses" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/addr.go#L242-L248
24,044
gravitational/teleport
lib/utils/addr.go
Set
func (nl *NetAddrList) Set(s string) error { v, err := ParseAddr(s) if err != nil { return err } *nl = append(*nl, *v) return nil }
go
func (nl *NetAddrList) Set(s string) error { v, err := ParseAddr(s) if err != nil { return err } *nl = append(*nl, *v) return nil }
[ "func", "(", "nl", "*", "NetAddrList", ")", "Set", "(", "s", "string", ")", "error", "{", "v", ",", "err", ":=", "ParseAddr", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "*", "nl", "=", "append", "(",...
// Set is called by CLI tools
[ "Set", "is", "called", "by", "CLI", "tools" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/addr.go#L251-L259
24,045
gravitational/teleport
lib/utils/addr.go
String
func (nl *NetAddrList) String() string { var ns []string for _, n := range *nl { ns = append(ns, n.FullAddress()) } return strings.Join(ns, " ") }
go
func (nl *NetAddrList) String() string { var ns []string for _, n := range *nl { ns = append(ns, n.FullAddress()) } return strings.Join(ns, " ") }
[ "func", "(", "nl", "*", "NetAddrList", ")", "String", "(", ")", "string", "{", "var", "ns", "[", "]", "string", "\n", "for", "_", ",", "n", ":=", "range", "*", "nl", "{", "ns", "=", "append", "(", "ns", ",", "n", ".", "FullAddress", "(", ")", ...
// String returns debug-friendly representation of the tool
[ "String", "returns", "debug", "-", "friendly", "representation", "of", "the", "tool" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/addr.go#L262-L268
24,046
gravitational/teleport
lib/utils/addr.go
IsLocalhost
func IsLocalhost(host string) bool { if host == "localhost" { return true } ip := net.ParseIP(host) return ip.IsLoopback() || ip.IsUnspecified() }
go
func IsLocalhost(host string) bool { if host == "localhost" { return true } ip := net.ParseIP(host) return ip.IsLoopback() || ip.IsUnspecified() }
[ "func", "IsLocalhost", "(", "host", "string", ")", "bool", "{", "if", "host", "==", "\"", "\"", "{", "return", "true", "\n", "}", "\n", "ip", ":=", "net", ".", "ParseIP", "(", "host", ")", "\n", "return", "ip", ".", "IsLoopback", "(", ")", "||", ...
// IsLocalhost returns true if this is a local hostname or ip
[ "IsLocalhost", "returns", "true", "if", "this", "is", "a", "local", "hostname", "or", "ip" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/addr.go#L291-L297
24,047
gravitational/teleport
lib/utils/addr.go
IsLoopback
func IsLoopback(host string) bool { if strings.Contains(host, ":") { var err error host, _, err = net.SplitHostPort(host) if err != nil { return false } } ips, err := net.LookupIP(host) if err != nil { return false } for _, ip := range ips { if ip.IsLoopback() { return true } } return false ...
go
func IsLoopback(host string) bool { if strings.Contains(host, ":") { var err error host, _, err = net.SplitHostPort(host) if err != nil { return false } } ips, err := net.LookupIP(host) if err != nil { return false } for _, ip := range ips { if ip.IsLoopback() { return true } } return false ...
[ "func", "IsLoopback", "(", "host", "string", ")", "bool", "{", "if", "strings", ".", "Contains", "(", "host", ",", "\"", "\"", ")", "{", "var", "err", "error", "\n", "host", ",", "_", ",", "err", "=", "net", ".", "SplitHostPort", "(", "host", ")", ...
// IsLoopback returns 'true' if a given hostname resolves to local // host's loopback interface
[ "IsLoopback", "returns", "true", "if", "a", "given", "hostname", "resolves", "to", "local", "host", "s", "loopback", "interface" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/addr.go#L301-L319
24,048
gravitational/teleport
lib/utils/addr.go
GuessHostIP
func GuessHostIP() (ip net.IP, err error) { ifaces, err := net.Interfaces() if err != nil { return nil, trace.Wrap(err) } adrs := make([]net.Addr, 0) for _, iface := range ifaces { ifadrs, err := iface.Addrs() if err != nil { log.Warn(err) } else { adrs = append(adrs, ifadrs...) } } return guessH...
go
func GuessHostIP() (ip net.IP, err error) { ifaces, err := net.Interfaces() if err != nil { return nil, trace.Wrap(err) } adrs := make([]net.Addr, 0) for _, iface := range ifaces { ifadrs, err := iface.Addrs() if err != nil { log.Warn(err) } else { adrs = append(adrs, ifadrs...) } } return guessH...
[ "func", "GuessHostIP", "(", ")", "(", "ip", "net", ".", "IP", ",", "err", "error", ")", "{", "ifaces", ",", "err", ":=", "net", ".", "Interfaces", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "trace", ".", "Wrap", "(", "...
// GuessIP tries to guess an IP address this machine is reachable at on the // internal network, always picking IPv4 from the internal address space // // If no internal IPs are found, it returns 127.0.0.1 but it never returns // an address from the public IP space
[ "GuessIP", "tries", "to", "guess", "an", "IP", "address", "this", "machine", "is", "reachable", "at", "on", "the", "internal", "network", "always", "picking", "IPv4", "from", "the", "internal", "address", "space", "If", "no", "internal", "IPs", "are", "found...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/addr.go#L326-L341
24,049
gravitational/teleport
lib/auth/mocku2f/mocku2f.go
decodeBase64
func decodeBase64(s string) ([]byte, error) { for i := 0; i < len(s)%4; i++ { s += "=" } return base64.URLEncoding.DecodeString(s) }
go
func decodeBase64(s string) ([]byte, error) { for i := 0; i < len(s)%4; i++ { s += "=" } return base64.URLEncoding.DecodeString(s) }
[ "func", "decodeBase64", "(", "s", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "s", ")", "%", "4", ";", "i", "++", "{", "s", "+=", "\"", "\"", "\n", "}", "\n", "return", "...
// The "websafe-base64 encoding" in the U2F specifications removes the padding
[ "The", "websafe", "-", "base64", "encoding", "in", "the", "U2F", "specifications", "removes", "the", "padding" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/mocku2f/mocku2f.go#L52-L57
24,050
gravitational/teleport
lib/reversetunnel/peer.go
newClusterPeer
func newClusterPeer(srv *server, connInfo services.TunnelConnection) (*clusterPeer, error) { clusterPeer := &clusterPeer{ srv: srv, connInfo: connInfo, log: log.WithFields(log.Fields{ trace.Component: teleport.ComponentReverseTunnelServer, trace.ComponentFields: map[string]string{ "cluster": connI...
go
func newClusterPeer(srv *server, connInfo services.TunnelConnection) (*clusterPeer, error) { clusterPeer := &clusterPeer{ srv: srv, connInfo: connInfo, log: log.WithFields(log.Fields{ trace.Component: teleport.ComponentReverseTunnelServer, trace.ComponentFields: map[string]string{ "cluster": connI...
[ "func", "newClusterPeer", "(", "srv", "*", "server", ",", "connInfo", "services", ".", "TunnelConnection", ")", "(", "*", "clusterPeer", ",", "error", ")", "{", "clusterPeer", ":=", "&", "clusterPeer", "{", "srv", ":", "srv", ",", "connInfo", ":", "connInf...
// newClusterPeer returns new cluster peer
[ "newClusterPeer", "returns", "new", "cluster", "peer" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/reversetunnel/peer.go#L136-L149
24,051
gravitational/teleport
lib/utils/otp.go
GenerateQRCode
func GenerateQRCode(u string) ([]byte, error) { otpKey, err := otp.NewKeyFromURL(u) if err != nil { return nil, trace.Wrap(err) } otpImage, err := otpKey.Image(450, 450) if err != nil { return nil, trace.Wrap(err) } var otpQR bytes.Buffer err = png.Encode(&otpQR, otpImage) if err != nil { return nil, t...
go
func GenerateQRCode(u string) ([]byte, error) { otpKey, err := otp.NewKeyFromURL(u) if err != nil { return nil, trace.Wrap(err) } otpImage, err := otpKey.Image(450, 450) if err != nil { return nil, trace.Wrap(err) } var otpQR bytes.Buffer err = png.Encode(&otpQR, otpImage) if err != nil { return nil, t...
[ "func", "GenerateQRCode", "(", "u", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "otpKey", ",", "err", ":=", "otp", ".", "NewKeyFromURL", "(", "u", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "trace", ".", "Wr...
// GenerateQRCode takes in a OTP Key URL and returns a PNG-encoded QR code.
[ "GenerateQRCode", "takes", "in", "a", "OTP", "Key", "URL", "and", "returns", "a", "PNG", "-", "encoded", "QR", "code", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/otp.go#L15-L33
24,052
gravitational/teleport
lib/web/password.go
changePassword
func (h *Handler) changePassword(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *SessionContext) (interface{}, error) { var req *changePasswordReq if err := httplib.ReadJSON(r, &req); err != nil { return nil, trace.Wrap(err) } clt, err := ctx.GetClient() if err != nil { return nil, trace.Wra...
go
func (h *Handler) changePassword(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *SessionContext) (interface{}, error) { var req *changePasswordReq if err := httplib.ReadJSON(r, &req); err != nil { return nil, trace.Wrap(err) } clt, err := ctx.GetClient() if err != nil { return nil, trace.Wra...
[ "func", "(", "h", "*", "Handler", ")", "changePassword", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "p", "httprouter", ".", "Params", ",", "ctx", "*", "SessionContext", ")", "(", "interface", "{", "}", ",", "...
// changePassword updates users password based on the old password
[ "changePassword", "updates", "users", "password", "based", "on", "the", "old", "password" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/password.go#L45-L70
24,053
gravitational/teleport
lib/web/password.go
u2fChangePasswordRequest
func (h *Handler) u2fChangePasswordRequest(w http.ResponseWriter, r *http.Request, _ httprouter.Params, ctx *SessionContext) (interface{}, error) { var req *client.U2fSignRequestReq if err := httplib.ReadJSON(r, &req); err != nil { return nil, trace.Wrap(err) } clt, err := ctx.GetClient() if err != nil { retu...
go
func (h *Handler) u2fChangePasswordRequest(w http.ResponseWriter, r *http.Request, _ httprouter.Params, ctx *SessionContext) (interface{}, error) { var req *client.U2fSignRequestReq if err := httplib.ReadJSON(r, &req); err != nil { return nil, trace.Wrap(err) } clt, err := ctx.GetClient() if err != nil { retu...
[ "func", "(", "h", "*", "Handler", ")", "u2fChangePasswordRequest", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "_", "httprouter", ".", "Params", ",", "ctx", "*", "SessionContext", ")", "(", "interface", "{", "}", ...
// u2fChangePasswordRequest is called to get U2F challedge for changing a user password
[ "u2fChangePasswordRequest", "is", "called", "to", "get", "U2F", "challedge", "for", "changing", "a", "user", "password" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/password.go#L73-L98
24,054
gravitational/teleport
lib/web/static.go
NewStaticFileSystem
func NewStaticFileSystem(debugMode bool) (http.FileSystem, error) { if debugMode { assetsToCheck := []string{"index.html", "/app"} if debugAssetsPath == "" { exePath, err := osext.ExecutableFolder() if err != nil { return nil, trace.Wrap(err) } debugAssetsPath = path.Join(exePath, "../web/dist") ...
go
func NewStaticFileSystem(debugMode bool) (http.FileSystem, error) { if debugMode { assetsToCheck := []string{"index.html", "/app"} if debugAssetsPath == "" { exePath, err := osext.ExecutableFolder() if err != nil { return nil, trace.Wrap(err) } debugAssetsPath = path.Join(exePath, "../web/dist") ...
[ "func", "NewStaticFileSystem", "(", "debugMode", "bool", ")", "(", "http", ".", "FileSystem", ",", "error", ")", "{", "if", "debugMode", "{", "assetsToCheck", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", "\n\n", "if", "debugAssetsPath...
// NewStaticFileSystem returns the initialized implementation of http.FileSystem // interface which can be used to serve Teleport Proxy Web UI // // If 'debugMode' is true, it will load the web assets from the same git repo // directory where the executable is, otherwise it will load them from the embedded // zip archi...
[ "NewStaticFileSystem", "returns", "the", "initialized", "implementation", "of", "http", ".", "FileSystem", "interface", "which", "can", "be", "used", "to", "serve", "Teleport", "Proxy", "Web", "UI", "If", "debugMode", "is", "true", "it", "will", "load", "the", ...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/static.go#L53-L77
24,055
gravitational/teleport
lib/web/static.go
isDebugMode
func isDebugMode() bool { v, _ := strconv.ParseBool(os.Getenv(teleport.DebugEnvVar)) return v }
go
func isDebugMode() bool { v, _ := strconv.ParseBool(os.Getenv(teleport.DebugEnvVar)) return v }
[ "func", "isDebugMode", "(", ")", "bool", "{", "v", ",", "_", ":=", "strconv", ".", "ParseBool", "(", "os", ".", "Getenv", "(", "teleport", ".", "DebugEnvVar", ")", ")", "\n", "return", "v", "\n", "}" ]
// isDebugMode determines if teleport is running in a "debug" mode. // It looks at DEBUG environment variable
[ "isDebugMode", "determines", "if", "teleport", "is", "running", "in", "a", "debug", "mode", ".", "It", "looks", "at", "DEBUG", "environment", "variable" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/static.go#L81-L84
24,056
gravitational/teleport
lib/web/static.go
loadZippedExeAssets
func loadZippedExeAssets() (ResourceMap, error) { // open ourselves (teleport binary) for reading: // NOTE: the file stays open to serve future Read() requests myExe, err := osext.Executable() if err != nil { return nil, trace.Wrap(err) } return readZipArchive(myExe) }
go
func loadZippedExeAssets() (ResourceMap, error) { // open ourselves (teleport binary) for reading: // NOTE: the file stays open to serve future Read() requests myExe, err := osext.Executable() if err != nil { return nil, trace.Wrap(err) } return readZipArchive(myExe) }
[ "func", "loadZippedExeAssets", "(", ")", "(", "ResourceMap", ",", "error", ")", "{", "// open ourselves (teleport binary) for reading:", "// NOTE: the file stays open to serve future Read() requests", "myExe", ",", "err", ":=", "osext", ".", "Executable", "(", ")", "\n", ...
// LoadWebResources returns a filesystem implementation compatible // with http.Serve. // // The "filesystem" is served from a zip file attached at the end of // the executable //
[ "LoadWebResources", "returns", "a", "filesystem", "implementation", "compatible", "with", "http", ".", "Serve", ".", "The", "filesystem", "is", "served", "from", "a", "zip", "file", "attached", "at", "the", "end", "of", "the", "executable" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/web/static.go#L92-L100
24,057
gravitational/teleport
lib/auth/register.go
LocalRegister
func LocalRegister(id IdentityID, authServer *AuthServer, additionalPrincipals, dnsNames []string, remoteAddr string) (*Identity, error) { // If local registration is happening and no remote address was passed in // (which means no advertise IP was set), use localhost. if remoteAddr == "" { remoteAddr = defaults.L...
go
func LocalRegister(id IdentityID, authServer *AuthServer, additionalPrincipals, dnsNames []string, remoteAddr string) (*Identity, error) { // If local registration is happening and no remote address was passed in // (which means no advertise IP was set), use localhost. if remoteAddr == "" { remoteAddr = defaults.L...
[ "func", "LocalRegister", "(", "id", "IdentityID", ",", "authServer", "*", "AuthServer", ",", "additionalPrincipals", ",", "dnsNames", "[", "]", "string", ",", "remoteAddr", "string", ")", "(", "*", "Identity", ",", "error", ")", "{", "// If local registration is...
// LocalRegister is used to generate host keys when a node or proxy is running // within the same process as the Auth Server and as such, does not need to // use provisioning tokens.
[ "LocalRegister", "is", "used", "to", "generate", "host", "keys", "when", "a", "node", "or", "proxy", "is", "running", "within", "the", "same", "process", "as", "the", "Auth", "Server", "and", "as", "such", "does", "not", "need", "to", "use", "provisioning"...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/register.go#L37-L62
24,058
gravitational/teleport
lib/auth/register.go
Register
func Register(params RegisterParams) (*Identity, error) { // Read in the token. The token can either be passed in or come from a file // on disk. token, err := readToken(params.Token) if err != nil { return nil, trace.Wrap(err) } // Attempt to register through the auth server, if it fails, try and // register...
go
func Register(params RegisterParams) (*Identity, error) { // Read in the token. The token can either be passed in or come from a file // on disk. token, err := readToken(params.Token) if err != nil { return nil, trace.Wrap(err) } // Attempt to register through the auth server, if it fails, try and // register...
[ "func", "Register", "(", "params", "RegisterParams", ")", "(", "*", "Identity", ",", "error", ")", "{", "// Read in the token. The token can either be passed in or come from a file", "// on disk.", "token", ",", "err", ":=", "readToken", "(", "params", ".", "Token", "...
// Register is used to generate host keys when a node or proxy are running on // different hosts than the auth server. This method requires provisioning // tokens to prove a valid auth server was used to issue the joining request // as well as a method for the node to validate the auth server.
[ "Register", "is", "used", "to", "generate", "host", "keys", "when", "a", "node", "or", "proxy", "are", "running", "on", "different", "hosts", "than", "the", "auth", "server", ".", "This", "method", "requires", "provisioning", "tokens", "to", "prove", "a", ...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/register.go#L108-L137
24,059
gravitational/teleport
lib/auth/register.go
registerThroughProxy
func registerThroughProxy(token string, params RegisterParams) (*Identity, error) { log.Debugf("Attempting to register through proxy server.") keys, err := params.CredsClient.HostCredentials(context.Background(), RegisterUsingTokenRequest{ Token: token, HostID: params.ID.HostUUID...
go
func registerThroughProxy(token string, params RegisterParams) (*Identity, error) { log.Debugf("Attempting to register through proxy server.") keys, err := params.CredsClient.HostCredentials(context.Background(), RegisterUsingTokenRequest{ Token: token, HostID: params.ID.HostUUID...
[ "func", "registerThroughProxy", "(", "token", "string", ",", "params", "RegisterParams", ")", "(", "*", "Identity", ",", "error", ")", "{", "log", ".", "Debugf", "(", "\"", "\"", ")", "\n\n", "keys", ",", "err", ":=", "params", ".", "CredsClient", ".", ...
// registerThroughProxy is used to register through the proxy server.
[ "registerThroughProxy", "is", "used", "to", "register", "through", "the", "proxy", "server", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/register.go#L140-L160
24,060
gravitational/teleport
lib/auth/register.go
registerThroughAuth
func registerThroughAuth(token string, params RegisterParams) (*Identity, error) { log.Debugf("Attempting to register through auth server.") var client *Client var err error // Build a client to the Auth Server. If a CA pin is specified require the // Auth Server is validated. Otherwise attempt to use the CA fil...
go
func registerThroughAuth(token string, params RegisterParams) (*Identity, error) { log.Debugf("Attempting to register through auth server.") var client *Client var err error // Build a client to the Auth Server. If a CA pin is specified require the // Auth Server is validated. Otherwise attempt to use the CA fil...
[ "func", "registerThroughAuth", "(", "token", "string", ",", "params", "RegisterParams", ")", "(", "*", "Identity", ",", "error", ")", "{", "log", ".", "Debugf", "(", "\"", "\"", ")", "\n\n", "var", "client", "*", "Client", "\n", "var", "err", "error", ...
// registerThroughAuth is used to register through the auth server.
[ "registerThroughAuth", "is", "used", "to", "register", "through", "the", "auth", "server", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/register.go#L163-L200
24,061
gravitational/teleport
lib/auth/register.go
insecureRegisterClient
func insecureRegisterClient(params RegisterParams) (*Client, error) { tlsConfig := utils.TLSConfig(params.CipherSuites) cert, err := readCA(params) if err != nil && !trace.IsNotFound(err) { return nil, trace.Wrap(err) } // If no CA was found, then create a insecure connection to the Auth Server, // otherwise ...
go
func insecureRegisterClient(params RegisterParams) (*Client, error) { tlsConfig := utils.TLSConfig(params.CipherSuites) cert, err := readCA(params) if err != nil && !trace.IsNotFound(err) { return nil, trace.Wrap(err) } // If no CA was found, then create a insecure connection to the Auth Server, // otherwise ...
[ "func", "insecureRegisterClient", "(", "params", "RegisterParams", ")", "(", "*", "Client", ",", "error", ")", "{", "tlsConfig", ":=", "utils", ".", "TLSConfig", "(", "params", ".", "CipherSuites", ")", "\n\n", "cert", ",", "err", ":=", "readCA", "(", "par...
// insecureRegisterClient attempts to connects to the Auth Server using the // CA on disk. If no CA is found on disk, Teleport will not verify the Auth // Server it is connecting to.
[ "insecureRegisterClient", "attempts", "to", "connects", "to", "the", "Auth", "Server", "using", "the", "CA", "on", "disk", ".", "If", "no", "CA", "is", "found", "on", "disk", "Teleport", "will", "not", "verify", "the", "Auth", "Server", "it", "is", "connec...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/register.go#L205-L237
24,062
gravitational/teleport
lib/auth/register.go
readCA
func readCA(params RegisterParams) (*x509.Certificate, error) { certBytes, err := utils.ReadPath(params.CAPath) if err != nil { return nil, trace.Wrap(err) } cert, err := tlsca.ParseCertificatePEM(certBytes) if err != nil { return nil, trace.Wrap(err, "failed to parse certificate at %v", params.CAPath) } ret...
go
func readCA(params RegisterParams) (*x509.Certificate, error) { certBytes, err := utils.ReadPath(params.CAPath) if err != nil { return nil, trace.Wrap(err) } cert, err := tlsca.ParseCertificatePEM(certBytes) if err != nil { return nil, trace.Wrap(err, "failed to parse certificate at %v", params.CAPath) } ret...
[ "func", "readCA", "(", "params", "RegisterParams", ")", "(", "*", "x509", ".", "Certificate", ",", "error", ")", "{", "certBytes", ",", "err", ":=", "utils", ".", "ReadPath", "(", "params", ".", "CAPath", ")", "\n", "if", "err", "!=", "nil", "{", "re...
// readCA will read in CA that will be used to validate the certificate that // the Auth Server presents.
[ "readCA", "will", "read", "in", "CA", "that", "will", "be", "used", "to", "validate", "the", "certificate", "that", "the", "Auth", "Server", "presents", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/register.go#L241-L251
24,063
gravitational/teleport
lib/auth/register.go
pinRegisterClient
func pinRegisterClient(params RegisterParams) (*Client, error) { // Build a insecure client to the Auth Server. This is safe because even if // an attacker were to MITM this connection the CA pin will not match below. tlsConfig := utils.TLSConfig(params.CipherSuites) tlsConfig.InsecureSkipVerify = true client, err...
go
func pinRegisterClient(params RegisterParams) (*Client, error) { // Build a insecure client to the Auth Server. This is safe because even if // an attacker were to MITM this connection the CA pin will not match below. tlsConfig := utils.TLSConfig(params.CipherSuites) tlsConfig.InsecureSkipVerify = true client, err...
[ "func", "pinRegisterClient", "(", "params", "RegisterParams", ")", "(", "*", "Client", ",", "error", ")", "{", "// Build a insecure client to the Auth Server. This is safe because even if", "// an attacker were to MITM this connection the CA pin will not match below.", "tlsConfig", "...
// pinRegisterClient first connects to the Auth Server using a insecure // connection to fetch the root CA. If the root CA matches the provided CA // pin, a connection will be re-established and the root CA will be used to // validate the certificate presented. If both conditions hold true, then we // know we are conne...
[ "pinRegisterClient", "first", "connects", "to", "the", "Auth", "Server", "using", "a", "insecure", "connection", "to", "fetch", "the", "root", "CA", ".", "If", "the", "root", "CA", "matches", "the", "provided", "CA", "pin", "a", "connection", "will", "be", ...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/register.go#L258-L303
24,064
gravitational/teleport
lib/auth/register.go
ReRegister
func ReRegister(params ReRegisterParams) (*Identity, error) { hostID, err := params.ID.HostID() if err != nil { return nil, trace.Wrap(err) } keys, err := params.Client.GenerateServerKeys(GenerateServerKeysRequest{ HostID: hostID, NodeName: params.ID.NodeName, Roles: ...
go
func ReRegister(params ReRegisterParams) (*Identity, error) { hostID, err := params.ID.HostID() if err != nil { return nil, trace.Wrap(err) } keys, err := params.Client.GenerateServerKeys(GenerateServerKeysRequest{ HostID: hostID, NodeName: params.ID.NodeName, Roles: ...
[ "func", "ReRegister", "(", "params", "ReRegisterParams", ")", "(", "*", "Identity", ",", "error", ")", "{", "hostID", ",", "err", ":=", "params", ".", "ID", ".", "HostID", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "trace", ...
// ReRegister renews the certificates and private keys based on the client's existing identity.
[ "ReRegister", "renews", "the", "certificates", "and", "private", "keys", "based", "on", "the", "client", "s", "existing", "identity", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/register.go#L327-L348
24,065
gravitational/teleport
lib/config/fileconf.go
ReadFromFile
func ReadFromFile(filePath string) (*FileConfig, error) { f, err := os.Open(filePath) if err != nil { return nil, trace.Wrap(err, fmt.Sprintf("failed to open file: %v", filePath)) } defer f.Close() return ReadConfig(f) }
go
func ReadFromFile(filePath string) (*FileConfig, error) { f, err := os.Open(filePath) if err != nil { return nil, trace.Wrap(err, fmt.Sprintf("failed to open file: %v", filePath)) } defer f.Close() return ReadConfig(f) }
[ "func", "ReadFromFile", "(", "filePath", "string", ")", "(", "*", "FileConfig", ",", "error", ")", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "filePath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "trace", ".", "Wrap",...
// ReadFromFile reads Teleport configuration from a file. Currently only YAML // format is supported
[ "ReadFromFile", "reads", "Teleport", "configuration", "from", "a", "file", ".", "Currently", "only", "YAML", "format", "is", "supported" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/config/fileconf.go#L170-L177
24,066
gravitational/teleport
lib/config/fileconf.go
ReadFromString
func ReadFromString(configString string) (*FileConfig, error) { data, err := base64.StdEncoding.DecodeString(configString) if err != nil { return nil, trace.BadParameter( "confiugraion should be base64 encoded: %v", err) } return ReadConfig(bytes.NewBuffer(data)) }
go
func ReadFromString(configString string) (*FileConfig, error) { data, err := base64.StdEncoding.DecodeString(configString) if err != nil { return nil, trace.BadParameter( "confiugraion should be base64 encoded: %v", err) } return ReadConfig(bytes.NewBuffer(data)) }
[ "func", "ReadFromString", "(", "configString", "string", ")", "(", "*", "FileConfig", ",", "error", ")", "{", "data", ",", "err", ":=", "base64", ".", "StdEncoding", ".", "DecodeString", "(", "configString", ")", "\n", "if", "err", "!=", "nil", "{", "ret...
// ReadFromString reads values from base64 encoded byte string
[ "ReadFromString", "reads", "values", "from", "base64", "encoded", "byte", "string" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/config/fileconf.go#L180-L187
24,067
gravitational/teleport
lib/config/fileconf.go
ReadConfig
func ReadConfig(reader io.Reader) (*FileConfig, error) { // read & parse YAML config: bytes, err := ioutil.ReadAll(reader) if err != nil { return nil, trace.Wrap(err, "failed reading Teleport configuration") } var fc FileConfig if err = yaml.Unmarshal(bytes, &fc); err != nil { return nil, trace.BadParameter("...
go
func ReadConfig(reader io.Reader) (*FileConfig, error) { // read & parse YAML config: bytes, err := ioutil.ReadAll(reader) if err != nil { return nil, trace.Wrap(err, "failed reading Teleport configuration") } var fc FileConfig if err = yaml.Unmarshal(bytes, &fc); err != nil { return nil, trace.BadParameter("...
[ "func", "ReadConfig", "(", "reader", "io", ".", "Reader", ")", "(", "*", "FileConfig", ",", "error", ")", "{", "// read & parse YAML config:", "bytes", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "reader", ")", "\n", "if", "err", "!=", "nil", "{", ...
// ReadConfig reads Teleport configuration from reader in YAML format
[ "ReadConfig", "reads", "Teleport", "configuration", "from", "reader", "in", "YAML", "format" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/config/fileconf.go#L190-L235
24,068
gravitational/teleport
lib/config/fileconf.go
MakeSampleFileConfig
func MakeSampleFileConfig() (fc *FileConfig) { conf := service.MakeDefaultConfig() // sample global config: var g Global g.NodeName = conf.Hostname g.AuthToken = "cluster-join-token" g.Logger.Output = "stderr" g.Logger.Severity = "INFO" g.AuthServers = []string{defaults.AuthListenAddr().Addr} g.Limits.MaxConn...
go
func MakeSampleFileConfig() (fc *FileConfig) { conf := service.MakeDefaultConfig() // sample global config: var g Global g.NodeName = conf.Hostname g.AuthToken = "cluster-join-token" g.Logger.Output = "stderr" g.Logger.Severity = "INFO" g.AuthServers = []string{defaults.AuthListenAddr().Addr} g.Limits.MaxConn...
[ "func", "MakeSampleFileConfig", "(", ")", "(", "fc", "*", "FileConfig", ")", "{", "conf", ":=", "service", ".", "MakeDefaultConfig", "(", ")", "\n\n", "// sample global config:", "var", "g", "Global", "\n", "g", ".", "NodeName", "=", "conf", ".", "Hostname",...
// MakeSampleFileConfig returns a sample config structure populated by defaults, // useful to generate sample configuration files
[ "MakeSampleFileConfig", "returns", "a", "sample", "config", "structure", "populated", "by", "defaults", "useful", "to", "generate", "sample", "configuration", "files" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/config/fileconf.go#L239-L297
24,069
gravitational/teleport
lib/config/fileconf.go
DebugDumpToYAML
func (conf *FileConfig) DebugDumpToYAML() string { bytes, err := yaml.Marshal(&conf) if err != nil { panic(err) } return string(bytes) }
go
func (conf *FileConfig) DebugDumpToYAML() string { bytes, err := yaml.Marshal(&conf) if err != nil { panic(err) } return string(bytes) }
[ "func", "(", "conf", "*", "FileConfig", ")", "DebugDumpToYAML", "(", ")", "string", "{", "bytes", ",", "err", ":=", "yaml", ".", "Marshal", "(", "&", "conf", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "re...
// DebugDumpToYAML allows for quick YAML dumping of the config
[ "DebugDumpToYAML", "allows", "for", "quick", "YAML", "dumping", "of", "the", "config" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/config/fileconf.go#L300-L306
24,070
gravitational/teleport
lib/config/fileconf.go
Parse
func (c *CachePolicy) Parse() (*service.CachePolicy, error) { out := service.CachePolicy{ Enabled: c.Enabled(), NeverExpires: c.NeverExpires(), } if out.NeverExpires { return &out, nil } var err error if c.TTL != "" { out.TTL, err = time.ParseDuration(c.TTL) if err != nil { return nil, trace.Bad...
go
func (c *CachePolicy) Parse() (*service.CachePolicy, error) { out := service.CachePolicy{ Enabled: c.Enabled(), NeverExpires: c.NeverExpires(), } if out.NeverExpires { return &out, nil } var err error if c.TTL != "" { out.TTL, err = time.ParseDuration(c.TTL) if err != nil { return nil, trace.Bad...
[ "func", "(", "c", "*", "CachePolicy", ")", "Parse", "(", ")", "(", "*", "service", ".", "CachePolicy", ",", "error", ")", "{", "out", ":=", "service", ".", "CachePolicy", "{", "Enabled", ":", "c", ".", "Enabled", "(", ")", ",", "NeverExpires", ":", ...
// Parse parses cache policy from Teleport config
[ "Parse", "parses", "cache", "policy", "from", "Teleport", "config" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/config/fileconf.go#L425-L441
24,071
gravitational/teleport
lib/config/fileconf.go
Parse
func (p *PAM) Parse() *pam.Config { serviceName := p.ServiceName if serviceName == "" { serviceName = defaults.ServiceName } enabled, _ := utils.ParseBool(p.Enabled) return &pam.Config{ Enabled: enabled, ServiceName: serviceName, } }
go
func (p *PAM) Parse() *pam.Config { serviceName := p.ServiceName if serviceName == "" { serviceName = defaults.ServiceName } enabled, _ := utils.ParseBool(p.Enabled) return &pam.Config{ Enabled: enabled, ServiceName: serviceName, } }
[ "func", "(", "p", "*", "PAM", ")", "Parse", "(", ")", "*", "pam", ".", "Config", "{", "serviceName", ":=", "p", ".", "ServiceName", "\n", "if", "serviceName", "==", "\"", "\"", "{", "serviceName", "=", "defaults", ".", "ServiceName", "\n", "}", "\n",...
// Parse returns a parsed pam.Config.
[ "Parse", "returns", "a", "parsed", "pam", ".", "Config", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/config/fileconf.go#L710-L720
24,072
gravitational/teleport
lib/config/fileconf.go
ConvertAndValidate
func (t *ReverseTunnel) ConvertAndValidate() (services.ReverseTunnel, error) { for i := range t.Addresses { addr, err := utils.ParseHostPortAddr(t.Addresses[i], defaults.SSHProxyTunnelListenPort) if err != nil { return nil, trace.Wrap(err, "Invalid address for tunnel %v", t.DomainName) } t.Addresses[i] = ad...
go
func (t *ReverseTunnel) ConvertAndValidate() (services.ReverseTunnel, error) { for i := range t.Addresses { addr, err := utils.ParseHostPortAddr(t.Addresses[i], defaults.SSHProxyTunnelListenPort) if err != nil { return nil, trace.Wrap(err, "Invalid address for tunnel %v", t.DomainName) } t.Addresses[i] = ad...
[ "func", "(", "t", "*", "ReverseTunnel", ")", "ConvertAndValidate", "(", ")", "(", "services", ".", "ReverseTunnel", ",", "error", ")", "{", "for", "i", ":=", "range", "t", ".", "Addresses", "{", "addr", ",", "err", ":=", "utils", ".", "ParseHostPortAddr"...
// ConvertAndValidate returns validated services.ReverseTunnel or nil and error otherwize
[ "ConvertAndValidate", "returns", "validated", "services", ".", "ReverseTunnel", "or", "nil", "and", "error", "otherwize" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/config/fileconf.go#L778-L792
24,073
gravitational/teleport
lib/config/fileconf.go
Parse
func (a *Authority) Parse() (services.CertAuthority, services.Role, error) { ca := &services.CertAuthorityV1{ AllowedLogins: a.AllowedLogins, DomainName: a.DomainName, Type: a.Type, } for _, path := range a.CheckingKeyFiles { keyBytes, err := utils.ReadPath(path) if err != nil { return nil,...
go
func (a *Authority) Parse() (services.CertAuthority, services.Role, error) { ca := &services.CertAuthorityV1{ AllowedLogins: a.AllowedLogins, DomainName: a.DomainName, Type: a.Type, } for _, path := range a.CheckingKeyFiles { keyBytes, err := utils.ReadPath(path) if err != nil { return nil,...
[ "func", "(", "a", "*", "Authority", ")", "Parse", "(", ")", "(", "services", ".", "CertAuthority", ",", "services", ".", "Role", ",", "error", ")", "{", "ca", ":=", "&", "services", ".", "CertAuthorityV1", "{", "AllowedLogins", ":", "a", ".", "AllowedL...
// Parse reads values and returns parsed CertAuthority
[ "Parse", "reads", "values", "and", "returns", "parsed", "CertAuthority" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/config/fileconf.go#L818-L851
24,074
gravitational/teleport
lib/config/fileconf.go
Parse
func (o *OIDCConnector) Parse() (services.OIDCConnector, error) { if o.Display == "" { o.Display = o.ID } var mappings []services.ClaimMapping for _, c := range o.ClaimsToRoles { var roles []string if len(c.Roles) > 0 { roles = append(roles, c.Roles...) } mappings = append(mappings, services.ClaimMap...
go
func (o *OIDCConnector) Parse() (services.OIDCConnector, error) { if o.Display == "" { o.Display = o.ID } var mappings []services.ClaimMapping for _, c := range o.ClaimsToRoles { var roles []string if len(c.Roles) > 0 { roles = append(roles, c.Roles...) } mappings = append(mappings, services.ClaimMap...
[ "func", "(", "o", "*", "OIDCConnector", ")", "Parse", "(", ")", "(", "services", ".", "OIDCConnector", ",", "error", ")", "{", "if", "o", ".", "Display", "==", "\"", "\"", "{", "o", ".", "Display", "=", "o", ".", "ID", "\n", "}", "\n\n", "var", ...
// Parse parses config struct into services connector and checks if it's valid
[ "Parse", "parses", "config", "struct", "into", "services", "connector", "and", "checks", "if", "it", "s", "valid" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/config/fileconf.go#L898-L935
24,075
gravitational/teleport
lib/config/fileconf.go
Parse
func (u *U2F) Parse() (*services.U2F, error) { // If no appID specified, default to hostname appID := u.AppID if appID == "" { hostname, err := os.Hostname() if err != nil { return nil, trace.Wrap(err, "failed to automatically determine U2F AppID from hostname") } appID = fmt.Sprintf("https://%s:%d", stri...
go
func (u *U2F) Parse() (*services.U2F, error) { // If no appID specified, default to hostname appID := u.AppID if appID == "" { hostname, err := os.Hostname() if err != nil { return nil, trace.Wrap(err, "failed to automatically determine U2F AppID from hostname") } appID = fmt.Sprintf("https://%s:%d", stri...
[ "func", "(", "u", "*", "U2F", ")", "Parse", "(", ")", "(", "*", "services", ".", "U2F", ",", "error", ")", "{", "// If no appID specified, default to hostname", "appID", ":=", "u", ".", "AppID", "\n", "if", "appID", "==", "\"", "\"", "{", "hostname", "...
// Parse parses values in the U2F configuration section and validates its content.
[ "Parse", "parses", "values", "in", "the", "U2F", "configuration", "section", "and", "validates", "its", "content", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/config/fileconf.go#L943-L964
24,076
gravitational/teleport
lib/sshutils/signer.go
NewSigner
func NewSigner(keyBytes, certBytes []byte) (ssh.Signer, error) { keySigner, err := ssh.ParsePrivateKey(keyBytes) if err != nil { return nil, trace.Wrap(err, "failed to parse SSH private key") } pubkey, _, _, _, err := ssh.ParseAuthorizedKey(certBytes) if err != nil { return nil, trace.Wrap(err, "failed to par...
go
func NewSigner(keyBytes, certBytes []byte) (ssh.Signer, error) { keySigner, err := ssh.ParsePrivateKey(keyBytes) if err != nil { return nil, trace.Wrap(err, "failed to parse SSH private key") } pubkey, _, _, _, err := ssh.ParseAuthorizedKey(certBytes) if err != nil { return nil, trace.Wrap(err, "failed to par...
[ "func", "NewSigner", "(", "keyBytes", ",", "certBytes", "[", "]", "byte", ")", "(", "ssh", ".", "Signer", ",", "error", ")", "{", "keySigner", ",", "err", ":=", "ssh", ".", "ParsePrivateKey", "(", "keyBytes", ")", "\n", "if", "err", "!=", "nil", "{",...
// NewSigner returns new ssh Signer from private key + certificate pair. The // signer can be used to create "auth methods" i.e. login into Teleport SSH // servers.
[ "NewSigner", "returns", "new", "ssh", "Signer", "from", "private", "key", "+", "certificate", "pair", ".", "The", "signer", "can", "be", "used", "to", "create", "auth", "methods", "i", ".", "e", ".", "login", "into", "Teleport", "SSH", "servers", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/sshutils/signer.go#L29-L46
24,077
gravitational/teleport
lib/sshutils/signer.go
CryptoPublicKey
func CryptoPublicKey(publicKey []byte) (crypto.PublicKey, error) { // reuse the same RSA keys for SSH and TLS keys pubKey, _, _, _, err := ssh.ParseAuthorizedKey(publicKey) if err != nil { return nil, trace.Wrap(err) } cryptoPubKey, ok := pubKey.(ssh.CryptoPublicKey) if !ok { return nil, trace.BadParameter("e...
go
func CryptoPublicKey(publicKey []byte) (crypto.PublicKey, error) { // reuse the same RSA keys for SSH and TLS keys pubKey, _, _, _, err := ssh.ParseAuthorizedKey(publicKey) if err != nil { return nil, trace.Wrap(err) } cryptoPubKey, ok := pubKey.(ssh.CryptoPublicKey) if !ok { return nil, trace.BadParameter("e...
[ "func", "CryptoPublicKey", "(", "publicKey", "[", "]", "byte", ")", "(", "crypto", ".", "PublicKey", ",", "error", ")", "{", "// reuse the same RSA keys for SSH and TLS keys", "pubKey", ",", "_", ",", "_", ",", "_", ",", "err", ":=", "ssh", ".", "ParseAuthor...
// CryptoPublicKey extracts public key from RSA public key in authorized_keys format
[ "CryptoPublicKey", "extracts", "public", "key", "from", "RSA", "public", "key", "in", "authorized_keys", "format" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/sshutils/signer.go#L49-L60
24,078
gravitational/teleport
lib/tlsca/parsegen.go
ClusterName
func ClusterName(subject pkix.Name) (string, error) { if len(subject.Organization) == 0 { return "", trace.BadParameter("missing subject organization") } return subject.Organization[0], nil }
go
func ClusterName(subject pkix.Name) (string, error) { if len(subject.Organization) == 0 { return "", trace.BadParameter("missing subject organization") } return subject.Organization[0], nil }
[ "func", "ClusterName", "(", "subject", "pkix", ".", "Name", ")", "(", "string", ",", "error", ")", "{", "if", "len", "(", "subject", ".", "Organization", ")", "==", "0", "{", "return", "\"", "\"", ",", "trace", ".", "BadParameter", "(", "\"", "\"", ...
// ClusterName returns cluster name from organization
[ "ClusterName", "returns", "cluster", "name", "from", "organization" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/tlsca/parsegen.go#L36-L41
24,079
gravitational/teleport
lib/tlsca/parsegen.go
GenerateRSAPrivateKeyPEM
func GenerateRSAPrivateKeyPEM() ([]byte, error) { priv, err := rsa.GenerateKey(rand.Reader, teleport.RSAKeySize) if err != nil { return nil, trace.Wrap(err) } return pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(priv)}), nil }
go
func GenerateRSAPrivateKeyPEM() ([]byte, error) { priv, err := rsa.GenerateKey(rand.Reader, teleport.RSAKeySize) if err != nil { return nil, trace.Wrap(err) } return pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(priv)}), nil }
[ "func", "GenerateRSAPrivateKeyPEM", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "priv", ",", "err", ":=", "rsa", ".", "GenerateKey", "(", "rand", ".", "Reader", ",", "teleport", ".", "RSAKeySize", ")", "\n", "if", "err", "!=", "nil", "{"...
// GenerateRSAPrivateKeyPEM generates new RSA private key and returns PEM encoded bytes
[ "GenerateRSAPrivateKeyPEM", "generates", "new", "RSA", "private", "key", "and", "returns", "PEM", "encoded", "bytes" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/tlsca/parsegen.go#L44-L50
24,080
gravitational/teleport
lib/tlsca/parsegen.go
ParsePublicKeyPEM
func ParsePublicKeyPEM(bytes []byte) (interface{}, error) { block, _ := pem.Decode(bytes) if block == nil { return nil, trace.BadParameter("expected PEM-encoded block") } return ParsePublicKeyDER(block.Bytes) }
go
func ParsePublicKeyPEM(bytes []byte) (interface{}, error) { block, _ := pem.Decode(bytes) if block == nil { return nil, trace.BadParameter("expected PEM-encoded block") } return ParsePublicKeyDER(block.Bytes) }
[ "func", "ParsePublicKeyPEM", "(", "bytes", "[", "]", "byte", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "block", ",", "_", ":=", "pem", ".", "Decode", "(", "bytes", ")", "\n", "if", "block", "==", "nil", "{", "return", "nil", ",", "...
// ParsePublicKeyPEM parses public key PEM
[ "ParsePublicKeyPEM", "parses", "public", "key", "PEM" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/tlsca/parsegen.go#L160-L166
24,081
gravitational/teleport
lib/tlsca/parsegen.go
ParsePublicKeyDER
func ParsePublicKeyDER(der []byte) (crypto.PublicKey, error) { generalKey, err := x509.ParsePKIXPublicKey(der) if err != nil { return nil, trace.Wrap(err) } return generalKey, nil }
go
func ParsePublicKeyDER(der []byte) (crypto.PublicKey, error) { generalKey, err := x509.ParsePKIXPublicKey(der) if err != nil { return nil, trace.Wrap(err) } return generalKey, nil }
[ "func", "ParsePublicKeyDER", "(", "der", "[", "]", "byte", ")", "(", "crypto", ".", "PublicKey", ",", "error", ")", "{", "generalKey", ",", "err", ":=", "x509", ".", "ParsePKIXPublicKey", "(", "der", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// ParsePublicKeyDER parses unencrypted DER-encoded publice key
[ "ParsePublicKeyDER", "parses", "unencrypted", "DER", "-", "encoded", "publice", "key" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/tlsca/parsegen.go#L169-L175
24,082
gravitational/teleport
lib/tlsca/parsegen.go
MarshalPublicKeyFromPrivateKeyPEM
func MarshalPublicKeyFromPrivateKeyPEM(privateKey crypto.PrivateKey) ([]byte, error) { rsaPrivateKey, ok := privateKey.(*rsa.PrivateKey) if !ok { return nil, trace.BadParameter("expected RSA key") } rsaPublicKey := rsaPrivateKey.Public() derBytes, err := x509.MarshalPKIXPublicKey(rsaPublicKey) if err != nil { ...
go
func MarshalPublicKeyFromPrivateKeyPEM(privateKey crypto.PrivateKey) ([]byte, error) { rsaPrivateKey, ok := privateKey.(*rsa.PrivateKey) if !ok { return nil, trace.BadParameter("expected RSA key") } rsaPublicKey := rsaPrivateKey.Public() derBytes, err := x509.MarshalPKIXPublicKey(rsaPublicKey) if err != nil { ...
[ "func", "MarshalPublicKeyFromPrivateKeyPEM", "(", "privateKey", "crypto", ".", "PrivateKey", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "rsaPrivateKey", ",", "ok", ":=", "privateKey", ".", "(", "*", "rsa", ".", "PrivateKey", ")", "\n", "if", "!", ...
// MarshalPublicKeyFromPrivateKeyPEM extracts public key from private key // and returns PEM marshalled key
[ "MarshalPublicKeyFromPrivateKeyPEM", "extracts", "public", "key", "from", "private", "key", "and", "returns", "PEM", "marshalled", "key" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/tlsca/parsegen.go#L179-L190
24,083
gravitational/teleport
lib/auth/init.go
isFirstStart
func isFirstStart(authServer *AuthServer, cfg InitConfig) (bool, error) { // check if the CA exists? _, err := authServer.GetCertAuthority( services.CertAuthID{ DomainName: cfg.ClusterName.GetClusterName(), Type: services.HostCA, }, false) if err != nil { if !trace.IsNotFound(err) { return false...
go
func isFirstStart(authServer *AuthServer, cfg InitConfig) (bool, error) { // check if the CA exists? _, err := authServer.GetCertAuthority( services.CertAuthID{ DomainName: cfg.ClusterName.GetClusterName(), Type: services.HostCA, }, false) if err != nil { if !trace.IsNotFound(err) { return false...
[ "func", "isFirstStart", "(", "authServer", "*", "AuthServer", ",", "cfg", "InitConfig", ")", "(", "bool", ",", "error", ")", "{", "// check if the CA exists?", "_", ",", "err", ":=", "authServer", ".", "GetCertAuthority", "(", "services", ".", "CertAuthID", "{...
// isFirstStart returns 'true' if the auth server is starting for the 1st time // on this server.
[ "isFirstStart", "returns", "true", "if", "the", "auth", "server", "is", "starting", "for", "the", "1st", "time", "on", "this", "server", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/init.go#L476-L491
24,084
gravitational/teleport
lib/auth/init.go
GenerateIdentity
func GenerateIdentity(a *AuthServer, id IdentityID, additionalPrincipals, dnsNames []string) (*Identity, error) { keys, err := a.GenerateServerKeys(GenerateServerKeysRequest{ HostID: id.HostUUID, NodeName: id.NodeName, Roles: teleport.Roles{id.Role}, AdditionalPrincipal...
go
func GenerateIdentity(a *AuthServer, id IdentityID, additionalPrincipals, dnsNames []string) (*Identity, error) { keys, err := a.GenerateServerKeys(GenerateServerKeysRequest{ HostID: id.HostUUID, NodeName: id.NodeName, Roles: teleport.Roles{id.Role}, AdditionalPrincipal...
[ "func", "GenerateIdentity", "(", "a", "*", "AuthServer", ",", "id", "IdentityID", ",", "additionalPrincipals", ",", "dnsNames", "[", "]", "string", ")", "(", "*", "Identity", ",", "error", ")", "{", "keys", ",", "err", ":=", "a", ".", "GenerateServerKeys",...
// GenerateIdentity generates identity for the auth server
[ "GenerateIdentity", "generates", "identity", "for", "the", "auth", "server" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/init.go#L494-L506
24,085
gravitational/teleport
lib/auth/init.go
String
func (i *Identity) String() string { var out []string if i.XCert != nil { out = append(out, fmt.Sprintf("cert(%v issued by %v:%v)", i.XCert.Subject.CommonName, i.XCert.Issuer.CommonName, i.XCert.Issuer.SerialNumber)) } for j := range i.TLSCACertsBytes { cert, err := tlsca.ParseCertificatePEM(i.TLSCACertsBytes[j...
go
func (i *Identity) String() string { var out []string if i.XCert != nil { out = append(out, fmt.Sprintf("cert(%v issued by %v:%v)", i.XCert.Subject.CommonName, i.XCert.Issuer.CommonName, i.XCert.Issuer.SerialNumber)) } for j := range i.TLSCACertsBytes { cert, err := tlsca.ParseCertificatePEM(i.TLSCACertsBytes[j...
[ "func", "(", "i", "*", "Identity", ")", "String", "(", ")", "string", "{", "var", "out", "[", "]", "string", "\n", "if", "i", ".", "XCert", "!=", "nil", "{", "out", "=", "append", "(", "out", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", ...
// String returns user-friendly representation of the identity.
[ "String", "returns", "user", "-", "friendly", "representation", "of", "the", "identity", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/init.go#L534-L548
24,086
gravitational/teleport
lib/auth/init.go
CertInfo
func CertInfo(cert *x509.Certificate) string { return fmt.Sprintf("cert(%v issued by %v:%v)", cert.Subject.CommonName, cert.Issuer.CommonName, cert.Issuer.SerialNumber) }
go
func CertInfo(cert *x509.Certificate) string { return fmt.Sprintf("cert(%v issued by %v:%v)", cert.Subject.CommonName, cert.Issuer.CommonName, cert.Issuer.SerialNumber) }
[ "func", "CertInfo", "(", "cert", "*", "x509", ".", "Certificate", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "cert", ".", "Subject", ".", "CommonName", ",", "cert", ".", "Issuer", ".", "CommonName", ",", "cert", ".", "...
// CertInfo returns diagnostic information about certificate
[ "CertInfo", "returns", "diagnostic", "information", "about", "certificate" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/init.go#L551-L553
24,087
gravitational/teleport
lib/auth/init.go
TLSCertInfo
func TLSCertInfo(cert *tls.Certificate) string { x509cert, err := x509.ParseCertificate(cert.Certificate[0]) if err != nil { return err.Error() } return CertInfo(x509cert) }
go
func TLSCertInfo(cert *tls.Certificate) string { x509cert, err := x509.ParseCertificate(cert.Certificate[0]) if err != nil { return err.Error() } return CertInfo(x509cert) }
[ "func", "TLSCertInfo", "(", "cert", "*", "tls", ".", "Certificate", ")", "string", "{", "x509cert", ",", "err", ":=", "x509", ".", "ParseCertificate", "(", "cert", ".", "Certificate", "[", "0", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// TLSCertInfo returns diagnostic information about certificate
[ "TLSCertInfo", "returns", "diagnostic", "information", "about", "certificate" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/init.go#L556-L562
24,088
gravitational/teleport
lib/auth/init.go
CertAuthorityInfo
func CertAuthorityInfo(ca services.CertAuthority) string { var out []string for _, keyPair := range ca.GetTLSKeyPairs() { cert, err := tlsca.ParseCertificatePEM(keyPair.Cert) if err != nil { out = append(out, err.Error()) } else { out = append(out, fmt.Sprintf("trust root(%v:%v)", cert.Subject.CommonName,...
go
func CertAuthorityInfo(ca services.CertAuthority) string { var out []string for _, keyPair := range ca.GetTLSKeyPairs() { cert, err := tlsca.ParseCertificatePEM(keyPair.Cert) if err != nil { out = append(out, err.Error()) } else { out = append(out, fmt.Sprintf("trust root(%v:%v)", cert.Subject.CommonName,...
[ "func", "CertAuthorityInfo", "(", "ca", "services", ".", "CertAuthority", ")", "string", "{", "var", "out", "[", "]", "string", "\n", "for", "_", ",", "keyPair", ":=", "range", "ca", ".", "GetTLSKeyPairs", "(", ")", "{", "cert", ",", "err", ":=", "tlsc...
// CertAuthorityInfo returns debugging information about certificate authority
[ "CertAuthorityInfo", "returns", "debugging", "information", "about", "certificate", "authority" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/init.go#L565-L576
24,089
gravitational/teleport
lib/auth/init.go
HasTLSConfig
func (i *Identity) HasTLSConfig() bool { return len(i.TLSCACertsBytes) != 0 && len(i.TLSCertBytes) != 0 }
go
func (i *Identity) HasTLSConfig() bool { return len(i.TLSCACertsBytes) != 0 && len(i.TLSCertBytes) != 0 }
[ "func", "(", "i", "*", "Identity", ")", "HasTLSConfig", "(", ")", "bool", "{", "return", "len", "(", "i", ".", "TLSCACertsBytes", ")", "!=", "0", "&&", "len", "(", "i", ".", "TLSCertBytes", ")", "!=", "0", "\n", "}" ]
// HasTSLConfig returns true if this identity has TLS certificate and private key
[ "HasTSLConfig", "returns", "true", "if", "this", "identity", "has", "TLS", "certificate", "and", "private", "key" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/init.go#L579-L581
24,090
gravitational/teleport
lib/auth/init.go
HasPrincipals
func (i *Identity) HasPrincipals(additionalPrincipals []string) bool { set := utils.StringsSet(i.Cert.ValidPrincipals) for _, principal := range additionalPrincipals { if _, ok := set[principal]; !ok { return false } } return true }
go
func (i *Identity) HasPrincipals(additionalPrincipals []string) bool { set := utils.StringsSet(i.Cert.ValidPrincipals) for _, principal := range additionalPrincipals { if _, ok := set[principal]; !ok { return false } } return true }
[ "func", "(", "i", "*", "Identity", ")", "HasPrincipals", "(", "additionalPrincipals", "[", "]", "string", ")", "bool", "{", "set", ":=", "utils", ".", "StringsSet", "(", "i", ".", "Cert", ".", "ValidPrincipals", ")", "\n", "for", "_", ",", "principal", ...
// HasPrincipals returns whether identity has principals
[ "HasPrincipals", "returns", "whether", "identity", "has", "principals" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/init.go#L584-L592
24,091
gravitational/teleport
lib/auth/init.go
HasDNSNames
func (i *Identity) HasDNSNames(dnsNames []string) bool { if i.XCert == nil { return false } set := utils.StringsSet(i.XCert.DNSNames) for _, dnsName := range dnsNames { if _, ok := set[dnsName]; !ok { return false } } return true }
go
func (i *Identity) HasDNSNames(dnsNames []string) bool { if i.XCert == nil { return false } set := utils.StringsSet(i.XCert.DNSNames) for _, dnsName := range dnsNames { if _, ok := set[dnsName]; !ok { return false } } return true }
[ "func", "(", "i", "*", "Identity", ")", "HasDNSNames", "(", "dnsNames", "[", "]", "string", ")", "bool", "{", "if", "i", ".", "XCert", "==", "nil", "{", "return", "false", "\n", "}", "\n", "set", ":=", "utils", ".", "StringsSet", "(", "i", ".", "...
// HasDNSNames returns true if TLS certificate has required DNS names
[ "HasDNSNames", "returns", "true", "if", "TLS", "certificate", "has", "required", "DNS", "names" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/init.go#L595-L606
24,092
gravitational/teleport
lib/auth/init.go
TLSConfig
func (i *Identity) TLSConfig(cipherSuites []uint16) (*tls.Config, error) { tlsConfig := utils.TLSConfig(cipherSuites) if !i.HasTLSConfig() { return nil, trace.NotFound("no TLS credentials setup for this identity") } tlsCert, err := tls.X509KeyPair(i.TLSCertBytes, i.KeyBytes) if err != nil { return nil, trace.B...
go
func (i *Identity) TLSConfig(cipherSuites []uint16) (*tls.Config, error) { tlsConfig := utils.TLSConfig(cipherSuites) if !i.HasTLSConfig() { return nil, trace.NotFound("no TLS credentials setup for this identity") } tlsCert, err := tls.X509KeyPair(i.TLSCertBytes, i.KeyBytes) if err != nil { return nil, trace.B...
[ "func", "(", "i", "*", "Identity", ")", "TLSConfig", "(", "cipherSuites", "[", "]", "uint16", ")", "(", "*", "tls", ".", "Config", ",", "error", ")", "{", "tlsConfig", ":=", "utils", ".", "TLSConfig", "(", "cipherSuites", ")", "\n", "if", "!", "i", ...
// TLSConfig returns TLS config for mutual TLS authentication // can return NotFound error if there are no TLS credentials setup for identity
[ "TLSConfig", "returns", "TLS", "config", "for", "mutual", "TLS", "authentication", "can", "return", "NotFound", "error", "if", "there", "are", "no", "TLS", "credentials", "setup", "for", "identity" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/init.go#L610-L632
24,093
gravitational/teleport
lib/auth/init.go
SSHClientConfig
func (i *Identity) SSHClientConfig() *ssh.ClientConfig { return &ssh.ClientConfig{ User: i.ID.HostUUID, Auth: []ssh.AuthMethod{ ssh.PublicKeys(i.KeySigner), }, HostKeyCallback: i.hostKeyCallback, Timeout: defaults.DefaultDialTimeout, } }
go
func (i *Identity) SSHClientConfig() *ssh.ClientConfig { return &ssh.ClientConfig{ User: i.ID.HostUUID, Auth: []ssh.AuthMethod{ ssh.PublicKeys(i.KeySigner), }, HostKeyCallback: i.hostKeyCallback, Timeout: defaults.DefaultDialTimeout, } }
[ "func", "(", "i", "*", "Identity", ")", "SSHClientConfig", "(", ")", "*", "ssh", ".", "ClientConfig", "{", "return", "&", "ssh", ".", "ClientConfig", "{", "User", ":", "i", ".", "ID", ".", "HostUUID", ",", "Auth", ":", "[", "]", "ssh", ".", "AuthMe...
// SSHClientConfig returns a ssh.ClientConfig used by nodes to connect to // the reverse tunnel server.
[ "SSHClientConfig", "returns", "a", "ssh", ".", "ClientConfig", "used", "by", "nodes", "to", "connect", "to", "the", "reverse", "tunnel", "server", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/init.go#L636-L645
24,094
gravitational/teleport
lib/auth/init.go
hostKeyCallback
func (i *Identity) hostKeyCallback(hostname string, remote net.Addr, key ssh.PublicKey) error { cert, ok := key.(*ssh.Certificate) if !ok { return trace.BadParameter("only host certificates supported") } // Loop over all CAs and see if any of them signed the certificate. for _, k := range i.SSHCACertBytes { p...
go
func (i *Identity) hostKeyCallback(hostname string, remote net.Addr, key ssh.PublicKey) error { cert, ok := key.(*ssh.Certificate) if !ok { return trace.BadParameter("only host certificates supported") } // Loop over all CAs and see if any of them signed the certificate. for _, k := range i.SSHCACertBytes { p...
[ "func", "(", "i", "*", "Identity", ")", "hostKeyCallback", "(", "hostname", "string", ",", "remote", "net", ".", "Addr", ",", "key", "ssh", ".", "PublicKey", ")", "error", "{", "cert", ",", "ok", ":=", "key", ".", "(", "*", "ssh", ".", "Certificate",...
// hostKeyCallback checks if the host certificate was signed by any of the // known CAs.
[ "hostKeyCallback", "checks", "if", "the", "host", "certificate", "was", "signed", "by", "any", "of", "the", "known", "CAs", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/init.go#L649-L667
24,095
gravitational/teleport
lib/auth/init.go
HostID
func (id *IdentityID) HostID() (string, error) { parts := strings.Split(id.HostUUID, ".") if len(parts) < 2 { return "", trace.BadParameter("expected 2 parts in %q", id.HostUUID) } return parts[0], nil }
go
func (id *IdentityID) HostID() (string, error) { parts := strings.Split(id.HostUUID, ".") if len(parts) < 2 { return "", trace.BadParameter("expected 2 parts in %q", id.HostUUID) } return parts[0], nil }
[ "func", "(", "id", "*", "IdentityID", ")", "HostID", "(", ")", "(", "string", ",", "error", ")", "{", "parts", ":=", "strings", ".", "Split", "(", "id", ".", "HostUUID", ",", "\"", "\"", ")", "\n", "if", "len", "(", "parts", ")", "<", "2", "{",...
// HostID is host ID part of the host UUID that consists cluster name
[ "HostID", "is", "host", "ID", "part", "of", "the", "host", "UUID", "that", "consists", "cluster", "name" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/init.go#L677-L683
24,096
gravitational/teleport
lib/auth/init.go
Equals
func (id *IdentityID) Equals(other IdentityID) bool { return id.Role == other.Role && id.HostUUID == other.HostUUID }
go
func (id *IdentityID) Equals(other IdentityID) bool { return id.Role == other.Role && id.HostUUID == other.HostUUID }
[ "func", "(", "id", "*", "IdentityID", ")", "Equals", "(", "other", "IdentityID", ")", "bool", "{", "return", "id", ".", "Role", "==", "other", ".", "Role", "&&", "id", ".", "HostUUID", "==", "other", ".", "HostUUID", "\n", "}" ]
// Equals returns true if two identities are equal
[ "Equals", "returns", "true", "if", "two", "identities", "are", "equal" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/init.go#L686-L688
24,097
gravitational/teleport
lib/auth/init.go
ReadIdentityFromKeyPair
func ReadIdentityFromKeyPair(keys *PackedKeys) (*Identity, error) { identity, err := ReadSSHIdentityFromKeyPair(keys.Key, keys.Cert) if err != nil { return nil, trace.Wrap(err) } if len(keys.SSHCACerts) != 0 { identity.SSHCACertBytes = keys.SSHCACerts } if len(keys.TLSCACerts) != 0 { // Parse the key pair...
go
func ReadIdentityFromKeyPair(keys *PackedKeys) (*Identity, error) { identity, err := ReadSSHIdentityFromKeyPair(keys.Key, keys.Cert) if err != nil { return nil, trace.Wrap(err) } if len(keys.SSHCACerts) != 0 { identity.SSHCACertBytes = keys.SSHCACerts } if len(keys.TLSCACerts) != 0 { // Parse the key pair...
[ "func", "ReadIdentityFromKeyPair", "(", "keys", "*", "PackedKeys", ")", "(", "*", "Identity", ",", "error", ")", "{", "identity", ",", "err", ":=", "ReadSSHIdentityFromKeyPair", "(", "keys", ".", "Key", ",", "keys", ".", "Cert", ")", "\n", "if", "err", "...
// ReadIdentityFromKeyPair reads SSH and TLS identity from key pair.
[ "ReadIdentityFromKeyPair", "reads", "SSH", "and", "TLS", "identity", "from", "key", "pair", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/init.go#L696-L718
24,098
gravitational/teleport
lib/auth/init.go
ReadTLSIdentityFromKeyPair
func ReadTLSIdentityFromKeyPair(keyBytes, certBytes []byte, caCertsBytes [][]byte) (*Identity, error) { if len(keyBytes) == 0 { return nil, trace.BadParameter("missing private key") } if len(certBytes) == 0 { return nil, trace.BadParameter("missing certificate") } cert, err := tlsca.ParseCertificatePEM(certB...
go
func ReadTLSIdentityFromKeyPair(keyBytes, certBytes []byte, caCertsBytes [][]byte) (*Identity, error) { if len(keyBytes) == 0 { return nil, trace.BadParameter("missing private key") } if len(certBytes) == 0 { return nil, trace.BadParameter("missing certificate") } cert, err := tlsca.ParseCertificatePEM(certB...
[ "func", "ReadTLSIdentityFromKeyPair", "(", "keyBytes", ",", "certBytes", "[", "]", "byte", ",", "caCertsBytes", "[", "]", "[", "]", "byte", ")", "(", "*", "Identity", ",", "error", ")", "{", "if", "len", "(", "keyBytes", ")", "==", "0", "{", "return", ...
// ReadTLSIdentityFromKeyPair reads TLS identity from key pair
[ "ReadTLSIdentityFromKeyPair", "reads", "TLS", "identity", "from", "key", "pair" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/init.go#L721-L763
24,099
gravitational/teleport
lib/auth/init.go
ReadSSHIdentityFromKeyPair
func ReadSSHIdentityFromKeyPair(keyBytes, certBytes []byte) (*Identity, error) { if len(keyBytes) == 0 { return nil, trace.BadParameter("PrivateKey: missing private key") } if len(certBytes) == 0 { return nil, trace.BadParameter("Cert: missing parameter") } pubKey, _, _, _, err := ssh.ParseAuthorizedKey(cert...
go
func ReadSSHIdentityFromKeyPair(keyBytes, certBytes []byte) (*Identity, error) { if len(keyBytes) == 0 { return nil, trace.BadParameter("PrivateKey: missing private key") } if len(certBytes) == 0 { return nil, trace.BadParameter("Cert: missing parameter") } pubKey, _, _, _, err := ssh.ParseAuthorizedKey(cert...
[ "func", "ReadSSHIdentityFromKeyPair", "(", "keyBytes", ",", "certBytes", "[", "]", "byte", ")", "(", "*", "Identity", ",", "error", ")", "{", "if", "len", "(", "keyBytes", ")", "==", "0", "{", "return", "nil", ",", "trace", ".", "BadParameter", "(", "\...
// ReadSSHIdentityFromKeyPair reads identity from initialized keypair
[ "ReadSSHIdentityFromKeyPair", "reads", "identity", "from", "initialized", "keypair" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/init.go#L766-L837