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

Unable to use with Bastion Server (err255) #153

Open
Merith-TK opened this issue Nov 26, 2019 · 1 comment
Open

Unable to use with Bastion Server (err255) #153

Merith-TK opened this issue Nov 26, 2019 · 1 comment

Comments

@Merith-TK
Copy link
Contributor

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,
			)
		}
	}
@deansheather deansheather changed the title {bug}{Interesting} Unable to use with Bastion Server (err255) Unable to use with Bastion Server (err255) Feb 21, 2020
@deansheather
Copy link
Member

@Merith-TK please post logs from sshcode.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants