diff options
| author | Paul Buetow <pbuetow@mimecast.com> | 2021-10-15 13:20:48 +0300 |
|---|---|---|
| committer | Paul Buetow <pbuetow@mimecast.com> | 2021-10-19 19:02:57 +0300 |
| commit | 10314cef906fd9b73e003be69c2f6b7b3d66570c (patch) | |
| tree | 03e8b96ad97d3382d439725166f83c774dc999a4 /internal/ssh/client/authmethods.go | |
| parent | b27fc108ecd6eead5c97cf6e894bf8d639fff75c (diff) | |
Can configure DTail client not to mess with ~/.ssh/known_hosts via env var - this is useful for running unit and integration tests in jenkins
Diffstat (limited to 'internal/ssh/client/authmethods.go')
| -rw-r--r-- | internal/ssh/client/authmethods.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/internal/ssh/client/authmethods.go b/internal/ssh/client/authmethods.go index ced1fb9..089a66a 100644 --- a/internal/ssh/client/authmethods.go +++ b/internal/ssh/client/authmethods.go @@ -35,8 +35,7 @@ func initKnownHostsAuthMethods(trustAllHosts bool, throttleCh chan struct{}, if err != nil { dlog.Common.FatalPanic(knownHostsPath, err) } - dlog.Common.Debug("initKnownHostsAuthMethods", "Added known hosts file path", - knownHostsPath) + dlog.Common.Debug("initKnownHostsAuthMethods", "Added known hosts file path", knownHostsPath) if config.Common.ExperimentalFeaturesEnable { sshAuthMethods = append(sshAuthMethods, gossh.Password("experimental feature test")) dlog.Common.Debug("initKnownHostsAuthMethods", "Added experimental method to list of auth methods") @@ -88,7 +87,11 @@ func initKnownHostsAuthMethods(trustAllHosts bool, throttleCh chan struct{}, } dlog.Common.Debug("initKnownHostsAuthMethods", "Unable to use private key", privateKeyPath, err) - dlog.Common.FatalPanic("Unable to find private SSH key information") + + // This is only a panic when we expect to do something about it. + if !config.Client.SSHDontAddHostsToKnownHostsFile { + dlog.Common.FatalPanic("Unable to find private SSH key information") + } // Never reach this point. return sshAuthMethods, knownHostsCallback |
