Skip to content
Closed

Staging #4749

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
eb26e44
Create main.yml
ben-diawara Apr 2, 2025
50d023f
Rename main.yml to dac_manual_push_rules_to_elastic.yml
ben-diawara Apr 2, 2025
3a6630e
Update dac_manual_push_rules_to_elastic.yml
ben-diawara Apr 2, 2025
43b05c4
Update dac_manual_push_rules_to_elastic.yml
ben-diawara Apr 2, 2025
4d53228
Update dac_manual_push_rules_to_elastic.yml
ben-diawara Apr 2, 2025
ad6e8aa
Update dac_manual_push_rules_to_elastic.yml
ben-diawara Apr 2, 2025
98292ed
Update dac_manual_push_rules_to_elastic.yml
ben-diawara Apr 2, 2025
37eff54
Update dac_manual_push_rules_to_elastic.yml
ben-diawara Apr 2, 2025
8e441b0
First Rule creation + Custom Rules repo
ben-diawara Apr 2, 2025
5066dab
Update dac_manual_push_rules_to_elastic.yml
ben-diawara Apr 2, 2025
cd0bd80
Update dac_manual_push_rules_to_elastic.yml
ben-diawara Apr 2, 2025
6850a54
Update dac_manual_push_rules_to_elastic.yml
ben-diawara Apr 2, 2025
9aae457
Update dac_manual_push_rules_to_elastic.yml
ben-diawara Apr 2, 2025
ca32e55
new rule
ben-diawara Apr 2, 2025
ddcf55a
Create dac_cicd.yml
ben-diawara Apr 3, 2025
0ec45ab
Update dac_cicd.yml
ben-diawara Apr 3, 2025
011aa01
new rule #2
ben-diawara Apr 3, 2025
5910787
Merge pull request #2 from ben-diawara/dev
ben-diawara Apr 3, 2025
7b95ce5
python event generator
ben-diawara Apr 3, 2025
8be556b
Update dac_cicd.yml
ben-diawara Apr 3, 2025
241cae1
new rule #3
ben-diawara Apr 3, 2025
1b87f7d
Merge pull request #3 from ben-diawara/staging
ben-diawara Apr 3, 2025
045f3f0
Rename add-guidelines.yml to add-guidelines-old.ymlddsds
ben-diawara Apr 3, 2025
54b4dc1
Merge pull request #4 from ben-diawara/dev
ben-diawara Apr 3, 2025
4e8d784
Merge pull request #5 from ben-diawara/staging
ben-diawara Apr 3, 2025
0166508
Update dac_cicd.yml
ben-diawara Apr 3, 2025
9eab2b2
Update dac_cicd.yml
ben-diawara Apr 3, 2025
9846be0
Update dac_cicd.yml
ben-diawara Apr 3, 2025
cebcd28
new rule #4
ben-diawara Apr 3, 2025
877ad3f
Merge pull request #6 from ben-diawara/dev
ben-diawara Apr 3, 2025
7ad8049
Update dac_cicd.yml
ben-diawara Apr 3, 2025
6b0fa82
Update dac_cicd.yml
ben-diawara Apr 3, 2025
a08095e
Update dac_cicd.yml
ben-diawara Apr 3, 2025
cab7251
new rule #6
ben-diawara Apr 3, 2025
318c962
Merge branch 'staging' into dev
ben-diawara Apr 3, 2025
059113e
Merge pull request #7 from ben-diawara/dev
ben-diawara Apr 3, 2025
1c5b5d3
Update dac_cicd.yml
ben-diawara Apr 3, 2025
3dd287f
Create main.yml
ben-diawara Apr 3, 2025
5339476
update log gen script
ben-diawara Apr 3, 2025
311ba45
Update windows_logs_gen.py
ben-diawara Apr 3, 2025
2328033
Update windows_logs_gen.py
ben-diawara Apr 3, 2025
c9b5ada
Update windows_logs_gen.py
ben-diawara Apr 3, 2025
6286cd0
Update windows_logs_gen.py
ben-diawara Apr 3, 2025
aa75b4b
Update main.yml
ben-diawara Apr 3, 2025
deaec04
Update main.yml
ben-diawara Apr 3, 2025
c09ca49
Update dac_cicd.yml
ben-diawara Apr 3, 2025
6643fa3
log gen script ipdate
ben-diawara Apr 3, 2025
53fdb58
new rule #7
ben-diawara Apr 3, 2025
02bc0a0
Delete .github/workflows/add-guidelines-old.ymlddsds
ben-diawara Apr 3, 2025
a147149
Merge pull request #8 from ben-diawara/dev
ben-diawara Apr 3, 2025
6e152ff
Merge branch 'main' into staging
ben-diawara Apr 3, 2025
bd546b8
Merge pull request #9 from ben-diawara/staging
ben-diawara Apr 3, 2025
661a48d
Update dac_cicd.yml
ben-diawara Apr 3, 2025
b61236e
Update dac_cicd.yml
ben-diawara Apr 3, 2025
47652ea
update rule #7
ben-diawara Apr 3, 2025
67b77ca
Update dac_cicd.yml
ben-diawara Apr 3, 2025
9838be5
Update dac_cicd.yml
ben-diawara Apr 3, 2025
c7a8283
Update dac_cicd.yml
ben-diawara Apr 3, 2025
7c7bcb9
new rule #8
ben-diawara Apr 3, 2025
ade33c1
Merge pull request #11 from ben-diawara/dev
ben-diawara Apr 3, 2025
d2d2e2d
Update dac_cicd.yml
ben-diawara Apr 3, 2025
38ec289
Merge pull request #12 from ben-diawara/dev
ben-diawara Apr 3, 2025
55cb778
Delete .github/workflows/add-guidelines.yml
ben-diawara Apr 3, 2025
23eaa15
Merge branch 'main' into staging
ben-diawara Apr 3, 2025
6c6d8d7
Merge pull request #13 from ben-diawara/staging
ben-diawara Apr 3, 2025
2f45130
Delete rules_custom/rules/suspicious authentication.toml
ben-diawara Apr 3, 2025
99f8965
Delete rules_custom/rules/suspicious authentication.toml
ben-diawara Apr 3, 2025
f53c89f
Update dac_cicd.yml
ben-diawara Apr 3, 2025
2bae985
Update dac_cicd.yml
ben-diawara Apr 3, 2025
c030624
Update dac_cicd.yml
ben-diawara Apr 3, 2025
35f748a
new update rule 1730
ben-diawara Apr 3, 2025
2b3f9bb
rule update
ben-diawara Apr 3, 2025
dbaf574
ok
ben-diawara Apr 3, 2025
0bde70b
Merge pull request #14 from ben-diawara/dev
ben-diawara Apr 3, 2025
5f7ed39
Update dac_cicd.yml
ben-diawara Apr 3, 2025
1a085fa
update rrule
ben-diawara Apr 3, 2025
0b68820
Update dac_cicd.yml
ben-diawara Apr 3, 2025
633e1fe
Merge pull request #15 from ben-diawara/dev
ben-diawara Apr 3, 2025
ff95bc9
rule update
ben-diawara Apr 3, 2025
95ca16d
Merge pull request #16 from ben-diawara/dev
ben-diawara Apr 3, 2025
eb113e6
Update dac_cicd.yml
ben-diawara Apr 3, 2025
04fec22
rule update
ben-diawara Apr 3, 2025
1a0e75a
Merge pull request #17 from ben-diawara/dev
ben-diawara Apr 3, 2025
e884c41
Update dac_cicd.yml
ben-diawara Apr 3, 2025
ac1dfe2
Rule + Script update
ben-diawara Apr 3, 2025
42ff4c7
Merge pull request #18 from ben-diawara/dev
ben-diawara Apr 3, 2025
7e91b86
Merge branch 'main' into staging
ben-diawara Apr 3, 2025
fca11be
Rule update
ben-diawara Apr 4, 2025
b34756e
Merge pull request #20 from ben-diawara/dev
ben-diawara Apr 4, 2025
9b70960
test
ben-diawara Apr 7, 2025
6209d79
Merge pull request #22 from ben-diawara/dev
ben-diawara Apr 7, 2025
b4c0ba8
test rule
ben-diawara Apr 7, 2025
101f47f
tete
ben-diawara Apr 7, 2025
04724b9
test2
ben-diawara Apr 7, 2025
5ce0384
test
ben-diawara Apr 7, 2025
6285eba
rere
ben-diawara Apr 7, 2025
887e663
Delete .github/workflows/main.yml
ben-diawara Apr 9, 2025
f7f4267
Script header added
ben-diawara Apr 9, 2025
b50ac2c
Merge pull request #24 from ben-diawara/dev
ben-diawara Apr 9, 2025
d844f1e
Rule update
ben-diawara Apr 10, 2025
e1188e0
Merge pull request #26 from ben-diawara/dev
ben-diawara Apr 10, 2025
5196439
Update dac_cicd.yml
ben-diawara Apr 10, 2025
292ae53
Dev (#28)
ben-diawara Apr 14, 2025
c170cce
Dev (#30)
ben-diawara Apr 14, 2025
37cb222
Dev (#32)
ben-diawara May 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 0 additions & 61 deletions .github/workflows/add-guidelines.yml

This file was deleted.

141 changes: 141 additions & 0 deletions .github/workflows/dac_cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: DAC - SIEM CI/CD Workflow

on:
push:
branches:
- "dev" # Dedicated for new rules implementatioln
- "staging" # Dedicated for rules evalation and fine tuning
- "main" # Decicated for production rules
paths:
- '**/*.toml'
pull_request:
branches:
- "staging"
- "main"
# workflow_dispatch:
# inputs:
# space:
# description: 'Kibana space to use (dev or prod)'
# required: false
# default: 'dac-dev'

jobs:

deploy-to-dev:
name: Deploy to Kibana Dev SIEM Space
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/dev'
env:
CUSTOM_RULES_DIR: ${{ secrets.CUSTOM_RULES_DIR }}

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: '3.12'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip cache purge
pip install .[dev]

#- name: Setup config file
# run: |
# python -m detection_rules custom-rules setup-config rules_custom --overwrite

- name: Import Rules to Kibana
run: |
python -m detection_rules kibana --space dac-dev import-rules --overwrite -e -ac -d ${{ env.CUSTOM_RULES_DIR }}/rules
env:
DR_CLOUD_ID: ${{ secrets.ELASTIC_CLOUD_ID }}
DR_API_KEY: ${{ secrets.ELASTIC_API_KEY }}

deploy-to-staging:
name: Deploy to Staging SIEM Space
#needs: deploy-to-dev
if: github.ref == 'refs/heads/staging'
runs-on: ubuntu-latest
env:
CUSTOM_RULES_DIR: ${{ secrets.CUSTOM_RULES_DIR }}

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: '3.12'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip cache purge
pip install .[dev]

- name: Import Rules to Kibana
run: |
python -m detection_rules kibana --space dac-staging import-rules --overwrite -e -ac -d ${{ env.CUSTOM_RULES_DIR }}/rules
env:
DR_CLOUD_ID: ${{ secrets.ELASTIC_CLOUD_ID }}
DR_API_KEY: ${{ secrets.ELASTIC_API_KEY }}

- name: Update rule hashes in version.lock.json file without bumping version
run: |
python -m detection_rules dev update-lock-versions --force

generate-auth-logs:
name: Generate Authentication Logs & Send to Elastic SIEM
needs: deploy-to-staging
if: github.ref == 'refs/heads/staging'
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Install Python Dependencies
run: pip install elasticsearch requests faker

- name: Run Authentication Log Generator
env:
ELASTIC_URL: "${{ secrets.ELASTIC_URL }}"
ELASTIC_API_KEY: ${{ secrets.ELASTIC_API_KEY }}
run: python scripts/windows_logs_gen.py

deploy-to-production:
name: Deploy to Production SIEM Space
#needs: deploy-to-staging
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
env:
CUSTOM_RULES_DIR: ${{ secrets.CUSTOM_RULES_DIR }}

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: '3.12'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip cache purge
pip install .[dev]

#- name: Setup config file
# run: |
# python -m detection_rules custom-rules setup-config rules_custom --overwrite

- name: Import Rules to Kibana
run: |
python -m detection_rules kibana --space dac-prod import-rules --overwrite -e -ac -d ${{ env.CUSTOM_RULES_DIR }}/rules
env:
DR_CLOUD_ID: ${{ secrets.ELASTIC_CLOUD_ID }}
DR_API_KEY: ${{ secrets.ELASTIC_API_KEY }}
46 changes: 46 additions & 0 deletions .github/workflows/dac_manual_push_rules_to_elastic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Push Latest Rules to Elastic Security Space

on:
push:
branches:
- main
paths:
- '**/*.toml'
workflow_dispatch:
inputs:
space:
description: 'Kibana space to use (dev or prod)'
required: false
default: 'dac-dev'

jobs:
push-to-dev:
runs-on: ubuntu-latest
env:
CUSTOM_RULES_DIR: ${{ secrets.CUSTOM_RULES_DIR }}

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: '3.12'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip cache purge
pip install .[dev]

#- name: Setup config file
# run: |
# python -m detection_rules custom-rules setup-config rules_custom --overwrite

- name: Import Rules to Kibana
run: |
python -m detection_rules kibana --space "${{ github.event.inputs.space }}" import-rules --overwrite -e -ac -d ${{ env.CUSTOM_RULES_DIR }}/rules
env:
DR_CLOUD_ID: ${{ secrets.ELASTIC_CLOUD_ID }}
DR_API_KEY: ${{ secrets.ELASTIC_API_KEY }}
15 changes: 15 additions & 0 deletions rules_custom/_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
bbr_rules_dirs:
- rules_building_block
directories:
action_connector_dir: action_connectors
action_dir: actions
exception_dir: exceptions
files:
deprecated_rules: etc/deprecated_rules.json
packages: etc/packages.yaml
stack_schema_map: etc/stack-schema-map.yaml
version_lock: etc/version.lock.json
rule_dirs:
- rules
testing:
config: etc/test_config.yaml
1 change: 1 addition & 0 deletions rules_custom/etc/deprecated_rules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
2 changes: 2 additions & 0 deletions rules_custom/etc/packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package:
name: '9.1'
4 changes: 4 additions & 0 deletions rules_custom/etc/stack-schema-map.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
9.1.0:
beats: 9.0.0-beta1
ecs: 9.0.0-rc1
endgame: 8.4.0
11 changes: 11 additions & 0 deletions rules_custom/etc/test_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# For more details, refer to the example configuration:
# /Users/bendiawara/Project/dac/detection-rules/detection_rules/etc/example_test_config.yaml
# Define tests to explicitly bypass, with all others being run.
# To run all tests, set bypass to empty or leave this file commented out.

unit_tests:
bypass:
- tests.test_gh_workflows.TestWorkflows.test_matrix_to_lock_version_defaults
- tests.test_schemas.TestVersionLockSchema.test_version_lock_has_nested_previous
- tests.test_packages.TestRegistryPackage.test_registry_package_config
- tests.test_all_rules.TestValidRules.test_schema_and_dupes
1 change: 1 addition & 0 deletions rules_custom/etc/version.lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
33 changes: 33 additions & 0 deletions rules_custom/exceptions/exception1.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[metadata]
creation_date = "2025/04/07"
list_name = "TestShareList"
rule_ids = ["4ed8e743-3af3-4503-b710-497c16a53ed9"]
rule_names = ["rere"]
updated_date = "2024/07/10"

[[exceptions]]
[exceptions.container]
description = "Dac Vuln Scanners"
list_id = "dbc9b368-5d39-41fa-9a16-bfcb995fc866"
name = "vulnerability_scanners"
namespace_type = "single"
tags = []
type = "detection"

[[exceptions.items]]
comments = []
description = "Exception list item"
list_id = "dbc9b368-5d39-41fa-9a16-bfcb995fc866"
item_id = "7c823cd0-ca30-46ba-af35-3633219eed1f"
name = "qualys_scanners"
namespace_type = "single"
tags = []
type = "simple"

[[exceptions.items.entries]]
field = "source.ip"
type = "match"
operator = "included"
value = "192.168.1.10"


37 changes: 37 additions & 0 deletions rules_custom/rules/suspicious_authentication.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[metadata]
creation_date = "2025/04/03"
maturity = "development"
updated_date = "2025/04/03"

[rule]
author = ["Ben D"]
description = """
Identifies Suspicious Authentication
"""
false_positives = ["Legitimate exchange system administrations activity."]
from = "now-9m"
index = [
"logs-*"]
language = "kuery"
license = "Elastic License v2"
name = "Suspicious Authentication Detected"
note = """## TBD.
"""
references = [
"https://www.elastic.co/",
"https://www.elastic.co/"
]
risk_score = 47
rule_id = "6aace640-e631-4870-ba8e-5fdda09325ae"
severity = "medium"
enabled = "true"
tags = [
"Domain: Endpoint",
"OS: Windows",
]
type = "query"

query = '''
event.category : "authentication" and event.outcome : "failure" and user.name : "adminfake"
'''

Loading
Loading