Class: RedshiftClusterMasterUserPasswordRule

Inherits:
BaseRule
  • Object
show all
Defined in:
lib/cfn-nag/custom_rules/RedshiftClusterMasterUserPasswordRule.rb

Instance Method Summary collapse

Methods inherited from BaseRule

#audit

Instance Method Details

#audit_impl(cfn_model) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/cfn-nag/custom_rules/RedshiftClusterMasterUserPasswordRule.rb', line 22

def audit_impl(cfn_model)
  redshift_clusters = cfn_model.resources_by_type('AWS::Redshift::Cluster')
  violating_redshift_clusters = redshift_clusters.select do |cluster|
    if cluster.masterUserPassword.nil?
      false
    else
      insecure_parameter?(cfn_model, cluster.masterUserPassword) ||
        insecure_string_or_dynamic_reference?(cfn_model, cluster.masterUserPassword)
    end
  end

  violating_redshift_clusters.map(&:logical_resource_id)
end

#rule_idObject



18
19
20
# File 'lib/cfn-nag/custom_rules/RedshiftClusterMasterUserPasswordRule.rb', line 18

def rule_id
  'F35'
end

#rule_textObject



9
10
11
12
# File 'lib/cfn-nag/custom_rules/RedshiftClusterMasterUserPasswordRule.rb', line 9

def rule_text
  'Redshift Cluster master user password must be Ref to NoEcho Parameter. ' \
  'Default credentials are not recommended'
end

#rule_typeObject



14
15
16
# File 'lib/cfn-nag/custom_rules/RedshiftClusterMasterUserPasswordRule.rb', line 14

def rule_type
  Violation::FAILING_VIOLATION
end