aaronlippold / inspec-aws

InSpec for AWS (Incubation)
https://www.inspec.io/
Other
1 stars 1 forks source link

Enhancement for aws_s3_bucket #33

Open rx294 opened 6 years ago

rx294 commented 6 years ago

Please consider the following features to support cis-aws-foundations-2.6 Enhancements: Enable testing of logging details of an s3 bucket

    describe aws_s3_bucket(name: 'test_bucket') do
      its('logging_enabled?') { should be true }
    end

Please see below the additional code (diff view)to aws_s3_bucket that will provide this enhancement

16c16
<   attr_reader :name, :permissions, :has_public_files, :region, :objects
---
>   attr_reader :name, :permissions, :has_public_files, :region, :objects, :logging
19a20,23
>   def logging_enabled?
>     !logging.nil?
>   end
>
47a52
>       :logging,
62a68
>       fetch_logging
119a126,129
>   def fetch_logging
>     @logging = AwsS3Bucket::BackendFactory.create.get_bucket_logging(bucket: name).logging_enabled
>   end
>
139a150,153
>
>       def get_bucket_logging(query)
>         AWSConnection.new.s3_client.get_bucket_logging(query)
>       end