feat: Add AWS CloudTrail Ingestion Source (#547)#561
Open
R1sh0bh-1 wants to merge 3 commits intocertego:developfrom
Open
feat: Add AWS CloudTrail Ingestion Source (#547)#561R1sh0bh-1 wants to merge 3 commits intocertego:developfrom
R1sh0bh-1 wants to merge 3 commits intocertego:developfrom
Conversation
Contributor
Author
|
Hi @Lorygold, I've added Could you please guide how to make CI install the new deps? Happy to add a fix if needed. Thanks! |
Contributor
|
Hi @R1sh0bh-1 for the CI errors, try to add the libraries into the |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: Add AWS CloudTrail Ingestion Source (#547)
Summary
This PR implements ingestion support for AWS CloudTrail logs stored in S3, enabling detection of impossible travel and anomalous logins in AWS environments. It processes successful events like
ConsoleLoginandAssumeRole, extracts usernames from directuserNameandsessionContext.sessionIssuer, enriches with GeoIP, and normalizes fields for the existing pipeline.Closes #547.
Key Changes
CloudTrailIngestionclass (buffalogs/impossible_travel/ingestion/cloudtrail_ingestion.py):get_log_files).extract_logins,is_login_event).parse_login).CLOUDTRAILtoSupportedIngestionSourcesenum (base_ingestion.py).IngestionFactoryto instantiateCloudTrailIngestion(ingestion_factory.py)."cloudtrail"section toconfig/buffalogs/ingestion.jsonwith placeholders for bucket, region, credentials, and GeoLite2 path.boto3>=1.35.0andgeoip2>=4.8.0todjango-buffalogs/setup.cfg.buffalogs/impossible_travel/tests/ingestion/test_cloudtrail_ingestion.py): 4 tests passing for S3 pagination, login parsing, IP skipping, and geo failure handling.test_cloudtrail_integration.py): Verifies end-to-end flow (fetch, parse, username extraction, user/logins return) — runs successfully locally.docs/ingestion/cloudtrail.mdwith setup, config, testing, troubleshooting, and future ideas.How to Test
python test_cloudtrail_integration.py→ Confirms S3 fetch, parsing, and username extraction work (output: Users found: ['alice', 'bob']; Alice logins: [1 login])../GeoLite2-City.mmdb:/etc/buffalogs/GeoLite2-City.mmdb:roin docker-compose.override.yml).ingestion.json."active_ingestion": "cloudtrail".docker compose down && docker compose up -d.python manage.py impossible_travel.python manage.py test impossible_travel.tests.ingestion -v 2→ All 4 tests pass.Verification
Notes
Ready for review and merge. Thanks for the feedback loop — happy to iterate!