id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c23500 | make([]column, columnCount),
rows: make([][]string, 0),
}
} | |
c23501 | t.columns[i].width = max(cellWidth, t.columns[i].width)
}
t.rows = append(t.rows, row[:limit])
} | |
c23502 | := range t.columns {
total += len(t.columns[i].title)
}
return total == 0
} | |
c23503 | url.Parse(in)
if err != nil {
return nil, trace.BadParameter("failed to parse URI %q: %v", in, err)
}
if u.Scheme == "" {
u.Scheme = teleport.SchemeFile
}
return u, nil
} | |
c23504 | }
log.Debugf("Starting tests with %v iterations.", iter)
return iter
} | |
c23505 |
The certificate presented by the proxy is invalid: %v.
Contact your Teleport system administrator to resolve this issue.`, innerError)
}
if log.GetLevel() == log.DebugLevel {
return trace.DebugReport(err)
}
if err != nil {
// If the error is a trace error, check if it has a user message embedded in
// ... | |
c23506 | app.HelpFlag.NoEnvar()
// set our own help template
return app.UsageTemplate(defaultUsageTemplate)
} | |
c23507 | if !strconv.IsPrint(r) {
return true
}
}
return false
} | |
c23508 |
Value: cmd.GetResult(),
})
}
sort.Sort(sortedLabels(uiLabels))
uiServers = append(uiServers, Server{
ClusterName: clusterName,
Name: server.GetName(),
Hostname: server.GetHostname(),
Addr: server.GetAddr(),
Labels: uiLabels,
})
}
return uiServers
} | |
c23509 |
case <-t.C:
log.Infof("Waiting for services: %v to finish.", process.Supervisor.Services())
}
}
} | |
c23510 | unused descriptor %v %v.", d.Type, d.Address)
errors = append(errors, d.File.Close())
}
}
return trace.NewAggregate(errors...)
} | |
c23511 | if err != nil {
return nil, trace.Wrap(err)
}
process.importedDescriptors = append(process.importedDescriptors[:i], process.importedDescriptors[i+1:]...)
process.registeredListeners = append(process.registeredListeners, RegisteredListener{Type: listenerType, Address: address, Listener: l})
return l, n... | |
c23512 | nil, trace.Wrap(err)
}
process.Lock()
defer process.Unlock()
r := RegisteredListener{Type: listenerType, Address: address, Listener: listener}
process.registeredListeners = append(process.registeredListeners, r)
return listener, nil
} | |
c23513 | return nil, trace.Wrap(err)
}
out = append(out, FileDescriptor{File: file, Type: r.Type, Address: r.Address})
}
return out, nil
} | |
c23514 | return nil, trace.BadParameter("child process has failed to read files, error %q", err)
}
if len(files) != 0 {
log.Infof("Child has been passed files: %v", files)
}
return files, nil
} | |
c23515 | Namespace: cfg.Namespace,
ForwardTo: cfg.ForwardTo,
})
if err != nil {
return nil, trace.Wrap(err)
}
sr := &ForwardRecorder{
ForwardRecorderConfig: cfg,
Entry: logrus.WithFields(logrus.Fields{
trace.Component: cfg.Component,
}),
AuditLog: auditLog,
}
return sr, nil
} | |
c23516 | SessionPrintEvent,
Data: dataCopy,
Time: time.Now().UTC().UnixNano(),
}
if err := r.AuditLog.PostSessionSlice(SessionSlice{
Namespace: r.Namespace,
SessionID: string(r.SessionID),
Chunks: []*SessionChunk{chunk},
}); err != nil {
r.Error(trace.DebugReport(err))
}
return len(data), nil
} | |
c23517 | not result in memory leak, but could result
// in missing playback events
context, cancel := context.WithTimeout(context.TODO(), defaults.ReadHeadersTimeout)
defer cancel() // releases resources if slowOperation completes before timeout elapses
err = r.AuditLog.WaitForDelivery(context)
if err != nil {
errors = ... | |
c23518 | break // success
}
if trace.IsAlreadyExists(err) { // locked? wait and repeat:
backend.Clock().Sleep(250 * time.Millisecond)
continue
}
return trace.ConvertSystemError(err)
}
return nil
} | |
c23519 |
if err := backend.Delete(ctx, key); err != nil {
return trace.Wrap(err)
}
return nil
} | |
c23520 | is required", c.ClusterName)
}
if err := c.Roles.Check(); err != nil {
return trace.Wrap(err)
}
return nil
} | |
c23521 |
return "", trace.Wrap(err)
}
return string(out), err
} | |
c23522 | &certRoles, []byte(data)); err != nil {
return nil, trace.BadParameter(err.Error())
}
return certRoles.Roles, nil
} | |
c23523 | keyPairs {
cert, err := tlsca.ParseCertificatePEM(keyPair.Cert)
if err != nil {
return nil, trace.Wrap(err)
}
certPool.AddCert(cert)
}
return certPool, nil
}
return certPool, nil
} | |
c23524 | {
out[i] = append([]byte{}, pair.Cert...)
}
return out
} | |
c23525 | SubKind: string(caType),
Metadata: Metadata{
Name: clusterName,
Namespace: defaults.Namespace,
},
Spec: CertAuthoritySpecV2{
Roles: roles,
Type: caType,
ClusterName: clusterName,
CheckingKeys: checkingKeys,
SigningKeys: signingKeys,
},
}
} | |
c23526 | := ca.(cav1)
if !ok {
return nil, trace.BadParameter("could not transform object to V1")
}
out[i] = *(v1.V1())
}
return out, nil
} | |
c23527 | utils.CopyByteSlice(kp.Key),
Cert: utils.CopyByteSlice(kp.Cert),
}
}
out.Spec.Roles = utils.CopyStrings(c.Spec.Roles)
return &out
} | |
c23528 | if c.Spec.Rotation == nil {
return Rotation{}
}
return *c.Spec.Rotation
} | |
c23529 | nil, trace.BadParameter("no TLS key pairs found for certificate authority")
}
return tlsca.New(c.Spec.TLSKeyPairs[0].Cert, c.Spec.TLSKeyPairs[0].Key)
} | |
c23530 | fmt.Sprintf("CA(name=%v, type=%v)", c.GetClusterName(), c.GetType())
} | |
c23531 | {
if r == name {
return
}
}
ca.Spec.Roles = append(ca.Spec.Roles, name)
} | |
c23532 | ca.Spec.SigningKeys = keys
return nil
} | |
c23533 | ca.Spec.CheckingKeys = keys
return nil
} | |
c23534 |
return CertAuthID{Type: ca.Spec.Type, DomainName: ca.Metadata.Name}
} | |
c23535 | RoleMap) {
c.Spec.RoleMap = []RoleMapping(m)
} | |
c23536 | no signing keys", ca.Metadata.Name)
}
return ca.Spec.SigningKeys[0], nil
} | |
c23537 | return nil, trace.BadParameter("invalid authority public key (len=%d): %v", len(keyBytes), err)
}
out = append(out, key)
}
return out, nil
} | |
c23538 | ssh.ParsePrivateKey(keyBytes)
if err != nil {
return nil, trace.Wrap(err)
}
out = append(out, signer)
}
return out, nil
} | |
c23539 | {
return trace.Wrap(err)
}
// This is to force users to migrate
if len(ca.Spec.Roles) != 0 && len(ca.Spec.RoleMap) != 0 {
return trace.BadParameter("should set either 'roles' or 'role_map', not both")
}
if err := RoleMap(ca.Spec.RoleMap).Check(); err != nil {
return trace.Wrap(err)
}
return nil
} | |
c23540 |
keyPairs[i].Key = nil
}
ca.SetTLSKeyPairs(keyPairs)
} | |
c23541 | == rotation.State && s.Phase == rotation.Phase
} | |
c23542 | rotated %v", r.LastRotated.Format(teleport.HumanDateFormatSeconds))
} | |
c23543 | case RotationPhaseUpdateClients:
return "rotating clients"
case RotationPhaseUpdateServers:
return "rotating servers"
case RotationPhaseRollback:
return "rolling back"
default:
return fmt.Sprintf("unknown phase: %q", r.Phase)
}
} | |
c23544 | r.Mode,
r.Started.Format(teleport.HumanDateFormatSeconds),
r.Started.Add(r.GracePeriod.Duration()).Format(teleport.HumanDateFormatSeconds),
)
default:
return "unknown"
}
} | |
c23545 | parameter for in progress rotation")
}
if r.Started.IsZero() {
return trace.BadParameter("set 'started' parameter for in progress rotation")
}
default:
return trace.BadParameter(
"unsupported rotation 'state': %q, supported states are: %q, %q",
r.State, RotationStateStandby, RotationStateInProgress)
... | |
c23546 | UpdateServers: clock.Now().UTC().Add((gracePeriod * 2) / 3).UTC(),
Standby: clock.Now().UTC().Add(gracePeriod).UTC(),
}, nil
} | |
c23547 | RotationPhaseUpdateServers)
}
if s.UpdateServers.Before(clock.Now()) {
return trace.BadParameter("phase %q can not be scheduled in the past", RotationPhaseUpdateServers)
}
if s.Standby.Before(clock.Now()) {
return trace.BadParameter("phase %q can not be scheduled in the past", RotationPhaseStandby)
}
return ... | |
c23548 | type=%v)", c.DomainName, c.Type)
} | |
c23549 | MetadataSchema, fmt.Sprintf(CertAuthoritySpecV2Schema, RotationSchema, RoleMapSchema), DefaultDefinitions)
} | |
c23550 |
return nil, trace.BadParameter(err.Error())
}
} else {
if err := utils.UnmarshalWithSchema(GetCertAuthoritySchema(), &ca, bytes); err != nil {
return nil, trace.BadParameter(err.Error())
}
}
if err := ca.CheckAndSetDefaults(); err != nil {
return nil, trace.Wrap(err)
}
if cfg.ID != 0 {
... | |
c23551 | if !ok {
return nil, trace.BadParameter("don't know how to marshal %v", V1)
}
return utils.FastMarshal(v.V1())
case V2:
v, ok := ca.(cav2)
if !ok {
return nil, trace.BadParameter("don't know how to marshal %v", V2)
}
v2 := v.V2()
if !cfg.PreserveResourceID {
// avoid modifying the original obje... | |
c23552 | {
additionalFields[EventTime] = clock.Now().UTC().Round(time.Second)
}
if event.Code != "" {
additionalFields[EventCode] = event.Code
}
for k, v := range additionalFields {
fields[k] = v
}
return nil
} | |
c23553 | {
return trace.BadParameter("parameter To required")
}
return nil
} | |
c23554 | Name: name,
Namespace: defaults.Namespace,
},
Spec: spec,
}, nil
} | |
c23555 | r {
if !r[i].Equals(o[i]) {
return false
}
}
return true
} | |
c23556 | len(values) != 0 {
return fmt.Sprintf("%v", values)
}
return "<empty>"
} | |
c23557 | // empty replacement can occur when $2 expand refers
// to non-existing capture group in match expression
if replacement != "" {
outRoles = append(outRoles, replacement)
}
case trace.IsNotFound(err):
continue
default:
return nil, trace.Wrap(err)
}
}
}
}
return outRo... | |
c23558 | r.parse()
return trace.Wrap(err)
} | |
c23559 | !utils.StringSlicesEqual(r.Local, r.Local) {
return false
}
return true
} | |
c23560 | trace.BadParameter("can not update role map for existing trusted cluster")
}
if c.GetEnabled() == t.GetEnabled() {
if t.GetEnabled() == true {
return trace.AlreadyExists("trusted cluster is already enabled")
}
return trace.AlreadyExists("trusted cluster state is already disabled")
}
return nil
} | |
c23561 |
c.Spec.Enabled, c.Spec.Roles, c.Spec.Token, c.Spec.ProxyAddress, c.Spec.ReverseTunnelAddress)
} | |
c23562 | = fmt.Sprintf(TrustedClusterSpecSchemaTemplate, RoleMapSchema, ","+extensionSchema)
}
return fmt.Sprintf(V2SchemaTemplate, MetadataSchema, trustedClusterSchema, DefaultDefinitions)
} | |
c23563 |
return s[i].GetName() < s[j].GetName()
} | |
c23564 |
s[i], s[j] = s[j], s[i]
} | |
c23565 |
if err != nil {
return c.WebProxyAddr
}
return addr
} | |
c23566 | filePath(""), CurrentProfileSymlink)))
} | |
c23567 | yaml.Unmarshal(bytes, &cp); err != nil {
return nil, trace.Wrap(err)
}
return cp, nil
} | |
c23568 | %v", err)
}
}
// set 'current' symlink:
if loc.Options&ProfileMakeCurrent != 0 {
symlink := filepath.Join(filepath.Dir(loc.Path), CurrentProfileSymlink)
if err := os.Remove(symlink); err != nil {
log.Warningf("Failed to remove symlink: %v", err)
}
err = os.Symlink(filepath.Base(loc.Path), symlink)
}
... | |
c23569 | teleport.SharedDirMode)
if err != nil {
return trace.ConvertSystemError(err)
}
return nil
} | |
c23570 | err != nil {
return nil, nil, trace.Wrap(err)
}
return certs.tls, priv, nil
case BuiltinRole:
keys, err := authServer.GenerateServerKeys(GenerateServerKeysRequest{
HostID: id.Username,
NodeName: id.Username,
Roles: teleport.Roles{id.Role},
})
if err != nil {
return nil, nil, trace.Wrap(e... | |
c23571 | tls.X509KeyPair(cert, key)
if err != nil {
return nil, trace.Wrap(err)
}
return &tlsCert, nil
} | |
c23572 | a.AuthServer.UpsertCertAuthority(remoteCA)
if err != nil {
return trace.Wrap(err)
}
remoteCA, err = remote.AuthServer.GetCertAuthority(services.CertAuthID{
Type: services.UserCA,
DomainName: remote.ClusterName,
}, false)
if err != nil {
return trace.Wrap(err)
}
remoteCA.SetRoleMap(roleMap)
err = ... | |
c23573 | tlsConfig.RootCAs = pool
addrs := []utils.NetAddr{{
AddrNetwork: addr.Network(),
Addr: addr.String()}}
return NewTLSClient(ClientConfig{Addrs: addrs, TLS: tlsConfig})
} | |
c23574 |
if cfg.Limiter == nil {
cfg.Limiter = &limiter.LimiterConfig{
MaxConnections: 1000,
MaxNumberOfUsers: 1000,
}
}
return nil
} | |
c23575 | TLS cert and key")
}
tlsConfig.Certificates = []tls.Certificate{tlsCert}
addrs := []utils.NetAddr{utils.FromAddr(t.Listener.Addr())}
return NewTLSClient(ClientConfig{Addrs: addrs, TLS: tlsConfig})
} | |
c23576 |
if err != nil {
return nil, trace.Wrap(err)
}
return tlsConfig.RootCAs, nil
} | |
c23577 | nil, trace.Wrap(err)
}
tlsConfig.Certificates = []tls.Certificate{*cert}
} else {
// this client is not authenticated, which means that auth
// server should apply Nop builtin role
tlsConfig.Certificates = nil
}
return tlsConfig, nil
} | |
c23578 | := NewTLSClient(ClientConfig{Addrs: addr, TLS: clt.TLSConfig()})
if err != nil {
panic(err)
}
return newClient
} | |
c23579 | if err != nil {
return nil, trace.Wrap(err)
}
addrs := []utils.NetAddr{utils.FromAddr(t.Listener.Addr())}
return NewTLSClient(ClientConfig{Addrs: addrs, TLS: tlsConfig})
} | |
c23580 | = net.Listen("tcp", "127.0.0.1:0")
if err != nil {
return trace.Wrap(err)
}
}
go t.TLSServer.Serve(t.Listener)
return nil
} | |
c23581 | if t.AuthServer.Backend != nil {
t.AuthServer.Backend.Close()
}
return err
} | |
c23582 | nil {
t.Listener.Close()
}
return err
} | |
c23583 | HostID: hostID,
NodeName: hostID,
Roles: teleport.Roles{teleport.RoleAuth},
})
if err != nil {
return nil, trace.Wrap(err)
}
return ReadIdentityFromKeyPair(keys)
} | |
c23584 | return nil, nil, trace.Wrap(err)
}
user.AddRole(role.GetName())
err = clt.UpsertUser(user)
if err != nil {
return nil, nil, trace.Wrap(err)
}
return user, role, nil
} | |
c23585 |
err = clt.UpsertRole(role)
if err != nil {
return nil, nil, trace.Wrap(err)
}
user.AddRole(role.GetName())
err = clt.UpsertUser(user)
if err != nil {
return nil, nil, trace.Wrap(err)
}
return user, role, nil
} | |
c23586 |
}
if cfg.Namespace == "" {
return trace.BadParameter("missing parameter Namespace")
}
if cfg.ConcurrentUploads <= 0 {
cfg.ConcurrentUploads = defaults.UploaderConcurrentUploads
}
if cfg.ScanPeriod <= 0 {
cfg.ScanPeriod = defaults.UploaderScanPeriod
}
if cfg.Context == nil {
cfg.Context = context.TODO()... | |
c23587 | UploaderConfig: cfg,
Entry: log.WithFields(log.Fields{
trace.Component: teleport.ComponentAuditLog,
}),
cancel: cancel,
ctx: ctx,
semaphore: make(chan struct{}, cfg.ConcurrentUploads),
scanDir: filepath.Join(cfg.DataDir, cfg.ServerID, SessionLogsDir, cfg.Namespace),
}
return uploader, nil
} | |
c23588 | }
sessionID := session.ID(parts[0])
lockFilePath := filepath.Join(u.scanDir, fi.Name())
if err := u.uploadFile(lockFilePath, sessionID); err != nil {
if trace.IsCompareFailed(err) {
u.Debugf("Uploader detected locked file %v, another process is uploading it.", lockFilePath)
continue
}
return tr... | |
c23589 |
Stdout: os.Stdout,
Stderr: os.Stderr,
Stdin: os.Stdin,
}
} | |
c23590 | p.ValidUntil.Sub(clock.Now()) <= 0
} | |
c23591 | nil {
log.Warningf("Failed to save profile: %v", err)
return trace.Wrap(err)
}
// Override client's auth methods, current cluster and user name
authMethod, err := key.AsAuthMethod()
if err != nil {
return trace.Wrap(err)
}
// After successful login we have local agent updated with latest
// and greatest a... | |
c23592 | + ".yaml"
}
// Make sure the profile requested actually exists.
_, err = os.Stat(filepath.Join(profileDir, profileName))
if err != nil {
return "", trace.ConvertSystemError(err)
}
return profileName, nil
} | |
c23593 |
return nil, nil, trace.NotFound("not logged in")
}
return nil, nil, trace.Wrap(err)
}
// Read in the active profile first. If readProfile returns trace.NotFound,
// that means the profile may have been corrupted (for example keys were
// deleted but profile exists), treat this as the user not being logged ... | |
c23594 |
webProxyHost, _ := c.WebProxyHostPort()
return webProxyHost, defaults.KubeProxyListenPort
} | |
c23595 |
webProxyHost, _ := c.WebProxyHostPort()
return webProxyHost, defaults.HTTPListenPort
} | |
c23596 |
webProxyHost, _ := c.WebProxyHostPort()
return webProxyHost, defaults.SSHProxyListenPort
} | |
c23597 |
loopbackPool(c.WebProxyAddr))
if err != nil {
return nil, trace.Wrap(err)
}
// sometimes we need to use external auth without using local auth
// methods, e.g. in automation daemons
if c.SkipLocalAuth {
if len(c.AuthMethods) == 0 {
return nil, trace.BadParameter("SkipLocalAuth is true but no AuthMethods... | |
c23598 |
// point.
if tc.CachePolicy == nil || runtime.GOOS == teleport.WindowsOS {
log.Debugf("not using caching access point")
return clt, nil
}
return clt, nil
} | |
c23599 | retval = append(retval, nodes[i].GetAddr())
}
}
if len(nodes) == 0 {
retval = append(retval, net.JoinHostPort(tc.Host, strconv.Itoa(tc.HostPort)))
}
return retval, nil
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.