Skip to content

Commit

Permalink
Add sample rules
Browse files Browse the repository at this point in the history
SSH usees include_match_in_root to give an example of the feature. Repeat offender is an example of a second order rule.
  • Loading branch information
Ruben van Vreeland committed Jul 25, 2019
1 parent 4b927b9 commit bb248f9
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 0 deletions.
61 changes: 61 additions & 0 deletions example_rules/ssh-repeat-offender.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Rule name, must be unique
name: SSH abuse - reapeat offender

# Alert on x events in y seconds
type: frequency

# Alert when this many documents matching the query occur within a timeframe
num_events: 2

# num_events must occur within this amount of time to trigger an alert
timeframe:
weeks: 1

# A list of elasticsearch filters used for find events
# These filters are joined with AND and nested in a filtered query
# For more info: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl.html
filter:
- term:
rule_name: "SSH abuse"

index: elastalert

# When the attacker continues, send a new alert after x minutes
realert:
weeks: 4

query_key:
- match_body.source.ip

include:
- match_body.host.hostname
- match_body.user.name
- match_body.source.ip

alert_subject: "SSH abuse (repeat offender) on <{}> | <{}|Show Dashboard>"
alert_subject_args:
- match_body.host.hostname
- kibana_link

alert_text: |-
An reapeat offender has been active on {}.
IP: {}
User: {}
alert_text_args:
- match_body.host.hostname
- match_body.user.name
- match_body.source.ip

# The alert is use when a match is found
alert:
- slack

slack_webhook_url: "https://hooks.slack.com/services/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"
slack_username_override: "ElastAlert"

# Alert body only cointains a title and text
alert_text_type: alert_text_only

# Link to BitSensor Kibana Dashboard
use_kibana4_dashboard: "https://dev.securely.ai/app/kibana#/dashboard/37739d80-a95c-11e9-b5ba-33a34ca252fb"
64 changes: 64 additions & 0 deletions example_rules/ssh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Rule name, must be unique
name: SSH abuse (ElastAlert 3.0.1) - 2

# Alert on x events in y seconds
type: frequency

# Alert when this many documents matching the query occur within a timeframe
num_events: 20

# num_events must occur within this amount of time to trigger an alert
timeframe:
minutes: 60

# A list of elasticsearch filters used for find events
# These filters are joined with AND and nested in a filtered query
# For more info: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl.html
filter:
- query:
query_string:
query: "event.type:authentication_failure"

index: auditbeat-*

# When the attacker continues, send a new alert after x minutes
realert:
minutes: 1

query_key:
- source.ip

include:
- host.hostname
- user.name
- source.ip

include_match_in_root: true

alert_subject: "SSH abuse on <{}> | <{}|Show Dashboard>"
alert_subject_args:
- host.hostname
- kibana_link

alert_text: |-
An attack on {} is detected.
The attacker looks like:
User: {}
IP: {}
alert_text_args:
- host.hostname
- user.name
- source.ip

# The alert is use when a match is found
alert:
- debug

slack_webhook_url: "https://hooks.slack.com/services/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"
slack_username_override: "ElastAlert"

# Alert body only cointains a title and text
alert_text_type: alert_text_only

# Link to BitSensor Kibana Dashboard
use_kibana4_dashboard: "https://dev.securely.ai/app/kibana#/dashboard/37739d80-a95c-11e9-b5ba-33a34ca252fb"

0 comments on commit bb248f9

Please sign in to comment.