Skip to content

Invalid usage of Validate function in ssh.golangConnectionDial is causing connection issues to remote podman #2453

Open
@gkapkowski

Description

@gkapkowski

It looks like Validate function requires a path to be passed as a second argument:

func Validate(user *url.Userinfo, path string, port int, identity string) (*config.Destination, *url.URL, error) {
	// url.Parse NEEDS ssh://, if this ever fails or returns some nonsense, that is why.
	uri, err := url.Parse(path)
	if err != nil {
		return nil, nil, err
	}

https://github.com/containers/common/blob/main/pkg/ssh/utils.go#L21

BUT in golangConnectionDial https://github.com/containers/common/blob/main/pkg/ssh/connection_golang.go#L92

The invocation passes options.Host (which at this point is simply an IP "x.x.x.x")

func golangConnectionDial(options ConnectionDialOptions) (*ConnectionDialReport, error) {
	_, uri, err := Validate(options.User, options.Host, options.Port, options.Identity)
	if err != nil {
		return nil, err
	}

This caused the uri.Host and uri.Path values to be invalid

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions