Skip to content

Commit

Permalink
Accept host key automatically for SSH debug sessions
Browse files Browse the repository at this point in the history
No checking is really required for this, the key will
always be unstable.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Nov 14, 2023
1 parent daca781 commit 68d4e58
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/ssh_connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,14 @@ func runSshConnectE(cmd *cobra.Command, args []string) error {
}

us, _ := url.Parse(SshGw)
sshArgs := []string{"-p", strconv.Itoa(found.Port), "runner@" + us.Host, "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null"}

if printOnly {
fmt.Printf("ssh -p %d ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null runner@%s\n", found.Port, us.Host)
fmt.Printf("ssh %s\n", strings.Join(sshArgs, " "))
return nil
}

sshCmd := exec.CommandContext(ctx, "ssh", "-p", strconv.Itoa(found.Port), "runner@"+us.Host)
sshCmd := exec.CommandContext(ctx, "ssh", sshArgs...)

sshCmd.Stdin = os.Stdin
sshCmd.Stdout = os.Stdout
Expand Down

0 comments on commit 68d4e58

Please sign in to comment.