1
0
mirror of https://github.com/rancher/rke.git synced 2025-04-27 19:25:44 +00:00

Better guidance on SSH errors

This commit is contained in:
Sebastiaan van Steenis 2018-07-11 17:22:38 +02:00 committed by Alena Prokharchyk
parent eab1411367
commit 1ff65d1fa3

View File

@ -4,6 +4,7 @@ import (
"fmt"
"net"
"net/http"
"strings"
"time"
"github.com/rancher/rke/k8s"
@ -106,6 +107,13 @@ func (d *dialer) Dial(network, addr string) (net.Conn, error) {
conn, err = d.getSSHTunnelConnection()
}
if err != nil {
if strings.Contains(err.Error(), "no key found") {
return nil, fmt.Errorf("Unable to access node with address [%s] using SSH. Please check if the configured key or specified key file is a valid SSH Private Key. Error: %v", d.sshAddress, err)
} else if strings.Contains(err.Error(), "no supported methods remain") {
return nil, fmt.Errorf("Unable to access node with address [%s] using SSH. Please check if you are able to SSH to the node using the specified SSH Private Key and if you have configured the correct SSH username. Error: %v", d.sshAddress, err)
} else if strings.Contains(err.Error(), "cannot decode encrypted private keys") {
return nil, fmt.Errorf("Unable to access node with address [%s] using SSH. Using encrypted private keys is only supported using ssh-agent. Please configure the option `ssh_agent_auth: true` in the configuration file or use --ssh-agent-auth as a parameter when running RKE. This will use the `SSH_AUTH_SOCK` environment variable. Error: %v", d.sshAddress, err)
}
return nil, fmt.Errorf("Failed to dial ssh using address [%s]: %v", d.sshAddress, err)
}
@ -117,7 +125,7 @@ func (d *dialer) Dial(network, addr string) (net.Conn, error) {
remote, err := conn.Dial(network, addr)
if err != nil {
return nil, fmt.Errorf("Failed to dial to %s: %v", addr, err)
return nil, fmt.Errorf("Unable to access the Docker socket (%s). Please check if the configured user can execute `docker ps` on the node, and if the SSH server version is at least version 6.7 or higher. If you are using RedHat/CentOS, you can't use the user `root`. Please refer to the documentation for more instructions. Error: %v", addr, err)
}
return remote, err
}