cfn-guardian 0.6.4 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9df1f4d7843a5283660b98138d46976465f2e64418c9a76b9a88cfb8ce8d2c59
4
- data.tar.gz: f05a68bf8dc81f31f70185e79f9aedce3497d0087013d9ed1bc5738786b3b3ea
3
+ metadata.gz: f67555f251f3b3722588f632934e2b620bf766e039c18978b401d177e2c4d7df
4
+ data.tar.gz: f7e27d27ef3b7e5276bee5b76346a0be1194026316d20f12bfe5f924c87ef742
5
5
  SHA512:
6
- metadata.gz: 1bafaf7b5dcbb19b3b3365cc514683426e1f26e98ad9c516606e20ca7463ab2de9fa102c0ac2a9e4bdbdf76b107c2c7f0c02e24f26894944d5d3429f055ad551
7
- data.tar.gz: 833a797750326a35d09cd96b1fc1d9e0d895793962da45e75dcf01c0197a1ad9283222e7c0ccadcf319446684eb5b66f4ce4b544012f5a7f01bc68efc2f20d57
6
+ metadata.gz: fae3f10ea6abbc18e8907b67ea52191ca245d45bf7a5dc7eb22a7510d2cb15522079eda8248420dbcba1280bb0cdf6680d2670612927a68aeb8d6fe4f84c4783
7
+ data.tar.gz: 467a2121d1e783ca38d19f43d2fc3708af8317b3c4297d171fe3f91cc1b9d6d58d417478d9b0236c38b94a2cac999e835da660cb2d642f2f2a72f2563c11830d
data/Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
1
  FROM ruby:2.7-alpine
2
2
 
3
- ARG GUARDIAN_VERSION="0.2.2"
3
+ ARG GUARDIAN_VERSION="0.6.9"
4
4
 
5
5
  COPY . /src
6
6
 
@@ -16,4 +16,4 @@ RUN addgroup -g 1000 guardian && \
16
16
 
17
17
  USER guardian
18
18
 
19
- RUN cfndsl -u 11.5.0
19
+ RUN cfndsl -u 11.5.0
@@ -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
- puts Terminal::Table.new(
308
- :headings => history.first.keys.map{|h| h.to_s.to_heading},
309
- :rows => history.map(&:values))
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='master',count=10)
22
+ def get_commit_history(branch,count)
23
23
  history = []
24
- commit = get_last_commit(branch)
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
 
@@ -37,6 +37,11 @@ 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'
44
+ require 'cfnguardian/resources/vpn_connection'
40
45
  require 'cfnguardian/version'
41
46
  require 'cfnguardian/error'
42
47
 
@@ -100,4 +100,8 @@ Resources:
100
100
  Query: Default
101
101
  SQSQueue:
102
102
  - Id: Default
103
+ VPNTunnel:
104
+ - Id: Default
105
+ VPNConnection:
106
+ - Id: Default
103
107
 
@@ -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,28 @@ module CfnGuardian
421
445
  @dimensions = { StorageAccount: resource['Id'], StorageContainer: resource['Container'] }
422
446
  end
423
447
  end
424
-
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
459
+
460
+ class VPNConnectionAlarm < BaseAlarm
461
+ def initialize(resource)
462
+ super(resource)
463
+ @group = 'VPNConnection'
464
+ @namespace = 'AWS/VPN'
465
+ @dimensions = {
466
+ VpnId: resource['Id']
467
+ }
468
+ end
469
+ end
470
+
425
471
  end
426
472
  end
@@ -1,96 +1,113 @@
1
1
  module CfnGuardian
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
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
- 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
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
- def detail
33
- return @detail
34
- end
35
- end
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
- class RDSEventSubscription < BaseEventSubscription
38
- attr_accessor :source_id, :rds_event_category, :message
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
- 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
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
- 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
59
+ class RDSInstanceEventSubscription < RDSEventSubscription
60
+ def initialize(resource)
61
+ super(resource)
62
+ @source_type = 'DB_INSTANCE'
63
+ end
64
+ end
58
65
 
59
- class RDSInstanceEventSubscription < RDSEventSubscription
60
- def initialize(resource)
61
- super(resource)
62
- @source_type = 'DB_INSTANCE'
63
- end
64
- end
66
+ class RDSClusterEventSubscription < RDSEventSubscription
67
+ def initialize(resource)
68
+ super(resource)
69
+ @source_type = 'DB_CLUSTER'
70
+ end
71
+ end
65
72
 
