This module is to help implement compliance with the CIS benchmarks as tested in the Bridgecrew checks https://docs.bridgecrew.io/docs/monitoring-policies:
- BC_AWS_MONITORING_1
- BC_AWS_MONITORING_2
- BC_AWS_MONITORING_3
- BC_AWS_MONITORING_4
- BC_AWS_MONITORING_5
- BC_AWS_MONITORING_6
- BC_AWS_MONITORING_7
- BC_AWS_MONITORING_8
- BC_AWS_MONITORING_9
- BC_AWS_MONITORING_10
- BC_AWS_MONITORING_11
- BC_AWS_MONITORING_12
- BC_AWS_MONITORING_13
- BC_AWS_MONITORING_14
This module is 100% Open Source and licensed under the APACHE2.
This module deploys security-alerts for an AWS account. TODO: Update to use lambda rather than SNS Email - https://aws.amazon.com/premiumsupport/knowledge-center/change-sns-email-for-cloudwatch-events/
Include this repository as a module in your existing Terraform code:
module "security-alerts" {
source = "JamesWoolfenden/security-alerts/aws"
version = "v0.0.3"
endpoint = var.endpoint
}
aws cloudwatch set-alarm-state --alarm-name "vpc_changes_alarm" --state-reason "Testing the Amazon Cloudwatch alarm" --state-value ALARM --region eu-west-2
Calculated monthly cost estimate
Project: .
Name Monthly Qty Unit Monthly Cost
module.alerts.aws_cloudwatch_metric_alarm.bucket_mod
└─ Standard resolution 1 alarm metrics $0.10
module.alerts.aws_cloudwatch_metric_alarm.cloudtrail_cfg
└─ Standard resolution 1 alarm metrics $0.10
module.alerts.aws_cloudwatch_metric_alarm.cmk
└─ Standard resolution 1 alarm metrics $0.10
module.alerts.aws_cloudwatch_metric_alarm.config_change
└─ Standard resolution 1 alarm metrics $0.10
module.alerts.aws_cloudwatch_metric_alarm.gateway
└─ Standard resolution 1 alarm metrics $0.10
module.alerts.aws_cloudwatch_metric_alarm.nacl
└─ Standard resolution 1 alarm metrics $0.10
module.alerts.aws_cloudwatch_metric_alarm.nomfa
└─ Standard resolution 1 alarm metrics $0.10
module.alerts.aws_cloudwatch_metric_alarm.policychange
└─ Standard resolution 1 alarm metrics $0.10
module.alerts.aws_cloudwatch_metric_alarm.root
└─ Standard resolution 1 alarm metrics $0.10
module.alerts.aws_cloudwatch_metric_alarm.routes
└─ Standard resolution 1 alarm metrics $0.10
module.alerts.aws_cloudwatch_metric_alarm.sg
└─ Standard resolution 1 alarm metrics $0.10
module.alerts.aws_cloudwatch_metric_alarm.signfail
└─ Standard resolution 1 alarm metrics $0.10
module.alerts.aws_cloudwatch_metric_alarm.unauth
└─ Standard resolution 1 alarm metrics $0.10
module.alerts.aws_cloudwatch_metric_alarm.vpc
└─ Standard resolution 1 alarm metrics $0.10
module.alerts.aws_sns_topic.trail-unauthorised
└─ Requests 0 1M requests $0.00
PROJECT TOTAL $1.40
----------------------------------
1 resource type wasn't estimated as it's not supported yet.
1 x aws_sns_topic_subscription
No requirements.
Name | Version |
---|---|
archive | n/a |
aws | n/a |
No modules.
Name | Description | Type | Default | Required |
---|---|---|---|---|
concurrency | n/a | number |
1 |
no |
endpoint | n/a | string |
n/a | yes |
function_name | n/a | string |
"message-processor" |
no |
kms-alias | n/a | string |
"alias/alarms" |
no |
kms_key | n/a | string |
"alias/aws/sns" |
no |
log_group_name | n/a | string |
"cloudtrail" |
no |
protocol | n/a | string |
"sms" |
no |
Name | Description |
---|---|
alarms | The alarms created |
lambda | The lambda |
metrics | The metrics filters for the Alarms |
sns_topic_processed | The final SNS endpoint for a processed message |
sns_topic_subscription_lambda | The SNS subcription that pulls messages into being processed by the Lambda |
This is the policy required to build this project:
The Terraform resource required is:
resource "aws_iam_policy" "terraform_pike" {
name_prefix = "terraform_pike"
path = "/"
description = "Pike Autogenerated policy from IAC"
policy = jsonencode({
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"SNS:CreateTopic",
"SNS:DeleteTopic",
"SNS:GetTopicAttributes",
"SNS:ListTagsForResource",
"SNS:SetTopicAttributes"
],
"Resource": "*"
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"cloudwatch:DeleteAlarms",
"cloudwatch:DescribeAlarms",
"cloudwatch:ListTagsForResource",
"cloudwatch:PutMetricAlarm"
],
"Resource": "*"
},
{
"Sid": "VisualEditor2",
"Effect": "Allow",
"Action": [
"ec2:DescribeAccountAttributes"
],
"Resource": "*"
},
{
"Sid": "VisualEditor3",
"Effect": "Allow",
"Action": [
"iam:CreateRole",
"iam:DeleteRole",
"iam:DeleteRolePolicy",
"iam:GetRole",
"iam:GetRolePolicy",
"iam:ListAttachedRolePolicies",
"iam:ListInstanceProfilesForRole",
"iam:ListRolePolicies",
"iam:PassRole",
"iam:PutRolePolicy"
],
"Resource": "*"
},
{
"Sid": "VisualEditor4",
"Effect": "Allow",
"Action": [
"kms:CreateAlias",
"kms:CreateKey",
"kms:DeleteAlias",
"kms:DescribeKey",
"kms:EnableKeyRotation",
"kms:GetKeyPolicy",
"kms:GetKeyRotationStatus",
"kms:ListAliases",
"kms:ListResourceTags",
"kms:PutKeyPolicy",
"kms:ScheduleKeyDeletion"
],
"Resource": "*"
},
{
"Sid": "VisualEditor5",
"Effect": "Allow",
"Action": [
"lambda:AddPermission",
"lambda:CreateFunction",
"lambda:DeleteFunction",
"lambda:GetFunction",
"lambda:GetFunctionCodeSigningConfig",
"lambda:GetPolicy",
"lambda:ListVersionsByFunction",
"lambda:RemovePermission"
],
"Resource": "*"
},
{
"Sid": "VisualEditor6",
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:DeleteLogGroup",
"logs:DeleteMetricFilter",
"logs:DeleteRetentionPolicy",
"logs:DescribeLogGroups",
"logs:DescribeMetricFilters",
"logs:ListTagsLogGroup",
"logs:PutMetricFilter",
"logs:PutRetentionPolicy"
],
"Resource": "*"
}
]
})
}
Check out these related projects.
- terraform-aws-s3 - S3 buckets
Got a question?
File a GitHub issue.
Please use the issue tracker to report any bugs or file feature requests.
Copyright © 2021-2022 James Woolfenden
See LICENSE for full details.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.