cfn-nag 0.6.16 → 0.6.21
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/DLMLifecyclePolicyCrossRegionCopyEncryptionRule.rb +37 -0
- data/lib/cfn-nag/custom_rules/EKSClusterEncryptionRule.rb +48 -0
- data/lib/cfn-nag/custom_rules/KendraIndexServerSideEncryptionConfigurationKmsKeyIdRule.rb +27 -0
- data/lib/cfn-nag/custom_rules/LogsLogGroupEncryptedRule.rb +27 -0
- metadata +6 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e84a4629eb894586819c36a332fd3cdb5b8c25492098870133773b0fb424041
|
4
|
+
data.tar.gz: 43cd5feabbede6b48f57145cf9cc84083d35f1aa1d54c55525fdcd3c8c04199c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c77d62ea98c2ecba8368b62dc58ebe7e516bc21773116490a25c2d1acf30a8d67e637e392cac71977d4c45755e151c747fdaa391864a2a806af6a11c14a39e4
|
7
|
+
data.tar.gz: ad2af23d60af46fc28daf5157e8e8a2934564e5f102d4bce020249fd654c1c85338dd56bcfab91d0068d5d387ee965406a6771345ea72229397500782112967a
|
@@ -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,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cfn-nag/violation'
|
4
|
+
require 'cfn-nag/util/truthy'
|
5
|
+
require_relative 'base'
|
6
|
+
|
7
|
+
class DLMLifecyclePolicyCrossRegionCopyEncryptionRule < BaseRule
|
8
|
+
def rule_text
|
9
|
+
'DLM LifecyclePolicy PolicyDetails Actions CrossRegionCopy EncryptionConfiguration should enable Encryption'
|
10
|
+
end
|
11
|
+
|
12
|
+
def rule_type
|
13
|
+
Violation::WARNING
|
14
|
+
end
|
15
|
+
|
16
|
+
def rule_id
|
17
|
+
'W81'
|
18
|
+
end
|
19
|
+
|
20
|
+
def audit_impl(cfn_model)
|
21
|
+
violating_policies = cfn_model.resources_by_type('AWS::DLM::LifecyclePolicy').select do |policy|
|
22
|
+
if policy.policyDetails['Actions'].nil?
|
23
|
+
false
|
24
|
+
else
|
25
|
+
violating_actions = policy.policyDetails['Actions'].select do |action|
|
26
|
+
violating_copies = action['CrossRegionCopy'].select do |copy|
|
27
|
+
!truthy?(copy['EncryptionConfiguration']['Encrypted'].to_s)
|
28
|
+
end
|
29
|
+
!violating_copies.empty?
|
30
|
+
end
|
31
|
+
!violating_actions.empty?
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
violating_policies.map(&:logical_resource_id)
|
36
|
+
end
|
37
|
+
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/violation'
|
4
|
+
require_relative 'base'
|
5
|
+
|
6
|
+
class KendraIndexServerSideEncryptionConfigurationKmsKeyIdRule < BaseRule
|
7
|
+
def rule_text
|
8
|
+
'Kendra Index ServerSideEncryptionConfiguration should specify a KmsKeyId value.'
|
9
|
+
end
|
10
|
+
|
11
|
+
def rule_type
|
12
|
+
Violation::WARNING
|
13
|
+
end
|
14
|
+
|
15
|
+
def rule_id
|
16
|
+
'W80'
|
17
|
+
end
|
18
|
+
|
19
|
+
def audit_impl(cfn_model)
|
20
|
+
violating_indices = cfn_model.resources_by_type('AWS::Kendra::Index').select do |index|
|
21
|
+
index.serverSideEncryptionConfiguration.nil? ||
|
22
|
+
index.serverSideEncryptionConfiguration['KmsKeyId'].nil?
|
23
|
+
end
|
24
|
+
|
25
|
+
violating_indices.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
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Kascic
|
@@ -198,6 +198,8 @@ 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
|
202
|
+
- lib/cfn-nag/custom_rules/DLMLifecyclePolicyCrossRegionCopyEncryptionRule.rb
|
201
203
|
- lib/cfn-nag/custom_rules/DMSEndpointMongoDbSettingsPasswordRule.rb
|
202
204
|
- lib/cfn-nag/custom_rules/DMSEndpointPasswordRule.rb
|
203
205
|
- lib/cfn-nag/custom_rules/DirectoryServiceMicrosoftADPasswordRule.rb
|
@@ -214,6 +216,7 @@ files:
|
|
214
216
|
- lib/cfn-nag/custom_rules/EC2SubnetMapPublicIpOnLaunchRule.rb
|
215
217
|
- lib/cfn-nag/custom_rules/ECRRepositoryScanOnPushRule.rb
|
216
218
|
- lib/cfn-nag/custom_rules/EFSFileSystemEncryptedRule.rb
|
219
|
+
- lib/cfn-nag/custom_rules/EKSClusterEncryptionRule.rb
|
217
220
|
- lib/cfn-nag/custom_rules/EMRClusterKerberosAttributesADDomainJoinPasswordRule.rb
|
218
221
|
- lib/cfn-nag/custom_rules/EMRClusterKerberosAttributesCrossRealmTrustPrincipalPasswordRule.rb
|
219
222
|
- lib/cfn-nag/custom_rules/EMRClusterKerberosAttributesKdcAdminPasswordRule.rb
|
@@ -257,6 +260,7 @@ files:
|
|
257
260
|
- lib/cfn-nag/custom_rules/IotPolicyWildcardResourceRule.rb
|
258
261
|
- lib/cfn-nag/custom_rules/KMSKeyRotationRule.rb
|
259
262
|
- lib/cfn-nag/custom_rules/KMSKeyWildcardPrincipalRule.rb
|
263
|
+
- lib/cfn-nag/custom_rules/KendraIndexServerSideEncryptionConfigurationKmsKeyIdRule.rb
|
260
264
|
- lib/cfn-nag/custom_rules/KinesisFirehoseDeliveryStreamRedshiftDestinationConfigurationPasswordRule.rb
|
261
265
|
- lib/cfn-nag/custom_rules/KinesisFirehoseDeliveryStreamSplunkDestinationConfigurationHECTokenRule.rb
|
262
266
|
- lib/cfn-nag/custom_rules/KinesisStreamStreamEncryptionRule.rb
|
@@ -264,6 +268,7 @@ files:
|
|
264
268
|
- lib/cfn-nag/custom_rules/LambdaPermissionEventSourceTokenRule.rb
|
265
269
|
- lib/cfn-nag/custom_rules/LambdaPermissionInvokeFunctionActionRule.rb
|
266
270
|
- lib/cfn-nag/custom_rules/LambdaPermissionWildcardPrincipalRule.rb
|
271
|
+
- lib/cfn-nag/custom_rules/LogsLogGroupEncryptedRule.rb
|
267
272
|
- lib/cfn-nag/custom_rules/LogsLogGroupRetentionRule.rb
|
268
273
|
- lib/cfn-nag/custom_rules/ManagedBlockchainMemberMemberFabricConfigurationAdminPasswordRule.rb
|
269
274
|
- lib/cfn-nag/custom_rules/ManagedPolicyOnUserRule.rb
|