66
- class RDSClusterEventSubscription < RDSEventSubscription
67
- def initialize(resource)
68
- super(resource)
69
- @source_type = 'DB_CLUSTER'
70
- end
71
- end
73
+ class Ec2InstanceEventSubscription < BaseEventSubscription
74
+ def initialize(resource)
75
+ super(resource)
76
+ @source = 'aws.ec2'
77
+ end
78
+ end
72
79
 
73
- class Ec2InstanceEventSubscription < BaseEventSubscription
74
- def initialize(resource)
75
- super(resource)
76
- @source = 'aws.ec2'
77
- end
78
- end
80
+ class BatchEventSubscription < BaseEventSubscription
81
+ def initialize(resource)
82
+ super(resource)
83
+ @source = 'aws.batch'
84
+ end
85
+ end
79
86
 
80
- class ApiGatewayEventSubscription < BaseEventSubscription; end
81
- class ApplicationTargetGroupEventSubscription < BaseEventSubscription; end
82
- class AmazonMQBrokerEventSubscription < BaseEventSubscription; end
83
- class CloudFrontDistributionEventSubscription < BaseEventSubscription; end
84
- class AutoScalingGroupEventSubscription < BaseEventSubscription; end
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
+ class VPNConnectionEventSubscription < BaseEventSubscription; end
112
+ end
96
113
  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
@@ -17,6 +17,17 @@ module CfnGuardian
17
17
  alarm.threshold = 90
18
18
  alarm.evaluation_periods = 10
19
19
  @alarms.push(alarm)
20
+
21
+ alarm = CfnGuardian::Models::Ec2InstanceAlarm.new(@resource)
22
+ alarm.name = 'CPUCreditBalanceLow'
23
+ alarm.metric_name = 'CPUCreditBalance'
24
+ alarm.comparison_operator = 'LessThanThreshold'
25
+ alarm.statistic = 'Minimum'
26
+ alarm.threshold = 100
27
+ alarm.evaluation_periods = 5
28
+ alarm.treat_missing_data = 'notBreaching'
29
+ alarm.datapoints_to_alarm = 5
30
+ @alarms.push(alarm)
20
31
  end
21
32
 
22
33
  def default_event_subscriptions()
@@ -11,6 +11,17 @@ module CfnGuardian
11
11
  alarm.evaluation_periods = 5
12
12
  alarm.statistic = 'Minimum'
13
13
  @alarms.push(alarm)
14
+
15
+ alarm = CfnGuardian::Models::ElasticFileSystemAlarm.new(@resource)
16
+ alarm.name = 'BurstCreditBalanceLow'
17
+ alarm.metric_name = 'BurstCreditBalance'
18
+ alarm.comparison_operator = 'LessThanThreshold'
19
+ alarm.statistic = 'Minimum'
20
+ alarm.threshold = 1000000000000
21
+ alarm.evaluation_periods = 5
22
+ alarm.treat_missing_data = 'notBreaching'
23
+ alarm.datapoints_to_alarm = 5
24
+ @alarms.push(alarm)
14
25
  end
15
26
  end
16
27
  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
@@ -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 VPNConnection < Base
3
+
4
+ def default_alarms
5
+ alarm = CfnGuardian::Models::VPNConnectionAlarm.new(@resource)
6
+ alarm.name = 'VPNConnectionState'
7
+ alarm.metric_name = 'TunnelState'
8
+ alarm.comparison_operator = 'LessThanThreshold'
9
+ alarm.statistic = 'Average'
10
+ alarm.threshold = 0.5
11
+ alarm.evaluation_periods = 3
12
+ alarm.treat_missing_data = 'breaching'
13
+ alarm.datapoints_to_alarm = 3
14
+ @alarms.push(alarm)
15
+ end
16
+
17
+ end
18
+ 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),
@@ -1,4 +1,4 @@
1
1
  module CfnGuardian
2
- VERSION = "0.6.4"
2
+ VERSION = "0.6.9"
3
3
  CHANGE_SET_VERSION = VERSION.gsub('.', '-').freeze
4
4
  end
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
4
+ version: 0.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guslington
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-03 00:00:00.000000000 Z
11
+ date: 2021-06-03 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,10 @@ 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_connection.rb
311
+ - lib/cfnguardian/resources/vpn_tunnel.rb
306
312
  - lib/cfnguardian/s3.rb
307
313
  - lib/cfnguardian/stacks/main.rb
308
314
  - lib/cfnguardian/stacks/resources.rb
@@ -331,7 +337,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
331
337
  - !ruby/object:Gem::Version
332
338
  version: '0'
333
339
  requirements: []
334
- rubygems_version: 3.1.4
340
+ rubygems_version: 3.1.6
335
341
  signing_key:
336
342
  specification_version: 4
337
343
  summary: Manages AWS cloudwatch alarms with default templates using cloudformation