cfn-nag 0.4.23 → 0.4.24
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/DMSEndpointPasswordRule.rb +9 -17
- data/lib/cfn-nag/custom_rules/DirectoryServiceMicrosoftADPasswordRule.rb +10 -17
- data/lib/cfn-nag/custom_rules/DirectoryServiceSimpleADPasswordRule.rb +10 -16
- data/lib/cfn-nag/custom_rules/RDSDBClusterMasterUserPasswordRule.rb +9 -17
- data/lib/cfn-nag/custom_rules/RDSInstanceMasterUserPasswordRule.rb +9 -21
- data/lib/cfn-nag/custom_rules/RDSInstanceMasterUsernameRule.rb +9 -22
- data/lib/cfn-nag/custom_rules/RedshiftClusterMasterUserPasswordRule.rb +9 -17
- data/lib/cfn-nag/custom_rules/password_base_rule.rb +32 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9485f94c90e2e05e6e2ff624e8c43e70a5ca4fb5946060a6301d53f1e3f053f
|
4
|
+
data.tar.gz: 40b173ce55caad1c9fe9991ea4a8520d89ced23e0d2f2f6258295bc5925c9540
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b482ad1361062684629561b900f69ec92e54c1a6f213edd1a958e916ace31ee196e09d5690441765c99530d2898728ad7662a62d6d56c76c5e4932ad41542c33
|
7
|
+
data.tar.gz: b93b1b8d83ffad07cd6da18ddf13f33109b0b72c553f8c3af6ae3dbb3a8f6917567fd78314a6f908f5e57b59cb9f1022b9d492ae4e7ed80c54cdc06e40cda9ff
|
@@ -1,14 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'cfn-nag/violation'
|
4
|
-
|
5
|
-
require 'cfn-nag/util/enforce_string_or_dynamic_reference'
|
6
|
-
require_relative 'base'
|
4
|
+
require_relative 'password_base_rule'
|
7
5
|
|
8
|
-
class DMSEndpointPasswordRule <
|
6
|
+
class DMSEndpointPasswordRule < PasswordBaseRule
|
9
7
|
def rule_text
|
10
|
-
'DMS Endpoint must not be a plaintext string
|
11
|
-
'Parameter with a Default value.'
|
8
|
+
'DMS Endpoint password must not be a plaintext string ' \
|
9
|
+
'or a Ref to a NoEcho Parameter with a Default value.'
|
12
10
|
end
|
13
11
|
|
14
12
|
def rule_type
|
@@ -19,17 +17,11 @@ class DMSEndpointPasswordRule < BaseRule
|
|
19
17
|
'F37'
|
20
18
|
end
|
21
19
|
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
-
if endpoint.password.nil?
|
26
|
-
false
|
27
|
-
else
|
28
|
-
insecure_parameter?(cfn_model, endpoint.password) ||
|
29
|
-
insecure_string_or_dynamic_reference?(cfn_model, endpoint.password)
|
30
|
-
end
|
31
|
-
end
|
20
|
+
def resource_type
|
21
|
+
'AWS::DMS::Endpoint'
|
22
|
+
end
|
32
23
|
|
33
|
-
|
24
|
+
def password_property
|
25
|
+
:password
|
34
26
|
end
|
35
27
|
end
|
@@ -1,15 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'cfn-nag/violation'
|
4
|
-
|
5
|
-
require 'cfn-nag/util/enforce_string_or_dynamic_reference'
|
6
|
-
require_relative 'base'
|
4
|
+
require_relative 'password_base_rule'
|
7
5
|
|
8
6
|
# Rule class to fail on DirectoryService::MicrosoftAD password in template
|
9
|
-
class DirectoryServiceMicrosoftADPasswordRule <
|
7
|
+
class DirectoryServiceMicrosoftADPasswordRule < PasswordBaseRule
|
10
8
|
def rule_text
|
11
|
-
'Directory Service Microsoft AD must not be a plaintext string
|
12
|
-
'Ref to a NoEcho Parameter with a Default value.'
|
9
|
+
'Directory Service Microsoft AD password must not be a plaintext string ' \
|
10
|
+
'or a Ref to a NoEcho Parameter with a Default value.'
|
13
11
|
end
|
14
12
|
|
15
13
|
def rule_type
|
@@ -20,16 +18,11 @@ class DirectoryServiceMicrosoftADPasswordRule < BaseRule
|
|
20
18
|
'F36'
|
21
19
|
end
|
22
20
|
|
23
|
-
def
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
insecure_parameter?(cfn_model, ad.password) ||
|
30
|
-
insecure_string_or_dynamic_reference?(cfn_model, ad.password)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
violating_ad.map(&:logical_resource_id)
|
21
|
+
def resource_type
|
22
|
+
'AWS::DirectoryService::MicrosoftAD'
|
23
|
+
end
|
24
|
+
|
25
|
+
def password_property
|
26
|
+
:password
|
34
27
|
end
|
35
28
|
end
|
@@ -1,14 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'cfn-nag/violation'
|
4
|
-
|
5
|
-
require 'cfn-nag/util/enforce_string_or_dynamic_reference'
|
6
|
-
require_relative 'base'
|
4
|
+
require_relative 'password_base_rule'
|
7
5
|
|
8
6
|
# Rule class to fail on DirectoryService::SimpleAD password in template
|
9
|
-
class DirectoryServiceSimpleADPasswordRule <
|
7
|
+
class DirectoryServiceSimpleADPasswordRule < PasswordBaseRule
|
10
8
|
def rule_text
|
11
|
-
'DirectoryService
|
9
|
+
'DirectoryService SimpleAD password must not be a plaintext string ' \
|
10
|
+
'or a Ref to a NoEcho Parameter with a Default value.'
|
12
11
|
end
|
13
12
|
|
14
13
|
def rule_type
|
@@ -19,16 +18,11 @@ class DirectoryServiceSimpleADPasswordRule < BaseRule
|
|
19
18
|
'F31'
|
20
19
|
end
|
21
20
|
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
insecure_parameter?(cfn_model, ad.password) ||
|
29
|
-
insecure_string_or_dynamic_reference?(cfn_model, ad.password)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
violating_ad.map(&:logical_resource_id)
|
21
|
+
def resource_type
|
22
|
+
'AWS::DirectoryService::SimpleAD'
|
23
|
+
end
|
24
|
+
|
25
|
+
def password_property
|
26
|
+
:password
|
33
27
|
end
|
34
28
|
end
|
@@ -1,14 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'cfn-nag/violation'
|
4
|
-
|
5
|
-
require 'cfn-nag/util/enforce_string_or_dynamic_reference'
|
6
|
-
require_relative 'base'
|
4
|
+
require_relative 'password_base_rule'
|
7
5
|
|
8
|
-
class RDSDBClusterMasterUserPasswordRule <
|
6
|
+
class RDSDBClusterMasterUserPasswordRule < PasswordBaseRule
|
9
7
|
def rule_text
|
10
|
-
'RDS DB Cluster master user password must be
|
11
|
-
'
|
8
|
+
'RDS DB Cluster master user password must not be a plaintext string ' \
|
9
|
+
'or a Ref to a NoEcho Parameter with a Default value.'
|
12
10
|
end
|
13
11
|
|
14
12
|
def rule_type
|
@@ -19,17 +17,11 @@ class RDSDBClusterMasterUserPasswordRule < BaseRule
|
|
19
17
|
'F34'
|
20
18
|
end
|
21
19
|
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
-
if cluster.masterUserPassword.nil?
|
26
|
-
false
|
27
|
-
else
|
28
|
-
insecure_parameter?(cfn_model, cluster.masterUserPassword) ||
|
29
|
-
insecure_string_or_dynamic_reference?(cfn_model, cluster.masterUserPassword)
|
30
|
-
end
|
31
|
-
end
|
20
|
+
def resource_type
|
21
|
+
'AWS::RDS::DBCluster'
|
22
|
+
end
|
32
23
|
|
33
|
-
|
24
|
+
def password_property
|
25
|
+
:masterUserPassword
|
34
26
|
end
|
35
27
|
end
|
@@ -1,14 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'cfn-nag/violation'
|
4
|
-
|
5
|
-
require 'cfn-nag/util/enforce_string_or_dynamic_reference'
|
6
|
-
require_relative 'base'
|
4
|
+
require_relative 'password_base_rule'
|
7
5
|
|
8
|
-
class RDSInstanceMasterUserPasswordRule <
|
6
|
+
class RDSInstanceMasterUserPasswordRule < PasswordBaseRule
|
9
7
|
def rule_text
|
10
|
-
'RDS instance master user password must be
|
11
|
-
'
|
8
|
+
'RDS instance master user password must not be a plaintext string ' \
|
9
|
+
'or a Ref to a NoEcho Parameter with a Default value.'
|
12
10
|
end
|
13
11
|
|
14
12
|
def rule_type
|
@@ -19,21 +17,11 @@ class RDSInstanceMasterUserPasswordRule < BaseRule
|
|
19
17
|
'F23'
|
20
18
|
end
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
# bother checking synthesized_value? that would be the indicator.....
|
26
|
-
def audit_impl(cfn_model)
|
27
|
-
rds_dbinstances = cfn_model.resources_by_type('AWS::RDS::DBInstance')
|
28
|
-
violating_rdsinstances = rds_dbinstances.select do |instance|
|
29
|
-
if instance.masterUserPassword.nil?
|
30
|
-
false
|
31
|
-
else
|
32
|
-
insecure_parameter?(cfn_model, instance.masterUserPassword) ||
|
33
|
-
insecure_string_or_dynamic_reference?(cfn_model, instance.masterUserPassword)
|
34
|
-
end
|
35
|
-
end
|
20
|
+
def resource_type
|
21
|
+
'AWS::RDS::DBInstance'
|
22
|
+
end
|
36
23
|
|
37
|
-
|
24
|
+
def password_property
|
25
|
+
:masterUserPassword
|
38
26
|
end
|
39
27
|
end
|
@@ -1,15 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'cfn-nag/violation'
|
4
|
-
|
5
|
-
require 'cfn-nag/util/enforce_string_or_dynamic_reference'
|
6
|
-
require_relative 'base'
|
4
|
+
require_relative 'password_base_rule'
|
7
5
|
|
8
6
|
# cfn_nag rules related to RDS Instance master username
|
9
|
-
class RDSInstanceMasterUsernameRule <
|
7
|
+
class RDSInstanceMasterUsernameRule < PasswordBaseRule
|
10
8
|
def rule_text
|
11
|
-
'RDS instance master username must be
|
12
|
-
'
|
9
|
+
'RDS instance master username must not be a plaintext string ' \
|
10
|
+
'or a Ref to a NoEcho Parameter with a Default value.'
|
13
11
|
end
|
14
12
|
|
15
13
|
def rule_type
|
@@ -20,22 +18,11 @@ class RDSInstanceMasterUsernameRule < BaseRule
|
|
20
18
|
'F24'
|
21
19
|
end
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
# if it's NoEcho there's a good reason
|
27
|
-
# bother checking synthesized_value? that would be the indicator.....
|
28
|
-
def audit_impl(cfn_model)
|
29
|
-
violating_rdsinstances = cfn_model.resources_by_type('AWS::RDS::DBInstance')
|
30
|
-
.select do |instance|
|
31
|
-
if instance.masterUsername.nil?
|
32
|
-
false
|
33
|
-
else
|
34
|
-
insecure_parameter?(cfn_model, instance.masterUsername) ||
|
35
|
-
insecure_string_or_dynamic_reference?(cfn_model, instance.masterUsername)
|
36
|
-
end
|
37
|
-
end
|
21
|
+
def resource_type
|
22
|
+
'AWS::RDS::DBInstance'
|
23
|
+
end
|
38
24
|
|
39
|
-
|
25
|
+
def password_property
|
26
|
+
:masterUsername
|
40
27
|
end
|
41
28
|
end
|
@@ -1,14 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'cfn-nag/violation'
|
4
|
-
|
5
|
-
require 'cfn-nag/util/enforce_string_or_dynamic_reference'
|
6
|
-
require_relative 'base'
|
4
|
+
require_relative 'password_base_rule'
|
7
5
|
|
8
|
-
class RedshiftClusterMasterUserPasswordRule <
|
6
|
+
class RedshiftClusterMasterUserPasswordRule < PasswordBaseRule
|
9
7
|
def rule_text
|
10
|
-
'Redshift Cluster master user password must be
|
11
|
-
'
|
8
|
+
'Redshift Cluster master user password must not be a plaintext string ' \
|
9
|
+
'or a Ref to a NoEcho Parameter with a Default value.'
|
12
10
|
end
|
13
11
|
|
14
12
|
def rule_type
|
@@ -19,17 +17,11 @@ class RedshiftClusterMasterUserPasswordRule < BaseRule
|
|
19
17
|
'F35'
|
20
18
|
end
|
21
19
|
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
-
if cluster.masterUserPassword.nil?
|
26
|
-
false
|
27
|
-
else
|
28
|
-
insecure_parameter?(cfn_model, cluster.masterUserPassword) ||
|
29
|
-
insecure_string_or_dynamic_reference?(cfn_model, cluster.masterUserPassword)
|
30
|
-
end
|
31
|
-
end
|
20
|
+
def resource_type
|
21
|
+
'AWS::Redshift::Cluster'
|
22
|
+
end
|
32
23
|
|
33
|
-
|
24
|
+
def password_property
|
25
|
+
:masterUserPassword
|
34
26
|
end
|
35
27
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cfn-nag/violation'
|
4
|
+
require 'cfn-nag/util/enforce_reference_parameter'
|
5
|
+
require 'cfn-nag/util/enforce_string_or_dynamic_reference'
|
6
|
+
require_relative 'base'
|
7
|
+
|
8
|
+
class PasswordBaseRule < BaseRule
|
9
|
+
def resource_type
|
10
|
+
raise 'must implement in subclass'
|
11
|
+
end
|
12
|
+
|
13
|
+
def password_property
|
14
|
+
raise 'must implement in subclass'
|
15
|
+
end
|
16
|
+
|
17
|
+
def audit_impl(cfn_model)
|
18
|
+
resources = cfn_model.resources_by_type(resource_type)
|
19
|
+
|
20
|
+
violating_resources = resources.select do |resource|
|
21
|
+
if resource.send(password_property).nil?
|
22
|
+
false
|
23
|
+
else
|
24
|
+
insecure_parameter?(cfn_model, resource.send(password_property)) ||
|
25
|
+
insecure_string_or_dynamic_reference?(cfn_model,
|
26
|
+
resource.send(password_property))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
violating_resources.map(&:logical_resource_id)
|
31
|
+
end
|
32
|
+
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.4.
|
4
|
+
version: 0.4.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Kascic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -239,6 +239,7 @@ files:
|
|
239
239
|
- lib/cfn-nag/custom_rules/WorkspacesWorkspaceEncryptionRule.rb
|
240
240
|
- lib/cfn-nag/custom_rules/base.rb
|
241
241
|
- lib/cfn-nag/custom_rules/boolean_base_rule.rb
|
242
|
+
- lib/cfn-nag/custom_rules/password_base_rule.rb
|
242
243
|
- lib/cfn-nag/ip_addr.rb
|
243
244
|
- lib/cfn-nag/jmes_path_discovery.rb
|
244
245
|
- lib/cfn-nag/jmes_path_evaluator.rb
|