Receive webhooks and trigger actions based on them.
Go to file
finga b370d59b40 Implement secret functionality
In order to validate requests a field called `secret` has to be sent
containing a secret key which validates the request. A hook will be
executed only if the secret sent with the request matches the hook's
secret.
2021-03-19 10:40:19 +01:00
src Implement secret functionality 2021-03-19 10:40:19 +01:00
.gitignore Parse JSON from post request 2021-02-02 11:17:27 +01:00
Cargo.lock Cargo update 2021-03-17 11:01:20 +01:00
Cargo.toml Add meta data to Cargo.toml 2021-03-17 11:01:30 +01:00
config.yml Implement secret functionality 2021-03-19 10:40:19 +01:00
README.md Implement secret functionality 2021-03-19 10:40:19 +01:00
webhookey.service Add webhookey systemd service file 2021-03-17 11:45:03 +01:00

Webhookey

Build

Install Rust

The Rust toolchain needs to be installed:

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Further, for Rocket we need to have the nightly toolchain installed:

    rustup toolchain install nightly

Build Webhookey

The webhookey project can be built for development:

    cargo b

or for releasing:

    cargo b --release

Install Webhookey

When a Rust toolchain installed you can also install Webhookey directly without cloning it manualy:

    cargo install --git https://git.onders.org/finga/webhookey.git webhookey

or from within the project:

    cargo install webhookey

Run Webhookey

Webhookey can either be run from the project directory with:

    cargo b

or you can copy the produced binary somewhere else from webhookey/target/{debug, release}/webhookey depending on which one you built.

Configuration

Configuration syntax is YAML and has to be done in following order:

Right now there is only the configuration parameter for hooks, here each hook has to be configured, It contains following fields:

  • action: optional string for the action to be executed when all filters match
  • secrets: list of secrets
  • filters: list of filters

Each filter has to have following fields:

  • pointer: pointer to the JSON field according to RFC 6901
  • regex: regular expression which has to match the field pointed to by the pointer

Configuration paths

Following locations are checked for a configuration file:

  • /etc/webhookey/config.yml
  • <config_dir>/webhookey/config.yml
  • ./config.yml

Whereas <config_dir> depends on the platform:

  • Linux: $XDG_CONFIG_HOME or $HOME/.config
  • macOS: $HOME/Library/Application Support
  • Windows: {FOLDERID_RoamingAppData}

TODOs

Systemd service file

Use lazy_static or once_cell for compiled regexes

Use clap to parse command line arguments

Implement the functionality to reply to certain webhooks

Security

Authentication features

Secure cookies?