summaryrefslogtreecommitdiff
path: root/internal/ssh/client/hostkeycallback.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/ssh/client/hostkeycallback.go')
-rw-r--r--internal/ssh/client/hostkeycallback.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/ssh/client/hostkeycallback.go b/internal/ssh/client/hostkeycallback.go
index 95543f2..1fcd9c6 100644
--- a/internal/ssh/client/hostkeycallback.go
+++ b/internal/ssh/client/hostkeycallback.go
@@ -8,8 +8,13 @@ import (
// HostKeyCallback is a wrapper around ssh.KnownHosts so that we can add all
// unknown hosts in a single batch to the known_hosts file.
+//
+// Wrap returns an ssh.HostKeyCallback that is bound to the lifetime of the
+// supplied SSH handshake context. Implementations MUST abort any blocking
+// operations (e.g. prompting the user for unknown hosts) once ctx is
+// cancelled so the SSH handshake does not hang and no goroutines leak.
type HostKeyCallback interface {
- Wrap() ssh.HostKeyCallback
+ Wrap(ctx context.Context) ssh.HostKeyCallback
Untrusted(server string) bool
PromptAddHosts(ctx context.Context)
}