summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2020-06-23 18:50:09 -0700
committerMatthew Heon <mheon@redhat.com>2020-06-24 14:43:31 -0400
commitd26662484b3cf7d49ec134b01a161fd4d47eebd4 (patch)
treec5a15bd163b90764d7c8645b884e0a6a077aea17 /pkg
parentd94644d35a6b7056f75da28b8a090ca250e121db (diff)
downloadpodman-d26662484b3cf7d49ec134b01a161fd4d47eebd4.tar.gz
podman-d26662484b3cf7d49ec134b01a161fd4d47eebd4.tar.bz2
podman-d26662484b3cf7d49ec134b01a161fd4d47eebd4.zip
Fix ssh-agent support
* An identity of "" implies ssh-agent and user/password to be used * Fixed example Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg')
-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)