summaryrefslogtreecommitdiff
path: root/pkg/bindings/connection.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-06-24 09:24:24 -0400
committerGitHub <noreply@github.com>2020-06-24 09:24:24 -0400
commitb74238864fe4a6fe22f3a8a370e9a32ea21ee383 (patch)
tree60dbd9f32dd24fa577d7c270cb6e04e50b1e6027 /pkg/bindings/connection.go
parent3df30ef358e3211d4d6812ab08e9ceb1e31a771a (diff)
parent4e59fd77a80a6295eb8dbf79991e1648bc739302 (diff)
downloadpodman-b74238864fe4a6fe22f3a8a370e9a32ea21ee383.tar.gz
podman-b74238864fe4a6fe22f3a8a370e9a32ea21ee383.tar.bz2
podman-b74238864fe4a6fe22f3a8a370e9a32ea21ee383.zip
Merge pull request #6739 from jwhonce/wip/connection
Fix ssh-agent support
Diffstat (limited to 'pkg/bindings/connection.go')
-rw-r--r--pkg/bindings/connection.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/pkg/bindings/connection.go b/pkg/bindings/connection.go
index 584aa55c1..c02d55e31 100644
--- a/pkg/bindings/connection.go
+++ b/pkg/bindings/connection.go
@@ -181,12 +181,15 @@ func pingNewConnection(ctx context.Context) error {
func sshClient(_url *url.URL, secure bool, passPhrase string, identity string) (Connection, error) {
authMethods := []ssh.AuthMethod{}
- auth, err := terminal.PublicKey(identity, []byte(passPhrase))
- if err != nil {
- return Connection{}, errors.Wrapf(err, "failed to parse identity %q", identity)
+
+ if len(identity) > 0 {
+ auth, err := terminal.PublicKey(identity, []byte(passPhrase))
+ if err != nil {
+ return Connection{}, errors.Wrapf(err, "failed to parse identity %q", identity)
+ }
+ logrus.Debugf("public key signer enabled for identity %q", identity)
+ authMethods = append(authMethods, auth)
}
- logrus.Debugf("public key signer enabled for identity %q", identity)
- authMethods = append(authMethods, auth)
if sock, found := os.LookupEnv("SSH_AUTH_SOCK"); found {
logrus.Debugf("Found SSH_AUTH_SOCK %q, ssh-agent signer enabled", sock)