diff options
| author | Paul Bütow <pbuetow@mimecast.com> | 2020-01-20 18:41:05 +0000 |
|---|---|---|
| committer | Paul Bütow <pbuetow@mimecast.com> | 2020-01-21 14:35:23 +0000 |
| commit | c128865c4c7411c29a59fca9a3a2f95537686d7b (patch) | |
| tree | 193bccc70d942c8b70cc93fae2670263701e43aa /ssh/client/authmethods.go | |
| parent | 3755a9911ecb05886577095f2b8cc8b9e4066a3a (diff) | |
Move commands to cmd/ and move internal dependencies to internal/
Diffstat (limited to 'ssh/client/authmethods.go')
| -rw-r--r-- | ssh/client/authmethods.go | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/ssh/client/authmethods.go b/ssh/client/authmethods.go deleted file mode 100644 index 84b7ce3..0000000 --- a/ssh/client/authmethods.go +++ /dev/null @@ -1,45 +0,0 @@ -package client - -import ( - "dtail/config" - "dtail/logger" - "dtail/ssh" - "os" - - gossh "golang.org/x/crypto/ssh" -) - -// InitSSHAuthMethods initialises all known SSH auth methods on othe client side. -func InitSSHAuthMethods(trustAllHosts bool, throttleCh chan struct{}) ([]gossh.AuthMethod, *HostKeyCallback) { - var sshAuthMethods []gossh.AuthMethod - - if config.Common.ExperimentalFeaturesEnable { - sshAuthMethods = append(sshAuthMethods, gossh.Password("experimental feature test")) - logger.Info("Added experimental method to list of auth methods") - } - - keyPath := os.Getenv("HOME") + "/.ssh/id_rsa" - if authMethod, err := ssh.PrivateKey(keyPath); err == nil { - sshAuthMethods = append(sshAuthMethods, authMethod) - logger.Info("Added path to list of auth methods", keyPath) - } - - keyPath = os.Getenv("HOME") + "/.ssh/id_dsa" - if authMethod, err := ssh.PrivateKey(keyPath); err == nil { - sshAuthMethods = append(sshAuthMethods, authMethod) - logger.Info("Added path to list of auth methods", keyPath) - } - - if authMethod, err := ssh.Agent(); err == nil { - sshAuthMethods = append(sshAuthMethods, authMethod) - logger.Info("Added SSH Agent to list of auth methods") - } - - knownHostsPath := os.Getenv("HOME") + "/.ssh/known_hosts" - hostKeyCallback, err := NewHostKeyCallback(knownHostsPath, trustAllHosts, throttleCh) - if err != nil { - logger.FatalExit(knownHostsPath, err) - } - - return sshAuthMethods, hostKeyCallback -} |
