ssh-webhook

command module
v0.0.0-...-33ade0a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

README

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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