ssh-webhook
is a simple server application that handles SSH sessions and HTTP webhooks. It allows users to set up webhooks through SSH commands and forward HTTP requests to specified destinations.
- Handle SSH sessions to set up webhook destinations.
- Forward HTTP POST requests to the specified destinations.
- Basic authentication and error handling.
- Go 1.16 or higher
- An SSH key pair
-
Clone the repository:
git clone https://github.com/yourusername/ssh-webhook.git cd ssh-webhook
-
Install the dependencies:
go mod tidy
-
Generate or provide an SSH private key and save it in the
keys/
directory:mkdir -p keys ssh-keygen -t rsa -b 4096 -f keys/privateKey
-
Start the SSH and HTTP servers:
go run main.go
The SSH server will start on port
2222
and the HTTP server will start on port4000
. -
Connect to the SSH server and set up a webhook destination:
ssh -p 2222 user@localhost
Enter the webhook destination when prompted.
-
Send a POST request to the webhook URL generated by the SSH session:
curl -X POST -d '{"amount":100,"message":"test"}' http://localhost:4000/{webhook_id}
Contributions are welcome! Please open an issue or submit a pull request for any changes.
- Gliderlabs SSH - Go library for building SSH servers
- Gorilla Mux - HTTP router and URL matcher for Go
- Shortid - Short, unique, non-sequential, URL-friendly IDs