cfn-nag 0.6.15 → 0.6.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16861651aa50f0df55c1f09ab3ee2b6805a5bbe5df2553509f1728922809d878
4
- data.tar.gz: ecf3c006adc7f35cd5f01246b2cb9315c029c7b86055d5ee5438fa2eeb44b68c
3
+ metadata.gz: acfa4c8d862bf691a56f99ded65fcfab7f5ca114f91a11aa3d453776093fd862
4
+ data.tar.gz: b125a02a79b010e02eee085d7421b359aeefb43de345f5ff8a2ab009c3528c44
5
5
  SHA512:
6
- metadata.gz: 640dcd9fe284f48ddcc714fc8573115062547e4e81c7b73500f7369e37392b7c4e06666ec1ac0d294d6f737d31f62be0062eaf745a1e5b640401b79ccafbf4cd
7
- data.tar.gz: df569ee1ad3089fd480dd9957cc7dbca4a0d4ec469aadc81048d143f9584369987ce3de53798e3ebd2b986a1ae44f6844c32b3e9e30b242ed7938f8edf2b1799
6
+ metadata.gz: 6d52ca5b92b8f8dce9034c493adb4a7c81cebc40211ba524dd8060ce9efdabea09d129d80db2eca2e4560239972d0192302f9027c53bd660139178697e4eb7ed
7
+ data.tar.gz: 5198f37c1c20d290d3c2073928f1509bca083dee22b03b099b456406f2bcbcc9f146a00d59d4fd57ef3bf5f44fb2a3753eddf0a0615544ef1374754c75f509d2
@@ -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/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
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.15
4
+ version: 0.6.20
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
@@ -229,6 +232,7 @@ files:
229
232
  - lib/cfn-nag/custom_rules/ElasticLoadBalancerV2ListenerProtocolRule.rb
230
233
  - lib/cfn-nag/custom_rules/ElasticLoadBalancerV2ListenerSslPolicyRule.rb
231
234
  - lib/cfn-nag/custom_rules/ElasticsearchDomainEncryptionAtRestOptionsRule.rb
235
+ - lib/cfn-nag/custom_rules/ElasticsearchDomainNodeToNodeEncryptionOptionsRule.rb
232
236
  - lib/cfn-nag/custom_rules/GameLiftFleetInboundPortRangeRule.rb
233
237
  - lib/cfn-nag/custom_rules/IAMUserLoginProfilePasswordRule.rb
234
238
  - lib/cfn-nag/custom_rules/IamManagedPolicyNotActionRule.rb
@@ -263,6 +267,7 @@ files:
263
267
  - lib/cfn-nag/custom_rules/LambdaPermissionEventSourceTokenRule.rb
264
268
  - lib/cfn-nag/custom_rules/LambdaPermissionInvokeFunctionActionRule.rb
265
269
  - lib/cfn-nag/custom_rules/LambdaPermissionWildcardPrincipalRule.rb
270
+ - lib/cfn-nag/custom_rules/LogsLogGroupEncryptedRule.rb
266
271
  - lib/cfn-nag/custom_rules/LogsLogGroupRetentionRule.rb
267
272
  - lib/cfn-nag/custom_rules/ManagedBlockchainMemberMemberFabricConfigurationAdminPasswordRule.rb
268
273
  - lib/cfn-nag/custom_rules/ManagedPolicyOnUserRule.rb