()
| 17 | ) |
| 18 | |
| 19 | func authFromAgent() (err error, auth ssh.AuthMethod) { |
| 20 | log.Debug("asking for ssh key to %s", SSHAuthSock) |
| 21 | |
| 22 | if socket := os.Getenv(SSHAuthSock); socket == "" { |
| 23 | err = fmt.Errorf("error while connecting to ssh-agent (cant find %s variable)", SSHAuthSock) |
| 24 | } else if conn, err := net.Dial("unix", socket); err != nil { |
| 25 | err = fmt.Errorf("error while connecting to ssh-agent '%s': %s", socket, err) |
| 26 | } else { |
| 27 | auth = ssh.PublicKeysCallback(agent.NewClient(conn).Signers) |
| 28 | } |
| 29 | return |
| 30 | } |
| 31 | |
| 32 | func authFromFile(sh models.Shell) (err error, auth ssh.AuthMethod) { |
| 33 | log.Debug("loading ssh key from %s ...", sh.Identity.KeyFile) |
no test coverage detected