Skip to content

khoaphungnguyen/ssh-webhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ssh-webhook

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.

Features

  • Handle SSH sessions to set up webhook destinations.
  • Forward HTTP POST requests to the specified destinations.
  • Basic authentication and error handling.

Requirements

  • Go 1.16 or higher
  • An SSH key pair

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/ssh-webhook.git
    cd ssh-webhook
  2. Install the dependencies:

    go mod tidy
  3. 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

Usage

  1. 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 port 4000.

  2. Connect to the SSH server and set up a webhook destination:

    ssh -p 2222 user@localhost

    Enter the webhook destination when prompted.

  3. 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}

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes.

Acknowledgements

  • 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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages