An open-source alternative to ngrok/serveo that allows you to expose your local web services to the internet through SSH tunneling.
- 🔒 Secure SSH tunneling
- 🌐 Custom domain support
- 🔑 Public key authentication
- 🚀 Easy to use CLI
- 📝 Detailed logging
- 🔄 Auto-reconnect support
- Node.js v14 or higher
- OpenSSH client (for key generation)
# Clone the repository
git clone https://github.com/anak10thn/porcupine.git
cd porcupine
# Install dependencies
npm install
# Generate SSH host keys
npm run generate-keys
npm run start:server
This will start the Porcupine server with:
- SSH server on port 2222
- HTTP proxy on port 80
First, make sure you have an SSH key pair. If not, generate one:
ssh-keygen -t rsa -b 4096
Add your public key to the server's authorized_keys:
cat ~/.ssh/id_rsa.pub >> keys/authorized_keys
Then start the client:
npm run start:client -- \
--host your-server.com \
--port 51397 \
--local-port 8080 \
--hostname myapp.example.com
Options:
--host
: Porcupine server hostname (default: localhost)--port
: Porcupine SSH server port (default: 51397)--local-port
: Your local service port (required)--hostname
: Public hostname for your service (required)--key
: Path to your SSH private key (default: ~/.ssh/id_rsa)
- Start a local web server:
python3 -m http.server 8080
- Start the Porcupine client:
npm run start:client -- \
--local-port 8080 \
--hostname myapp.localhost
Your local server will be accessible at http://myapp.localhost:80
npm test
To enable debug logs:
DEBUG=porcupine:* npm run start:server
DEBUG=porcupine:* npm run start:client -- [options]
┌─────────────┐ SSH ┌──────────────┐ HTTP ┌──────────┐
│ Client ├────tunnel───► Porcupine ◄────proxy───┤ Internet │
│ (Your App) │ │ Server │ │ │
└─────────────┘ └──────────────┘ └──────────┘
- Client: Connects to your local service and establishes SSH tunnel
- Server: Handles SSH connections and proxies HTTP requests
- Tunnel: Secure SSH tunnel for forwarding traffic
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
anak10thn (anak10thn@gmail.com)
[ ] Support secure connection [ ] Bash script client