Skip to content
This repository was archived by the owner on Jan 17, 2021. It is now read-only.
This repository was archived by the owner on Jan 17, 2021. It is now read-only.

Unable to use with Bastion Server (err255) #153

@Merith-TK

Description

@Merith-TK

the bastion server in question is (sshPortal)[https://github.com/moul/sshportal]

something in this chunk of code in sshcode.go
errors out with Error Code 255
Dont know exactly what is causing it, but my therory is it is trying to do things on the bastionserver before it is proxied across to the target,

To reproduce, do the following
install sshportal
"invite" a new user, and add a host,

create invite <email, can be false>
# read the readme of the program for how to do so
host create user@host:port --name <hostname, can be anything>

then ssh through sshportal to the host, to verify it is configured properly
ssh <hostname>@portal -p 2222
Then test sshcode to verify this issue
sshcode --skipsync --ssh-flags "-p 2222" <hostname>@portal

If you are unable to reproduce this issue, go ahead and close this

	if o.uploadCodeServer != "" {
		flog.Info("uploading local code-server binary...")
		err = copyCodeServerBinary(o.sshFlags, host, o.uploadCodeServer, codeServerPath)
		if err != nil {
			return xerrors.Errorf("failed to upload local code-server binary to remote server: %w", err)
		}

		sshCmdStr :=
			fmt.Sprintf("ssh %v %v 'chmod +x %v'",
				o.sshFlags, host, codeServerPath,
			)

		sshCmd := exec.Command("sh", "-l", "-c", sshCmdStr)
		sshCmd.Stdout = os.Stdout
		sshCmd.Stderr = os.Stderr
		err = sshCmd.Run()
		if err != nil {
			return xerrors.Errorf("failed to make code-server binary executable:\n---ssh cmd---\n%s: %w",
				sshCmdStr,
				err,
			)
		}
	} else {
		flog.Info("ensuring code-server is updated...")
		dlScript := downloadScript(codeServerPath)

		// Downloads the latest code-server and allows it to be executed.
		sshCmdStr := fmt.Sprintf("ssh %v %v '/usr/bin/env bash -l'", o.sshFlags, host)

		sshCmd := exec.Command("sh", "-l", "-c", sshCmdStr)
		sshCmd.Stdout = os.Stdout
		sshCmd.Stderr = os.Stderr
		sshCmd.Stdin = strings.NewReader(dlScript)
		err = sshCmd.Run()
		if err != nil {
			return xerrors.Errorf("failed to update code-server:\n---ssh cmd---\n%s"+
				"\n---download script---\n%s: %w",
				sshCmdStr,
				dlScript,
				err,
			)
		}
	}

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