
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@pmonori/node-ssh-forward
Advanced tools
Easy to use ssh client with port forwarding and bastion host support
Another easy simple ssh lib for forwarding ports, command execution and interactive shell support.
Has in-built support for bastion hosts (also known as jump hosts).
$ npm install node-ssh-forward
or
$ yarn add node-ssh-forward
Setting up the initial ssh connection (using a bastion host)
import { SSHConnection } from 'node-ssh-forward'
const sshConnection = new SSHConnection({
endHost: 'example.com',
bastionHost: 'my-bastion-host.com'
})
$ ssh -L 9000:imgur.com:80 example.com
const sshConnection = new SSHConnection({
endHost: 'example.com',
})
await sshConnection.forward({
fromPort: 9000,
toPort: 80,
toHost: 'imgur.com'
})
$ ssh -L 9000:localhost:80 -J your-jump-host.com example.com
const sshConnection = new SSHConnection({
endHost: 'example.com',
bastionHost: 'your-jump-host.com'
})
await sshConnection.forward({
fromPort: 9000,
toPort: 80,
})
$ ssh -L 9000:localhost:80 -J your-jump-user@your-jump-host.com example.com
const sshConnection = new SSHConnection({
endHost: 'example.com',
bastionHost: 'your-jump-host.com',
bastionUsername: 'your-jump-user'
})
await sshConnection.forward({
fromPort: 9000,
toPort: 80,
})
const sshConnection = new SSHConnection({
endHost: 'example.com',
bastionHost: 'your-jump-host.com'
})
await sshConnection.executeCommand('uptime')
new SSHConnection(options)Options are an object with following properties:
username (optional): The username used for your ssh connection (equivalent to -l option). If not set, it first looks for an SSH_USERNAME environment variable. If that is not set, it fallbacks to USER environment variable.password (optional): Provide a password to authenticate with username and password, not private key. Also see skipAutoPrivateKey.privateKey (optional): Can be a string or Buffer that contains a private key. If not set, it fallbacks to ~/.ssh/id_rsaskipAutoPrivateKey (optional): Don't try and read ~/.ssh/id_rsa if no private key is providedagentForward (optional): Is a boolean which uses the ssh-agent for connection (defaults to false). If set defaults to the value of env.SSH_AUTH_SOCK (all platforms), then pageant on Windows if no SSH_AUTH_SOCK is present.agentSocket (optional): Provide your own path to the SSH Agent Socket you want to use. Useful if your app doesn't have access to ENV directly.endHost (required): The host you want to end up on (connect to)endPort (optional): Port number of the server. Needed in case the server runs on a custom port (defaults to 22)bastionHost (optional): You can specify a bastion host if you wantbastionUsername (optional): You can specify the bastion username if you want, in case it is different from the user connecting to end host.
If not provided while bastionHost is specified, connection will fall back to the username.passphrase (optional): You can specify the passphrase when you have an encrypted private key. If you don't specify the passphrase and you use an encrypted private key, you get prompted in the command line.noReadline (optional): Don't prompt for private key passphrases using readline (eg if this is not run in an interactive session)connection.executeCommand(command: string): Promise<void>Executes a command on the server. Promise will resolve after the command has been executed.
connection.tty(): Promise<void>Starts an interactive shell session. Will resolve when then client has logged out from the server.
connection.forward(forwardOptions: Object)Established port-forwarding. Promise resolves after the forwarding has been established. Forwarding can be stopped by calling connection.shutdown()
Possible options for forwardOptions:
fromPort (required): Specifies the port on your local computertoPort (required): The port on endHost (specified in the SSHConnection options).toHost (optional): You can specify an additional toHost when you want to forward a port from a different server than your endHost.connection.shutdown()Closes all connections.
./src./test/test.ts./test/test.shforward that specifies when the promise is resolved and the forwarding is stoppedFAQs
Easy to use ssh client with port forwarding and bastion host support
We found that @pmonori/node-ssh-forward 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.