Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
#Http(S) SHell for Node.JS Web Server
hssh is a SSH like shell using WebSocket based on Http(s) to connect remote node.js web server. Features include remote terminal / port forwarding / file transfer etc.
Couple reasons:
A lot of things:
hssh uses WebSockets as underlying communication channel. Client forwards CLI keypress to Server which further streams it to a bash process. Based on this idea, tunnel works similarly (by forwarding TCP pakcets). See simple diagram below:
###Is it secure
WebSocket is using underlying Http(s) protocol. The data transportation will be encrypted with ssl if web server is under https.
For user authentication, see User Authentication section below.
##Quick Start
To use hssh
you will need have:
hssh
client###Install hssh
Client
Install hssh through npm:
npm install -g hssh
The command will install hssh globally which includes cli command hssh
and hssh-serve
hssh
is the main cli which connects remote web server. hssh-serve
is a testing web server enabled with hssh support.
Use hssh
as a module in node.js web application and attach hssh to node.js http.Server instance.
First install hssh
as a module
npm i hssh --save
Use with http.Server:
var server=require("http").createServer(function handler(){});
require("hssh")(server);
server.listen(8080);
That's it! now the server is ready to be connected through hssh through:
hssh http://<server_host>:8080
If express (>3.x) is used, simply do following:
var app=require("express")();
var server=require("http").Server(app);
require("hssh")(server);
//Define app routes
server.listen(8080);
Once you have both hssh client installed and node.js web-server enabled, you are ready to connect. Simply:
hssh <server_url>
For more usage, see hssh --help
or Modules section below.
hssh is module based. All functionalities are plugable modules. This section gives the detailed usage of each module. Each module has 3 parts:
Shell module is base module of hssh. The module will be started automatically once connection succeed. This grants local shell access on remote server.
Command:
hssh <url>
Below graph shows how shell module works under the hood:
By default, hssh uses bash
as remote bash in terminal. However, this can be changed to any type of bash. Set environment variable HSSH_SH
to the bash wanted.
e.g. use sh
HSSH_SH=sh node ./my_hssh_server
You can forward port from remote to local:
hash -L <local_port>:<host>:<port> <server_url>
This will forward <host>:<port> from remote to local port <local_port> (same as how SSH -L works)
You can copy file from / to remote using hcp
command:
# copy from local to remote
hcp ./localfile http://<server_url>:/tmp/remotefile
# copy from remote to local
hcp http://<server_url>:/tmp/remotefile ./localfile
hssh has a bunch of configurations:
Just pass the parameter object as the second parameter when attaching to http.Server:
require("hssh")(server,params);
User authentication is customised. By default, there is not user authentication and any connection can run the bash. To add user authentication, simply add auth
field to hssh parameters.
require("hssh")(server,{
auth:function(auth,cb){
//check auth.username and auth.password
// once validated, call cb(true) or cb(false)
// async auth is supported
}
});
Once hssh server is configured with auth, hssh
client will promt for username and password.
$ hssh http://127.0.0.1:8010
Connecting to http://127.0.0.1:8010
Connection made
Waiting for welcome message...
Remote server requires login
Username: test
Password:
Welcome to HssH server
HssH Server version: 1.0.2
Server available modules: shell,tunnel
bash-3.2$
If you want non-interactive, simply use --auth
parameter:
$ hssh --auth test:test http://127.0.0.1:8010
Connecting to http://127.0.0.1:8010
Connection made
Waiting for welcome message...
Remote server requires login
Login using --auth parameter
Welcome to HssH server
HssH Server version: 1.0.2
Server available modules: shell,tunnel
bash-3.2$
Welcome banner text will be displayed in the welcome information
require("hssh")(server,{
banner:"Welcome to my server"
});
FAQs
Http(S) Shell that works just like SSH
We found that hssh demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.