-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[rule processor] Support data normalization
* Add a configuration file conf/types.json * Add data normalization logic in rule processor * Add a sample rule for integration test * Add unit test cases
- Loading branch information
Chunyong Lin
committed
Aug 31, 2017
1 parent
ec648d1
commit 7093697
Showing
17 changed files
with
572 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"carbonblack":{ | ||
"username": ["username"], | ||
"domain": ["domain"], | ||
"process_path": ["parent_path", "process_path", "path"], | ||
"protocol": ["protocol"], | ||
"feed_source": ["feed_name"], | ||
"process": ["parent_name", "process_name"], | ||
"filename": ["observed_filename", "file_path"], | ||
"command": ["cmdline"], | ||
"md5_hash": ["process_md5", "parent_md5", "expect_followon_w_md5", "md5"], | ||
"binary_score": ["report_score"], | ||
"os_type": ["host_type", "os_type"], | ||
"ipaddress": ["ipv4", "comms_ip", "interface_ip", "remote_ip", "local_ip"], | ||
"port": ["port", "remote_port", "local_port"], | ||
"src_host": ["other_hostnames", "server_name", "hostname", "computer_name"] | ||
}, | ||
"cloudwatch":{ | ||
"username": ["userName", "owner", "invokedBy"], | ||
"account": ["account", "recipientAccountId"], | ||
"protocol": ["protocol"], | ||
"event_type": ["eventType"], | ||
"event_name": ["eventName"], | ||
"region": ["region"], | ||
"user_agent": ["userAgent"], | ||
"ipaddress": ["destination", "source", "sourceIPAddress"], | ||
"port": ["srcport", "destport"] | ||
}, | ||
"cloudtrail": { | ||
"account": ["account", "recipientAccountId", "accountId"], | ||
"event_type": ["eventType"], | ||
"event_name": ["eventName"], | ||
"region": ["region", "awsRegion"], | ||
"user_type": ["type"], | ||
"user_agent": ["userAgent"], | ||
"ipaddress": ["sourceIPAddress"] | ||
}, | ||
"ghe": { | ||
"process": ["program"], | ||
"username": ["current_user"], | ||
"ipaddress": ["remote_address"], | ||
"port": ["port"], | ||
"src_host": ["host"] | ||
}, | ||
"osquery": { | ||
"username": ["username", "user"], | ||
"process_path": ["path"], | ||
"protocol": ["protocol"], | ||
"severity": ["severity"], | ||
"cluster": ["envIdentifier"], | ||
"role": ["roleIdentifier"], | ||
"command": ["cmdline", "command"], | ||
"message": ["message"], | ||
"ipaddress": ["destination", "remote_address", "host", "source", "local_address", "gateway", "address"], | ||
"port": ["local_port", "remote_port", "port"], | ||
"src_host": ["hostIdentifier"] | ||
}, | ||
"pan": { | ||
"username": ["srcuser", "dstuser"], | ||
"protocol": ["proto"], | ||
"ipaddress": ["src", "natsrc", "dst", "natdst"], | ||
"port": ["dport", "sport", "natsport", "natdport"], | ||
"src_host": ["sourceName"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
rules/community/cloudtrail/cloudtrail_aws_access_by_evil.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Alert on matching IP address from aws access.""" | ||
from stream_alert.rule_processor.rules_engine import StreamRules | ||
from helpers.base import fetch_values_by_datatype | ||
|
||
rule = StreamRules.rule | ||
|
||
|
||
@rule(logs=['cloudwatch:events'], | ||
matchers=[], | ||
datatypes=['ipaddress'], | ||
outputs=['aws-s3:sample-bucket', | ||
'pagerduty:sample-integration', | ||
'slack:sample-channel']) | ||
def cloudtrail_aws_access_by_evil(rec): | ||
""" | ||
author: airbnb_csirt | ||
description: This is sample rule to get alert by using normalized type | ||
"ipaddress". | ||
""" | ||
|
||
results = fetch_values_by_datatype(rec, 'ipaddress') | ||
|
||
for result in results: | ||
if result == '1.1.1.2': | ||
return True | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.