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

How can we open a ssh in web browser without the form submit #294

Open
ashokMafiree opened this issue Oct 10, 2022 · 1 comment
Open

How can we open a ssh in web browser without the form submit #294

ashokMafiree opened this issue Oct 10, 2022 · 1 comment

Comments

@ashokMafiree
Copy link

We need to open a web ssh in a browser tab by calling API along with the destination host details from the laravel application.

We dont need the default html form that is associated with the webssh

@klarose
Copy link
Contributor

klarose commented Nov 17, 2022

I have been working on something like this myself. I have a branch with my changes -- somewhat outstanding. The main thing I've found to be problematic is the xsrf token. It's missing, and you don't really want to scrape it, as well as the other csrf checks.

This branch has a whole series of changes in it: https://github.com/klarose/webssh/tree/add-plugins

The main thing I've done in it is allow consumers to plugin a different backend connectivity mechanism (websocket in my case). I've also broken up the startup so you can control how it is run a bit in your own binary.

I added the --allow-cross-origin argument because I have a dynamic set of origins accessing my application, and it's too cumbersome to update the allow list in webssh (I'd have to restart or add some form of API integration), or to do the same with some form of reverse proxy so that it's all hosted together. It's important to note, though, that in my case access to the server is tightly controlled through a detailed auth subsystem in front of it.

The main flow of the API is to basically post the same details the form would normally submit, followed by opening a websocket to the server's /ws endpoint with the returned id as the query parameter. The websocket output stream has a bit of a protocol to understand (e.g. data vs commands like resize). I think I'd also like to make that stream have a similar protocol on receive/rewrite the form logic entirely to allow for keyboard-interface auth/challenges, but we'll see if I ever get there.

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

No branches or pull requests

2 participants