Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions lib/client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,24 +525,6 @@ type CachePolicy struct {
NeverExpires bool
}

// MakeDefaultConfig returns default client config.
// If store is not provided, it will default to in-memory storage without
// hardware key support. This should only be used with static auth methods
// (TLS and AuthMethods fields).
func MakeDefaultConfig(store *Store) *Config {
if store == nil {
store = NewMemClientStore()
}
return &Config{
Stdout: os.Stdout,
Stderr: os.Stderr,
Stdin: os.Stdin,
AddKeysToAgent: AddKeysToAgentAuto,
Tracer: tracing.NoopProvider().Tracer("TeleportClient"),
ClientStore: store,
}
}

func (c *Config) CheckAndSetDefaults() error {
if c.ClientStore == nil {
if c.TLS == nil && c.AuthMethods == nil {
Expand Down
2 changes: 1 addition & 1 deletion lib/client/keyagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ func (a *LocalKeyAgent) Signers() ([]ssh.Signer, error) {
if err != nil {
return nil, trace.Wrap(err)
}
agentSigners = append(signers, sshAgentSigners...)
agentSigners = append(agentSigners, sshAgentSigners...)
}

// Filter out non-certificates (like regular public SSH keys stored in the SSH agent).
Expand Down
22 changes: 22 additions & 0 deletions lib/client/keyagent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,28 @@ func TestLoadKey(t *testing.T) {
}
}

func TestSigners(t *testing.T) {
s := makeSuite(t)
keyAgent := s.newKeyAgent(t)

// add the key to the local and system agent.
err := keyAgent.AddKeyRing(s.keyRing)
require.NoError(t, err)

// Check that the ssh cert (signer) appears three times:
// - from the client store
// - from the local agent
// - from the system agent
signers, err := keyAgent.Signers()
require.NoError(t, err)
require.Len(t, signers, 3)

// non ssh certs should be filtered out
for i, signer := range signers {
require.True(t, sshutils.IsSSHCertType(signer.PublicKey().Type()), "signer %d has unexpected type %s", i, signer.PublicKey().Type())
}
}

type caType struct {
signer ssh.Signer
trustedCerts authclient.TrustedCerts
Expand Down
1 change: 1 addition & 0 deletions lib/web/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -5297,6 +5297,7 @@ func makeTeleportClientConfig(ctx context.Context, sctx *SessionContext) (*clien
HostKeyCallback: callback,
TLSRoutingEnabled: proxyListenerMode == types.ProxyListenerMode_Multiplex,
Tracer: apitracing.DefaultProvider().Tracer("webterminal"),
AddKeysToAgent: client.AddKeysToAgentNo,
}

return config, nil
Expand Down
Loading