summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2020-06-23 18:50:09 -0700
committerJhon Honce <jhonce@redhat.com>2020-06-23 18:51:56 -0700
commit4e59fd77a80a6295eb8dbf79991e1648bc739302 (patch)
tree66eecbb91e80c3325d16d71df4503880dbf17567
parent5fe122bf528a0665f7d12bc47357779b8686f6cf (diff)
downloadpodman-4e59fd77a80a6295eb8dbf79991e1648bc739302.tar.gz
podman-4e59fd77a80a6295eb8dbf79991e1648bc739302.tar.bz2
podman-4e59fd77a80a6295eb8dbf79991e1648bc739302.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>
-rw-r--r--cmd/podman/system/connection.go4
-rw-r--r--pkg/bindings/connection.go13
2 files changed, 10 insertions, 7 deletions
diff --git a/cmd/podman/system/connection.go b/cmd/podman/system/connection.go
index d8c709d6e..2fdfcf7c5 100644
--- a/cmd/podman/system/connection.go
+++ b/cmd/podman/system/connection.go
@@ -42,7 +42,7 @@ var (
RunE: connection,
Example: `podman system connection server.fubar.com
podman system connection --identity ~/.ssh/dev_rsa ssh://root@server.fubar.com:2222
- podman system connection --identity ~/.ssh/dev_rsa -port 22 root@server.fubar.com`,
+ podman system connection --identity ~/.ssh/dev_rsa --port 22 root@server.fubar.com`,
}
cOpts = struct {
@@ -202,7 +202,7 @@ func getUDS(cmd *cobra.Command, uri *url.URL) (string, error) {
return "", errors.Wrapf(err, "failed to parse 'podman info' results")
}
- if info.Host.RemoteSocket == nil || !info.Host.RemoteSocket.Exists {
+ if info.Host.RemoteSocket == nil || len(info.Host.RemoteSocket.Path) == 0 {
return "", fmt.Errorf("remote podman %q failed to report its UDS socket", uri.Host)
}
return info.Host.RemoteSocket.Path, nil
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)