repo stringlengths 5 67 | sha stringlengths 40 40 | path stringlengths 4 234 | url stringlengths 85 339 | language stringclasses 6
values | split stringclasses 3
values | doc stringlengths 3 51.2k | sign stringlengths 5 8.01k | problem stringlengths 13 51.2k | output stringlengths 0 3.87M |
|---|---|---|---|---|---|---|---|---|---|
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1136-L1142 | go | train | // DeleteRemoteCluster deletes remote cluster by name | func (c *Client) DeleteRemoteCluster(clusterName string) error | // DeleteRemoteCluster deletes remote cluster by name
func (c *Client) DeleteRemoteCluster(clusterName string) error | {
if clusterName == "" {
return trace.BadParameter("missing parameter cluster name")
}
_, err := c.Delete(c.Endpoint("remoteclusters", clusterName))
return trace.Wrap(err)
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1151-L1161 | go | train | // CreateRemoteCluster creates remote cluster resource | func (c *Client) CreateRemoteCluster(rc services.RemoteCluster) error | // CreateRemoteCluster creates remote cluster resource
func (c *Client) CreateRemoteCluster(rc services.RemoteCluster) error | {
data, err := services.MarshalRemoteCluster(rc)
if err != nil {
return trace.Wrap(err)
}
args := &createRemoteClusterRawReq{
RemoteCluster: data,
}
_, err = c.PostJSON(c.Endpoint("remoteclusters"), args)
return trace.Wrap(err)
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1178-L1196 | go | train | // GetAuthServers returns the list of auth servers registered in the cluster. | func (c *Client) GetAuthServers() ([]services.Server, error) | // GetAuthServers returns the list of auth servers registered in the cluster.
func (c *Client) GetAuthServers() ([]services.Server, error) | {
out, err := c.Get(c.Endpoint("authservers"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
var items []json.RawMessage
if err := json.Unmarshal(out.Bytes(), &items); err != nil {
return nil, trace.Wrap(err)
}
re := make([]services.Server, len(items))
for i, raw := range items {
server, er... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1210-L1220 | go | train | // UpsertProxy is used by proxies to report their presence
// to other auth servers in form of hearbeat expiring after ttl period. | func (c *Client) UpsertProxy(s services.Server) error | // UpsertProxy is used by proxies to report their presence
// to other auth servers in form of hearbeat expiring after ttl period.
func (c *Client) UpsertProxy(s services.Server) error | {
data, err := services.GetServerMarshaler().MarshalServer(s)
if err != nil {
return trace.Wrap(err)
}
args := &upsertServerRawReq{
Server: data,
}
_, err = c.PostJSON(c.Endpoint("proxies"), args)
return trace.Wrap(err)
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1244-L1250 | go | train | // DeleteAllProxies deletes all proxies | func (c *Client) DeleteAllProxies() error | // DeleteAllProxies deletes all proxies
func (c *Client) DeleteAllProxies() error | {
_, err := c.Delete(c.Endpoint("proxies"))
if err != nil {
return trace.Wrap(err)
}
return nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1278-L1289 | go | train | // UpsertPassword updates web access password for the user | func (c *Client) UpsertPassword(user string, password []byte) error | // UpsertPassword updates web access password for the user
func (c *Client) UpsertPassword(user string, password []byte) error | {
_, err := c.PostJSON(
c.Endpoint("users", user, "web", "password"),
upsertPasswordReq{
Password: string(password),
})
if err != nil {
return trace.Wrap(err)
}
return nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1292-L1299 | go | train | // UpsertUser user updates or inserts user entry | func (c *Client) UpsertUser(user services.User) error | // UpsertUser user updates or inserts user entry
func (c *Client) UpsertUser(user services.User) error | {
data, err := services.GetUserMarshaler().MarshalUser(user)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("users"), &upsertUserRawReq{User: data})
return trace.Wrap(err)
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1302-L1305 | go | train | // ChangePassword changes user password | func (c *Client) ChangePassword(req services.ChangePasswordReq) error | // ChangePassword changes user password
func (c *Client) ChangePassword(req services.ChangePasswordReq) error | {
_, err := c.PutJSON(c.Endpoint("users", req.User, "web", "password"), req)
return trace.Wrap(err)
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1308-L1316 | go | train | // CheckPassword checks if the suplied web access password is valid. | func (c *Client) CheckPassword(user string, password []byte, otpToken string) error | // CheckPassword checks if the suplied web access password is valid.
func (c *Client) CheckPassword(user string, password []byte, otpToken string) error | {
_, err := c.PostJSON(
c.Endpoint("users", user, "web", "password", "check"),
checkPasswordReq{
Password: string(password),
OTPToken: otpToken,
})
return trace.Wrap(err)
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1319-L1334 | go | train | // GetU2FSignRequest generates request for user trying to authenticate with U2F token | func (c *Client) GetU2FSignRequest(user string, password []byte) (*u2f.SignRequest, error) | // GetU2FSignRequest generates request for user trying to authenticate with U2F token
func (c *Client) GetU2FSignRequest(user string, password []byte) (*u2f.SignRequest, error) | {
out, err := c.PostJSON(
c.Endpoint("u2f", "users", user, "sign"),
signInReq{
Password: string(password),
},
)
if err != nil {
return nil, trace.Wrap(err)
}
var signRequest *u2f.SignRequest
if err := json.Unmarshal(out.Bytes(), &signRequest); err != nil {
return nil, err
}
return signRequest, nil... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1338-L1349 | go | train | // ExtendWebSession creates a new web session for a user based on another
// valid web session | func (c *Client) ExtendWebSession(user string, prevSessionID string) (services.WebSession, error) | // ExtendWebSession creates a new web session for a user based on another
// valid web session
func (c *Client) ExtendWebSession(user string, prevSessionID string) (services.WebSession, error) | {
out, err := c.PostJSON(
c.Endpoint("users", user, "web", "sessions"),
createWebSessionReq{
PrevSessionID: prevSessionID,
},
)
if err != nil {
return nil, trace.Wrap(err)
}
return services.GetWebSessionMarshaler().UnmarshalWebSession(out.Bytes())
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1365-L1374 | go | train | // AuthenticateWebUser authenticates web user, creates and returns web session
// in case if authentication is successful | func (c *Client) AuthenticateWebUser(req AuthenticateUserRequest) (services.WebSession, error) | // AuthenticateWebUser authenticates web user, creates and returns web session
// in case if authentication is successful
func (c *Client) AuthenticateWebUser(req AuthenticateUserRequest) (services.WebSession, error) | {
out, err := c.PostJSON(
c.Endpoint("users", req.Username, "web", "authenticate"),
req,
)
if err != nil {
return nil, trace.Wrap(err)
}
return services.GetWebSessionMarshaler().UnmarshalWebSession(out.Bytes())
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1378-L1391 | go | train | // AuthenticateSSHUser authenticates SSH console user, creates and returns a pair of signed TLS and SSH
// short lived certificates as a result | func (c *Client) AuthenticateSSHUser(req AuthenticateSSHRequest) (*SSHLoginResponse, error) | // AuthenticateSSHUser authenticates SSH console user, creates and returns a pair of signed TLS and SSH
// short lived certificates as a result
func (c *Client) AuthenticateSSHUser(req AuthenticateSSHRequest) (*SSHLoginResponse, error) | {
out, err := c.PostJSON(
c.Endpoint("users", req.Username, "ssh", "authenticate"),
req,
)
if err != nil {
return nil, trace.Wrap(err)
}
var re SSHLoginResponse
if err := json.Unmarshal(out.Bytes(), &re); err != nil {
return nil, trace.Wrap(err)
}
return &re, nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1395-L1402 | go | train | // GetWebSessionInfo checks if a web sesion is valid, returns session id in case if
// it is valid, or error otherwise. | func (c *Client) GetWebSessionInfo(user string, sid string) (services.WebSession, error) | // GetWebSessionInfo checks if a web sesion is valid, returns session id in case if
// it is valid, or error otherwise.
func (c *Client) GetWebSessionInfo(user string, sid string) (services.WebSession, error) | {
out, err := c.Get(
c.Endpoint("users", user, "web", "sessions", sid), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
return services.GetWebSessionMarshaler().UnmarshalWebSession(out.Bytes())
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1405-L1408 | go | train | // DeleteWebSession deletes a web session for this user by id | func (c *Client) DeleteWebSession(user string, sid string) error | // DeleteWebSession deletes a web session for this user by id
func (c *Client) DeleteWebSession(user string, sid string) error | {
_, err := c.Delete(c.Endpoint("users", user, "web", "sessions", sid))
return trace.Wrap(err)
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1411-L1424 | go | train | // GetUser returns a list of usernames registered in the system | func (c *Client) GetUser(name string) (services.User, error) | // GetUser returns a list of usernames registered in the system
func (c *Client) GetUser(name string) (services.User, error) | {
if name == "" {
return nil, trace.BadParameter("missing username")
}
out, err := c.Get(c.Endpoint("users", name), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
user, err := services.GetUserMarshaler().UnmarshalUser(out.Bytes(), services.SkipValidation())
if err != nil {
return nil, trace.W... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1427-L1445 | go | train | // GetUsers returns a list of usernames registered in the system | func (c *Client) GetUsers() ([]services.User, error) | // GetUsers returns a list of usernames registered in the system
func (c *Client) GetUsers() ([]services.User, error) | {
out, err := c.Get(c.Endpoint("users"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
var items []json.RawMessage
if err := json.Unmarshal(out.Bytes(), &items); err != nil {
return nil, trace.Wrap(err)
}
users := make([]services.User, len(items))
for i, userBytes := range items {
user, err... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1448-L1451 | go | train | // DeleteUser deletes a user by username | func (c *Client) DeleteUser(user string) error | // DeleteUser deletes a user by username
func (c *Client) DeleteUser(user string) error | {
_, err := c.Delete(c.Endpoint("users", user))
return trace.Wrap(err)
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1456-L1466 | go | train | // GenerateKeyPair generates SSH private/public key pair optionally protected
// by password. If the pass parameter is an empty string, the key pair
// is not password-protected. | func (c *Client) GenerateKeyPair(pass string) ([]byte, []byte, error) | // GenerateKeyPair generates SSH private/public key pair optionally protected
// by password. If the pass parameter is an empty string, the key pair
// is not password-protected.
func (c *Client) GenerateKeyPair(pass string) ([]byte, []byte, error) | {
out, err := c.PostJSON(c.Endpoint("keypair"), generateKeyPairReq{Password: pass})
if err != nil {
return nil, nil, trace.Wrap(err)
}
var kp *generateKeyPairResponse
if err := json.Unmarshal(out.Bytes(), &kp); err != nil {
return nil, nil, err
}
return kp.PrivKey, []byte(kp.PubKey), err
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1471-L1494 | go | train | // GenerateHostCert takes the public key in the Open SSH ``authorized_keys``
// plain text format, signs it using Host Certificate Authority private key and returns the
// resulting certificate. | func (c *Client) GenerateHostCert(
key []byte, hostID, nodeName string, principals []string, clusterName string, roles teleport.Roles, ttl time.Duration) ([]byte, error) | // GenerateHostCert takes the public key in the Open SSH ``authorized_keys``
// plain text format, signs it using Host Certificate Authority private key and returns the
// resulting certificate.
func (c *Client) GenerateHostCert(
key []byte, hostID, nodeName string, principals []string, clusterName string, roles telep... | {
out, err := c.PostJSON(c.Endpoint("ca", "host", "certs"),
generateHostCertReq{
Key: key,
HostID: hostID,
NodeName: nodeName,
Principals: principals,
ClusterName: clusterName,
Roles: roles,
TTL: ttl,
})
if err != nil {
return nil, trace.Wrap(err)
}
var c... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1498-L1514 | go | train | // CreateSignupToken creates one time token for creating account for the user
// For each token it creates username and otp generator | func (c *Client) CreateSignupToken(user services.UserV1, ttl time.Duration) (string, error) | // CreateSignupToken creates one time token for creating account for the user
// For each token it creates username and otp generator
func (c *Client) CreateSignupToken(user services.UserV1, ttl time.Duration) (string, error) | {
if err := user.Check(); err != nil {
return "", trace.Wrap(err)
}
out, err := c.PostJSON(c.Endpoint("signuptokens"), createSignupTokenReq{
User: user,
TTL: ttl,
})
if err != nil {
return "", trace.Wrap(err)
}
var token string
if err := json.Unmarshal(out.Bytes(), &token); err != nil {
return "", t... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1517-L1529 | go | train | // GetSignupTokenData returns token data for a valid token | func (c *Client) GetSignupTokenData(token string) (user string, otpQRCode []byte, e error) | // GetSignupTokenData returns token data for a valid token
func (c *Client) GetSignupTokenData(token string) (user string, otpQRCode []byte, e error) | {
out, err := c.Get(c.Endpoint("signuptokens", token), url.Values{})
if err != nil {
return "", nil, err
}
var tokenData getSignupTokenDataResponse
if err := json.Unmarshal(out.Bytes(), &tokenData); err != nil {
return "", nil, err
}
return tokenData.User, tokenData.QRImg, nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1534-L1550 | go | train | // GenerateUserCert takes the public key in the OpenSSH `authorized_keys` plain
// text format, signs it using User Certificate Authority signing key and
// returns the resulting certificate. | func (c *Client) GenerateUserCert(key []byte, user string, ttl time.Duration, compatibility string) ([]byte, error) | // GenerateUserCert takes the public key in the OpenSSH `authorized_keys` plain
// text format, signs it using User Certificate Authority signing key and
// returns the resulting certificate.
func (c *Client) GenerateUserCert(key []byte, user string, ttl time.Duration, compatibility string) ([]byte, error) | {
out, err := c.PostJSON(c.Endpoint("ca", "user", "certs"),
generateUserCertReq{
Key: key,
User: user,
TTL: ttl,
Compatibility: compatibility,
})
if err != nil {
return nil, trace.Wrap(err)
}
var cert string
if err := json.Unmarshal(out.Bytes(), &cert); err != nil {
... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1553-L1563 | go | train | // GetSignupU2FRegisterRequest generates sign request for user trying to sign up with invite tokenx | func (c *Client) GetSignupU2FRegisterRequest(token string) (u2fRegisterRequest *u2f.RegisterRequest, e error) | // GetSignupU2FRegisterRequest generates sign request for user trying to sign up with invite tokenx
func (c *Client) GetSignupU2FRegisterRequest(token string) (u2fRegisterRequest *u2f.RegisterRequest, e error) | {
out, err := c.Get(c.Endpoint("u2f", "signuptokens", token), url.Values{})
if err != nil {
return nil, err
}
var u2fRegReq u2f.RegisterRequest
if err := json.Unmarshal(out.Bytes(), &u2fRegReq); err != nil {
return nil, err
}
return &u2fRegReq, nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1568-L1578 | go | train | // CreateUserWithOTP creates account with provided token and password.
// Account username and OTP key are taken from token data.
// Deletes token after account creation. | func (c *Client) CreateUserWithOTP(token, password, otpToken string) (services.WebSession, error) | // CreateUserWithOTP creates account with provided token and password.
// Account username and OTP key are taken from token data.
// Deletes token after account creation.
func (c *Client) CreateUserWithOTP(token, password, otpToken string) (services.WebSession, error) | {
out, err := c.PostJSON(c.Endpoint("signuptokens", "users"), createUserWithTokenReq{
Token: token,
Password: password,
OTPToken: otpToken,
})
if err != nil {
return nil, trace.Wrap(err)
}
return services.GetWebSessionMarshaler().UnmarshalWebSession(out.Bytes())
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1594-L1604 | go | train | // CreateUserWithU2FToken creates user account with provided token and U2F sign response | func (c *Client) CreateUserWithU2FToken(token string, password string, u2fRegisterResponse u2f.RegisterResponse) (services.WebSession, error) | // CreateUserWithU2FToken creates user account with provided token and U2F sign response
func (c *Client) CreateUserWithU2FToken(token string, password string, u2fRegisterResponse u2f.RegisterResponse) (services.WebSession, error) | {
out, err := c.PostJSON(c.Endpoint("u2f", "users"), createUserWithU2FTokenReq{
Token: token,
Password: password,
U2FRegisterResponse: u2fRegisterResponse,
})
if err != nil {
return nil, trace.Wrap(err)
}
return services.GetWebSessionMarshaler().UnmarshalWebSession(out.Bytes())
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1607-L1619 | go | train | // UpsertOIDCConnector updates or creates OIDC connector | func (c *Client) UpsertOIDCConnector(connector services.OIDCConnector) error | // UpsertOIDCConnector updates or creates OIDC connector
func (c *Client) UpsertOIDCConnector(connector services.OIDCConnector) error | {
data, err := services.GetOIDCConnectorMarshaler().MarshalOIDCConnector(connector)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("oidc", "connectors"), &upsertOIDCConnectorRawReq{
Connector: data,
})
if err != nil {
return trace.Wrap(err)
}
return nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1622-L1632 | go | train | // GetOIDCConnector returns OIDC connector information by id | func (c *Client) GetOIDCConnector(id string, withSecrets bool) (services.OIDCConnector, error) | // GetOIDCConnector returns OIDC connector information by id
func (c *Client) GetOIDCConnector(id string, withSecrets bool) (services.OIDCConnector, error) | {
if id == "" {
return nil, trace.BadParameter("missing connector id")
}
out, err := c.Get(c.Endpoint("oidc", "connectors", id),
url.Values{"with_secrets": []string{fmt.Sprintf("%t", withSecrets)}})
if err != nil {
return nil, err
}
return services.GetOIDCConnectorMarshaler().UnmarshalOIDCConnector(out.Byt... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1635-L1654 | go | train | // GetOIDCConnector gets OIDC connectors list | func (c *Client) GetOIDCConnectors(withSecrets bool) ([]services.OIDCConnector, error) | // GetOIDCConnector gets OIDC connectors list
func (c *Client) GetOIDCConnectors(withSecrets bool) ([]services.OIDCConnector, error) | {
out, err := c.Get(c.Endpoint("oidc", "connectors"),
url.Values{"with_secrets": []string{fmt.Sprintf("%t", withSecrets)}})
if err != nil {
return nil, err
}
var items []json.RawMessage
if err := json.Unmarshal(out.Bytes(), &items); err != nil {
return nil, trace.Wrap(err)
}
connectors := make([]services.... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1666-L1678 | go | train | // CreateOIDCAuthRequest creates OIDCAuthRequest | func (c *Client) CreateOIDCAuthRequest(req services.OIDCAuthRequest) (*services.OIDCAuthRequest, error) | // CreateOIDCAuthRequest creates OIDCAuthRequest
func (c *Client) CreateOIDCAuthRequest(req services.OIDCAuthRequest) (*services.OIDCAuthRequest, error) | {
out, err := c.PostJSON(c.Endpoint("oidc", "requests", "create"), createOIDCAuthRequestReq{
Req: req,
})
if err != nil {
return nil, trace.Wrap(err)
}
var response *services.OIDCAuthRequest
if err := json.Unmarshal(out.Bytes(), &response); err != nil {
return nil, trace.Wrap(err)
}
return response, nil
... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1718-L1730 | go | train | // CreateOIDCConnector creates SAML connector | func (c *Client) CreateSAMLConnector(connector services.SAMLConnector) error | // CreateOIDCConnector creates SAML connector
func (c *Client) CreateSAMLConnector(connector services.SAMLConnector) error | {
data, err := services.GetSAMLConnectorMarshaler().MarshalSAMLConnector(connector)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("saml", "connectors"), &createSAMLConnectorRawReq{
Connector: data,
})
if err != nil {
return trace.Wrap(err)
}
return nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1733-L1745 | go | train | // UpsertSAMLConnector updates or creates OIDC connector | func (c *Client) UpsertSAMLConnector(connector services.SAMLConnector) error | // UpsertSAMLConnector updates or creates OIDC connector
func (c *Client) UpsertSAMLConnector(connector services.SAMLConnector) error | {
data, err := services.GetSAMLConnectorMarshaler().MarshalSAMLConnector(connector)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PutJSON(c.Endpoint("saml", "connectors"), &upsertSAMLConnectorRawReq{
Connector: data,
})
if err != nil {
return trace.Wrap(err)
}
return nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1748-L1758 | go | train | // GetOIDCConnector returns SAML connector information by id | func (c *Client) GetSAMLConnector(id string, withSecrets bool) (services.SAMLConnector, error) | // GetOIDCConnector returns SAML connector information by id
func (c *Client) GetSAMLConnector(id string, withSecrets bool) (services.SAMLConnector, error) | {
if id == "" {
return nil, trace.BadParameter("missing connector id")
}
out, err := c.Get(c.Endpoint("saml", "connectors", id),
url.Values{"with_secrets": []string{fmt.Sprintf("%t", withSecrets)}})
if err != nil {
return nil, trace.Wrap(err)
}
return services.GetSAMLConnectorMarshaler().UnmarshalSAMLConne... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1761-L1780 | go | train | // GetSAMLConnectors gets SAML connectors list | func (c *Client) GetSAMLConnectors(withSecrets bool) ([]services.SAMLConnector, error) | // GetSAMLConnectors gets SAML connectors list
func (c *Client) GetSAMLConnectors(withSecrets bool) ([]services.SAMLConnector, error) | {
out, err := c.Get(c.Endpoint("saml", "connectors"),
url.Values{"with_secrets": []string{fmt.Sprintf("%t", withSecrets)}})
if err != nil {
return nil, err
}
var items []json.RawMessage
if err := json.Unmarshal(out.Bytes(), &items); err != nil {
return nil, trace.Wrap(err)
}
connectors := make([]services.... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1783-L1789 | go | train | // DeleteSAMLConnector deletes SAML connector by ID | func (c *Client) DeleteSAMLConnector(connectorID string) error | // DeleteSAMLConnector deletes SAML connector by ID
func (c *Client) DeleteSAMLConnector(connectorID string) error | {
if connectorID == "" {
return trace.BadParameter("missing connector id")
}
_, err := c.Delete(c.Endpoint("saml", "connectors", connectorID))
return trace.Wrap(err)
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1792-L1804 | go | train | // CreateSAMLAuthRequest creates SAML AuthnRequest | func (c *Client) CreateSAMLAuthRequest(req services.SAMLAuthRequest) (*services.SAMLAuthRequest, error) | // CreateSAMLAuthRequest creates SAML AuthnRequest
func (c *Client) CreateSAMLAuthRequest(req services.SAMLAuthRequest) (*services.SAMLAuthRequest, error) | {
out, err := c.PostJSON(c.Endpoint("saml", "requests", "create"), createSAMLAuthRequestReq{
Req: req,
})
if err != nil {
return nil, trace.Wrap(err)
}
var response *services.SAMLAuthRequest
if err := json.Unmarshal(out.Bytes(), &response); err != nil {
return nil, trace.Wrap(err)
}
return response, nil
... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1807-L1841 | go | train | // ValidateSAMLResponse validates response returned by SAML identity provider | func (c *Client) ValidateSAMLResponse(re string) (*SAMLAuthResponse, error) | // ValidateSAMLResponse validates response returned by SAML identity provider
func (c *Client) ValidateSAMLResponse(re string) (*SAMLAuthResponse, error) | {
out, err := c.PostJSON(c.Endpoint("saml", "requests", "validate"), validateSAMLResponseReq{
Response: re,
})
if err != nil {
return nil, trace.Wrap(err)
}
var rawResponse *samlAuthRawResponse
if err := json.Unmarshal(out.Bytes(), &rawResponse); err != nil {
return nil, trace.Wrap(err)
}
response := SAM... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1844-L1856 | go | train | // CreateGithubConnector creates a new Github connector | func (c *Client) CreateGithubConnector(connector services.GithubConnector) error | // CreateGithubConnector creates a new Github connector
func (c *Client) CreateGithubConnector(connector services.GithubConnector) error | {
bytes, err := services.GetGithubConnectorMarshaler().Marshal(connector)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("github", "connectors"), &createGithubConnectorRawReq{
Connector: bytes,
})
if err != nil {
return trace.Wrap(err)
}
return nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1859-L1871 | go | train | // UpsertGithubConnector creates or updates a Github connector | func (c *Client) UpsertGithubConnector(connector services.GithubConnector) error | // UpsertGithubConnector creates or updates a Github connector
func (c *Client) UpsertGithubConnector(connector services.GithubConnector) error | {
bytes, err := services.GetGithubConnectorMarshaler().Marshal(connector)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PutJSON(c.Endpoint("github", "connectors"), &upsertGithubConnectorRawReq{
Connector: bytes,
})
if err != nil {
return trace.Wrap(err)
}
return nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1874-L1894 | go | train | // GetGithubConnectors returns all configured Github connectors | func (c *Client) GetGithubConnectors(withSecrets bool) ([]services.GithubConnector, error) | // GetGithubConnectors returns all configured Github connectors
func (c *Client) GetGithubConnectors(withSecrets bool) ([]services.GithubConnector, error) | {
out, err := c.Get(c.Endpoint("github", "connectors"), url.Values{
"with_secrets": []string{strconv.FormatBool(withSecrets)},
})
if err != nil {
return nil, trace.Wrap(err)
}
var items []json.RawMessage
if err := json.Unmarshal(out.Bytes(), &items); err != nil {
return nil, trace.Wrap(err)
}
connectors ... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1897-L1905 | go | train | // GetGithubConnector returns the specified Github connector | func (c *Client) GetGithubConnector(id string, withSecrets bool) (services.GithubConnector, error) | // GetGithubConnector returns the specified Github connector
func (c *Client) GetGithubConnector(id string, withSecrets bool) (services.GithubConnector, error) | {
out, err := c.Get(c.Endpoint("github", "connectors", id), url.Values{
"with_secrets": []string{strconv.FormatBool(withSecrets)},
})
if err != nil {
return nil, trace.Wrap(err)
}
return services.GetGithubConnectorMarshaler().Unmarshal(out.Bytes())
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1908-L1914 | go | train | // DeleteGithubConnector deletes the specified Github connector | func (c *Client) DeleteGithubConnector(id string) error | // DeleteGithubConnector deletes the specified Github connector
func (c *Client) DeleteGithubConnector(id string) error | {
_, err := c.Delete(c.Endpoint("github", "connectors", id))
if err != nil {
return trace.Wrap(err)
}
return nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1917-L1928 | go | train | // CreateGithubAuthRequest creates a new request for Github OAuth2 flow | func (c *Client) CreateGithubAuthRequest(req services.GithubAuthRequest) (*services.GithubAuthRequest, error) | // CreateGithubAuthRequest creates a new request for Github OAuth2 flow
func (c *Client) CreateGithubAuthRequest(req services.GithubAuthRequest) (*services.GithubAuthRequest, error) | {
out, err := c.PostJSON(c.Endpoint("github", "requests", "create"),
createGithubAuthRequestReq{Req: req})
if err != nil {
return nil, trace.Wrap(err)
}
var response services.GithubAuthRequest
if err := json.Unmarshal(out.Bytes(), &response); err != nil {
return nil, trace.Wrap(err)
}
return &response, ni... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1931-L1965 | go | train | // ValidateGithubAuthCallback validates Github auth callback returned from redirect | func (c *Client) ValidateGithubAuthCallback(q url.Values) (*GithubAuthResponse, error) | // ValidateGithubAuthCallback validates Github auth callback returned from redirect
func (c *Client) ValidateGithubAuthCallback(q url.Values) (*GithubAuthResponse, error) | {
out, err := c.PostJSON(c.Endpoint("github", "requests", "validate"),
validateGithubAuthCallbackReq{Query: q})
if err != nil {
return nil, trace.Wrap(err)
}
var rawResponse githubAuthRawResponse
if err := json.Unmarshal(out.Bytes(), &rawResponse); err != nil {
return nil, trace.Wrap(err)
}
response := Gi... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1968-L1979 | go | train | // EmitAuditEvent sends an auditable event to the auth server (part of evets.IAuditLog interface) | func (c *Client) EmitAuditEvent(event events.Event, fields events.EventFields) error | // EmitAuditEvent sends an auditable event to the auth server (part of evets.IAuditLog interface)
func (c *Client) EmitAuditEvent(event events.Event, fields events.EventFields) error | {
_, err := c.PostJSON(c.Endpoint("events"), &auditEventReq{
Event: event,
Fields: fields,
// Send "type" as well for backwards compatibility.
Type: event.Name,
})
if err != nil {
return trace.Wrap(err)
}
return nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L1986-L2006 | go | train | // PostSessionSlice allows clients to submit session stream chunks to the audit log
// (part of evets.IAuditLog interface)
//
// The data is POSTed to HTTP server as a simple binary body (no encodings of any
// kind are needed) | func (c *Client) PostSessionSlice(slice events.SessionSlice) error | // PostSessionSlice allows clients to submit session stream chunks to the audit log
// (part of evets.IAuditLog interface)
//
// The data is POSTed to HTTP server as a simple binary body (no encodings of any
// kind are needed)
func (c *Client) PostSessionSlice(slice events.SessionSlice) error | {
data, err := slice.Marshal()
if err != nil {
return trace.Wrap(err)
}
r, err := http.NewRequest("POST", c.Endpoint("namespaces", slice.Namespace, "sessions", string(slice.SessionID), "slice"), bytes.NewReader(data))
if err != nil {
return trace.Wrap(err)
}
r.Header.Set("Content-Type", "application/grpc")
... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2011-L2024 | go | train | // GetSessionChunk allows clients to receive a byte array (chunk) from a recorded
// session stream, starting from 'offset', up to 'max' in length. The upper bound
// of 'max' is set to events.MaxChunkBytes | func (c *Client) GetSessionChunk(namespace string, sid session.ID, offsetBytes, maxBytes int) ([]byte, error) | // GetSessionChunk allows clients to receive a byte array (chunk) from a recorded
// session stream, starting from 'offset', up to 'max' in length. The upper bound
// of 'max' is set to events.MaxChunkBytes
func (c *Client) GetSessionChunk(namespace string, sid session.ID, offsetBytes, maxBytes int) ([]byte, error) | {
if namespace == "" {
return nil, trace.BadParameter(MissingNamespaceError)
}
response, err := c.Get(c.Endpoint("namespaces", namespace, "sessions", string(sid), "stream"), url.Values{
"offset": []string{strconv.Itoa(offsetBytes)},
"bytes": []string{strconv.Itoa(maxBytes)},
})
if err != nil {
log.Error(... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2027-L2042 | go | train | // UploadSessionRecording uploads session recording to the audit server | func (c *Client) UploadSessionRecording(r events.SessionRecording) error | // UploadSessionRecording uploads session recording to the audit server
func (c *Client) UploadSessionRecording(r events.SessionRecording) error | {
file := roundtrip.File{
Name: "recording",
Filename: "recording",
Reader: r.Recording,
}
values := url.Values{
"sid": []string{string(r.SessionID)},
"namespace": []string{r.Namespace},
}
_, err := c.PostForm(c.Endpoint("namespaces", r.Namespace, "sessions", string(r.SessionID), "recording"... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2052-L2072 | go | train | // Returns events that happen during a session sorted by time
// (oldest first).
//
// afterN allows to filter by "newer than N" value where N is the cursor ID
// of previously returned bunch (good for polling for latest)
//
// This function is usually used in conjunction with GetSessionReader to
// replay recorded ses... | func (c *Client) GetSessionEvents(namespace string, sid session.ID, afterN int, includePrintEvents bool) (retval []events.EventFields, err error) | // Returns events that happen during a session sorted by time
// (oldest first).
//
// afterN allows to filter by "newer than N" value where N is the cursor ID
// of previously returned bunch (good for polling for latest)
//
// This function is usually used in conjunction with GetSessionReader to
// replay recorded ses... | {
if namespace == "" {
return nil, trace.BadParameter(MissingNamespaceError)
}
query := make(url.Values)
if afterN > 0 {
query.Set("after", strconv.Itoa(afterN))
}
if includePrintEvents {
query.Set("print", fmt.Sprintf("%v", includePrintEvents))
}
response, err := c.Get(c.Endpoint("namespaces", namespace... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2075-L2092 | go | train | // SearchEvents returns events that fit the criteria | func (c *Client) SearchEvents(from, to time.Time, query string, limit int) ([]events.EventFields, error) | // SearchEvents returns events that fit the criteria
func (c *Client) SearchEvents(from, to time.Time, query string, limit int) ([]events.EventFields, error) | {
q, err := url.ParseQuery(query)
if err != nil {
return nil, trace.BadParameter("query")
}
q.Set("from", from.Format(time.RFC3339))
q.Set("to", to.Format(time.RFC3339))
q.Set("limit", fmt.Sprintf("%v", limit))
response, err := c.Get(c.Endpoint("events"), q)
if err != nil {
return nil, trace.Wrap(err)
}
... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2116-L2126 | go | train | // GetNamespaces returns a list of namespaces | func (c *Client) GetNamespaces() ([]services.Namespace, error) | // GetNamespaces returns a list of namespaces
func (c *Client) GetNamespaces() ([]services.Namespace, error) | {
out, err := c.Get(c.Endpoint("namespaces"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
var re []services.Namespace
if err := utils.FastUnmarshal(out.Bytes(), &re); err != nil {
return nil, trace.Wrap(err)
}
return re, nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2129-L2138 | go | train | // GetNamespace returns namespace by name | func (c *Client) GetNamespace(name string) (*services.Namespace, error) | // GetNamespace returns namespace by name
func (c *Client) GetNamespace(name string) (*services.Namespace, error) | {
if name == "" {
return nil, trace.BadParameter("missing namespace name")
}
out, err := c.Get(c.Endpoint("namespaces", name), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
return services.UnmarshalNamespace(out.Bytes(), services.SkipValidation())
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2141-L2144 | go | train | // UpsertNamespace upserts namespace | func (c *Client) UpsertNamespace(ns services.Namespace) error | // UpsertNamespace upserts namespace
func (c *Client) UpsertNamespace(ns services.Namespace) error | {
_, err := c.PostJSON(c.Endpoint("namespaces"), upsertNamespaceReq{Namespace: ns})
return trace.Wrap(err)
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2153-L2171 | go | train | // GetRoles returns a list of roles | func (c *Client) GetRoles() ([]services.Role, error) | // GetRoles returns a list of roles
func (c *Client) GetRoles() ([]services.Role, error) | {
out, err := c.Get(c.Endpoint("roles"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
var items []json.RawMessage
if err := json.Unmarshal(out.Bytes(), &items); err != nil {
return nil, trace.Wrap(err)
}
roles := make([]services.Role, len(items))
for i, roleBytes := range items {
role, err... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2179-L2186 | go | train | // UpsertRole creates or updates role | func (c *Client) UpsertRole(role services.Role) error | // UpsertRole creates or updates role
func (c *Client) UpsertRole(role services.Role) error | {
data, err := services.GetRoleMarshaler().MarshalRole(role)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("roles"), &upsertRoleRawReq{Role: data})
return trace.Wrap(err)
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2189-L2202 | go | train | // GetRole returns role by name | func (c *Client) GetRole(name string) (services.Role, error) | // GetRole returns role by name
func (c *Client) GetRole(name string) (services.Role, error) | {
if name == "" {
return nil, trace.BadParameter("missing name")
}
out, err := c.Get(c.Endpoint("roles", name), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
role, err := services.GetRoleMarshaler().UnmarshalRole(out.Bytes(), services.SkipValidation())
if err != nil {
return nil, trace.Wrap(... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2211-L2223 | go | train | // GetClusterConfig returns cluster level configuration information. | func (c *Client) GetClusterConfig(opts ...services.MarshalOption) (services.ClusterConfig, error) | // GetClusterConfig returns cluster level configuration information.
func (c *Client) GetClusterConfig(opts ...services.MarshalOption) (services.ClusterConfig, error) | {
out, err := c.Get(c.Endpoint("configuration"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
cc, err := services.GetClusterConfigMarshaler().Unmarshal(out.Bytes(), services.SkipValidation())
if err != nil {
return nil, trace.Wrap(err)
}
return cc, err
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2226-L2238 | go | train | // SetClusterConfig sets cluster level configuration information. | func (c *Client) SetClusterConfig(cc services.ClusterConfig) error | // SetClusterConfig sets cluster level configuration information.
func (c *Client) SetClusterConfig(cc services.ClusterConfig) error | {
data, err := services.GetClusterConfigMarshaler().Marshal(cc)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("configuration"), &setClusterConfigReq{ClusterConfig: data})
if err != nil {
return trace.Wrap(err)
}
return nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2241-L2253 | go | train | // GetClusterName returns a cluster name | func (c *Client) GetClusterName(opts ...services.MarshalOption) (services.ClusterName, error) | // GetClusterName returns a cluster name
func (c *Client) GetClusterName(opts ...services.MarshalOption) (services.ClusterName, error) | {
out, err := c.Get(c.Endpoint("configuration", "name"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
cn, err := services.GetClusterNameMarshaler().Unmarshal(out.Bytes(), services.SkipValidation())
if err != nil {
return nil, trace.Wrap(err)
}
return cn, err
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2257-L2269 | go | train | // SetClusterName sets cluster name once, will
// return Already Exists error if the name is already set | func (c *Client) SetClusterName(cn services.ClusterName) error | // SetClusterName sets cluster name once, will
// return Already Exists error if the name is already set
func (c *Client) SetClusterName(cn services.ClusterName) error | {
data, err := services.GetClusterNameMarshaler().Marshal(cn)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("configuration", "name"), &setClusterNameReq{ClusterName: data})
if err != nil {
return trace.Wrap(err)
}
return nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2277-L2280 | go | train | // DeleteStaticTokens deletes static tokens | func (c *Client) DeleteStaticTokens() error | // DeleteStaticTokens deletes static tokens
func (c *Client) DeleteStaticTokens() error | {
_, err := c.Delete(c.Endpoint("configuration", "static_tokens"))
return trace.Wrap(err)
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2283-L2295 | go | train | // GetStaticTokens returns a list of static register tokens | func (c *Client) GetStaticTokens() (services.StaticTokens, error) | // GetStaticTokens returns a list of static register tokens
func (c *Client) GetStaticTokens() (services.StaticTokens, error) | {
out, err := c.Get(c.Endpoint("configuration", "static_tokens"), url.Values{})
if err != nil {
return nil, trace.Wrap(err)
}
st, err := services.GetStaticTokensMarshaler().Unmarshal(out.Bytes(), services.SkipValidation())
if err != nil {
return nil, trace.Wrap(err)
}
return st, err
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/auth/clt.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/clt.go#L2298-L2310 | go | train | // SetStaticTokens sets a list of static register tokens | func (c *Client) SetStaticTokens(st services.StaticTokens) error | // SetStaticTokens sets a list of static register tokens
func (c *Client) SetStaticTokens(st services.StaticTokens) error | {
data, err := services.GetStaticTokensMarshaler().Marshal(st)
if err != nil {
return trace.Wrap(err)
}
_, err = c.PostJSON(c.Endpoint("configuration", "static_tokens"), &setStaticTokensReq{StaticTokens: data})
if err != nil {
return trace.Wrap(err)
}
return nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/forward/subsystem.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/forward/subsystem.go#L45-L58 | go | train | // parseRemoteSubsystem returns *remoteSubsystem which can be used to run a subsystem on a remote node. | func parseRemoteSubsystem(ctx context.Context, subsytemName string, serverContext *srv.ServerContext) *remoteSubsystem | // parseRemoteSubsystem returns *remoteSubsystem which can be used to run a subsystem on a remote node.
func parseRemoteSubsystem(ctx context.Context, subsytemName string, serverContext *srv.ServerContext) *remoteSubsystem | {
return &remoteSubsystem{
log: log.WithFields(log.Fields{
trace.Component: teleport.ComponentRemoteSubsystem,
trace.ComponentFields: map[string]string{
"name": subsytemName,
},
}),
serverContext: serverContext,
subsytemName: subsytemName,
ctx: ctx,
errorCh: make(chan error, ... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/forward/subsystem.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/forward/subsystem.go#L61-L108 | go | train | // Start will begin execution of the remote subsytem on the passed in channel. | func (r *remoteSubsystem) Start(channel ssh.Channel) error | // Start will begin execution of the remote subsytem on the passed in channel.
func (r *remoteSubsystem) Start(channel ssh.Channel) error | {
session := r.serverContext.RemoteSession
stdout, err := session.StdoutPipe()
if err != nil {
return trace.Wrap(err)
}
stderr, err := session.StderrPipe()
if err != nil {
return trace.Wrap(err)
}
stdin, err := session.StdinPipe()
if err != nil {
return trace.Wrap(err)
}
// request the subsystem fro... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/forward/subsystem.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/forward/subsystem.go#L111-L130 | go | train | // Wait until the remote subsystem has finished execution and then return the last error. | func (r *remoteSubsystem) Wait() error | // Wait until the remote subsystem has finished execution and then return the last error.
func (r *remoteSubsystem) Wait() error | {
var lastErr error
for i := 0; i < 3; i++ {
select {
case err := <-r.errorCh:
if err != nil && err != io.EOF {
r.log.Warnf("Connection problem: %v %T", trace.DebugReport(err), err)
lastErr = err
}
case <-r.ctx.Done():
lastErr = trace.ConnectionProblem(nil, "context is closing")
}
}
// e... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/services/session.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L74-L84 | go | train | // NewWebSession returns new instance of the web session based on the V2 spec | func NewWebSession(name string, spec WebSessionSpecV2) WebSession | // NewWebSession returns new instance of the web session based on the V2 spec
func NewWebSession(name string, spec WebSessionSpecV2) WebSession | {
return &WebSessionV2{
Kind: KindWebSession,
Version: V2,
Metadata: Metadata{
Name: name,
Namespace: defaults.Namespace,
},
Spec: spec,
}
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/services/session.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L123-L127 | go | train | // WithoutSecrets returns copy of the object but without secrets | func (ws *WebSessionV2) WithoutSecrets() WebSession | // WithoutSecrets returns copy of the object but without secrets
func (ws *WebSessionV2) WithoutSecrets() WebSession | {
v2 := ws.V2()
v2.Spec.Priv = nil
return v2
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/services/session.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L130-L137 | go | train | // CheckAndSetDefaults checks and set default values for any missing fields. | func (ws *WebSessionV2) CheckAndSetDefaults() error | // CheckAndSetDefaults checks and set default values for any missing fields.
func (ws *WebSessionV2) CheckAndSetDefaults() error | {
err := ws.Metadata.CheckAndSetDefaults()
if err != nil {
return trace.Wrap(err)
}
return nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/services/session.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L155-L160 | go | train | // GetShortName returns visible short name used in logging | func (ws *WebSessionV2) GetShortName() string | // GetShortName returns visible short name used in logging
func (ws *WebSessionV2) GetShortName() string | {
if len(ws.Metadata.Name) < 4 {
return "<undefined>"
}
return ws.Metadata.Name[:4]
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/services/session.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L194-L196 | go | train | // SetBearerTokenExpiryTime sets bearer token expiry time | func (ws *WebSessionV2) SetBearerTokenExpiryTime(tm time.Time) | // SetBearerTokenExpiryTime sets bearer token expiry time
func (ws *WebSessionV2) SetBearerTokenExpiryTime(tm time.Time) | {
ws.Spec.BearerTokenExpires = tm
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/services/session.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L199-L201 | go | train | // SetExpiryTime sets session expiry time | func (ws *WebSessionV2) SetExpiryTime(tm time.Time) | // SetExpiryTime sets session expiry time
func (ws *WebSessionV2) SetExpiryTime(tm time.Time) | {
ws.Spec.Expires = tm
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/services/session.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L219-L227 | go | train | // V1 returns V1 version of the object | func (ws *WebSessionV2) V1() *WebSessionV1 | // V1 returns V1 version of the object
func (ws *WebSessionV2) V1() *WebSessionV1 | {
return &WebSessionV1{
ID: ws.Metadata.Name,
Priv: ws.Spec.Priv,
Pub: ws.Spec.Pub,
BearerToken: ws.Spec.BearerToken,
Expires: ws.Spec.Expires,
}
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/services/session.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L269-L285 | go | train | // V2 returns V2 version of the resource | func (s *WebSessionV1) V2() *WebSessionV2 | // V2 returns V2 version of the resource
func (s *WebSessionV1) V2() *WebSessionV2 | {
return &WebSessionV2{
Kind: KindWebSession,
Version: V2,
Metadata: Metadata{
Name: s.ID,
Namespace: defaults.Namespace,
},
Spec: WebSessionSpecV2{
Pub: s.Pub,
Priv: s.Priv,
BearerToken: s.BearerToken,
Expires: s.Expires,
BearerTok... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/services/session.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L395-L397 | go | train | // GetWebSessionSchemaWithExtensions returns JSON Schema for web session with user-supplied extensions | func GetWebSessionSchemaWithExtensions(extension string) string | // GetWebSessionSchemaWithExtensions returns JSON Schema for web session with user-supplied extensions
func GetWebSessionSchemaWithExtensions(extension string) string | {
return fmt.Sprintf(V2SchemaTemplate, MetadataSchema, fmt.Sprintf(WebSessionSpecV2Schema, extension), DefaultDefinitions)
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/services/session.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L414-L445 | go | train | // UnmarshalWebSession unmarshals web session from on-disk byte format | func (*TeleportWebSessionMarshaler) UnmarshalWebSession(bytes []byte) (WebSession, error) | // UnmarshalWebSession unmarshals web session from on-disk byte format
func (*TeleportWebSessionMarshaler) UnmarshalWebSession(bytes []byte) (WebSession, error) | {
var h ResourceHeader
err := json.Unmarshal(bytes, &h)
if err != nil {
return nil, trace.Wrap(err)
}
switch h.Version {
case "":
var ws WebSessionV1
err := json.Unmarshal(bytes, &ws)
if err != nil {
return nil, trace.Wrap(err)
}
utils.UTC(&ws.Expires)
return ws.V2(), nil
case V2:
var ws WebS... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/services/session.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/session.go#L448-L484 | go | train | // MarshalWebSession marshals web session into on-disk representation | func (*TeleportWebSessionMarshaler) MarshalWebSession(ws WebSession, opts ...MarshalOption) ([]byte, error) | // MarshalWebSession marshals web session into on-disk representation
func (*TeleportWebSessionMarshaler) MarshalWebSession(ws WebSession, opts ...MarshalOption) ([]byte, error) | {
cfg, err := collectOptions(opts)
if err != nil {
return nil, trace.Wrap(err)
}
type ws1 interface {
V1() *WebSessionV1
}
type ws2 interface {
V2() *WebSessionV2
}
version := cfg.GetVersion()
switch version {
case V1:
v, ok := ws.(ws1)
if !ok {
return nil, trace.BadParameter("don't know how to ... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/sess.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L115-L145 | go | train | // emitSessionJoinEvent emits a session join event to both the Audit Log as
// well as sending a "x-teleport-event" global request on the SSH connection. | func (s *SessionRegistry) emitSessionJoinEvent(ctx *ServerContext) | // emitSessionJoinEvent emits a session join event to both the Audit Log as
// well as sending a "x-teleport-event" global request on the SSH connection.
func (s *SessionRegistry) emitSessionJoinEvent(ctx *ServerContext) | {
sessionJoinEvent := events.EventFields{
events.EventType: events.SessionJoinEvent,
events.SessionEventID: string(ctx.session.id),
events.EventNamespace: s.srv.GetNamespace(),
events.EventLogin: ctx.Identity.Login,
events.EventUser: ctx.Identity.TeleportUser,
events.LocalAddr: ct... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/sess.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L148-L185 | go | train | // OpenSession either joins an existing session or starts a new session. | func (s *SessionRegistry) OpenSession(ch ssh.Channel, req *ssh.Request, ctx *ServerContext) error | // OpenSession either joins an existing session or starts a new session.
func (s *SessionRegistry) OpenSession(ch ssh.Channel, req *ssh.Request, ctx *ServerContext) error | {
if ctx.session != nil {
ctx.Infof("Joining existing session %v.", ctx.session.id)
// Update the in-memory data structure that a party member has joined.
_, err := ctx.session.join(ch, req, ctx)
if err != nil {
return trace.Wrap(err)
}
// Emit session join event to both the Audit Log as well as over... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/sess.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L189-L216 | go | train | // emitSessionLeaveEvent emits a session leave event to both the Audit Log as
// well as sending a "x-teleport-event" global request on the SSH connection. | func (s *SessionRegistry) emitSessionLeaveEvent(party *party) | // emitSessionLeaveEvent emits a session leave event to both the Audit Log as
// well as sending a "x-teleport-event" global request on the SSH connection.
func (s *SessionRegistry) emitSessionLeaveEvent(party *party) | {
sessionLeaveEvent := events.EventFields{
events.EventType: events.SessionLeaveEvent,
events.SessionEventID: party.id.String(),
events.EventUser: party.user,
events.SessionServerID: party.serverID,
events.EventNamespace: s.srv.GetNamespace(),
}
// Emit session leave event to Audit Log.
pa... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/sess.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L219-L281 | go | train | // leaveSession removes the given party from this session. | func (s *SessionRegistry) leaveSession(party *party) error | // leaveSession removes the given party from this session.
func (s *SessionRegistry) leaveSession(party *party) error | {
sess := party.s
s.Lock()
defer s.Unlock()
// Emit session leave event to both the Audit Log as well as over the
// "x-teleport-event" channel in the SSH connection.
s.emitSessionLeaveEvent(party)
// Remove member from in-members representation of party.
if err := sess.removeParty(party); err != nil {
ret... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/sess.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L285-L300 | go | train | // getParties allows to safely return a list of parties connected to this
// session (as determined by ctx) | func (s *SessionRegistry) getParties(sess *session) []*party | // getParties allows to safely return a list of parties connected to this
// session (as determined by ctx)
func (s *SessionRegistry) getParties(sess *session) []*party | {
var parties []*party
if sess == nil {
return parties
}
sess.Lock()
defer sess.Unlock()
for _, p := range sess.parties {
parties = append(parties, p)
}
return parties
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/sess.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L305-L364 | go | train | // NotifyWinChange is called to notify all members in the party that the PTY
// size has changed. The notification is sent as a global SSH request and it
// is the responsibility of the client to update it's window size upon receipt. | func (s *SessionRegistry) NotifyWinChange(params rsession.TerminalParams, ctx *ServerContext) error | // NotifyWinChange is called to notify all members in the party that the PTY
// size has changed. The notification is sent as a global SSH request and it
// is the responsibility of the client to update it's window size upon receipt.
func (s *SessionRegistry) NotifyWinChange(params rsession.TerminalParams, ctx *ServerC... | {
if ctx.session == nil {
s.log.Debugf("Unable to update window size, no session found in context.")
return nil
}
sid := ctx.session.id
// Build the resize event.
resizeEvent := events.EventFields{
events.EventType: events.ResizeEvent,
events.EventNamespace: s.srv.GetNamespace(),
events.SessionEve... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/sess.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L428-L491 | go | train | // newSession creates a new session with a given ID within a given context. | func newSession(id rsession.ID, r *SessionRegistry, ctx *ServerContext) (*session, error) | // newSession creates a new session with a given ID within a given context.
func newSession(id rsession.ID, r *SessionRegistry, ctx *ServerContext) (*session, error) | {
serverSessions.Inc()
rsess := rsession.Session{
ID: id,
TerminalParams: rsession.TerminalParams{
W: teleport.DefaultTerminalWidth,
H: teleport.DefaultTerminalHeight,
},
Login: ctx.Identity.Login,
Created: time.Now().UTC(),
LastActive: time.Now().UTC(),
ServerID: ctx.srv.ID(),
Namesp... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/sess.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L495-L500 | go | train | // isLingering returns true if every party has left this session. Occurs
// under a lock. | func (s *session) isLingering() bool | // isLingering returns true if every party has left this session. Occurs
// under a lock.
func (s *session) isLingering() bool | {
s.Lock()
defer s.Unlock()
return len(s.parties) == 0
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/sess.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L503-L529 | go | train | // Close ends the active session forcing all clients to disconnect and freeing all resources | func (s *session) Close() error | // Close ends the active session forcing all clients to disconnect and freeing all resources
func (s *session) Close() error | {
serverSessions.Dec()
s.closeOnce.Do(func() {
// closing needs to happen asynchronously because the last client
// (session writer) will try to close this session, causing a deadlock
// because of closeOnce
go func() {
s.log.Infof("Closing session %v", s.id)
if s.term != nil {
s.term.Close()
}
... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/sess.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L537-L698 | go | train | // start starts a new interactive process (or a shell) in the current session | func (s *session) start(ch ssh.Channel, ctx *ServerContext) error | // start starts a new interactive process (or a shell) in the current session
func (s *session) start(ch ssh.Channel, ctx *ServerContext) error | {
var err error
// create a new "party" (connected client)
p := newParty(s, ch, ctx)
// get the audit log from the server and create a session recorder. this will
// be a discard audit log if the proxy is in recording mode and a teleport
// node so we don't create double recordings.
auditLog := s.registry.srv... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/sess.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L712-L717 | go | train | // removePartyMember removes participant from in-memory representation of
// party members. Occurs under a lock. | func (s *session) removePartyMember(party *party) | // removePartyMember removes participant from in-memory representation of
// party members. Occurs under a lock.
func (s *session) removePartyMember(party *party) | {
s.Lock()
defer s.Unlock()
delete(s.parties, party.id)
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/sess.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L721-L730 | go | train | // removeParty removes the party from the in-memory map that holds all party
// members. | func (s *session) removeParty(p *party) error | // removeParty removes the party from the in-memory map that holds all party
// members.
func (s *session) removeParty(p *party) error | {
p.ctx.Infof("Removing party %v from session %v", p, s.id)
// Removes participant from in-memory map of party members.
s.removePartyMember(p)
s.writer.deleteWriter(string(p.id))
return nil
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/sess.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L750-L766 | go | train | // exportPartyMembers exports participants in the in-memory map of party
// members. Occurs under a lock. | func (s *session) exportPartyMembers() []rsession.Party | // exportPartyMembers exports participants in the in-memory map of party
// members. Occurs under a lock.
func (s *session) exportPartyMembers() []rsession.Party | {
s.Lock()
defer s.Unlock()
var partyList []rsession.Party
for _, p := range s.parties {
partyList = append(partyList, rsession.Party{
ID: p.id,
User: p.user,
ServerID: p.serverID,
RemoteAddr: p.site,
LastActive: p.getLastActive(),
})
}
return partyList
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/sess.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L772-L813 | go | train | // heartbeat will loop as long as the session is not closed and mark it as
// active and update the list of party members. If the session are recorded at
// the proxy, then this function does nothing as it's counterpart
// in the proxy will do this work. | func (s *session) heartbeat(ctx *ServerContext) | // heartbeat will loop as long as the session is not closed and mark it as
// active and update the list of party members. If the session are recorded at
// the proxy, then this function does nothing as it's counterpart
// in the proxy will do this work.
func (s *session) heartbeat(ctx *ServerContext) | {
// If sessions are being recorded at the proxy, an identical version of this
// goroutine is running in the proxy, which means it does not need to run here.
if ctx.ClusterConfig.GetSessionRecording() == services.RecordAtProxy &&
s.registry.srv.Component() == teleport.ComponentNode {
return
}
// If no sessi... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/sess.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L817-L822 | go | train | // addPartyMember adds participant to in-memory map of party members. Occurs
// under a lock. | func (s *session) addPartyMember(p *party) | // addPartyMember adds participant to in-memory map of party members. Occurs
// under a lock.
func (s *session) addPartyMember(p *party) | {
s.Lock()
defer s.Unlock()
s.parties[p.id] = p
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/sess.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L825-L865 | go | train | // addParty is called when a new party joins the session. | func (s *session) addParty(p *party) error | // addParty is called when a new party joins the session.
func (s *session) addParty(p *party) error | {
if s.login != p.login {
return trace.AccessDenied(
"can't switch users from %v to %v for session %v",
s.login, p.login, s.id)
}
// Adds participant to in-memory map of party members.
s.addPartyMember(p)
// Write last chunk (so the newly joined parties won't stare at a blank
// screen).
getRecentWrit... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/srv/sess.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/sess.go#L915-L946 | go | train | // Write multiplexes the input to multiple sub-writers. The entire point
// of multiWriter is to do this | func (m *multiWriter) Write(p []byte) (n int, err error) | // Write multiplexes the input to multiple sub-writers. The entire point
// of multiWriter is to do this
func (m *multiWriter) Write(p []byte) (n int, err error) | {
// lock and make a local copy of available writers:
getWriters := func() (writers []writerWrapper) {
m.RLock()
defer m.RUnlock()
writers = make([]writerWrapper, 0, len(m.writers))
for _, w := range m.writers {
writers = append(writers, w)
}
// add the recent write chunk to the "instant replay" buff... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/service/supervisor.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/supervisor.go#L96-L98 | go | train | // String returns user-friendly representation of the mapping. | func (e EventMapping) String() string | // String returns user-friendly representation of the mapping.
func (e EventMapping) String() string | {
return fmt.Sprintf("EventMapping(in=%v, out=%v)", e.In, e.Out)
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/service/supervisor.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/supervisor.go#L142-L166 | go | train | // NewSupervisor returns new instance of initialized supervisor | func NewSupervisor(id string) Supervisor | // NewSupervisor returns new instance of initialized supervisor
func NewSupervisor(id string) Supervisor | {
closeContext, cancel := context.WithCancel(context.TODO())
exitContext, signalExit := context.WithCancel(context.TODO())
reloadContext, signalReload := context.WithCancel(context.TODO())
srv := &LocalSupervisor{
id: id,
services: []Service{},
wg: &sync.WaitGroup{},
events: ... |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/service/supervisor.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/supervisor.go#L191-L195 | go | train | // ServiceCount returns the number of registered and actively running services | func (s *LocalSupervisor) ServiceCount() int | // ServiceCount returns the number of registered and actively running services
func (s *LocalSupervisor) ServiceCount() int | {
s.Lock()
defer s.Unlock()
return len(s.services)
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/service/supervisor.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/supervisor.go#L199-L201 | go | train | // RegisterFunc creates a service from function spec and registers
// it within the system | func (s *LocalSupervisor) RegisterFunc(name string, fn ServiceFunc) | // RegisterFunc creates a service from function spec and registers
// it within the system
func (s *LocalSupervisor) RegisterFunc(name string, fn ServiceFunc) | {
s.Register(&LocalService{Function: fn, ServiceName: name})
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/service/supervisor.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/supervisor.go#L206-L208 | go | train | // RegisterCriticalFunc creates a critical service from function spec and registers
// it within the system, if this service exits with error,
// the process shuts down. | func (s *LocalSupervisor) RegisterCriticalFunc(name string, fn ServiceFunc) | // RegisterCriticalFunc creates a critical service from function spec and registers
// it within the system, if this service exits with error,
// the process shuts down.
func (s *LocalSupervisor) RegisterCriticalFunc(name string, fn ServiceFunc) | {
s.Register(&LocalService{Function: fn, ServiceName: name, Critical: true})
} |
gravitational/teleport | d5243dbe8d36bba44bf640c08f1c49185ed2c8a4 | lib/service/supervisor.go | https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/service/supervisor.go#L211-L224 | go | train | // RemoveService removes service from supervisor tracking list | func (s *LocalSupervisor) RemoveService(srv Service) error | // RemoveService removes service from supervisor tracking list
func (s *LocalSupervisor) RemoveService(srv Service) error | {
l := logrus.WithFields(logrus.Fields{"service": srv.Name(), trace.Component: teleport.Component(teleport.ComponentProcess, s.id)})
s.Lock()
defer s.Unlock()
for i, el := range s.services {
if el == srv {
s.services = append(s.services[:i], s.services[i+1:]...)
l.Debugf("Service is completed and removed."... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.