cfn-guardian 0.11.5 → 0.11.7

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: f723e435275fc1a6e2b27f9af51fe3ca405f19621c761aa26fdcf1db6567258c
4
- data.tar.gz: d84f42b73498a82d831b7ccccaaa42d379df99c73d719e75ca3262b544de35c9
3
+ metadata.gz: '0288f9b06a2fd6e602a31c949af12e5e5cd3fab1c0c954cd3a0317cd27011416'
4
+ data.tar.gz: 346f47481b46bc57049669188fdb872a15efd442f093ca59a204954d46548daa
5
5
  SHA512:
6
- metadata.gz: 4b843af3e2e6a131853d472575eb71edd22d529e93e4203cf4c726b231101f4644426acd69e1b21ad4c03ec675620b4836d7f3dc2c1a8ec864c6769ea564bde3
7
- data.tar.gz: 765da898a28024041595acdcd7e46de3e34c172861f0b4df7aeb82e434de4c8ec99abf659370e4fc58615ddf32abbb885224c7ee13e48e02dd3c2d29a1fd170f
6
+ metadata.gz: 66aacccb1582066e32779c8edef2c621eaab5858df2b402b0504ea4635fd2bb8ee30ebdebfe5c41ca62f5bbc5a4152afb816cf4162a890ccd3e33981eb1ff1cf
7
+ data.tar.gz: e57bb9c8a734f2e0be7d40400e9a4e76d5e89bf6b5f530115f8c44fc05e97698871f9debb55724e9bdcb29cc01eadcf0f302f60ed965572ece09885a1daa11d0
data/README.md CHANGED
@@ -22,7 +22,7 @@ CfnGuardian is a AWS monitoring tool with a few capabilities:
22
22
  - tls version checking
23
23
 
24
24
  **Supported AWS Resources**
25
-
25
+ - ACM Certificates
26
26
  - AmazonMq(RabbitMQ and ActiveMQ)
27
27
  - ApiGateway
28
28
  - Application Targetgroups
data/docs/resources.md CHANGED
@@ -36,6 +36,7 @@ Resources:
36
36
 
37
37
  | Resource Group | Require Keys |
38
38
  | --------------------------- | ---------------- |
39
+ | Acm | Id |
39
40
  | ApiGateway | Id |
40
41
  | AmazonMQBroker | Id |
41
42
  | AutoScalingGroup | Id |
@@ -5,6 +5,7 @@ require 'cfnguardian/stacks/resources'
5
5
  require 'cfnguardian/stacks/main'
6
6
  require 'cfnguardian/models/composite'
7
7
  require 'cfnguardian/resources/base'
8
+ require 'cfnguardian/resources/acm'
8
9
  require 'cfnguardian/resources/apigateway'
9
10
  require 'cfnguardian/resources/application_targetgroup'
10
11
  require 'cfnguardian/resources/amazonmq_broker'
@@ -139,6 +140,9 @@ module CfnGuardian
139
140
  @cost += resource_class.get_cost
140
141
  end
141
142
  end
143
+
144
+ # Add default event subscriptions
145
+ @resources.concat generate_default_event_subscriptions()
142
146
 
143
147
  @maintenance_groups.each do |maintenance_group,resource_groups|
144
148
  resource_groups.each do |group, alarms|
@@ -251,6 +255,19 @@ module CfnGuardian
251
255
 
252
256
  File.write("out/template-config.guardian.json", template.to_json)
253
257
  end
254
-
258
+
259
+ def generate_default_event_subscriptions()
260
+ # List of Classes which default events should be deployed
261
+ default_resource_classes = ['CfnGuardian::Resource::Acm']
262
+ default_event_subscriptions = []
263
+
264
+ default_resource_classes.each do |resource_class|
265
+ resource_instance = Kernel.const_get(resource_class).new({"Id"=>resource_class}) # Dummy ID
266
+ default_event_subscriptions.concat(resource_instance.default_event_subscriptions())
267
+ end
268
+
269
+ return default_event_subscriptions
270
+ end
271
+
255
272
  end
256
273
  end
