Skip to content

Instantly share code, notes, and snippets.

@syncip
Created January 5, 2024 15:52
Show Gist options
  • Save syncip/c462234cf1cbd163fc01bd42b86c8d3d to your computer and use it in GitHub Desktop.
Save syncip/c462234cf1cbd163fc01bd42b86c8d3d to your computer and use it in GitHub Desktop.
ntfy crowdsec notification example
# /etc/crowdsec/notifications/ntfy.yaml
type: http # Don't change
name: ntfy # Must match the registered plugin in the profile
# One of "trace", "debug", "info", "warn", "error", "off"
log_level: trace
# group_wait: # Time to wait collecting alerts before relaying a message to this plugin, eg "30s"
# group_threshold: # Amount of alerts that triggers a message before <group_wait> has expired, eg "10"
# max_retry: # Number of attempts to relay messages to plugins in case of error
# timeout: # Time to wait for response from the plugin before considering the attempt a failure, eg "10s"
#-------------------------
# plugin-specific options
# The following template receives a list of models.Alert objects
# The output goes in the http request body
format: |
{{range . -}}{{$alert := . -}}{{range .Decisions -}}{{.Value}} will get {{.Type}} for next {{.Duration}} for triggering {{.Scenario}}
https://www.shodan.io/host/{{.Value}}
https://app.crowdsec.net/cti/{{.Value}}{{end -}}{{end -}}
url: https://ntfy.sh/crowdsec
method: POST
headers:
Content-Type: "text/plain"
Title: "Crowdsec Trigger"
Tags: "warning"
@hardwareadictos
Copy link

Hey!! I'm trying to make it work with ntfy authentication: https://docs.ntfy.sh/publish/#authentication

Do you know any way of implementing this on this template??

@Uzurka
Copy link

Uzurka commented Jan 29, 2025

Hey!! I'm trying to make it work with ntfy authentication: https://docs.ntfy.sh/publish/#authentication

Do you know any way of implementing this on this template??

Yep, there's a way.

headers:
  Content-Type: "text/plain"
  Authorization: "Bearer ntfy_token_generated_from_cli"
  Title: "Crowdsec Trigger"
  Tags: "warning"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment