Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added admin features #64

Merged
merged 11 commits into from
Dec 26, 2019
Prev Previous commit
Add console URL to connection output
  • Loading branch information
antoniomika committed Dec 25, 2019
commit 839a7317d417629451e71c734fa3d36219c49d9f
17 changes: 16 additions & 1 deletion requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,22 @@ func handleRemoteForward(newRequest *ssh.Request, sshConn *SSHConnection, state
defer state.Console.RemoveRoute(host)

if *serviceConsoleEnabled && sendToken {
requestMessages += fmt.Sprintf("Service console can be accessed with token: %s\r\n", routeToken)
scheme := "http"
portString := ""
if httpPort != 80 {
portString = fmt.Sprintf(":%d", httpPort)
}

if *httpsEnabled {
scheme = "https"
if httpsPort != 443 {
portString = fmt.Sprintf(":%d", httpsPort)
}
}

consoleURL := fmt.Sprintf("%s://%s%s", scheme, host, portString)

requestMessages += fmt.Sprintf("Service console can be accessed here: %s/_sish/console?x-authorization=%s\r\n", consoleURL, routeToken)
}
}

Expand Down