diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-03 10:45:50 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-03 10:45:50 +0200 |
| commit | 2de007f9ef8ae2724b9fbe2808ee25cbfe4ca876 (patch) | |
| tree | f91a742d682928ef12eb5a011411c3bb0ef16a02 /internal/clients | |
| parent | 6d50a475114699911f2ebe1376915cd8317f1881 (diff) | |
feat(config): add auth-key CLI and server cache settings
Diffstat (limited to 'internal/clients')
| -rw-r--r-- | internal/clients/baseclient.go | 2 | ||||
| -rw-r--r-- | internal/clients/connectors/serverconnection.go | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/internal/clients/baseclient.go b/internal/clients/baseclient.go index 766f05d..ad90c8d 100644 --- a/internal/clients/baseclient.go +++ b/internal/clients/baseclient.go @@ -204,5 +204,5 @@ func (c *baseClient) makeConnection(server string, sshAuthMethods []gossh.AuthMe } return connectors.NewServerConnection(server, c.UserName, sshAuthMethods, hostKeyCallback, c.maker.makeHandler(server), c.maker.makeCommands(), - c.Args.SSHPrivateKeyFilePath) + c.Args.SSHPrivateKeyFilePath, c.Args.NoAuthKey) } diff --git a/internal/clients/connectors/serverconnection.go b/internal/clients/connectors/serverconnection.go index ca1fc43..fbeb1bc 100644 --- a/internal/clients/connectors/serverconnection.go +++ b/internal/clients/connectors/serverconnection.go @@ -32,6 +32,7 @@ type ServerConnection struct { handler handlers.Handler commands []string authKeyPath string + authKeyDisabled bool hostKeyCallback client.HostKeyCallback throttlingDone bool } @@ -41,7 +42,8 @@ var _ Connector = (*ServerConnection)(nil) // NewServerConnection returns a new DTail SSH server connection. func NewServerConnection(server string, userName string, authMethods []ssh.AuthMethod, hostKeyCallback client.HostKeyCallback, - handler handlers.Handler, commands []string, authKeyPath string) *ServerConnection { + handler handlers.Handler, commands []string, authKeyPath string, + authKeyDisabled bool) *ServerConnection { dlog.Client.Debug(server, "Creating new connection", server, handler, commands) sshConnectTimeout := time.Duration(config.Common.SSHConnectTimeoutMs) * time.Millisecond @@ -55,6 +57,7 @@ func NewServerConnection(server string, userName string, handler: handler, commands: commands, authKeyPath: resolveAuthKeyPath(authKeyPath), + authKeyDisabled: authKeyDisabled, config: &ssh.ClientConfig{ User: userName, Auth: authMethods, @@ -228,7 +231,11 @@ func (c *ServerConnection) handle(ctx context.Context, cancel context.CancelFunc dlog.Client.Debug(err) } } - c.sendAuthKeyRegistrationCommand() + if c.authKeyDisabled { + dlog.Client.Debug(c.server, "Skipping AUTHKEY registration because auth-key is disabled") + } else { + c.sendAuthKeyRegistrationCommand() + } if !c.throttlingDone { dlog.Client.Debug(c.server, "Unthrottling connection (2)", |
