Skip to content

Commit e7adf3d

Browse files
author
Lee Chagolla-Christensen
committed
yara clarifications
1 parent 3d83369 commit e7adf3d

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

compose.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ services:
238238
interval: 5s
239239
timeout: 5s
240240
retries: 5
241-
volumes:
242-
# Uncomment the following line to use custom YARA rules
243-
- ./libs/file_enrichment_modules/yara_rules/prod/:/yara_rules/:ro
241+
volumes: []
242+
# Uncomment the following line to use custom YARA rules (*.yar/*.yara files)
243+
# - ./libs/file_enrichment_modules/yara_rules/prod/:/yara_rules/:ro
244244
environment: &file-enrichment-environment
245245
ENABLE_PII_DETECTION: ${ENABLE_PII_DETECTION:-false}
246246
PII_DETECTION_THRESHOLD: ${PII_DETECTION_THRESHOLD:-0.7}

docs/yara.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ After rule creation, click the (now) green "Reload Yara Engine" button to ensure
2020

2121
If you want to change the default set of rules _without_ having to add rules on each deployment, add a new yara file to `./libs/file_enrichment_modules/yara_rules/dev/` for development or `./libs/file_enrichment_modules/yara_rules/prod/` for production.
2222

23+
**Note:** Rule files must use a `.yar` or `.yara` extension to be loaded. Files with other extensions (e.g., `.txt`) will be ignored. The example production rules shipped in `./libs/file_enrichment_modules/yara_rules/prod/` are distributed as `.txt` files and must be renamed to `.yar` or `.yara` before they will be picked up.
24+
2325
### Editing Existing Rules
2426

2527
To edit an existing rule, click the "Edit Rule" button under actions, modify the rule as wanted, and click "Save":

libs/file_enrichment_modules/file_enrichment_modules/yara/yara_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async def _process_disk_rules(self):
5858
disk_sources = {}
5959
disk_rules = {} # Store rule name to content mapping
6060

61-
# First load and parse all disk rules
61+
# First load and parse all disk rules (only .yar and .yara extensions are supported)
6262
yara_file_paths = glob.glob(f"{YARA_RULES_FOLDER_PATH}**/*.yar*", recursive=True)
6363
for path in yara_file_paths:
6464
logger.info("Loading yara rules from disk", path=path)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
YARA rule files in this directory must use a .yar or .yara extension to be
2+
loaded by the engine. The example rules are distributed as .txt files and
3+
must be renamed before they will be picked up.
4+
5+
You must also uncomment the volume mount in compose.yaml for the
6+
file-enrichment service to mount this directory into the container.

0 commit comments

Comments
 (0)