@@ -66,6 +66,15 @@ module CfnGuardian
66
66
  end
67
67
  end
68
68
 
69
+ class AcmAlarm < BaseAlarm
70
+ def initialize(resource)
71
+ super(resource)
72
+ @group = 'Acm'
73
+ @namespace = 'AWS/CertificateManager'
74
+ @dimensions = { CertificateArn: { "Fn::Sub" => "arn:aws:acm:${AWS::Region}:${AWS::AccountId}:certificate/#{resource['Id']}"}}
75
+ end
76
+ end
77
+
69
78
  class ApiGatewayAlarm < BaseAlarm
70
79
  def initialize(resource)
71
80
  super(resource)
@@ -42,8 +42,8 @@ module CfnGuardian
42
42
  @name = 'HttpCheck'
43
43
  @package = 'http-check'
44
44
  @handler = 'handler.http_check'
45
- @version = '0e945240f9d93242f807e86d1a9b3383a1764b96'
46
- @runtime = 'python3.7'
45
+ @version = '077c726ed691a1176caf95497b8b02f05f00e0cb'
46
+ @runtime = 'python3.11'
47
47
  end
48
48
  end
49
49
  class WebSocketCheck < BaseCheck
@@ -53,8 +53,8 @@ module CfnGuardian
53
53
  @name = 'WebSocketCheck'
54
54
  @package = 'websocket-check'
55
55
  @handler = 'handler.websocket_check'
56
- @version = 'fb374fcf606b921d3745d7171d81ab5a32135d2f'
57
- @runtime = 'python3.7'
56
+ @version = 'bb0125e878e127028dfb3d4a0de93e580e77305e'
57
+ @runtime = 'python3.11'
58
58
  @branch = 'main'
59
59
  end
60
60
  end
@@ -77,8 +77,8 @@ module CfnGuardian
77
77
  @name = 'PortCheck'
78
78
  @package = 'port-check'
79
79
  @handler = 'handler.port_check'
80
- @version = '356203b2a720ba0730622f978e677b88f8d0c328'
81
- @runtime = 'python3.7'
80
+ @version = 'd773db7333fddea1f4e1781f9906bb05c363dd42'
81
+ @runtime = 'python3.11'
82
82
  end
83
83
  end
84
84
 
@@ -165,8 +165,8 @@ module CfnGuardian
165
165
  @name = 'ContainerInstanceCheck'
166
166
  @package = 'ecs-container-instance-check'
167
167
  @handler = 'handler.run_check'
168
- @version = '387446fbe2eb18fb4f75462c27cc07caad4a26b8'
169
- @runtime = 'python3.7'
168
+ @version = '5cb604acccd0823c74b21e83d7e40612ef38e313'
169
+ @runtime = 'python3.11'
170
170
  end
171
171
  end
172
172
 
@@ -177,8 +177,8 @@ module CfnGuardian
177
177
  @name = 'TLSCheck'
178
178
  @package = 'tls-version-check'
179
179
  @handler = 'handler.run_check'
180
- @version = 'de83afdde0d976364af37ad7552a8496c3c94ab5'
181
- @runtime = 'python3.7'
180
+ @version = '2b4fcbf55e266e793ee06e72013ed098f4eb2c0a'
181
+ @runtime = 'python3.11'
182
182
  end
183
183
  end
184
184
 
@@ -189,8 +189,8 @@ module CfnGuardian
189
189
  @name = 'SFTPCheck'
190
190
  @package = 'sftp-check'
191
191
  @handler = 'handler.sftp_check'
192
- @version = '901a63a0b9bbb4f09d1efae7049b20de4a1a22e2'
193
- @runtime = 'python3.7'
192
+ @version = '03e934328939cd87e5fb41fb01d6a690a94dc94c'
193
+ @runtime = 'python3.11'
194
194
  end
195
195
  end
196
196
 
@@ -212,8 +212,8 @@ module CfnGuardian
212
212
  @name = 'AzureFileCheck'
213
213
  @package = 'azure-file-check'
214
214
  @handler = 'handler.file_check'
