Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Splunk Webhook request format #1

Closed
atc0005 opened this issue Jan 24, 2020 · 6 comments · Fixed by #30
Closed

Splunk Webhook request format #1

atc0005 opened this issue Jan 24, 2020 · 6 comments · Fixed by #30
Labels
documentation Improvements or additions to documentation question Further information is requested
Milestone

Comments

@atc0005
Copy link
Owner

atc0005 commented Jan 24, 2020

Per the Splunk Enterprise Alerting Manual, this is the format of the received POST request:

{

	"result": {
		"sourcetype" : "mongod",
		"count" : "8"
	},
	"sid" : "scheduler_admin_search_W2_at_14232356_132",
	"results_link" : "http://web.example.local:8000/app/search/@go?sid=scheduler_admin_search_W2_at_14232356_132",
	"search_name" : null,
	"owner" : "admin",
	"app" : "search"
}

Webhook data payload

The webhook POST request's JSON data payload includes the following details.

Search ID or SID for the saved search that triggered the alert
Link to search results
Search owner and app
First result row from the triggering search results
@atc0005
Copy link
Owner Author

atc0005 commented Jan 24, 2020

I suspect that API keys are not natively supported, so the web app would likely have to key off of expected data and/or the expected source IP to help prevent abuse.

I'd guess that sid and maybe the search_name values could be used for this.

@atc0005
Copy link
Owner Author

atc0005 commented Jan 24, 2020

Thanks to Matt Holt, the JSON format would be matched to this Go struct:

type AutoGenerated struct {
	Result struct {
		Sourcetype string `json:"sourcetype"`
		Count      string `json:"count"`
	} `json:"result"`
	Sid         string      `json:"sid"`
	ResultsLink string      `json:"results_link"`
	SearchName  interface{} `json:"search_name"`
	Owner       string      `json:"owner"`
	App         string      `json:"app"`
}

refs https://mholt.github.io/json-to-go/

@atc0005
Copy link
Owner Author

atc0005 commented Feb 5, 2020

Some additional notes:

@atc0005
Copy link
Owner Author

atc0005 commented Feb 5, 2020

Note to self:

  • Setup small demo CLI app to generate Splunk-compatible webhook requests against a target URL
  • Setup small demo API to receive ...

This should help with local testing.

@atc0005
Copy link
Owner Author

atc0005 commented Feb 7, 2020

https://gist.github.com/ungoldman/11282441

From that gist:

$ curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION

@atc0005 atc0005 added documentation Improvements or additions to documentation question Further information is requested labels Mar 6, 2020
@atc0005
Copy link
Owner Author

atc0005 commented Mar 6, 2020

  • Setup small demo API to receive ...

The https://github.com/atc0005/bounce project can serve as a starting point for this with the result being a small endpoint specific to this project (e.g., lack of auto-index landing page, added support for filtering out unwanted fields from search result payloads).

@atc0005 atc0005 added this to the v0.1.0 milestone May 3, 2020
atc0005 added a commit that referenced this issue May 23, 2020
Features of the initial prototype release:

- Highly configurable (with more configuration choices to be exposed
  in the future)

- Supports configuration settings from multiple sources
  - command-line flags
  - environment variables
  - configuration file
  - reasonable default settings

- Ignore individual usernames (i.e., prevent disabling listed accounts)
- Ignore individual IP Addresses (i.e., prevent disabling associated
  account)

- User configurable logging settings
  - levels, format and output

- Microsoft Teams notifications
  - generated for multiple events
    - alert received
    - disabled user
    - ignored user
    - ignored IP Address
    - error occurred
  - configurable retries
  - configurable notifications delay in order to respect remote API
    limits

- Logging
  - Payload receipt from monitoring system
  - Action taken due to payload
    - username ignored
      - due to username inclusion in ignore file for usernames
      - due to IP Address inclusion in ignore file for IP Addresses
    - username disabled

