-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new: added policy ecc-aws-067-unauthorized_api_calls_alarm_exists
- Loading branch information
1 parent
9176e9f
commit 96f4899
Showing
20 changed files
with
396 additions
and
38 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
20 changes: 0 additions & 20 deletions
20
non-compatible-policies/ecc-aws-067-unauthorized_api_calls_alarm_exists.yml
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
policies/ecc-aws-067-unauthorized_api_calls_alarm_exists.yml
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,23 @@ | ||
# Copyright (c) 2023 EPAM Systems, Inc. | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
policies: | ||
- name: ecc-aws-067-unauthorized_api_calls_alarm_exists | ||
comment: '010016010300' | ||
description: | | ||
Log metric filter and alarm do not exist for unauthorized API calls | ||
resource: aws.account | ||
filters: | ||
- type: check-cloudtrail | ||
multi-region: true | ||
running: true | ||
include-management-events: true | ||
log-metric-filter-pattern: | ||
type: value | ||
op: regex | ||
value: '{ ?\(? ?\(? ?((\$\.errorCode ?= ?\"?\*UnauthorizedOperation\"?)|(\$\.errorCode ?= ?\"?AccessDenied\*\"?)) ?\)? ?\|\| ?\(? ?((\$\.errorCode ?= ?\"?AccessDenied\*\"?)|(\$\.errorCode ?= ?\"?\*UnauthorizedOperation\"?)) ?\)? ?\)? ?&& ?\(? ?\(? ?((\$\.sourceIPAddress ?[!]= ?\"?delivery\.logs\.amazonaws\.com\"?)|(\$\.eventName ?[!]= ?\"?HeadBucket\"?)) ?\)? ?&& ?\(?((\$\.sourceIPAddress ?[!]= ?\"?delivery\.logs\.amazonaws\.com\"?)|(\$\.eventName ?[!]= ?\"?HeadBucket\"?)) ?\)? ?\)? ?}' | ||
|
||
|
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
2 changes: 1 addition & 1 deletion
2
terraform/ecc-aws-067-unauthorized_api_calls_alarm_exists/red4/sns.tf
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
resource "aws_sns_topic" "sns" { | ||
resource "aws_sns_topic" "this" { | ||
name = "067-c7n-sns-red4" | ||
} |
22 changes: 22 additions & 0 deletions
22
...ws-067-unauthorized_api_calls_alarm_exists/placebo-green/cloudtrail.DescribeTrails_1.json
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,22 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"trailList": [ | ||
{ | ||
"Name": "c7n-067-cloudtrail-green", | ||
"S3BucketName": "067-bucket-7401094-green", | ||
"IncludeGlobalServiceEvents": true, | ||
"IsMultiRegionTrail": true, | ||
"HomeRegion": "us-east-1", | ||
"TrailARN": "arn:aws:cloudtrail:us-east-1:644160558196:trail/c7n-067-cloudtrail-green", | ||
"LogFileValidationEnabled": false, | ||
"CloudWatchLogsLogGroupArn": "arn:aws:logs:us-east-1:644160558196:log-group:067_log_group_green:*", | ||
"CloudWatchLogsRoleArn": "arn:aws:iam::644160558196:role/067_role_green", | ||
"HasCustomEventSelectors": true, | ||
"HasInsightSelectors": false, | ||
"IsOrganizationTrail": false | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...067-unauthorized_api_calls_alarm_exists/placebo-green/cloudtrail.GetEventSelectors_1.json
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,19 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"TrailARN": "arn:aws:cloudtrail:us-east-1:644160558196:trail/c7n-067-cloudtrail-green", | ||
"AdvancedEventSelectors": [ | ||
{ | ||
"FieldSelectors": [ | ||
{ | ||
"Field": "eventCategory", | ||
"Equals": [ | ||
"Management" | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...ws-067-unauthorized_api_calls_alarm_exists/placebo-green/cloudtrail.GetTrailStatus_1.json
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,43 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"IsLogging": true, | ||
"LatestDeliveryTime": { | ||
"__class__": "datetime", | ||
"year": 2023, | ||
"month": 10, | ||
"day": 15, | ||
"hour": 22, | ||
"minute": 37, | ||
"second": 38, | ||
"microsecond": 982000 | ||
}, | ||
"StartLoggingTime": { | ||
"__class__": "datetime", | ||
"year": 2023, | ||
"month": 10, | ||
"day": 15, | ||
"hour": 13, | ||
"minute": 16, | ||
"second": 49, | ||
"microsecond": 492000 | ||
}, | ||
"LatestCloudWatchLogsDeliveryTime": { | ||
"__class__": "datetime", | ||
"year": 2023, | ||
"month": 10, | ||
"day": 15, | ||
"hour": 22, | ||
"minute": 38, | ||
"second": 0, | ||
"microsecond": 211000 | ||
}, | ||
"LatestDeliveryAttemptTime": "2023-10-15T19:37:38Z", | ||
"LatestNotificationAttemptTime": "", | ||
"LatestNotificationAttemptSucceeded": "", | ||
"LatestDeliveryAttemptSucceeded": "2023-10-15T19:37:38Z", | ||
"TimeLoggingStarted": "2023-10-15T10:16:49Z", | ||
"TimeLoggingStopped": "", | ||
"ResponseMetadata": {} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...c-aws-067-unauthorized_api_calls_alarm_exists/placebo-green/iam.ListAccountAliases_1.json
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,10 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"AccountAliases": [ | ||
"test" | ||
], | ||
"IsTruncated": false, | ||
"ResponseMetadata": {} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...s-067-unauthorized_api_calls_alarm_exists/placebo-green/logs.DescribeMetricFilters_1.json
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,22 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"metricFilters": [ | ||
{ | ||
"filterName": "067_Unauthorized_API_Calls_green", | ||
"filterPattern": "{(($.errorCode=\"*UnauthorizedOperation\") || ($.errorCode=\"AccessDenied*\")) && (($.sourceIPAddress!=\"delivery.logs.amazonaws.com\") && ($.eventName!=\"HeadBucket\"))}", | ||
"metricTransformations": [ | ||
{ | ||
"metricName": "067_Unauthorized_API_Calls_green", | ||
"metricNamespace": "API_Calls", | ||
"metricValue": "1", | ||
"unit": "None" | ||
} | ||
], | ||
"creationTime": 1697365001970, | ||
"logGroupName": "067_log_group_green" | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...authorized_api_calls_alarm_exists/placebo-green/monitoring.DescribeAlarmsForMetric_1.json
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,60 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"MetricAlarms": [ | ||
{ | ||
"AlarmName": "067_Unauthorized_API_Calls_green", | ||
"AlarmArn": "arn:aws:cloudwatch:us-east-1:644160558196:alarm:067_Unauthorized_API_Calls_green", | ||
"AlarmConfigurationUpdatedTimestamp": { | ||
"__class__": "datetime", | ||
"year": 2023, | ||
"month": 10, | ||
"day": 15, | ||
"hour": 10, | ||
"minute": 16, | ||
"second": 43, | ||
"microsecond": 353000 | ||
}, | ||
"ActionsEnabled": true, | ||
"OKActions": [], | ||
"AlarmActions": [ | ||
"arn:aws:sns:us-east-1:644160558196:067-sns-green" | ||
], | ||
"InsufficientDataActions": [], | ||
"StateValue": "INSUFFICIENT_DATA", | ||
"StateReason": "Insufficient Data: 1 datapoint was unknown.", | ||
"StateReasonData": "{\"version\":\"1.0\",\"queryDate\":\"2023-10-15T19:34:23.797+0000\",\"statistic\":\"Sum\",\"period\":300,\"recentDatapoints\":[],\"threshold\":1.0,\"evaluatedDatapoints\":[{\"timestamp\":\"2023-10-15T19:29:00.000+0000\"}]}", | ||
"StateUpdatedTimestamp": { | ||
"__class__": "datetime", | ||
"year": 2023, | ||
"month": 10, | ||
"day": 15, | ||
"hour": 19, | ||
"minute": 34, | ||
"second": 23, | ||
"microsecond": 799000 | ||
}, | ||
"MetricName": "067_Unauthorized_API_Calls_green", | ||
"Namespace": "API_Calls", | ||
"Statistic": "Sum", | ||
"Dimensions": [], | ||
"Period": 300, | ||
"EvaluationPeriods": 1, | ||
"Threshold": 1.0, | ||
"ComparisonOperator": "GreaterThanOrEqualToThreshold", | ||
"TreatMissingData": "missing", | ||
"StateTransitionedTimestamp": { | ||
"__class__": "datetime", | ||
"year": 2023, | ||
"month": 10, | ||
"day": 15, | ||
"hour": 19, | ||
"minute": 34, | ||
"second": 23, | ||
"microsecond": 799000 | ||
} | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...c-aws-067-unauthorized_api_calls_alarm_exists/placebo-green/sns.GetTopicAttributes_1.json
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,21 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"Attributes": { | ||
"Policy": "{\"Version\":\"2008-10-17\",\"Id\":\"__default_policy_ID\",\"Statement\":[{\"Sid\":\"__default_statement_ID\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"*\"},\"Action\":[\"SNS:GetTopicAttributes\",\"SNS:SetTopicAttributes\",\"SNS:AddPermission\",\"SNS:RemovePermission\",\"SNS:DeleteTopic\",\"SNS:Subscribe\",\"SNS:ListSubscriptionsByTopic\",\"SNS:Publish\"],\"Resource\":\"arn:aws:sns:us-east-1:644160558196:067-sns-green\",\"Condition\":{\"StringEquals\":{\"AWS:SourceOwner\":\"644160558196\"}}}]}", | ||
"LambdaSuccessFeedbackSampleRate": "0", | ||
"Owner": "644160558196", | ||
"SubscriptionsPending": "0", | ||
"TopicArn": "arn:aws:sns:us-east-1:644160558196:067-sns-green", | ||
"EffectiveDeliveryPolicy": "{\"http\":{\"defaultHealthyRetryPolicy\":{\"minDelayTarget\":20,\"maxDelayTarget\":20,\"numRetries\":3,\"numMaxDelayRetries\":0,\"numNoDelayRetries\":0,\"numMinDelayRetries\":0,\"backoffFunction\":\"linear\"},\"disableSubscriptionOverrides\":false,\"defaultRequestPolicy\":{\"headerContentType\":\"text/plain; charset=UTF-8\"}}}", | ||
"FirehoseSuccessFeedbackSampleRate": "0", | ||
"SubscriptionsConfirmed": "2", | ||
"SQSSuccessFeedbackSampleRate": "0", | ||
"HTTPSuccessFeedbackSampleRate": "0", | ||
"ApplicationSuccessFeedbackSampleRate": "0", | ||
"DisplayName": "", | ||
"SubscriptionsDeleted": "0" | ||
}, | ||
"ResponseMetadata": {} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...-aws-067-unauthorized_api_calls_alarm_exists/placebo-red/cloudtrail.DescribeTrails_1.json
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,22 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"trailList": [ | ||
{ | ||
"Name": "c7n-067-cloudtrail-red1", | ||
"S3BucketName": "067-bucket-552812-red1", | ||
"IncludeGlobalServiceEvents": true, | ||
"IsMultiRegionTrail": false, | ||
"HomeRegion": "us-east-1", | ||
"TrailARN": "arn:aws:cloudtrail:us-east-1:644160558196:trail/c7n-067-cloudtrail-red1", | ||
"LogFileValidationEnabled": false, | ||
"CloudWatchLogsLogGroupArn": "arn:aws:logs:us-east-1:644160558196:log-group:067_log_group_red1:*", | ||
"CloudWatchLogsRoleArn": "arn:aws:iam::644160558196:role/067_role_red1", | ||
"HasCustomEventSelectors": false, | ||
"HasInsightSelectors": false, | ||
"IsOrganizationTrail": false | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...s-067-unauthorized_api_calls_alarm_exists/placebo-red/cloudtrail.GetEventSelectors_1.json
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,15 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"TrailARN": "arn:aws:cloudtrail:us-east-1:644160558196:trail/c7n-067-cloudtrail-red1", | ||
"EventSelectors": [ | ||
{ | ||
"ReadWriteType": "All", | ||
"IncludeManagementEvents": true, | ||
"DataResources": [], | ||
"ExcludeManagementEventSources": [] | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
Oops, something went wrong.