cfn-guardian 0.6.3 → 0.6.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +2 -2
- data/docs/custom_checks/ecs_container_instance_check.md +18 -0
- data/docs/overview.md +1 -0
- data/lib/cfnguardian.rb +8 -4
- data/lib/cfnguardian/codecommit.rb +11 -2
- data/lib/cfnguardian/compile.rb +4 -0
- data/lib/cfnguardian/config/defaults.yaml +2 -0
- data/lib/cfnguardian/models/alarm.rb +36 -1
- data/lib/cfnguardian/models/event_subscription.rb +100 -84
- data/lib/cfnguardian/resources/base.rb +1 -1
- data/lib/cfnguardian/resources/batch.rb +14 -0
- data/lib/cfnguardian/resources/glue.rb +23 -0
- data/lib/cfnguardian/resources/rds_instance.rb +9 -0
- data/lib/cfnguardian/resources/redshift_cluster.rb +22 -5
- data/lib/cfnguardian/resources/step_functions.rb +41 -0
- data/lib/cfnguardian/resources/vpn_tunnel.rb +18 -0
- data/lib/cfnguardian/stacks/resources.rb +1 -1
- data/lib/cfnguardian/version.rb +1 -1
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbdee8de2045f846a77f73303f61d13fbf8f9110d54d053ff78ad157f0ba96b7
|
4
|
+
data.tar.gz: 1aa05cff0d3bfa15d296adc0d508161ca80360f0cb1bcee454c9668ca65bd8b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db29791aaf3771a0013d77dfef99683be75cf3093ccc121531e92adf37316d0d4a2e22ddb65652297a86674f07784383a01510f23d3c79534a431a97eccc5906
|
7
|
+
data.tar.gz: 4d568808e86bf1e4e3effb6ee3b4e6270093ac3a8ea4ac809bac3126e343271989e0932afdb811eebfaa7d2b8381c7a89084f5b3c7937b81701bc96ab1e40424
|
data/Dockerfile
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# ECS Container Instance Check
|
2
|
+
|
3
|
+
Source: https://github.com/base2Services/aws-lambda-ecs-container-instance-check
|
4
|
+
|
5
|
+
Checks the agent status of a ECS container instance for a ECS cluster.
|
6
|
+
This check and alarms are created by default when a ECS cluster resource is specified in the config.
|
7
|
+
|
8
|
+
```yaml
|
9
|
+
Resources:
|
10
|
+
ECSCluster:
|
11
|
+
- Id: my-cluster
|
12
|
+
|
13
|
+
Templates:
|
14
|
+
ECSCluster:
|
15
|
+
# override the alarm defaults
|
16
|
+
ECSContianerInstancesDisconnected:
|
17
|
+
...
|
18
|
+
```
|
data/docs/overview.md
CHANGED
@@ -14,6 +14,7 @@
|
|
14
14
|
7. [SQL](custom_checks/sql.md)
|
15
15
|
8. [TLS](custom_checks/tls.md)
|
16
16
|
9. [Azure File Check](custom_checks/azure_file_check.md)
|
17
|
+
10. [ECS Container Instance Check](custom_checks/ecs_container_instance_check.md)
|
17
18
|
5. [Event Subscriptions](event_subscriptions.md)
|
18
19
|
6. [Notifiers](notifiers.md)
|
19
20
|
7. [Maintenance Mode](maintenance_mode.md)
|
data/lib/cfnguardian.rb
CHANGED
@@ -299,14 +299,18 @@ module CfnGuardian
|
|
299
299
|
LONG
|
300
300
|
method_option :region, aliases: :r, type: :string, desc: "set the AWS region"
|
301
301
|
method_option :repository, type: :string, default: 'guardian', desc: "codecommit repository name"
|
302
|
+
method_option :branch, type: :string, default: 'master', desc: "codecommit branch"
|
303
|
+
method_option :count, type: :numeric, default: 10, desc: "number of last commits to retrieve"
|
302
304
|
|
303
305
|
def show_config_history
|
304
306
|
set_region(options[:region],true)
|
305
307
|
|
306
|
-
history = CfnGuardian::CodeCommit.new(options[:repository]).get_commit_history()
|
307
|
-
|
308
|
-
|
309
|
-
|
308
|
+
history = CfnGuardian::CodeCommit.new(options[:repository]).get_commit_history(options[:branch], options[:count])
|
309
|
+
if history.any?
|
310
|
+
puts Terminal::Table.new(
|
311
|
+
:headings => history.first.keys.map{|h| h.to_s.to_heading},
|
312
|
+
:rows => history.map(&:values))
|
313
|
+
end
|
310
314
|
end
|
311
315
|
|
312
316
|
desc "show-pipeline", "Shows the current state of the AWS code pipeline"
|
@@ -19,9 +19,18 @@ module CfnGuardian
|
|
19
19
|
return resp.branch.commit_id
|
20
20
|
end
|
21
21
|
|
22
|
-
def get_commit_history(branch
|
22
|
+
def get_commit_history(branch,count)
|
23
23
|
history = []
|
24
|
-
|
24
|
+
|
25
|
+
begin
|
26
|
+
commit = get_last_commit(branch)
|
27
|
+
rescue Aws::CodeCommit::Errors::BranchDoesNotExistException => e
|
28
|
+
logger.error "Branch #{branch} does not exist in the #{@repo_name} repository"
|
29
|
+
return []
|
30
|
+
rescue Aws::CodeCommit::Errors::RepositoryDoesNotExistException => e
|
31
|
+
logger.error "Respository #{@repo_name} does not exist in this AWS account or region"
|
32
|
+
return []
|
33
|
+
end
|
25
34
|
|
26
35
|
count.times do
|
27
36
|
|
data/lib/cfnguardian/compile.rb
CHANGED
@@ -37,6 +37,10 @@ require 'cfnguardian/resources/internal_sftp'
|
|
37
37
|
require 'cfnguardian/resources/tls'
|
38
38
|
require 'cfnguardian/resources/azure_file'
|
39
39
|
require 'cfnguardian/resources/amazonmq_rabbitmq'
|
40
|
+
require 'cfnguardian/resources/batch'
|
41
|
+
require 'cfnguardian/resources/glue'
|
42
|
+
require 'cfnguardian/resources/step_functions'
|
43
|
+
require 'cfnguardian/resources/vpn_tunnel'
|
40
44
|
require 'cfnguardian/version'
|
41
45
|
require 'cfnguardian/error'
|
42
46
|
|
@@ -343,7 +343,31 @@ module CfnGuardian
|
|
343
343
|
@dimensions = { DBInstanceIdentifier: resource['Id'] }
|
344
344
|
end
|
345
345
|
end
|
346
|
-
|
346
|
+
|
347
|
+
class StepFunctionsAlarm < BaseAlarm
|
348
|
+
def initialize(resource)
|
349
|
+
super(resource)
|
350
|
+
@group = 'StepFunctions'
|
351
|
+
@namespace = 'AWS/States'
|
352
|
+
@dimensions = { StateMachineArn: { "Fn::Sub" => "arn:aws:states:${AWS::Region}:${AWS::AccountId}:stateMachine:#{resource['Id']}"} }
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
356
|
+
class BatchAlarm < BaseAlarm
|
357
|
+
def initialize(resource)
|
358
|
+
super(resource)
|
359
|
+
@group = 'Batch'
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
class GlueAlarm < BaseAlarm
|
364
|
+
def initialize(resource)
|
365
|
+
super(resource)
|
366
|
+
@group = 'Batch'
|
367
|
+
@namespace = 'Glue'
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
347
371
|
class SqlAlarm < BaseAlarm
|
348
372
|
def initialize(resource)
|
349
373
|
super(resource)
|
@@ -421,6 +445,17 @@ module CfnGuardian
|
|
421
445
|
@dimensions = { StorageAccount: resource['Id'], StorageContainer: resource['Container'] }
|
422
446
|
end
|
423
447
|
end
|
448
|
+
|
449
|
+
class VPNTunnelAlarm < BaseAlarm
|
450
|
+
def initialize(resource)
|
451
|
+
super(resource)
|
452
|
+
@group = 'VPNTunnel'
|
453
|
+
@namespace = 'AWS/VPN'
|
454
|
+
@dimensions = {
|
455
|
+
TunnelIpAddress: resource['Id']
|
456
|
+
}
|
457
|
+
end
|
458
|
+
end
|
424
459
|
|
425
460
|
end
|
426
461
|
end
|
@@ -1,96 +1,112 @@
|
|
1
1
|
module CfnGuardian
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
2
|
+
module Models
|
3
|
+
class BaseEventSubscription
|
4
|
+
|
5
|
+
attr_reader :type, :group
|
6
|
+
attr_writer :detail
|
7
|
+
attr_accessor :name,
|
8
|
+
:enabled,
|
9
|
+
:hash,
|
10
|
+
:topic,
|
11
|
+
:resource_id,
|
12
|
+
:resource_arn,
|
13
|
+
:source,
|
14
|
+
:detail_type,
|
15
|
+
:detail
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
17
|
+
def initialize(resource)
|
18
|
+
@type = 'EventSubscription'
|
19
|
+
@group = self.class.name.split('::').last
|
20
|
+
@name = ''
|
21
|
+
@hash = Digest::MD5.hexdigest resource['Id']
|
22
|
+
@enabled = true
|
23
|
+
@events = []
|
24
|
+
@topic = 'Events'
|
25
|
+
@resource_id = resource['Id']
|
26
|
+
@resource_arn = ''
|
27
|
+
@source = ''
|
28
|
+
@detail_type = ''
|
29
|
+
@detail = {}
|
30
|
+
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
def detail
|
33
|
+
return @detail
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class RDSEventSubscription < BaseEventSubscription
|
38
|
+
attr_accessor :source_id, :rds_event_category, :message
|
36
39
|
|
37
|
-
|
38
|
-
|
40
|
+
def initialize(resource)
|
41
|
+
super(resource)
|
42
|
+
@source = 'aws.rds'
|
43
|
+
@detail_type = 'RDS DB Instance Event'
|
44
|
+
@source_id = ''
|
45
|
+
@rds_event_category = ''
|
46
|
+
@message = ''
|
47
|
+
end
|
39
48
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
49
|
+
def detail
|
50
|
+
return {
|
51
|
+
EventCategories: [@rds_event_category],
|
52
|
+
SourceType: [@source_type],
|
53
|
+
SourceIdentifier: ["rds:#{@resource_id}"],
|
54
|
+
Message: [@message]
|
55
|
+
}
|
56
|
+
end
|
57
|
+
end
|
48
58
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}
|
56
|
-
end
|
57
|
-
end
|
59
|
+
class RDSInstanceEventSubscription < RDSEventSubscription
|
60
|
+
def initialize(resource)
|
61
|
+
super(resource)
|
62
|
+
@source_type = 'DB_INSTANCE'
|
63
|
+
end
|
64
|
+
end
|
58
65
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
66
|
+
class RDSClusterEventSubscription < RDSEventSubscription
|
67
|
+
def initialize(resource)
|
68
|
+
super(resource)
|
69
|
+
@source_type = 'DB_CLUSTER'
|
70
|
+
end
|
71
|
+
end
|
65
72
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
73
|
+
class Ec2InstanceEventSubscription < BaseEventSubscription
|
74
|
+
def initialize(resource)
|
75
|
+
super(resource)
|
76
|
+
@source = 'aws.ec2'
|
77
|
+
end
|
78
|
+
end
|
72
79
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
80
|
+
class BatchEventSubscription < BaseEventSubscription
|
81
|
+
def initialize(resource)
|
82
|
+
super(resource)
|
83
|
+
@source = 'aws.batch'
|
84
|
+
end
|
85
|
+
end
|
79
86
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
class DynamoDBTableEventSubscription < BaseEventSubscription; end
|
86
|
-
class Ec2InstanceEventSubscription < BaseEventSubscription; end
|
87
|
-
class ECSClusterEventSubscription < BaseEventSubscription; end
|
88
|
-
class ECSServiceEventSubscription < BaseEventSubscription; end
|
89
|
-
class ElastiCacheReplicationGroupEventSubscription < BaseEventSubscription; end
|
90
|
-
class ElasticLoadBalancerEventSubscription < BaseEventSubscription; end
|
91
|
-
class ElasticFileSystemEventSubscription < BaseEventSubscription; end
|
92
|
-
class LambdaEventSubscription < BaseEventSubscription; end
|
93
|
-
class NetworkTargetGroupEventSubscription < BaseEventSubscription; end
|
94
|
-
class RedshiftClusterEventSubscription < BaseEventSubscription; end
|
87
|
+
class GlueEventSubscription < BaseEventSubscription
|
88
|
+
def initialize(resource)
|
89
|
+
super(resource)
|
90
|
+
@source = 'aws.glue'
|
91
|
+
end
|
95
92
|
end
|
93
|
+
|
94
|
+
class ApiGatewayEventSubscription < BaseEventSubscription; end
|
95
|
+
class ApplicationTargetGroupEventSubscription < BaseEventSubscription; end
|
96
|
+
class AmazonMQBrokerEventSubscription < BaseEventSubscription; end
|
97
|
+
class CloudFrontDistributionEventSubscription < BaseEventSubscription; end
|
98
|
+
class AutoScalingGroupEventSubscription < BaseEventSubscription; end
|
99
|
+
class DynamoDBTableEventSubscription < BaseEventSubscription; end
|
100
|
+
class Ec2InstanceEventSubscription < BaseEventSubscription; end
|
101
|
+
class ECSClusterEventSubscription < BaseEventSubscription; end
|
102
|
+
class ECSServiceEventSubscription < BaseEventSubscription; end
|
103
|
+
class ElastiCacheReplicationGroupEventSubscription < BaseEventSubscription; end
|
104
|
+
class ElasticLoadBalancerEventSubscription < BaseEventSubscription; end
|
105
|
+
class ElasticFileSystemEventSubscription < BaseEventSubscription; end
|
106
|
+
class LambdaEventSubscription < BaseEventSubscription; end
|
107
|
+
class NetworkTargetGroupEventSubscription < BaseEventSubscription; end
|
108
|
+
class RedshiftClusterEventSubscription < BaseEventSubscription; end
|
109
|
+
class StepFunctionsSubscription < BaseEventSubscription; end
|
110
|
+
class VPNTunnelEventSubscription < BaseEventSubscription; end
|
111
|
+
end
|
96
112
|
end
|
@@ -108,7 +108,7 @@ module CfnGuardian::Resource
|
|
108
108
|
@alarms.each do |alarm|
|
109
109
|
next if alarm.dimensions.nil?
|
110
110
|
alarm.dimensions.each do |k,v|
|
111
|
-
if v.match?(/^\${Resource::.*[A-Za-z]}$/)
|
111
|
+
if v.is_a?(String) && v.match?(/^\${Resource::.*[A-Za-z]}$/)
|
112
112
|
resource_key = v.tr('${}', '').split('Resource::').last
|
113
113
|
if @resource.has_key?(resource_key)
|
114
114
|
logger.debug "overriding alarm #{alarm.name} dimension key '#{k}' with value '#{@resource[resource_key]}'"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module CfnGuardian::Resource
|
2
|
+
class Batch < Base
|
3
|
+
def default_event_subscriptions()
|
4
|
+
event_subscription = CfnGuardian::Models::BatchEventSubscription.new(@resource)
|
5
|
+
event_subscription.name = 'FailedBatch'
|
6
|
+
event_subscription.detail_type = 'Batch Job State Change'
|
7
|
+
event_subscription.detail = {
|
8
|
+
'status': ['FAILED'],
|
9
|
+
'jobQueue': ["arn:aws:batch:${AWS::Region}:${AWS::AccountId}:job-queue/#{@resource['Id']}"]
|
10
|
+
}
|
11
|
+
@event_subscriptions.push(event_subscription)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module CfnGuardian::Resource
|
2
|
+
class Glue < Base
|
3
|
+
def default_event_subscriptions()
|
4
|
+
event_subscription = CfnGuardian::Models::BatchEventSubscription.new(@resource)
|
5
|
+
event_subscription.name = 'FailedGlueJob'
|
6
|
+
event_subscription.detail_type = 'Glue Job State Change'
|
7
|
+
event_subscription.detail = {
|
8
|
+
'state': ['FAILED'],
|
9
|
+
'jobName': [{'prefix': @resource['Id']}]
|
10
|
+
}
|
11
|
+
@event_subscriptions.push(event_subscription)
|
12
|
+
|
13
|
+
event_subscription = CfnGuardian::Models::BatchEventSubscription.new(@resource)
|
14
|
+
event_subscription.name = 'TimeoutGlueJob'
|
15
|
+
event_subscription.detail_type = 'Glue Job State Change'
|
16
|
+
event_subscription.detail = {
|
17
|
+
'state': ['TIMEOUT'],
|
18
|
+
'jobName': [{'prefix': @resource['Id']}]
|
19
|
+
}
|
20
|
+
@event_subscriptions.push(event_subscription)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -41,6 +41,15 @@ module CfnGuardian::Resource
|
|
41
41
|
alarm.threshold = 45
|
42
42
|
alarm.evaluation_periods = 10
|
43
43
|
@alarms.push(alarm)
|
44
|
+
|
45
|
+
alarm = CfnGuardian::Models::RDSInstanceAlarm.new(@resource)
|
46
|
+
alarm.name = 'ReplicaLag'
|
47
|
+
alarm.metric_name = 'ReplicaLag'
|
48
|
+
alarm.threshold = 30 # seconds
|
49
|
+
alarm.evaluation_periods = 5
|
50
|
+
alarm.alarm_action = 'Warning'
|
51
|
+
alarm.enabled = false
|
52
|
+
@alarms.push(alarm)
|
44
53
|
end
|
45
54
|
|
46
55
|
def default_event_subscriptions()
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module CfnGuardian::Resource
|
2
2
|
class RedshiftCluster < Base
|
3
|
-
|
4
|
-
def default_alarms
|
3
|
+
|
4
|
+
def default_alarms
|
5
5
|
alarm = CfnGuardian::Models::RedshiftClusterAlarm.new(@resource)
|
6
6
|
alarm.name = 'CPUUtilizationHighSpike'
|
7
7
|
alarm.metric_name = 'CPUUtilization'
|
8
8
|
alarm.threshold = 95
|
9
9
|
alarm.evaluation_periods = 10
|
10
10
|
@alarms.push(alarm)
|
11
|
-
|
11
|
+
|
12
12
|
alarm = CfnGuardian::Models::RedshiftClusterAlarm.new(@resource)
|
13
13
|
alarm.name = 'CPUUtilizationHighBase'
|
14
14
|
alarm.metric_name = 'CPUUtilization'
|
@@ -16,7 +16,7 @@ module CfnGuardian::Resource
|
|
16
16
|
alarm.evaluation_periods = 60
|
17
17
|
alarm.alarm_action = 'Warning'
|
18
18
|
@alarms.push(alarm)
|
19
|
-
|
19
|
+
|
20
20
|
alarm = CfnGuardian::Models::RedshiftClusterAlarm.new(@resource)
|
21
21
|
alarm.name = 'UnHealthyCluster'
|
22
22
|
alarm.metric_name = 'HealthStatus'
|
@@ -24,7 +24,24 @@ module CfnGuardian::Resource
|
|
24
24
|
alarm.threshold = 1
|
25
25
|
alarm.evaluation_periods = 10
|
26
26
|
@alarms.push(alarm)
|
27
|
+
|
28
|
+
alarm = CfnGuardian::Models::RedshiftClusterAlarm.new(@resource)
|
29
|
+
alarm.name = 'DiskSpaceUsedCrit'
|
30
|
+
alarm.metric_name = 'PercentageDiskSpaceUsed'
|
31
|
+
alarm.comparison_operator = 'GreaterThanThreshold'
|
32
|
+
alarm.threshold = 90
|
33
|
+
alarm.evaluation_periods = 10
|
34
|
+
@alarms.push(alarm)
|
35
|
+
|
36
|
+
alarm = CfnGuardian::Models::RedshiftClusterAlarm.new(@resource)
|
37
|
+
alarm.name = 'DiskSpaceUsedWarm'
|
38
|
+
alarm.metric_name = 'PercentageDiskSpaceUsed'
|
39
|
+
alarm.comparison_operator = 'GreaterThanThreshold'
|
40
|
+
alarm.threshold = 80
|
41
|
+
alarm.evaluation_periods = 10
|
42
|
+
alarm.alarm_action = 'Warning'
|
43
|
+
@alarms.push(alarm)
|
27
44
|
end
|
28
|
-
|
45
|
+
|
29
46
|
end
|
30
47
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module CfnGuardian::Resource
|
2
|
+
class StepFunctions < Base
|
3
|
+
|
4
|
+
def default_alarms
|
5
|
+
alarm = CfnGuardian::Models::StepFunctionsAlarm.new(@resource)
|
6
|
+
alarm.name = 'ExecutionsFailed'
|
7
|
+
alarm.metric_name = 'ExecutionsFailed'
|
8
|
+
alarm.threshold = 1
|
9
|
+
alarm.evaluation_periods = 5
|
10
|
+
alarm.treat_missing_data = 'notBreaching'
|
11
|
+
@alarms.push(alarm)
|
12
|
+
|
13
|
+
alarm = CfnGuardian::Models::StepFunctionsAlarm.new(@resource)
|
14
|
+
alarm.name = 'ExecutionsTimedOut'
|
15
|
+
alarm.metric_name = 'ExecutionsTimedOut'
|
16
|
+
alarm.threshold = 1
|
17
|
+
alarm.evaluation_periods = 5
|
18
|
+
alarm.treat_missing_data = 'notBreaching'
|
19
|
+
@alarms.push(alarm)
|
20
|
+
|
21
|
+
alarm = CfnGuardian::Models::StepFunctionsAlarm.new(@resource)
|
22
|
+
alarm.name = 'ExecutionThrottled'
|
23
|
+
alarm.metric_name = 'ExecutionThrottled'
|
24
|
+
alarm.threshold = 1
|
25
|
+
alarm.evaluation_periods = 5
|
26
|
+
alarm.alarm_action = 'Warning'
|
27
|
+
alarm.treat_missing_data = 'notBreaching'
|
28
|
+
@alarms.push(alarm)
|
29
|
+
|
30
|
+
alarm = CfnGuardian::Models::StepFunctionsAlarm.new(@resource)
|
31
|
+
alarm.name = 'ExecutionTime'
|
32
|
+
alarm.metric_name = 'ExecutionTime'
|
33
|
+
alarm.threshold = 60
|
34
|
+
alarm.evaluation_periods = 5
|
35
|
+
alarm.alarm_action = 'Warning'
|
36
|
+
alarm.treat_missing_data = 'notBreaching'
|
37
|
+
@alarms.push(alarm)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module CfnGuardian::Resource
|
2
|
+
class VPNTunnel < Base
|
3
|
+
|
4
|
+
def default_alarms
|
5
|
+
alarm = CfnGuardian::Models::VPNTunnelAlarm.new(@resource)
|
6
|
+
alarm.name = 'VPNTunnelState'
|
7
|
+
alarm.metric_name = 'TunnelState'
|
8
|
+
alarm.comparison_operator = 'LessThanThreshold'
|
9
|
+
alarm.statistic = 'Minimum'
|
10
|
+
alarm.threshold = 1
|
11
|
+
alarm.evaluation_periods = 5
|
12
|
+
alarm.treat_missing_data = 'breaching'
|
13
|
+
alarm.datapoints_to_alarm = 5
|
14
|
+
@alarms.push(alarm)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -132,7 +132,7 @@ module CfnGuardian
|
|
132
132
|
Events_Rule("#{subscription.group}#{subscription.name}#{subscription.hash}"[0..255]) do
|
133
133
|
State subscription.enabled ? 'ENABLED' : 'DISABLED'
|
134
134
|
Description "Guardian event subscription #{subscription.group} #{subscription.name} for resource #{subscription.resource_id}"
|
135
|
-
EventPattern event_pattern
|
135
|
+
EventPattern FnSub(event_pattern.to_json)
|
136
136
|
Targets [
|
137
137
|
{
|
138
138
|
Arn: Ref(subscription.topic),
|
data/lib/cfnguardian/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfn-guardian
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guslington
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -238,6 +238,7 @@ files:
|
|
238
238
|
- docs/composite_alarms.md
|
239
239
|
- docs/custom_checks/azure_file_check.md
|
240
240
|
- docs/custom_checks/domain_expiry.md
|
241
|
+
- docs/custom_checks/ecs_container_instance_check.md
|
241
242
|
- docs/custom_checks/http.md
|
242
243
|
- docs/custom_checks/log_group_metric_filters.md
|
243
244
|
- docs/custom_checks/nrpe.md
|
@@ -277,6 +278,7 @@ files:
|
|
277
278
|
- lib/cfnguardian/resources/autoscaling_group.rb
|
278
279
|
- lib/cfnguardian/resources/azure_file.rb
|
279
280
|
- lib/cfnguardian/resources/base.rb
|
281
|
+
- lib/cfnguardian/resources/batch.rb
|
280
282
|
- lib/cfnguardian/resources/cloudfront_distribution.rb
|
281
283
|
- lib/cfnguardian/resources/domain_expiry.rb
|
282
284
|
- lib/cfnguardian/resources/dynamodb_table.rb
|
@@ -286,6 +288,7 @@ files:
|
|
286
288
|
- lib/cfnguardian/resources/elastic_file_system.rb
|
287
289
|
- lib/cfnguardian/resources/elastic_loadbalancer.rb
|
288
290
|
- lib/cfnguardian/resources/elasticache_replication_group.rb
|
291
|
+
- lib/cfnguardian/resources/glue.rb
|
289
292
|
- lib/cfnguardian/resources/http.rb
|
290
293
|
- lib/cfnguardian/resources/internal_http.rb
|
291
294
|
- lib/cfnguardian/resources/internal_port.rb
|
@@ -302,7 +305,9 @@ files:
|
|
302
305
|
- lib/cfnguardian/resources/sftp.rb
|
303
306
|
- lib/cfnguardian/resources/sql.rb
|
304
307
|
- lib/cfnguardian/resources/sqs_queue.rb
|
308
|
+
- lib/cfnguardian/resources/step_functions.rb
|
305
309
|
- lib/cfnguardian/resources/tls.rb
|
310
|
+
- lib/cfnguardian/resources/vpn_tunnel.rb
|
306
311
|
- lib/cfnguardian/s3.rb
|
307
312
|
- lib/cfnguardian/stacks/main.rb
|
308
313
|
- lib/cfnguardian/stacks/resources.rb
|
@@ -331,7 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
331
336
|
- !ruby/object:Gem::Version
|
332
337
|
version: '0'
|
333
338
|
requirements: []
|
334
|
-
rubygems_version: 3.1.
|
339
|
+
rubygems_version: 3.1.6
|
335
340
|
signing_key:
|
336
341
|
specification_version: 4
|
337
342
|
summary: Manages AWS cloudwatch alarms with default templates using cloudformation
|