cfn-nag 0.5.16 → 0.5.17
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:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a2aef8ca978e7bec7da91b72542b6ce2a71d5b892ea68742e8ec354a6378baf7
         | 
| 4 | 
            +
              data.tar.gz: aac3bcd3d7655b5482df715cd596b2e92d466b121d64c2e427687e1bf816d72e
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a32ace894c95bd5ff075a0de2cdb3ba62aa6e749d52ea3395985d0c71c86ba8deebd983ea5783dbe4994f9697da2e882f0361a222b0533ad61fb7e656d821b35
         | 
| 7 | 
            +
              data.tar.gz: 4defeed8e3cef607919e4964dbc08a36c54b502ed19decaa5b95cc544c374d7aec6d897bc9f8b62f3fa67ec43705b31b2f3a3836000d12b1c75dcefed67d6287
         | 
| @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'cfn-nag/violation'
         | 
| 4 | 
            +
            require_relative 'base'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            class EMRClusterSecurityConfigurationAttachedRule < BaseRule
         | 
| 7 | 
            +
              def rule_text
         | 
| 8 | 
            +
                'EMR Cluster should specify SecurityConfiguration.'
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              def rule_type
         | 
| 12 | 
            +
                Violation::WARNING
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              def rule_id
         | 
| 16 | 
            +
                'W63'
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
              def audit_impl(cfn_model)
         | 
| 20 | 
            +
                violating_emr_clusters = cfn_model.resources_by_type('AWS::EMR::Cluster').select do |cluster|
         | 
| 21 | 
            +
                  # Warn if SecurityConfiguration property is not set or does not exist in this template
         | 
| 22 | 
            +
                  cluster.securityConfiguration.nil? || cfn_model.resource_by_ref(cluster.securityConfiguration, 'Arn').nil?
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                violating_emr_clusters.map(&:logical_resource_id)
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
            end
         | 
| @@ -0,0 +1,66 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'cfn-nag/violation'
         | 
| 4 | 
            +
            require_relative 'base'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            class EMRSecurityConfigurationEncryptionsEnabledAndConfiguredRule < BaseRule
         | 
| 7 | 
            +
              def rule_text
         | 
| 8 | 
            +
                'EMR SecurityConfiguration should enable and properly configure encryption at rest and in transit.'
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              def rule_type
         | 
| 12 | 
            +
                Violation::WARNING
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              def rule_id
         | 
| 16 | 
            +
                'W61'
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
              def audit_impl(cfn_model)
         | 
| 20 | 
            +
                violating_emr_sec_configs = cfn_model.resources_by_type('AWS::EMR::SecurityConfiguration').select do |sec_config|
         | 
| 21 | 
            +
                  bad_security_config?(sec_config)
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                violating_emr_sec_configs.map(&:logical_resource_id)
         | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
              private
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              def bad_security_config?(security_config_object)
         | 
| 30 | 
            +
                # Poorly formatted SecurityConfiguration
         | 
| 31 | 
            +
                return true unless security_config_object.securityConfiguration['EncryptionConfiguration']
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                encryption_config = security_config_object.securityConfiguration['EncryptionConfiguration']
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                # Either encryption type disabled
         | 
| 36 | 
            +
                return true unless encryption_config['EnableAtRestEncryption'] && encryption_config['EnableInTransitEncryption']
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                bad_at_rest_encryption?(encryption_config) || bad_in_transit_encryption?(encryption_config)
         | 
| 39 | 
            +
              end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
              def bad_at_rest_encryption?(config)
         | 
| 42 | 
            +
                # Missing AtRestEncryptionConfiguration
         | 
| 43 | 
            +
                return true unless config.key?('AtRestEncryptionConfiguration')
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                # AtRest encryptions misconfigured
         | 
| 46 | 
            +
                return true unless \
         | 
| 47 | 
            +
                  (config['AtRestEncryptionConfiguration'].key?('LocalDiskEncryptionConfiguration') &&
         | 
| 48 | 
            +
                   config['AtRestEncryptionConfiguration']['LocalDiskEncryptionConfiguration'].key?('EncryptionKeyProviderType')) ||
         | 
| 49 | 
            +
                  (config['AtRestEncryptionConfiguration'].key?('S3EncryptionConfiguration') &&
         | 
| 50 | 
            +
                   config['AtRestEncryptionConfiguration']['S3EncryptionConfiguration'].key?('EncryptionMode'))
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                false
         | 
| 53 | 
            +
              end
         | 
| 54 | 
            +
             | 
| 55 | 
            +
              def bad_in_transit_encryption?(config)
         | 
| 56 | 
            +
                # Missing InTransitEncryptionConfiguration
         | 
| 57 | 
            +
                return true unless config.key?('InTransitEncryptionConfiguration')
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                # InTransit encryptions misconfigured
         | 
| 60 | 
            +
                return true unless \
         | 
| 61 | 
            +
                  config['InTransitEncryptionConfiguration'].key?('TLSCertificateConfiguration') &&
         | 
| 62 | 
            +
                  config['InTransitEncryptionConfiguration']['TLSCertificateConfiguration'].key?('CertificateProviderType')
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                false
         | 
| 65 | 
            +
              end
         | 
| 66 | 
            +
            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.5. | 
| 4 | 
            +
              version: 0.5.17
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Eric Kascic
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2020-03- | 
| 11 | 
            +
            date: 2020-03-03 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rake
         | 
| @@ -202,6 +202,8 @@ files: | |
| 202 202 | 
             
            - lib/cfn-nag/custom_rules/EMRClusterKerberosAttributesADDomainJoinPasswordRule.rb
         | 
| 203 203 | 
             
            - lib/cfn-nag/custom_rules/EMRClusterKerberosAttributesCrossRealmTrustPrincipalPasswordRule.rb
         | 
| 204 204 | 
             
            - lib/cfn-nag/custom_rules/EMRClusterKerberosAttributesKdcAdminPasswordRule.rb
         | 
| 205 | 
            +
            - lib/cfn-nag/custom_rules/EMRClusterSecurityConfigurationAttachedRule.rb
         | 
| 206 | 
            +
            - lib/cfn-nag/custom_rules/EMRSecurityConfigurationEncryptionsEnabledAndConfiguredRule.rb
         | 
| 205 207 | 
             
            - lib/cfn-nag/custom_rules/EbsVolumeEncryptionKeyRule.rb
         | 
| 206 208 | 
             
            - lib/cfn-nag/custom_rules/EbsVolumeHasSseRule.rb
         | 
| 207 209 | 
             
            - lib/cfn-nag/custom_rules/ElastiCacheReplicationGroupAtRestEncryptionRule.rb
         |