A serverless alerting system built to monitor AWS Infrastructure for suspicious activites.
- Monitors AWS resources for configurable suspicious activities and API calls for events like: CreateUser, DeleteUser, AttachUserPolicy, StopLogging, PutBucketPolicy, etc.
- Sends notifications via email.
- Easy deployment with Terraform
- AWS CloudTrail
- AWS Lambda
- AWS Simple Storage Service (s3)
- AWS Identity and Access Management (IAM)
- AWS Simple Notification Service (SNS)
- AWS account with IAM permissions to deploy resources
- Fork this repo and then clone it.
- Enable Github Actions in your fork.
- Edit
lambda_function.pyto define alert rules. - Inside the
terraformfolder, copy the contents of theexample_terraform_tfvarsfile into a newterraform.tfvarsfile and fill in required variables. - Create github actions secrets for:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYSNS_TOPIC_ARNLAMBDA_CODE_BUCKET_NAME( Must be thesame as specified interrform.tfvarsfile).
- Initialize and apply the Terraform configuration:
Note: If you run into an "object key not found error" then just commit and push a change for the
terraform init terraform apply
lambda_function.pyfile to your repo and that would trigger the CICD workflow to upload thelambda_function.zipfile to s3. Then runterraform applyagain. - Confirm the sns subscription notification from the email sent to you.
- Create a new iam user to test it out. Note: Alerts may take a short while before you get notified.
The test_lambda.sh script and the sample_log.json files were used for locally testing this project while it was in its early stages before cloud deployment.
The sample_long.json contains the format of what a suspicious event would look like in the cloudTrail log.
Contributions are welcome! Please open issues or submit pull requests.