Sha256: c45e7c77d9a745d65a18730bc3dd491352cea5421f71866de541de4275aa2568

Contents?: true

Size: 954 Bytes

Versions: 4

Compression:

Stored size: 954 Bytes

Contents

module Outliers
  module Resources
    module Aws
      module Iam
        class User < Resource
          def self.verifications
            [
              { name: 'mfa_enabled',
                description: 'Verify MFA enabled for user.' },
              { name: 'no_access_keys',
                description: 'Verify user has no access keys.' },
              { name: 'no_password_set',
                description: 'Verify password not set for user.' }
            ]
          end

          def no_access_keys?
            logger.debug "#{id} has #{access_keys.count} access key(s)."
            !access_keys.any?
          end

          def no_password_set?
            !source.login_profile.exists?
          end

          def mfa_enabled?
            source.mfa_devices.count > 0
          end

          private

          def access_keys
            @access_keys ||= source.access_keys
          end

        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
outliers-0.2.0 lib/outliers/resources/aws/iam/user.rb
outliers-0.1.1 lib/outliers/resources/aws/iam/user.rb
outliers-0.1.0 lib/outliers/resources/aws/iam/user.rb
outliers-0.0.1 lib/outliers/resources/aws/iam/user.rb