- contrib files/content provided to allow for spinning up a demo
   environment in order to provide a hands-on sense of what this
   project can do
  - fail2ban
  - postfix
  - docker
    - Maildev container
  - brick
  - rsyslog
  - systemd
  - sample JSON payloads for use with curl or other http/API clients
  - demo environment doc
  - slides from group presentation/demo

Worth noting:

- Go modules (vs classic GOPATH setup)
- GitHub Actions Workflows which apply linting and build checks
- Makefile for general use cases (including local linting)
  - Note: See README first if building on Windows

refs:

- GH-26
- GH-21
- GH-16
- GH-15
- GH-13
- GH-12
- GH-11
- GH-7
- GH-6
- GH-4
- GH-1
atc0005 added a commit that referenced this issue May 23, 2020
Features of the initial prototype release:

- Highly configurable (with more configuration choices to be exposed
  in the future)

- Supports configuration settings from multiple sources
  - command-line flags
  - environment variables
  - configuration file
  - reasonable default settings

- Ignore individual usernames (i.e., prevent disabling listed accounts)
- Ignore individual IP Addresses (i.e., prevent disabling associated
  account)

- User configurable logging settings
  - levels, format and output

- Microsoft Teams notifications
  - generated for multiple events
    - alert received
    - disabled user
    - ignored user
    - ignored IP Address
    - error occurred
  - configurable retries
  - configurable notifications delay in order to respect remote API
    limits

- Logging
  - Payload receipt from monitoring system
  - Action taken due to payload
    - username ignored
      - due to username inclusion in ignore file for usernames
      - due to IP Address inclusion in ignore file for IP Addresses
    - username disabled

- contrib files/content provided to allow for spinning up a demo
   environment in order to provide a hands-on sense of what this
   project can do
  - fail2ban
  - postfix
  - docker
    - Maildev container
  - brick
  - rsyslog
  - systemd
  - sample JSON payloads for use with curl or other http/API clients
  - demo environment doc
  - slides from group presentation/demo

Worth noting:

- Go modules (vs classic GOPATH setup)
- GitHub Actions Workflows which apply linting and build checks
- Makefile for general use cases (including local linting)
  - Note: See README first if building on Windows

refs:

- GH-26
- GH-21
- GH-16
- GH-15
- GH-13
- GH-12
- GH-11
- GH-7
- GH-6
- GH-4
- GH-1
atc0005 added a commit that referenced this issue May 23, 2020
Features of the initial prototype release:

- Highly configurable (with more configuration choices to be exposed
  in the future)

- Supports configuration settings from multiple sources
  - command-line flags
  - environment variables
  - configuration file
  - reasonable default settings

- Ignore individual usernames (i.e., prevent disabling listed accounts)
- Ignore individual IP Addresses (i.e., prevent disabling associated
  account)

- User configurable logging settings
  - levels, format and output

- Microsoft Teams notifications
  - generated for multiple events
    - alert received
    - disabled user
    - ignored user
    - ignored IP Address
    - error occurred
  - configurable retries
  - configurable notifications delay in order to respect remote API
    limits

- Logging
  - Payload receipt from monitoring system
  - Action taken due to payload
    - username ignored
      - due to username inclusion in ignore file for usernames
      - due to IP Address inclusion in ignore file for IP Addresses
    - username disabled

- contrib files/content provided to allow for spinning up a demo
   environment in order to provide a hands-on sense of what this
   project can do
  - fail2ban
  - postfix
  - docker
    - Maildev container
  - brick
  - rsyslog
  - systemd
  - sample JSON payloads for use with curl or other http/API clients
  - demo environment doc
  - slides from group presentation/demo

Worth noting:

- Go modules (vs classic GOPATH setup)
- GitHub Actions Workflows which apply linting and build checks
- Makefile for general use cases (including local linting)
  - Note: See README first if building on Windows

refs:

- GH-26
- GH-21
- GH-16
- GH-15
- GH-13
- GH-12
- GH-11
- GH-7
- GH-6
- GH-4
- GH-1
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant