Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make method a configurable option (reportHTTP) #915

Closed
NickBouwhuis opened this issue Oct 3, 2022 · 2 comments
Closed

Make method a configurable option (reportHTTP) #915

NickBouwhuis opened this issue Oct 3, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@NickBouwhuis
Copy link
Contributor

NickBouwhuis commented Oct 3, 2022

Describe what you would like to achieve
I would like to be able to configure the HTTP method that the reportHTTP alert module uses. At the moment, this is hardcoded to be 'POST'. Making it incompatible with APIs that use other methods for messages (for example: Matrix uses 'PUT' requests for sending messages to rooms).

Describe why the current solution (if any) is not satisfactory
The current situation makes the module incompatible with APIs that do not use the 'POST' method.

Provide an example
For Matrix, the config.yml would look something like this:

  - file: reportHTTP
    channels:
      - hijack
      - newprefix
      - visibility
      - path
      - misconfiguration
      - rpki
      - roa
    params:
      templates: 
        default: '{"body": "${channel}: ${summary}", "msgtype": "m.text"}'
      headers:
      isTemplateJSON: true
      showPaths: 0
      method: 'PUT'
      hooks:
        default: https://HOMESERVER/_matrix/client/v3/rooms/CHANNELID/send/m.room.message/?access_token=TOKEN

Your information
By day:
Nick Bouwhuis
Speakup B.V.
AS49627

By night:
Nick Bouwhuis
AS202585

@NickBouwhuis NickBouwhuis added the enhancement New feature or request label Oct 3, 2022
@massimocandela
Copy link
Member

Hi @NickBouwhuis,

This can be done easily, I'll give it a look asap.

@massimocandela
Copy link
Member

This is done and it will go out with the next release.
However, I see that you are using Matrix, which was requested also by #977

It would be nice if you could do a pull request (in branch dev) containing a documentation snippet of a working JSON template for Matrix. For example, you can follow what has been done here. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants