rammyblog / sdump

Quickly introspect and debug webhooks/HTTP requests over SSH

Home Page:https://sdump.lanre.wtf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sdump

An opensource HTTP request bin built over SSH

Sdump is a HTTP request bin built over SSH. I usually have to google for some 3rd party server or download a binary to inspect certain requests.

Inspect, test and debug any request or webhook from your terminal

sdump TUI

Why?

There is always a new flavor of an online HTTP request bin i have to use every other month. Or sometimes, people have to download Ngrok to get a request bin functionality i.e people have to download or use external services to get a request bin.

I spend an awful amount of time in the terminal and it makes sense i should be able to spin up and use a request bin on my terminal. Hence this project sdump

SSH can normally forward local and remote ports. This service implements an SSH server that only handles forwarding and nothing else. The service supports multiplexing connections over HTTP/HTTPS with WebSocket support. Just assign a remote port as port 80 to proxy HTTP traffic and 443 to proxy HTTPS traffic. If you use any other remote port, the server will listen to the port for TCP connections, but only if that port is available.

How to use public hosted version

ssh -p 2222 ssh.sdump.app

Getting started

  • sdump http: starts the HTTP server.
  • sdump ssh: starts the SSH server
  • sdump delete-http: deletes/prunes old ingested requests. This can be a form of a cron job that runs every few days or so

Configuration file

Here is a full config file for all possible values:

## log level
log: debug

cron:
  ## how often should the `delete-http` command run
  ttl: "48h"
  ## Do soft deletes or actually wipe them off the database
  soft_deletes: false

tui:
  ## the color_scheme to use for the request body
  # see https://github.com/alecthomas/chroma/tree/master/styles
  color_scheme: monokai

ssh:
  ## port to run ssh server on
  port: 2222
  ## allow_list is a list of public keys that can connect to the ssh server
  # this is useful if you were running a private instance for a few coworkers 
  # or friends
  allow_list:
    - ./.ssh/id_rsa.pub
    - /Users/lanreadelowo/.ssh/id_rsa.pub
    
  ## keys for the ssh server
  identities:
    - "id_ed25519"

http:
  ## port to run http server on
  port: 4200
  ## what domain name you want to use?
  domain: http://localhost:4200
  ## rate limiting clients
  rate_limit:
    ## limit the number of ingested requests from a specific client
    requests_per_minute: 60
  ## database configuration. postgres essentially
  database:
    ## database dsn
    dsn: postgres://sdump:sdump@localhost:3432/sdump?sslmode=disable
    ## should we log sql queries? In prod, no but in local mode, 
    ## you probably want to 
    log_queries: true

  #  limit the size of jSON request body that can be sent to endpoints
  max_request_body_size: 500

  ## Opentelemetry and tracing config
  otel:
    ## does OTEL endpoint have tls enabled?
    use_tls: true
    ## custom name you want to use to identify the service
    service_name: SDUMP
    ## OTEL Endpoint 
    endpoint: http://localhost:4200
    ## Should we trace all http and DB requests
    is_enabled: false

  ## Prometheus configuration
  prometheus:
    ## protect your /metrics endpoint with basic auth
    ## if provided, password must also be provided too
    username: sdump
    ## basic auth password for your /metrics
    password: sdump

    ## enable /metrics endpoint and metrics collection?
    is_enabled: true

  prometheus:
    username: sdump
    password: sdump
    is_enabled: true

Developers' note

Use ssh-keygen -f .ssh/id_rsa to generate a test ssh key

Deployment to your own server?

I have added a guide here on how I have deployed the public version

About

Quickly introspect and debug webhooks/HTTP requests over SSH

https://sdump.lanre.wtf

License:MIT License


Languages

Language:Go 98.4%Language:Shell 0.6%Language:Dockerfile 0.5%Language:Makefile 0.5%