215
- @version = 'cc37aa8fe4855570132431611b507274b390f4c1'
216
- @runtime = 'python3.7'
215
+ @version = '6a5abdbed4408592a3045638a1a5a74c89a37e12'
216
+ @runtime = 'python3.11'
217
217
  @memory = 256
218
218
  @timeout = 600
219
219
  end
@@ -225,8 +225,8 @@ module CfnGuardian
225
225
  @name = 'MaintenanceGroupCheck'
226
226
  @package = 'maintenance-group-check'
227
227
  @handler = 'handler.maintenance_group_check'
228
- @version = '5b795e6509068d1767e4be80f2e6868cbeb3b425'
229
- @runtime = 'python3.7'
228
+ @version = '5e880ffc7d0c478383fa353e28fe3e9f8310a93c'
229
+ @runtime = 'python3.11'
230
230
  end
231
231
  end
232
232
 
@@ -95,6 +95,7 @@ module CfnGuardian
95
95
  end
96
96
  end
97
97
 
98
+ class AcmEventSubscription < BaseEventSubscription; end
98
99
  class ApiGatewayEventSubscription < BaseEventSubscription; end
99
100
  class ApplicationTargetGroupEventSubscription < BaseEventSubscription; end
100
101
  class AmazonMQBrokerEventSubscription < BaseEventSubscription; end
@@ -0,0 +1,39 @@
1
+ module CfnGuardian::Resource
2
+ class Acm < Base
3
+
4
+ def default_alarms
5
+ alarm = CfnGuardian::Models::AcmAlarm.new(@resource)
6
+ alarm.name = 'CertificateExpiry'
7
+ alarm.metric_name = 'DaysToExpiry'
8
+ alarm.statistic = 'Average'
9
+ alarm.threshold = 30
10
+ alarm.comparison_operator = 'LessThanThreshold'
11
+ alarm.evaluation_periods = 1
12
+ alarm.period = 86400
13
+ @alarms.push(alarm)
14
+ end
15
+
16
+ def default_event_subscriptions()
17
+ event_subscription = CfnGuardian::Models::AcmEventSubscription.new(@resource)
18
+ event_subscription.name = 'AcmCertificateNearExpiry'
19
+ event_subscription.detail_type = 'ACM Certificate Approaching Expiration'
20
+ event_subscription.source = 'aws.acm'
21
+ event_subscription.detail = {
22
+ 'DaysToExpiry' => [31]
23
+ }
24
+ @event_subscriptions.push(event_subscription)
25
+
26
+ event_subscription = CfnGuardian::Models::AcmEventSubscription.new(@resource)
27
+ event_subscription.name = 'AcmCertificateExpired'
28
+ event_subscription.detail_type = 'ACM Certificate Expired'
29
+ event_subscription.source = 'aws.acm'
30
+ @event_subscriptions.push(event_subscription)
31
+
32
+ event_subscription = CfnGuardian::Models::AcmEventSubscription.new(@resource)
33
+ event_subscription.name = 'AcmRenewalActionRequired'
34
+ event_subscription.detail_type = 'ACM Certificate Renewal Action Required'
35
+ event_subscription.source = 'aws.acm'
36
+ @event_subscriptions.push(event_subscription)
37
+ end
38
+ end
39
+ end
@@ -1,4 +1,4 @@
1
1
  module CfnGuardian
2
- VERSION = "0.11.5"
2
+ VERSION = "0.11.7"
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.11.5
4
+ version: 0.11.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guslington
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-14 00:00:00.000000000 Z
11
+ date: 2023-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -328,6 +328,7 @@ files:
328
328
  - lib/cfnguardian/models/event.rb
329
329
  - lib/cfnguardian/models/event_subscription.rb
330
330
  - lib/cfnguardian/models/metric_filter.rb
331
+ - lib/cfnguardian/resources/acm.rb
331
332
  - lib/cfnguardian/resources/amazonmq_broker.rb
332
333
  - lib/cfnguardian/resources/amazonmq_rabbitmq.rb
333
334
  - lib/cfnguardian/resources/apigateway.rb