Detection Rules as Code
This repository contains tooling to manage CrowdStrike Correlation Rules as code, enabling version control and automated deployment of detection rules.
Overview
The project provides a Python-based solution for managing CrowdStrike Correlation Detection Rules through code, supporting:
Synchronization between local rules and the API
Creation of new rules
Updates to existing rules
Deletion of rules
Version control through Git
Prerequisites
Python 3.x
CrowdStrike API Credential for read & write permission on the
Correlation RulesscopeRequired Python packages: crowdstrike-falconpy
pip install crowdstrike-falconpy
Setup
Clone the repository:
Set up environment variables:
Usage
Initial Sync
To perform initial synchronization with the API:
This will create/update rules/rules.json with the current state from the API.
Creating New Rules
Add a new rule to
rules.jsonwithout an ID:
Run the sync script to create the rule in the API.
Updating Rules
Modify the desired rule in
rules.jsonRun the sync script to apply changes
Deleting Rules
Add
"deleted": trueto the rule in rules.jsonRun the sync script to delete the rule from the API
File Structure
GitHub Actions
This repository includes a GitHub Actions workflow that:
Runs on changes to rules.json
Validates and syncs rules with the API
Required GitHub Secrets
FALCON_CLIENT_ID
FALCON_CLIENT_SECRET
FALCON_BASE_URL (optional)
LOG_LEVEL (optional)
Last updated
Was this helpful?