Skip to content

x/crypto/ssh: Cannot connect to unencrypted server #51860

Open
@jfullerton44

Description

@jfullerton44

What version of Go are you using (go version)?

go version go1.18 darwin/arm64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

GOARCH="arm64"
GOHOSTARCH="arm64"
GOHOSTOS="darwin"

What did you do?

Tried to connect to a server that has "none" used for KeyExchanges, Ciphers, and HostKeyAlgorithms. I set all three of these values in ClientConfig but the connection threw an error as the "none" value is currently not allowed for ciphers.

clientConfig := ssh.ClientConfig{
		User:    "user",
		Timeout: 10 * time.Second,
		HostKeyCallback: ssh.InsecureIgnoreHostKey(),
		Config: ssh.Config{
			KeyExchanges: []string{"none"},
			Ciphers:      []string{"none"},
		},
		HostKeyAlgorithms: []string{"none"},
	}

	sshClientConn, chans, reqs, err := ssh.NewClientConn(s.socket, "", &clientConfig)

What did you expect to see?

The client connects to the server without using encryption.

What did you see instead?

Using the above config produces the error

failed to create ssh session: error creating ssh client connection: ssh: handshake failed: ssh: no common algorithm for client to server cipher; client offered: [], server offered: [none]

The none value is accepted for KeyExchanges and HostKeyAlgorithms but for ciphers the none value is not being allowed which does not allow for the ssh client to connect without encryption.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions