Skip to content

Commit 4a1c52f

Browse files
Improve templates
1 parent b19fea1 commit 4a1c52f

12 files changed

+39
-32
lines changed

.gitlab-ci.yml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
stages:
2323
- build
2424
- test
25-
- deploy
2625
- mirror
26+
- deploy
2727

2828
cache:
2929
key: elastalert
@@ -45,11 +45,18 @@ test:
4545
- npm install --quiet
4646
- npm test
4747

48-
lint:
49-
<<: *node-test
48+
mirror:github:
49+
stage: mirror
5050
script:
51-
- npm install --quiet
52-
- ./node_modules/.bin/eslint .
51+
- git clone --mirror https://git.bitsensor.io/back-end/elastalert.git mirror-github
52+
- cd mirror-github
53+
- git remote add github https://$MIRROR_GITHUB_USER:$MIRROR_GITHUB_PASSWORD@$MIRROR_GITHUB_URL
54+
- git push -u github -q --mirror
55+
- rm -rf mirror-github
56+
when: always
57+
only:
58+
- tags
59+
- develop
5360

5461
deploy:npm:
5562
image: node:slim
@@ -63,6 +70,8 @@ deploy:npm:
6370

6471
deploy:docker:
6572
stage: deploy
73+
before_script:
74+
- sh scripts/replace_templates.sh
6675
script:
6776
- docker info
6877
- docker login -u $BITSENSOR_USERNAME -p $BITSENSOR_PASSWORD artifacts.bitsensor.io:1443
@@ -78,6 +87,8 @@ deploy:docker:
7887

7988
deploy:docker:snapshot:
8089
stage: deploy
90+
before_script:
91+
- sh scripts/replace_templates.sh
8192
script:
8293
- docker info
8394
- docker login -u $BITSENSOR_USERNAME -p $BITSENSOR_PASSWORD artifacts.bitsensor.io:1443
@@ -115,16 +126,4 @@ deploy:docker-hub:snapshot:
115126
only:
116127
- develop
117128
tags:
118-
- docker
119-
120-
mirror:github:
121-
stage: mirror
122-
script:
123-
- git clone --mirror https://git.bitsensor.io/back-end/elastalert.git mirror-github
124-
- cd mirror-github
125-
- git remote add github https://$MIRROR_GITHUB_USER:$MIRROR_GITHUB_PASSWORD@$MIRROR_GITHUB_URL
126-
- git push -u github -q --mirror
127-
when: always
128-
only:
129-
- tags
130-
- develop
129+
- docker

rule_templates/detection_template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ alert_text_args:
5252
# The alert is use when a match is found
5353
alert:
5454
- slack
55-
slack_webhook_url: "https://hooks.slack.com/services/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"
55+
slack_webhook_url: "https://hooks.slack.com/services/"
5656
slack_username_override: "ElastAlert"

rule_templates/integration_started.yaml renamed to rule_templates/integration_started_template.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ alert_text_args:
3939
alert:
4040
- slack
4141

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

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

4848
# Link to BitSensor Kibana Dashboard
49-
use_kibana4_dashboard: "https://dev.bitsensor.io/app/kibana#/dashboard/Pre-Integration"
49+
use_kibana4_dashboard: "https://kibana.dashboard.io/app/kibana#/dashboard"
5050

5151
# Index to search, wildcard supported
5252
index: bitsensor
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ doc_type: datapoint
2626
index: bitsensor
2727
timestamp_field: endpoint.localtime
2828

29-
alert_subject: "No data on dev.bitsensor.io"
29+
alert_subject: "No data on dashboard"
3030

3131
alert_text_type: alert_text_only
3232
alert_text: "The stack receives no data. It might be down :("
3333

3434
# The alert is use when a match is found
3535
alert:
3636
- slack
37-
slack_webhook_url: "https://hooks.slack.com/services/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"
37+
slack_webhook_url: "https://hooks.slack.com/services/"
3838
slack_username_override: "ElastAlert"

rule_templates/relevant_attack_template.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ alert:
6363
# Click on your Workspace name (upper left corner)
6464
# Go to "Manage Apps", then "Custom Integrations", "Incoming Webhooks"
6565
# Press "Add Configuration", and choose your channel. Now paste it here:
66-
slack_webhook_url: "https://hooks.slack.com/services/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"
66+
slack_webhook_url: "https://hooks.slack.com/services/"
6767
slack_username_override: "BitSensor Alerting"
6868

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

7272
# Link to BitSensor Kibana Dashboard
73-
use_kibana4_dashboard: "https://dev.bitsensor.io/app/kibana#/dashboard/Live-Hacking"
73+
use_kibana4_dashboard: "https://kibana.dashboard.io/app/kibana#/dashboard"
7474

7575
# Enhancement for converting 'detections' array into object, ex. get merged detection type by
7676
# 'detections_parsed.type' or get first detection type by 'detection_parsed.0.type'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ alert_text_args:
2929
# The alert is use when a match is found
3030
alert:
3131
- slack
32-
slack_webhook_url: "https://hooks.slack.com/services/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"
32+
slack_webhook_url: "https://hooks.slack.com/services/"
3333
slack_username_override: "ElastAlert"
3434

rule_templates/successful_attack_template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ alert_text_args:
4646
# The alert is use when a match is found
4747
alert:
4848
- slack
49-
slack_webhook_url: "https://hooks.slack.com/services/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"
49+
slack_webhook_url: "https://hooks.slack.com/services/"
5050
slack_username_override: "ElastAlert"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@ alert_text_args:
5555
# The alert is use when a match is found
5656
alert:
5757
- slack
58-
slack_webhook_url: "https://hooks.slack.com/services/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"
58+
slack_webhook_url: "https://hooks.slack.com/services/"
5959
slack_username_override: "ElastAlert"

rule_templates/volumetric_alert.yaml renamed to rule_templates/volumetric_alert_template.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ alert_text_args:
6060
alert:
6161
- slack
6262

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

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

6969
# Link to BitSensor Kibana Dashboard
70-
use_kibana4_dashboard: "https://dev.bitsensor.io/app/kibana#/dashboard/Live-Hacking"
70+
use_kibana4_dashboard: "https://kibana.dashboard.io/app/kibana#/dashboard"

scripts/replace_templates.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# This script replaces the default templates with
3+
# custom ElastAlert templates we use at BitSensor
4+
5+
rm rule_templates/*
6+
git clone [email protected]:front-end/elastalert-rules.git replacement-rules
7+
cp replacement-rules/rules/* rule_templates/
8+
rm -rf replacement-rules

0 commit comments

Comments
 (0)