Package: webssh-mxpi
IntroductionA simple web application to be used as an ssh client to connect to your
ssh servers. It is written in Python, base on tornado, paramiko and
xterm.js.FeaturesSSH password authentication supported, including empty password.SSH public-key authentication supported, including DSA RSA ECDSA
Ed25519 keys.Encrypted keys supported.Two-Factor Authentication (time-based one-time password) supported.Fullscreen terminal supported.Terminal window resizable.Auto detect the ssh server’s default encoding.Modern browsers including Chrome, Firefox, Safari, Edge, Opera
supported.PreviewHow it works+---------+     http     +--------+    ssh    +-----------+
| browser | <==========> | webssh | <=======> | ssh server|
+---------+   websocket  +--------+    ssh    +-----------+RequirementsPython 2.7/3.4+QuickstartInstall this app, run commandpip install websshStart a webserver, run commandwsshOpen your browser, navigate to127.0.0.1:8888Input your data, submit the form.Server options# start a http server with specified listen address and listen portwssh--address='2.2.2.2'--port=8000# start a https server, certfile and keyfile must be passedwssh--certfile='/path/to/cert.crt'--keyfile='/path/to/cert.key'# missing host key policywssh--policy=reject# logging levelwssh--logging=debug# log to filewssh--log-file-prefix=main.log# more optionswssh--helpBrowser console// connect to your ssh serverwssh.connect(hostname,port,username,password,privatekey,passphrase,totp);// pass an object to wssh.connectvaropts={hostname:'hostname',port:'port',username:'username',password:'password',privatekey:'the private key text',passphrase:'passphrase',totp:'totp'};wssh.connect(opts);// without an argument, wssh will use the form data to connectwssh.connect();// set a new encoding for client to usewssh.set_encoding(encoding);// reset encoding to use the default onewssh.reset_encoding();// send a command to the serverwssh.send('ls -l');Custom FontTo use custom font, put your font file in the directorywebssh/static/css/fonts/and restart the server.URL ArgumentsSupport passing arguments by url (query or fragment) like following
examples:Passing form data (password must be encoded in base64, privatekey not
supported)http://localhost:8888/?hostname=xx&username=yy&password=str_base64_encodedPassing a terminal background colorhttp://localhost:8888/#bgcolor=greenPassing a user defined titlehttp://localhost:8888/?title=my-ssh-serverPassing an encodinghttp://localhost:8888/#encoding=gbkPassing a command executed right after loginhttp://localhost:8888/?command=pwdPassing a terminal typehttp://localhost:8888/?term=xterm-256colorUse DockerStart up the appdocker-compose upTear down the appdocker-compose downTestsRequirementspip install pytest pytest-cov codecov flake8 mockUse unittest to run all testspython -m unittest discover testsUse pytest to run all testspython -m pytest testsDeploymentRunning behind an Nginx serverwssh--address='127.0.0.1'--port=8888--policy=reject# Nginx config examplelocation/{proxy_passhttp://127.0.0.1:8888;proxy_http_version1.1;proxy_read_timeout300;proxy_set_headerUpgrade$http_upgrade;proxy_set_headerConnection"upgrade";proxy_set_headerHost$http_host;proxy_set_headerX-Real-IP$remote_addr;proxy_set_headerX-Real-PORT$remote_port;}Running as a standalone serverwssh--port=8080--sslport=4433--certfile='cert.crt'--keyfile='cert.key'--xheaders=False--policy=rejectTipsFor whatever deployment choice you choose, don’t forget to enable
SSL.By default plain http requests from a public network will be either
redirected or blocked and being redirected takes precedence over
being blocked.Try to use reject policy as the missing host key policy along with
your verified known_hosts, this will prevent man-in-the-middle
attacks. The idea is that it checks the system host keys
file(“~/.ssh/known_hosts”) and the application host keys
file(“./known_hosts”) in order, if the ssh server’s hostname is not
found or the key is not matched, the connection will be aborted.