From 1b836dbab6c3a987aa1d4b7ecbada766b33c86d3 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Fri, 19 Nov 2021 15:29:17 +0100 Subject: [PATCH] fix: better borked ssh config message See https://git.coopcloud.tech/coop-cloud/organising/issues/243. --- cli/app/list.go | 3 ++- cli/internal/common.go | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/cli/app/list.go b/cli/app/list.go index 1ee8b8c0..8c35ca5d 100644 --- a/cli/app/list.go +++ b/cli/app/list.go @@ -6,6 +6,7 @@ import ( "strings" abraFormatter "coopcloud.tech/abra/cli/formatter" + "coopcloud.tech/abra/cli/internal" "coopcloud.tech/abra/pkg/catalogue" "coopcloud.tech/abra/pkg/config" "coopcloud.tech/abra/pkg/ssh" @@ -72,7 +73,7 @@ can take some time. for _, app := range apps { if err := ssh.EnsureHostKey(app.Server); err != nil { - logrus.Fatal(err) + logrus.Fatal(fmt.Sprintf(internal.SSHFailMsg, app.Server)) } } diff --git a/cli/internal/common.go b/cli/internal/common.go index 9968f0c7..66026d75 100644 --- a/cli/internal/common.go +++ b/cli/internal/common.go @@ -271,3 +271,42 @@ var DebugFlag = &cli.BoolFlag{ Destination: &Debug, Usage: "Show DEBUG messages", } + +// SSHFailMsg is a hopefully helpful SSH failure message +var SSHFailMsg = ` +Woops, Abra is unable to connect to connect to %s. + +Here are a few tips for debugging your local SSH config. Abra uses plain 'ol +SSH to make connections to servers, so if your SSH config is working, Abra is +working. + +Is your ssh-agent running? You can start it by running the following command: + + eval "$(ssh-agent)" + +If your SSH private key loaded? You can check by running the following command: + + ssh-add -L + +If you are using a non-default public/private key, you can configure this in +your ~/.ssh/config file which Abra will read in order to figure out connection +details: + +Host foo.coopcloud.tech + Hostname foo.coopcloud.tech + User bar + Port 12345 + IdentityFile ~/.ssh/bar@foo.coopcloud.tech + +If you're only using password authentication, you can use the following config: + +Host foo.coopcloud.tech + Hostname foo.coopcloud.tech + User bar + Port 12345 + PreferredAuthentications=password + PubkeyAuthentication=no + +Good luck! + +`