hostnextra-tunnel
v1.0.0
Published
Official secure tunnel plugin for the HostnExtra CLI.
Maintainers
Readme
HostnExtra Tunnel
HostnExtra Tunnel is the official SSH tunnel plugin for the HostnExtra CLI. It provides secure local port forwarding using OpenSSH, allowing you to access services running on remote servers as if they were available on your local machine.
Features
- Secure SSH local port forwarding
- Reusable tunnel profiles
- Open, list, show and close tunnels
- Automatic SSH host resolution
- Compatible with OpenSSH
- Supports HostnExtra SSH plugin
- Supports
~/.ssh/config - No passwords or private keys are stored
- Lightweight with zero runtime dependencies
- Fully written in TypeScript
Installation
npm install -g hostnextraInstall the tunnel plugin.
hostnextra plugin add tunnelVerify installation:
hostnextra tunnel helpRequirements
- Node.js 22 or later
- OpenSSH client installed
- SSH access to the remote server
Tunnel Profiles
Tunnel profiles define reusable local forwarding rules.
Profiles are stored locally.
~/.hostnextra/
└── tunnel/
└── profiles.jsonProfiles only contain tunnel definitions.
The plugin never stores:
- Passwords
- SSH private keys
- Secrets
- Authentication tokens
Creating a Profile
MySQL
hostnextra tunnel profile add mysql-prod \
--from web-prod:3306 \
--to localhost:3306Nginx
hostnextra tunnel profile add nginx-prod \
--from web-prod:80 \
--to localhost:8080Redis
hostnextra tunnel profile add redis-prod \
--from web-prod:6379 \
--to localhost:6379PostgreSQL
hostnextra tunnel profile add postgres-prod \
--from web-prod:5432 \
--to localhost:5432Opening a Tunnel
hostnextra tunnel open mysql-prodListing Active Tunnels
hostnextra tunnel listShow Tunnel Information
hostnextra tunnel show tunnel-93551670Closing a Tunnel
If the tunnel is running in the foreground, press:
Ctrl+COr close it using:
hostnextra tunnel close tunnel-93551670Profile Management
Add profile
hostnextra tunnel profile add NAME \
--from HOST:REMOTE_PORT \
--to LOCAL_HOST:LOCAL_PORTRemove profile
hostnextra tunnel profile remove mysql-prodList profiles
hostnextra tunnel profile listShow profile
hostnextra tunnel profile show mysql-prodSSH Host Resolution
HostnExtra Tunnel resolves SSH hosts in the following order:
- Explicit CLI arguments
- HostnExtra SSH plugin
~/.ssh/config
The HostnExtra SSH plugin is optional.
If it is installed, server aliases are resolved automatically.
If it is not installed, the plugin falls back to the standard OpenSSH configuration.
Examples
MySQL
hostnextra tunnel profile add mysql-prod \
--from web-prod:3306 \
--to localhost:3306
hostnextra tunnel open mysql-prod
mysql -h 127.0.0.1 -P 3306 -u root -pNginx
hostnextra tunnel profile add nginx-prod \
--from web-prod:80 \
--to localhost:8080
hostnextra tunnel open nginx-prodOpen:
http://127.0.0.1:8080Uninstall
Remove the plugin.
hostnextra plugin remove tunnelSecurity
HostnExtra Tunnel uses the system OpenSSH client.
Authentication is handled entirely by OpenSSH.
The plugin never stores:
- Passwords
- SSH keys
- SSH agent data
- Secrets
Tunnel profiles only define forwarding rules.
Contributing
Contributions are welcome.
Please open an issue before submitting significant changes so they can be discussed first.
License
MIT License.
