cfn-nag 0.6.14 → 0.6.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cfn-nag/custom_rules/DAXClusterEncryptionRule.rb +27 -0
- data/lib/cfn-nag/custom_rules/EKSClusterEncryptionRule.rb +48 -0
- data/lib/cfn-nag/custom_rules/ElasticsearchDomainNodeToNodeEncryptionOptionsRule.rb +27 -0
- data/lib/cfn-nag/custom_rules/LogsLogGroupEncryptedRule.rb +27 -0
- data/lib/cfn-nag/custom_rules/LogsLogGroupRetentionRule.rb +27 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28cde1a5e7484f6b0f2d63097071e68ef162a97de6d5e957cd5638d08aa420ce
|
4
|
+
data.tar.gz: a325b62b2f79bbb4b4ae2beec6a5beec6c0e40ba53cd1bb10b11a9c26f78e72a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50d18a321a5a0f9050523c657d0f8eee055555fce4e62547738760c5dae59e603ed7ef49e85a4618e51d64fbe30eafd7439e112516c2f7adc021db34b40cacbe
|
7
|
+
data.tar.gz: b44e85f191a4c3710491cfd2ed9e81e6107b641c28414656f19163ee3cf66b547a19296d28836e6fbface9a1087ccb03bfb037dc72e21a242899d0ee70e07b12
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cfn-nag/violation'
|
4
|
+
require 'cfn-nag/util/truthy'
|
5
|
+
require_relative 'base'
|
6
|
+
|
7
|
+
class DAXClusterEncryptionRule < BaseRule
|
8
|
+
def rule_text
|
9
|
+
'DynamoDB Accelerator (DAX) Cluster should have encryption enabled'
|
10
|
+
end
|
11
|
+
|
12
|
+
def rule_type
|
13
|
+
Violation::WARNING
|
14
|
+
end
|
15
|
+
|
16
|
+
def rule_id
|
17
|
+
'W83'
|
18
|
+
end
|
19
|
+
|
20
|
+
def audit_impl(cfn_model)
|
21
|
+
violating_clusters = cfn_model.resources_by_type('AWS::DAX::Cluster').select do |cluster|
|
22
|
+
cluster.sSESpecification.nil? || !truthy?(cluster.sSESpecification['SSEEnabled'].to_s)
|
23
|
+
end
|
24
|
+
|
25
|
+
violating_clusters.map(&:logical_resource_id)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cfn-nag/violation'
|
4
|
+
require_relative 'base'
|
5
|
+
|
6
|
+
class EKSClusterEncryptionRule < BaseRule
|
7
|
+
def rule_text
|
8
|
+
'EKS Cluster EncryptionConfig Provider should specify KeyArn to enable Encryption.'
|
9
|
+
end
|
10
|
+
|
11
|
+
def rule_type
|
12
|
+
Violation::WARNING
|
13
|
+
end
|
14
|
+
|
15
|
+
def rule_id
|
16
|
+
'W82'
|
17
|
+
end
|
18
|
+
|
19
|
+
def audit_impl(cfn_model)
|
20
|
+
violating_clusters = cfn_model.resources_by_type('AWS::EKS::Cluster').select do |cluster|
|
21
|
+
if cluster.encryptionConfig.nil?
|
22
|
+
true
|
23
|
+
elsif violating_configs?(cluster)
|
24
|
+
true
|
25
|
+
else
|
26
|
+
violating_providers?(cluster)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
violating_clusters.map(&:logical_resource_id)
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def violating_configs?(cluster)
|
36
|
+
violating_config = cluster.encryptionConfig.select do |config|
|
37
|
+
config['Provider'].nil?
|
38
|
+
end
|
39
|
+
!violating_config.empty?
|
40
|
+
end
|
41
|
+
|
42
|
+
def violating_providers?(cluster)
|
43
|
+
violating_provider = cluster.encryptionConfig.select do |config|
|
44
|
+
config['Provider']['KeyArn'].empty?
|
45
|
+
end
|
46
|
+
!violating_provider.empty?
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cfn-nag/util/truthy'
|
4
|
+
require 'cfn-nag/violation'
|
5
|
+
require_relative 'base'
|
6
|
+
|
7
|
+
class ElasticsearchDomainNodeToNodeEncryptionOptionsRule < BaseRule
|
8
|
+
def rule_text
|
9
|
+
'ElasticsearchcDomain should have NodeToNodeEncryptionOptions enabled'
|
10
|
+
end
|
11
|
+
|
12
|
+
def rule_type
|
13
|
+
Violation::WARNING
|
14
|
+
end
|
15
|
+
|
16
|
+
def rule_id
|
17
|
+
'W85'
|
18
|
+
end
|
19
|
+
|
20
|
+
def audit_impl(cfn_model)
|
21
|
+
violating_domains = cfn_model.resources_by_type('AWS::Elasticsearch::Domain').select do |domain|
|
22
|
+
domain.nodeToNodeEncryptionOptions.nil? || not_truthy?(domain.nodeToNodeEncryptionOptions['Enabled'])
|
23
|
+
end
|
24
|
+
|
25
|
+
violating_domains.map(&:logical_resource_id)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cfn-nag/violation'
|
4
|
+
require 'cfn-nag/util/truthy'
|
5
|
+
require_relative 'base'
|
6
|
+
|
7
|
+
class LogsLogGroupEncryptedRule < BaseRule
|
8
|
+
def rule_text
|
9
|
+
'CloudWatchLogs LogGroup should specify a KMS Key Id to encrypt the log data'
|
10
|
+
end
|
11
|
+
|
12
|
+
def rule_type
|
13
|
+
Violation::WARNING
|
14
|
+
end
|
15
|
+
|
16
|
+
def rule_id
|
17
|
+
'W84'
|
18
|
+
end
|
19
|
+
|
20
|
+
def audit_impl(cfn_model)
|
21
|
+
violating_groups = cfn_model.resources_by_type('AWS::Logs::LogGroup').select do |group|
|
22
|
+
group.kmsKeyId.nil?
|
23
|
+
end
|
24
|
+
|
25
|
+
violating_groups.map(&:logical_resource_id)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cfn-nag/violation'
|
4
|
+
require 'cfn-nag/util/truthy'
|
5
|
+
require_relative 'base'
|
6
|
+
|
7
|
+
class LogsLogGroupRetentionRule < BaseRule
|
8
|
+
def rule_text
|
9
|
+
'CloudWatchLogs LogGroup should specify RetentionInDays to expire the log data'
|
10
|
+
end
|
11
|
+
|
12
|
+
def rule_type
|
13
|
+
Violation::WARNING
|
14
|
+
end
|
15
|
+
|
16
|
+
def rule_id
|
17
|
+
'W86'
|
18
|
+
end
|
19
|
+
|
20
|
+
def audit_impl(cfn_model)
|
21
|
+
violating_groups = cfn_model.resources_by_type('AWS::Logs::LogGroup').select do |group|
|
22
|
+
group.retentionInDays.nil?
|
23
|
+
end
|
24
|
+
|
25
|
+
violating_groups.map(&:logical_resource_id)
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfn-nag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Kascic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -198,6 +198,7 @@ files:
|
|
198
198
|
- lib/cfn-nag/custom_rules/CodePipelineWebhookAuthenticationConfigurationSecretTokenRule.rb
|
199
199
|
- lib/cfn-nag/custom_rules/CognitoIdentityPoolAllowUnauthenticatedIdentitiesRule.rb
|
200
200
|
- lib/cfn-nag/custom_rules/CognitoUserPoolMfaConfigurationOnorOptionalRule.rb
|
201
|
+
- lib/cfn-nag/custom_rules/DAXClusterEncryptionRule.rb
|
201
202
|
- lib/cfn-nag/custom_rules/DMSEndpointMongoDbSettingsPasswordRule.rb
|
202
203
|
- lib/cfn-nag/custom_rules/DMSEndpointPasswordRule.rb
|
203
204
|
- lib/cfn-nag/custom_rules/DirectoryServiceMicrosoftADPasswordRule.rb
|
@@ -214,6 +215,7 @@ files:
|
|
214
215
|
- lib/cfn-nag/custom_rules/EC2SubnetMapPublicIpOnLaunchRule.rb
|
215
216
|
- lib/cfn-nag/custom_rules/ECRRepositoryScanOnPushRule.rb
|
216
217
|
- lib/cfn-nag/custom_rules/EFSFileSystemEncryptedRule.rb
|
218
|
+
- lib/cfn-nag/custom_rules/EKSClusterEncryptionRule.rb
|
217
219
|
- lib/cfn-nag/custom_rules/EMRClusterKerberosAttributesADDomainJoinPasswordRule.rb
|
218
220
|
- lib/cfn-nag/custom_rules/EMRClusterKerberosAttributesCrossRealmTrustPrincipalPasswordRule.rb
|
219
221
|
- lib/cfn-nag/custom_rules/EMRClusterKerberosAttributesKdcAdminPasswordRule.rb
|
@@ -229,6 +231,7 @@ files:
|
|
229
231
|
- lib/cfn-nag/custom_rules/ElasticLoadBalancerV2ListenerProtocolRule.rb
|
230
232
|
- lib/cfn-nag/custom_rules/ElasticLoadBalancerV2ListenerSslPolicyRule.rb
|
231
233
|
- lib/cfn-nag/custom_rules/ElasticsearchDomainEncryptionAtRestOptionsRule.rb
|
234
|
+
- lib/cfn-nag/custom_rules/ElasticsearchDomainNodeToNodeEncryptionOptionsRule.rb
|
232
235
|
- lib/cfn-nag/custom_rules/GameLiftFleetInboundPortRangeRule.rb
|
233
236
|
- lib/cfn-nag/custom_rules/IAMUserLoginProfilePasswordRule.rb
|
234
237
|
- lib/cfn-nag/custom_rules/IamManagedPolicyNotActionRule.rb
|
@@ -263,6 +266,8 @@ files:
|
|
263
266
|
- lib/cfn-nag/custom_rules/LambdaPermissionEventSourceTokenRule.rb
|
264
267
|
- lib/cfn-nag/custom_rules/LambdaPermissionInvokeFunctionActionRule.rb
|
265
268
|
- lib/cfn-nag/custom_rules/LambdaPermissionWildcardPrincipalRule.rb
|
269
|
+
- lib/cfn-nag/custom_rules/LogsLogGroupEncryptedRule.rb
|
270
|
+
- lib/cfn-nag/custom_rules/LogsLogGroupRetentionRule.rb
|
266
271
|
- lib/cfn-nag/custom_rules/ManagedBlockchainMemberMemberFabricConfigurationAdminPasswordRule.rb
|
267
272
|
- lib/cfn-nag/custom_rules/ManagedPolicyOnUserRule.rb
|
268
273
|
- lib/cfn-nag/custom_rules/MissingBucketPolicyRule.rb
|