Giter VIP home page Giter VIP logo

sshy's Introduction

SSH: HTML5 Based SSH Client

SSHy is a HTML5 SSHv2 web client implementing E2E encryption that runs well on modern web browsers.

About

SSHy is a fast and responsive SSHv2 web client with end-to-end encryption supplied by SJCL. SSHy implements a minimal subset of the SSHv2 protocol that provides and controls a pseudo-terminal. The terminal front-end interface is provided by xterm.js. Currently in use at https://linuxzoo.net , a non-functional preview is available at https://stuicey.github.io/SSHy/.

Features

  • 8 Preset color schemes & Xresources upload and import
  • UTF-8 Character support
  • Automatic local echo detection
  • Customisable terminal & font size
  • Copy and Paste support for Chrome & Firefox
  • Network Traffic Monitor

Installation

Either copy or clone the repository into a directory being currently served by a web server and navigate to index.html.

Two versions of this project are supplied:

  • index.html - The main page featuring a modal login container and modifiable destination IP.
  • wrapper.html - A minimal wrapper intended for use with CGI builds. Features interactive terminal login and fixed destination IP. By default SSH-RSA is disabled on this version. To enable it comment out transport.settings.rsaCheckEnabled = false; inside wrapper.html.

The required files are:

css/*
fonts/*
js/*
index.html OR wrapper.html

For best performance it is recommended to host a websocket proxy close to the traffic origin or destination. This can be done by modifying wsproxyURL near the top of index.html or wrapper.html to the IP or domain of a personal websocket proxy.

This project is intended to be used with wsProxy provided as a submodule in wsproxy/. This application allows for IP multiplexing by appending the destination IP to the websocket proxy URI. More details on this application an be obtained from the related README.

git submodule update --init --recursive
npm i -g  wsproxy/
wsproxy

Other websocket proxies such as Websockify should be compatable with wrapper.html.

Building

This project utilises the Google Closure Compiler to minify and compile the JavaScript. The two versions index.html and wrapper.html can be either compiled manually or through Atom build.

Index.html

java -jar closure-compiler.jar --js_output_file=js/combinedLibs.comb.js js/defines.js js/src/*.js js/*.js '!**.comb.js' '!**Client.js'

Wrapper.html

java -jar closure-compiler.jar --js_output_file=js/combinedJS.comb.js js/defines.js js/src/*.js js/*.js '!**.comb.js'

Compatability

SSHy was designed to be compatable with a majority of SSHv2 servers. SSHy should be able to connect to any standardly configured SSHv2 server that has the following algorithms enabled:

diffie-hellman-group-exchange, diffie-hellman-group14, diffie-hellman-group1
ssh-rsa
aes128-ctr
hmac

Both SHA1 and SHA256 are supported for diffie-hellman and HMAC algorithms.

sshy's People

Contributors

metabolix avatar samuelmarks avatar stuicey avatar whydoubt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sshy's Issues

Better error handling

I am using SSHy with Chrome 85.

When something goes wrong, error handling isn't great. In some cases, all I see is the "spinner" spinning (or in the case of wrapper.html, just a black screen), and no other error displayed.

Here are some ways to replicate this:

  • Simply don't start wsproxy. tcpdump on port 5999 shows a SYN and RST exchange. SSHy shows nothing, and the spinner just keeps going.
  • Run the stock version of wsproxy, instead of the stuicey one. tcpdump shows the exchange getting as far as SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, at which point it hangs with the spinner spinning.

Another minor bug:

  • Connect with a wrong password. SSHy correctly says "Invalid Username or Password" in the dialog box. But if you then enter the correct password and hit enter again, the terminal displays WebSocket connection failed: Error in connection establishment: code 1005. You have to refresh the screen and enter the target, username and (correct) password again.

WebSocket connection failed: Error in connection establishment: code 1005

Hello,
when i try to connect to one of my hosts with SSHy trough wsproxy i get the error "WebSocket connection failed: Error in connection establishment: code 1005
On the ssh client side in /var/log/secure i have this
Mar 31 00:17:07 nswitchwifi sshd[11770]: Bad protocol version identification 'U1NILTIuMC1TU0h5Q2xpZW50DQo=AAABVAsUTjy4eGErxwpOjzhshDCylgAAALlkaWZmaWUtaGVsbG1hbi1ncm91cC1leGNoYW5n' from 10.0.1.28 port 46738

The string is the base64 version for this :
SSH-2.0-SSHyClient
���U�"�5WIT6.Re���.Y�YYKZ�[��X[Yܛ\�Y^��[

What am i doing wrong?

Invalid Signature Using Public Key Auth

Since SSHy doesn't have support for publickey authentication, I'm adding it as an option in the ssh_connection method in the auth_handler.js file. I'm able to send the first SSH_MSG_USERAUTH_REQUEST without the signature and get back a SSH_MSG_USERAUTH_PK_OK. But when I send the next message with the signature, I always get a SSH_MSG_USERAUTH_FAILURE.

I'm doing the signing with another library (sshpk-browser) and forming the signature below using SSHy based on the SSH schema.

Can anyone see any potential issues with how I am forming the signature?

    const decodedPublicKey = config.privateKey.toPublic().toString('ssh', { hashAlgo: 'sha512' }).split(' ')[1];
    const publicKey = atob(decodedPublicKey);

    var m = new SSHyClient.Message();
    m.add_bytes(String.fromCharCode(SSHyClient.MSG_USERAUTH_REQUEST));
    m.add_string(this.termUsername);
    m.add_string('ssh-connection');
    m.add_string('publickey');
    m.add_boolean(true); // has signature
    m.add_string('rsa-sha2-512'); // public key algorithm name
    m.add_string(publicKey); // public key

    // Create signature
    var sigMsg = new SSHyClient.Message();
    sigMsg.add_string(SSHyClient.kex.sessionId);
    sigMsg.add_bytes(String.fromCharCode(SSHyClient.MSG_USERAUTH_REQUEST));
    sigMsg.add_string(this.termUsername);
    sigMsg.add_string('ssh-connection');
    sigMsg.add_string('publickey');
    sigMsg.add_boolean(true); // has signature
    sigMsg.add_string('rsa-sha2-512');
    sigMsg.add_string(publicKey);
    const sigMsgString = sigMsg.toString();

    // Sign signature
    const sign = config.privateKey.createSign('sha512');
    sign.update(sigMsgString);
    const signature = sign.sign();

    m.add_string(atob(signatureToString)); // signature

    this.parceler.send(m);

atob issue nginx

Hi,

I've successfully tested SSHy in a test environment, but when rolling out to my real system, I'm running into the following issue (IP obfuscated) in the javascript console on my browser:

Uncaught DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
at WebSocket.ws.onmessage (http://10.20.30.40/sshy/js/combinedJS.comb.js:381:240)
ws.onmessage @ combinedJS.comb.js:381

The connection comes through wsproxy ok as I see the following on my console:

$ wsproxy
[Status]: Starting wsProxy on port 5999...
[Info]: Requested connection from '::ffff:20.30.40.50' to '10.20.30.40:22' [ACCEPTED].
[Status]: Connection accepted from '10.20.30.40:22'.

But nothing happens on the webpage (using wrapper) or I just get a connection attempt (index). Eventually it seems to time out as I see a connection closed message on the wsproxy console output.

I've tried adding additional console.log to parceler.js as advised on another ticket to see increased logging of comms between server and client, but I see nothing at all.

I'm pretty sure I've replicated the (minimal) config between test and real.

Any ideas?

Thanks,

Chris

Error connecting to Debian / OpenSSH 7.4

Trying to connect to a Debian 9.13 server, SSHy just shows WebSocket connection failed: Error in connection establishment: code 1005 in the terminal window. It doesn't make a difference whether a correct or invalid username/password is given.

The browser console shows:

image

so it appears that something went wrong during DH exchange.

Running the server in debug mode (/usr/sbin/sshd -ddd -p 99 and connect to port 99), the server shows:

sh-4.4# /usr/sbin/sshd -ddd -p 99
debug2: load_server_config: filename /etc/ssh/sshd_config
debug2: load_server_config: done config len = 275
debug2: parse_server_config: config /etc/ssh/sshd_config len 275
debug3: /etc/ssh/sshd_config:61 setting ChallengeResponseAuthentication no
debug3: /etc/ssh/sshd_config:84 setting UsePAM yes
debug3: /etc/ssh/sshd_config:88 setting GatewayPorts yes
debug3: /etc/ssh/sshd_config:89 setting X11Forwarding yes
debug3: /etc/ssh/sshd_config:93 setting PrintMotd no
debug3: /etc/ssh/sshd_config:113 setting AcceptEnv LANG LC_*
debug3: /etc/ssh/sshd_config:116 setting Subsystem sftp	/usr/lib/openssh/sftp-server
debug1: sshd version OpenSSH_7.4, OpenSSL 1.0.2u  20 Dec 2019
debug1: private host key #0: ssh-rsa SHA256:AAzT984aD0JhEOUC4cYjuC22IWEhmzQT4burzFHFOv0
debug1: private host key #1: ecdsa-sha2-nistp256 SHA256:AuqxsTzwaC2OWRHyysPLhIqo24AX5Z3GI753EW3ZwHg
debug1: private host key #2: ssh-ed25519 SHA256:U70HBHIOQCKd07RtkNF1Zp3MDjKZaeotXJ8HFPafhtU
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-ddd'
debug1: rexec_argv[2]='-p'
debug1: rexec_argv[3]='99'
debug3: oom_adjust_setup
debug1: Set /proc/self/oom_score_adj from 0 to -1000
debug2: fd 3 setting O_NONBLOCK
debug1: Bind to port 99 on 0.0.0.0.
Server listening on 0.0.0.0 port 99.
debug2: fd 4 setting O_NONBLOCK
debug3: sock_set_v6only: set socket 4 IPV6_V6ONLY
debug1: Bind to port 99 on ::.
Server listening on :: port 99.
-----
debug3: fd 5 is not O_NONBLOCK
debug1: Server will not fork when running in debugging mode.
debug3: send_rexec_state: entering fd = 8 config len 275
debug3: ssh_msg_send: type 0
debug3: send_rexec_state: done
debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8
debug1: inetd sockets after dupping: 3, 3
Connection from x.x.x.x port 54782 on y.y.y.y port 99
debug1: Client protocol version 2.0; client software version SSHyClient
debug1: no match: SSHyClient
debug1: Local version string SSH-2.0-OpenSSH_7.4p1 Debian-10+deb9u7
debug1: Enabling compatibility mode for protocol 2.0
debug2: fd 3 setting O_NONBLOCK
debug3: ssh_sandbox_init: preparing seccomp filter sandbox
debug2: Network child is on pid 13729
debug3: preauth child monitor started
debug3: privsep user:group 102:65534 [preauth]
debug1: permanently_set_uid: 102/65534 [preauth]
debug3: ssh_sandbox_child: setting PR_SET_NO_NEW_PRIVS [preauth]
debug3: ssh_sandbox_child: attaching seccomp filter program [preauth]
debug1: list_hostkey_types: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth]
debug3: send packet: type 20 [preauth]
debug1: SSH2_MSG_KEXINIT sent [preauth]
debug3: receive packet: type 20 [preauth]
debug1: SSH2_MSG_KEXINIT received [preauth]
debug2: local server KEXINIT proposal [preauth]
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1 [preauth]
debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth]
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] [preauth]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] [preauth]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth]
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth]
debug2: compression ctos: none,[email protected] [preauth]
debug2: compression stoc: none,[email protected] [preauth]
debug2: languages ctos:  [preauth]
debug2: languages stoc:  [preauth]
debug2: first_kex_follows 0  [preauth]
debug2: reserved 0  [preauth]
debug2: peer client KEXINIT proposal [preauth]
debug2: KEX algorithms: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha256,diffie-hellman-group1-sha1 [preauth]
debug2: host key algorithms: ssh-rsa [preauth]
debug2: ciphers ctos: aes128-ctr [preauth]
debug2: ciphers stoc: aes128-ctr [preauth]
debug2: MACs ctos: hmac-sha2-256,hmac-sha1 [preauth]
debug2: MACs stoc: hmac-sha2-256,hmac-sha1 [preauth]
debug2: compression ctos: none [preauth]
debug2: compression stoc: none [preauth]
debug2: languages ctos:  [preauth]
debug2: languages stoc:  [preauth]
debug2: first_kex_follows 0  [preauth]
debug2: reserved 0  [preauth]
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256 [preauth]
debug1: kex: host key algorithm: ssh-rsa [preauth]
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none [preauth]
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none [preauth]
debug1: expecting SSH2_MSG_KEX_DH_GEX_REQUEST [preauth]
debug3: receive packet: type 34 [preauth]
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received [preauth]
debug3: mm_request_send entering: type 0 [preauth]
debug3: mm_request_receive entering
debug3: monitor_read: checking request 0
debug3: mm_answer_moduli: got parameters: 2048 2048 8192
debug3: mm_request_send entering: type 1
debug2: monitor_read: 0 used once, disabling now
debug3: mm_choose_dh: waiting for MONITOR_ANS_MODULI [preauth]
debug3: mm_request_receive_expect entering: type 1 [preauth]
debug3: mm_request_receive entering [preauth]
debug3: mm_choose_dh: remaining 0 [preauth]
debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent [preauth]
debug3: send packet: type 31 [preauth]
debug2: bits set: 1028/2048 [preauth]
debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT [preauth]
debug3: receive packet: type 32 [preauth]
debug2: bits set: 997/2048 [preauth]
debug3: mm_key_sign entering [preauth]
debug3: mm_request_send entering: type 6 [preauth]
debug3: mm_key_sign: waiting for MONITOR_ANS_SIGN [preauth]
debug3: mm_request_receive_expect entering: type 7 [preauth]
debug3: mm_request_receive entering [preauth]
debug3: mm_request_receive entering
debug3: monitor_read: checking request 6
debug3: mm_answer_sign
debug3: mm_answer_sign: hostkey proof signature 0x5616450b5d00(271)
debug3: mm_request_send entering: type 7
debug2: monitor_read: 6 used once, disabling now
debug3: send packet: type 33 [preauth]
debug3: send packet: type 21 [preauth]
debug2: set_newkeys: mode 1 [preauth]
debug1: rekey after 4294967296 blocks [preauth]
debug1: SSH2_MSG_NEWKEYS sent [preauth]
debug1: expecting SSH2_MSG_NEWKEYS [preauth]
debug3: receive packet: type 1 [preauth]
ssh_dispatch_run_fatal: Connection from x.x.x.x port 54782: incomplete message [preauth]
debug1: do_cleanup [preauth]
debug3: PAM: sshpam_thread_cleanup entering [preauth]
debug1: monitor_read_log: child log fd closed
debug3: mm_request_receive entering
debug1: do_cleanup
debug3: PAM: sshpam_thread_cleanup entering
debug1: Killing privsep child 13729
debug1: audit_event: unhandled event 12
sh-4.4#

It would be good to improve the error handling in this situation (#39) to give a more meaningful error, as well as actually fixing the issue.

General Question

I'm integrating your work on SSHy into a project at work (and sorry for the vagueness of this question but it is bound by confidentiality).

I'm curious off the top of your head if you have any ideas where a certain behavior is coming from - although I realize without more detail this is kind of a shot in the dark.

I'm having something occur on Firefox where about every 1/20 times I launch SSHy, the text isn't visible until I either resize or reload the window. I haven't found much on StackOverflow about this library so I figured I would run it by you in case you had any ideas of things I could look at that might be causing similar behavior.

(Images before and directly after resizing horizontally)

screen shot 2019-02-07 at 4 10 52 pm

screen shot 2019-02-07 at 4 11 15 pm

If nothing comes to mind, I totally understand & thanks anyway :)

SSL Error

I'm really looking forward to using this, however, I am running into one issue. I have installed SSHy by git into the folder I wish to start from nerd.mydomain.com I installed wsproxy using sudo (only way it seems to work for my on my install of ubuntu)

git submodule update --init --recursive
sudo npm i -g wsproxy/
sudo wsproxy

I run the command
sudo wsproxy -s -k /etc/letsencrypt/live/mydomain.com-0001/privkey.pem -c /etc/letsencrypt/live/mydomain.com-0001/privkey.pem

I get the following error in the terminal

      c.context.setCert(cert);
                ^

Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
    at Object.createSecureContext (_tls_common.js:113:17)
    at Server (_tls_wrap.js:870:27)
    at new Server (https.js:62:14)
    at Object.createServer (https.js:85:10)
    at new Init (/var/www/html/nerd/wsproxy/src/server.js:28:23)
    at Init (/var/www/html/nerd/wsproxy/src/main.js:29:15)
    at Object.<anonymous> (/var/www/html/nerd/wsproxy/index.js:37:1)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)

I sincerely appreciate any assistance. Cheers!

License

Hi Guys,

What is the license on this project? :)

Thomas

installing wsproxy fails

➜  wsproxy git:(8ef26ac) sudo npm i -g wsproxy
[sudo] password for striky: 
npm ERR! code EPROTO
npm ERR! errno EPROTO
npm ERR! request to https://registry.npmjs.org/wsproxy/-/wsproxy-1.2.32.tgz failed, reason: write EPROTO 140083184126848:error:1414D17A:SSL routines:tls12_check_peer_sigalg:wrong curve:t1_lib.c:1097:
npm ERR! 

➜  wsproxy git:(8ef26ac) sudo npm i -g wsproxy
[sudo] password for striky: 
npm ERR! code EPROTO
npm ERR! errno EPROTO
npm ERR! request to https://registry.npmjs.org/wsproxy/-/wsproxy-1.2.32.tgz failed, reason: write EPROTO 140083184126848:error:1414D17A:SSL routines:tls12_check_peer_sigalg:wrong curve:t1_lib.c:1097:
npm ERR! 
➜  wsproxy git:(8ef26ac) node -v
v9.5.0

Question and Possible bug.

I have an interesting issue.

Your ssh terminal implementation is absolutely beautiful, and I really want to use the code in my project!

I am trying to use your code as a proxy to allow a user to create SSH sessions in a Web based Tomcat network monitoring application. Essentially, I took your source code and dropped it into the 'webapp' directory of a Tomcat application. Hacked 'index.html' slightly to create a file 'ssh.jsp'. It isn't much different except that it has some extra bits to get make it work as a tomcat action target. The rest of your application is unchanged. On the Tomcat Server, I installed your version of wsproxy.

When I finished all of this, it worked if I used 'http' and 'ws' protocol, but it failed if I used 'https' and 'wss'. I got busy and left it alone for a while because I didn't have time to play with it. I recently came back to it, and can no longer duplicate my success even without security. Browsers keep updating their security, and if I remember correctly, it never worked on some browsers (I tested at the time with Chrome, Firefox, Opera, and Safari). I don't recall which browsers did, and did not work. I can't run my application with 'http', especially since browsers are tightening security. I don't much like using wsproxy as it is a huge security hole, but at least my application lives inside a walled environment. I tried building a Webproxy interface in Java through tomcat, so that I could avoid running an external program, which works, but I don't know the subtlety of the security and protocol exchanges. I wish I could just open an SSH session in Java, and tie STDIN, STDOUT, and STDERR to your application, but that might not work over HTTPS, and I don't understand your application enough to try.

... anyway...

I am using valid keys in both Tomcat and wsproxy, and get 'Connection accepted' in wsproxy.

SSHy complains:
'InvalidCharacterError: String contains an invalid character' in the 'atob' call.

I put a try/catch around it, and ran a 'JSON.stringify' on 'e.data' in the catch, and it is simply receiving an empty string '{}'. I looked at the object in debug, and there is not text contained in the 'e.data' object.

I am not sure what it should receive, and why it isn't receiving what it should.

I would love to work with you to resolve it. Feel free to contact me via email if you wish.

Stopped working with latest browsers

Not really sure what is wrong, but I cannot now use SSHy with the latest Chrome or Edge browser.
Exactly the same problem I was having with safari a few months back.

The ENTER key is no longer bubbling up to term.textarea.onkeydown in js/SSHyClient.js.

Note if I comment out (delete) "this.bindKeys" from combinedJS.comb.js everything works fine again. This seems to capture a number of events at the lowest DIV levels and does not always bubble up to your event handler. Unfortunately that is part of xterm.min.js. I did try to update the code to the latest xtermjs, but there seems to be an issue with the function "fix", which I couldnt find any documentation on. I did see an xtermjs extension called fix, but that could be a co-incidence.

Incidentally removing this.bindKeys got me working again in Safari, so win-win.

Happy to help if I can.

Support for binary websockets

According to README.md, SSHy is compatible with websockify when you use wrapper.html and insert the correct websocket endpoint.

However I found it doesn't work: SSHy requests Sec-WebSocket-Protocol: base64, but websockify has dropped base64 support and now only implements binary. It gives a 400 response. See here for a tcpdump of the exchange.

I think it would be useful for SSHy to support "binary" - or if not, at least to remove the reference to websockify from the documentation.

It looks like binary support might be straightforward. I found this patch:
jonsito/labo_sphere@1c3a235
However it applies to index.html, not to wrapper.html (which only uses the minified javascript).

DOMException: Failed to execute 'atob' on 'Window'

Getting the following error:
DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
at WebSocket.ws.onmessage
I see the connections are accepted by the server but it spins and eventually fails out. I have seen other people say they have fixed it by utilizing the wsproxy install that you have in the repo but that did not work for me.

Version: 6.14.4

Thanks in advance!

connect to local IP

Hi,

Just wondering if we can use SSHy to access a local IP?
If i enter a local ip eg. 10.0.0.20 i get the error "Could no resolve hostname: Please use an external address"

I can ssh from the machine hosting SSHy but cant from SSHy.

Thanks
Phillip

no output in terminal iframe

Using the wrapper.html and wsProxy, the terminal loads with a cursor, and a connection accepted is logged in the wsProxy output. However, there is no login prompt -- eventually the terminal windows displays a message about the connection closing due to inactivity.

Confirmed can SSH into the system via CLI from the same host.

Is there any way to include user name in wrapper.html?

Hello!

I want to use SSHy in an student lab at dit.upm.es to allow students remote access to our resources without installing any app in their computers

The lab platform already performs an LDAP authentication, then choose an available host from lab and fires up an ssh console to that host via wrapper.
I wish to include in wrapper user name, to avoid re-enter it at login prompt (and thus avoiding change pre-authenticated user), that is just ask (again) for password before opening ssh session

Is this possible?
Thanks in advance
Juan Antonio

Can not correctly handle keyboard input on iOS/Android

I have setup SSHy on a server and it works perfectly while accessing from PC based web browser.

However, when accessing from either "iOS + safari" or "android + chrome", the terminal failed to response to keyboard events.

It seems SSHy doesn't support such "virtual keyboard" on mobile devices.

Is this a bug or intended?

SSHy without wsProxy

I am new to this so I am sorry for a stupid question, but is it possible to install wsproxy manually, without npm or avoid it altogether? I want to use SSH only to connect to my machine (where sshy is installed) from elsewhere...

Originally posted by @kidygetnada in #24 (comment)

Moving this to a new issue for search-ability

Error! code - 20 does not exist!

I'm trying to make it work with websockify.
Since websockify does not support base64 flow since v0.5, I have tried the following changes in your code :

// Opens the websocket!
ws = new WebSocket(wsproxyURL);
ws.binaryType = "arraybuffer";
// Send all recieved messages to SSHyClient.Transport.handle()
ws.onmessage = function(e) {
	// ArrayBuffer to String
	var enc = new TextDecoder("utf-8");
	var clearMessage = enc.decode(e.data);
	console.log(clearMessage);
	transport.parceler.handle(clearMessage);
};
ws.sendB64 = function(e){
	var enc = new TextEncoder();
	this.send(enc.encode(e)); // String to ArrayBuffer conversion
	console.log("sendB64", e);
	
	transport.parceler.transmitData += e.length;
	transport.settings.setNetTraffic(transport.parceler.transmitData, false);
};

I'm getting the following logs in the console :

SSH-2.0-OpenSSH_7.4p1 Debian-10+deb9u3
SSH-2.0-SSHyClient
T��<�=���òDÞ¸�Þ'B9���¹diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha256,diffie-hellman-group1-sha1����ssh-rsa���
aes128-ctr���
aes128-ctr����hmac-sha2-256,hmac-sha1����hmac-sha2-256,hmac-sha1����none����none������������������������
���4���h�v����uha+Q+������curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1���Assh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519���[email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]���[email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]����[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1����[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1����none,[email protected]����none,[email protected]�������������������
Chosen Algs = kex=diffie-hellman-group-exchange-sha256, keys=ssh-rsa, cipher=aes128-ctr, mac=undefined
Error! code - 20 does not exist!

Then the websockets closes. What does Error! code - 20 does not exist! mean ?

Many thanks !

Really dumb question

What are the programs running in the screenshot? (You have no email listed, this is pretty much the only way to ask)

Question: SSHy as angular/vue component?

Hello, and thank you to everybody who has contributed to the project.

I would like embed the sshy into a angular ( or perhaps vue) based project. There is any example on how to do that? or perhaps any existing angular/vue related component?

Thank you very much !!!

Few questions about this awesome repo

First off thanks for taking the time to code this.
I wrote an automated installer for another popular script and came up with the idea today to add a console section to that scripts admin area since the admins have to do a lot of work both on the web and in ssh.

I was wondering if though, not all users of the script would actually be using domain names and it just gets setup to use the server IP with a self generated cert. And then the others would be domain based with a letsencrypt cert.

Is it possible to use this script with just server ip and self generated cert? Also is there a way to keep the connection persistent, so that if they start a task in the console, move to another page on the site and then come back to the console its the same session? Ill gladly donate some coffee money to help get this going in the project I am wanting to use it for.

Stuck on connecting...

Hi there,
Thank you for creating this.
I have installed it on a VPS to use for a class project. I can access the login page, but any server I try to connect to, it keeps 'connecting...' forever.
Do I need to open any incoming ports in my firewall, or is there something else I've not done right?
I am not using a websocket as I didn't think it would be necessary, this will be very low traffic.

EDIT: I have just installed wsProxy and it's running, but I still get stucj on 'connecting...'

Unable to closure-compile or connect

java -jar closure-compiler.jar --js_output_file=js/combinedLibs.comb.js js/defines.js js/src/*.js js/*.js 'wsproxy/.comb.js' 'wsproxy/Client.js'
ERROR - Cannot read file wsproxy/.comb.js: wsproxy/.comb.js

ERROR - Cannot read file wsproxy/Client.js: wsproxy/Client.js

2 error(s), 0 warning(s)

NPM Version 6.14.8
Node Version v14.13.0
openjdk 11.0.8 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-1)
OpenJDK 64-Bit Server VM (build 11.0.8+10-1, mixed mode)

I tried to make the modifications here but was still unable to connect. I also tried updating var wsproxyURL to be the webserver's DNS name.

combinedLibs.comb.js:372 Uncaught DOMException: Failed to execute 'insertRule' on 'CSSStyleSheet': The index provided (13) is larger than the maximum index (0).
    at SSHyClient.settings.setColorScheme (https://ssh.nightmare.haus/js/combinedLibs.comb.js:372:85)
    at window.onload (https://ssh.nightmare.haus/:44:13)
(index):222 Uncaught DOMException: Failed to construct 'WebSocket': The URL 'ssh.nightmare.haus' is invalid.
    at startSSHy (https://ssh.nightmare.haus/:222:11)
    at HTMLInputElement.onclick (https://ssh.nightmare.haus/:464:92)

commands I ran:

   509  8:42    git clone https://github.com/stuicey/SSHy.git   
   510  8:44    cd SSHy/
   511  8:46    git submodule update --init --recursive
   512  8:46    npm i -g wsproxy/
   513  8:46    wsproxy
   514  8:46    bg
   515  8:46    ls wsproxy/
   516  8:46    java -jar closure-compiler.jar --js_output_file=js/combinedLibs.comb.js js/defines.js js/src/*.js js/*.js 'wsproxy/.comb.js' 'wsproxy/Client.js'

Note command 516 was typed as java -jar closure-compiler.jar --js_output_file=js/combinedLibs.comb.js js/defines.js js/src/*.js js/*.js '!**.comb.js' '!**Client.js' however bash expanded the ! for some reason.

JS Error

Hi,
I'm trying to set up SSHy, it's running behind Apache with ssl.
I started the wsproxy with ssl support:
wsproxy -t 4 -a 127.0.0.1:22 -p 65173 -s -k /path/to/privkey.pem -c /path/to/certfile.pem
when I try to connect either via wrapper.html or index.html
I get a JS Error:
Firefox can’t establish a connection to the server at wss://localhost:65173/127.0.0.1:22. TypeError: transport is undefined
what am I doing wrong?

Modify scripts with nano

Hi!

More than issue it's a question

It's possible modify scripts using this minimal version of ssh? using nano or vim?

Regards

ER

Failed to execute 'atob' on 'Window'

so I just started up the index.html,
installed the wsproxy which seems to work fine

As I tried to connect to my pi it got stuck on "connecting...",
I looked in the chrome console and I saw this:

Uncaught DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
    at WebSocket.ws.onmessage (http://my_ip:82/SSHy/index.html:235:31)

should I try to make it work without the WebSocket or is there another fix

Error! code - 33 does not exist!

when i try to connect to another device on the same network it give this error, but when i try 127.0.0.1 it work just fine.
RSA signature verification failed, disconnecting. transport.js:363:13
Error! code - 33 does not exist!
wsproxy:
[Info]: Requested connection from '::ffff:127.0.0.1' to '192.168.52.159:22' [ACCEPTED].
[Status]: Connection accepted from '192.168.52.159:22'.
[Info]: Connection closed from '192.168.52.159:22'.
[Info]: Connection closed from '::ffff:127.0.0.1'.
[Info]: Connection closed from '192.168.52.159:22'.
[Info]: Connection closed from '::ffff:127.0.0.1'.
any idea ?

DOMExeption atob()

I have a problem with decode function atob().

It's generate an error :

Uncaught DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
at WebSocket.ws.onmessage (http://localhost/index.php:237:38)

My code in index.php :
// Send all recieved messages to SSHyClient.Transport.handle()
ws.onmessage = function(e) {
// Convert the recieved data from base64 to a string
transport.parceler.handle(window.atob(e.data));
};

My WebSocket is turn on correctly on Debian Server in my host localhost.

I am a beginner in programming.

Thank you for your help !

Safari support

Hi
The system does not seem to work in safari. Is that a known problem?
I get the login prompt, but cannot get the return key recognised after typing the username.
Excellent otherwise though! Still all good in Chrome.
Thanks
Gordon.

Hi... i have question...

i want to Connect sshv2...

I ran the wsproxy.

Then run index.html on sshv2 and type the IP to connect to and connect.

However, the word "WebSocket connection failed: Error in connection reservation: code 1000" is

broken and cannot be accessed.

I need your help me please.

my email - [email protected] / [email protected]

Keeps loading without connecting - wsproxy problem

getting this error by using wsproxy

alessiosca@kali:~/Scrivania/web/default/ssh$ sudo wsproxy -k /home/alessiosca/Scrivania/web/default/ssh/wsproxy/default.key -c /home/alessiosca/Scrivania/web/default/ssh/wsproxy/default.crt
[sudo] password di alessiosca: 
[Status]: Starting wsProxy on port 5999...
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: bind EADDRINUSE null:5999
    at listenOnMasterHandle (net.js:1347:16)
    at rr (internal/cluster/child.js:126:12)
    at Worker.send (internal/cluster/child.js:93:7)
    at process.onInternalMessage (internal/cluster/utils.js:45:8)
    at process.emit (events.js:203:15)
    at emit (internal/child_process.js:832:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at Server.WebSocketServer._ultron.on (/usr/local/lib/node_modules/wsproxy/node_modules/ws/lib/WebSocketServer.js:85:46)
    at Server.emit (events.js:198:13)
    at listenOnMasterHandle (net.js:1348:21)
    at rr (internal/cluster/child.js:126:12)
    [... lines matching original stack trace ...]
    at process._tickCallback (internal/process/next_tick.js:63:19)

Installing SSHy and WSProxy

Trying to install SSHy and WSProxy. Steps I did were:

git clone https://github.com/stuicey/SSHy.git
nvm use 9.6.1
#Now using node v9.6.1 (npm v6.9.0)
npm i -g wsproxy
#Installation was fine. No errors or anything.

I attempt to go to https://forsaken-borders.net/dev/ssh, and then those errors show up...
Screenshot 2019-05-03 at 10 45 54

Any clues?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.