summaryrefslogtreecommitdiff
path: root/pkg/bindings/connection.go
diff options
context:
space:
mode:
authorCharlie Doern <cdoern@redhat.com>2022-08-23 11:04:54 -0400
committercdoern <cbdoer23@g.holycross.edu>2022-09-26 18:35:01 -0400
commit2e4e1bb97cdd0fbef7ada673fa97f6b4989998eb (patch)
treede2e77c1852b505891c11d4cecfac5a1945abf0d /pkg/bindings/connection.go
parent5fc6d95a947bdf0e0bf013ee282c4a0f99b52a5a (diff)
downloadpodman-2e4e1bb97cdd0fbef7ada673fa97f6b4989998eb.tar.gz
podman-2e4e1bb97cdd0fbef7ada673fa97f6b4989998eb.tar.bz2
podman-2e4e1bb97cdd0fbef7ada673fa97f6b4989998eb.zip
podman machine ssh handling
add the key used in newly initialized machines to the user's known_hosts file. This ensures that golang will be able to ssh into the machine using podman-remote. Also, remove the /dev/null redirection for podman machine ssh's known_hosts file. resolves #15347 Signed-off-by: Charlie Doern <cdoern@redhat.com> Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
Diffstat (limited to 'pkg/bindings/connection.go')
-rw-r--r--pkg/bindings/connection.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/pkg/bindings/connection.go b/pkg/bindings/connection.go
index 6d7b052b7..a3677d393 100644
--- a/pkg/bindings/connection.go
+++ b/pkg/bindings/connection.go
@@ -59,7 +59,7 @@ func JoinURL(elements ...string) string {
// NewConnection creates a new service connection without an identity
func NewConnection(ctx context.Context, uri string) (context.Context, error) {
- return NewConnectionWithIdentity(ctx, uri, "")
+ return NewConnectionWithIdentity(ctx, uri, "", false)
}
// NewConnectionWithIdentity takes a URI as a string and returns a context with the
@@ -70,7 +70,7 @@ func NewConnection(ctx context.Context, uri string) (context.Context, error) {
// For example tcp://localhost:<port>
// or unix:///run/podman/podman.sock
// or ssh://<user>@<host>[:port]/run/podman/podman.sock?secure=True
-func NewConnectionWithIdentity(ctx context.Context, uri string, identity string) (context.Context, error) {
+func NewConnectionWithIdentity(ctx context.Context, uri string, identity string, machine bool) (context.Context, error) {
var (
err error
)
@@ -96,10 +96,11 @@ func NewConnectionWithIdentity(ctx context.Context, uri string, identity string)
return nil, err
}
conn, err := ssh.Dial(&ssh.ConnectionDialOptions{
- Host: uri,
- Identity: identity,
- User: _url.User,
- Port: port,
+ Host: uri,
+ Identity: identity,
+ User: _url.User,
+ Port: port,
+ InsecureIsMachineConnection: machine,
}, "golang")
if err != nil {
return nil, err