-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resource updates #971
Draft
Amndeep7
wants to merge
16
commits into
inspec:main
Choose a base branch
from
mitre:resource_updates
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Resource updates #971
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
3fa020a
added the iam credential report as a resource
Amndeep7 db1b679
wip addition of the account as a resource
Amndeep7 3b9614d
implemented aws account resource
Amndeep7 f34e9ed
pass arguments properly to the get_alternate_contact function
Amndeep7 a09f972
iam_access_keys - use correct function call for list_access_keys
Amndeep7 821d360
iam_access_keys - assign correct values to user_created_date
Amndeep7 a558d8d
iam_access_keys - debugging + fixed last_used to stop using a global …
Amndeep7 8161d70
make sure to assign nil to attribute in row when it is nil
Amndeep7 64b9a70
adding new docs
aaronlippold edbf49e
added fix for presence error issue
aaronlippold a200543
Fixes and Linting
aaronlippold 5120750
fixed aws-backend to not throw errors when some account setting are n…
aaronlippold f40ab21
ran bundle exec chefstyle -A
aaronlippold 23b69d8
Merge remote-tracking branch 'upstream/main' into resource_updates
aaronlippold d0bfefa
Merge from upstream fix
aaronlippold e4b35ba
step 1: fixing autocorrect
aaronlippold File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
--- | ||
title: About the aws_cloudfront_distribution Resource | ||
platform: aws | ||
--- | ||
|
||
# aws\_cloudfront\_distribution | ||
|
||
Use the `aws_cloudfront_distribution` InSpec audit resource to test properties of a single AWS CloudFront distribution. | ||
|
||
## Syntax | ||
|
||
Ensure that an `aws_cloudfront_distribution` exists: | ||
|
||
describe aws_cloudfront_distribution('DISTRIBUTION') do | ||
it { should exist } | ||
end | ||
|
||
describe aws_cloudfront_distribution(distribution_id: 'DISTRIBUTION') do | ||
it { should exist } | ||
end | ||
|
||
#### Parameters | ||
|
||
##### distribution\_id _(required)_ | ||
|
||
The ID of the CloudFront distribution. This can be passed either as a string or as a `name: 'value'` key-value entry in a hash. | ||
|
||
##### disallowed\_ssl\_protocols _(optional)_ | ||
|
||
If provided, this parameter is expected to be an array of strings identifying SSL/TLS protocols that you wish not to allow. | ||
|
||
Included in the array should be the union of disallowed identifiers for: | ||
- custom origin SSL/TLS protocols (currently SSLv3 | TLSv1 | TLSv1.1 | TLSv1.2) | ||
- identifiers for the minimum SSL/TLS protocol in the Viewer Certificate that CloudFront can use to communicate with viewers (currently SSLv3 | TLSv1 | TLSv1_1026 | TLSv1.1_2016 | TLSv1.2_2018 | TLSv1.2_2019 | TLSv1.2_2021). | ||
|
||
Newer protocol identification strings (when available) may be provided in the set, as validity is not checked. The default value for disallowed_ssl_protocols is `%w{SSLv3 TLSv1 TLSv1_2016}`. | ||
|
||
For additional information, see the [AWS API reference for CloudFront distributions](https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_distribution.html) documentation. For available SSL/TLS version identifiers, see [OriginSslProtocols](https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_OriginSslProtocols.html) and [AWS::CloudFront::distribution ViewerCertificate](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-viewercertificate.html) documentation. | ||
|
||
## Properties | ||
|
||
|Property | Description| | ||
| --- | --- | | ||
|distribution\_id | The identifier for the CloudFront distribution. | | ||
|viewer\_protocol\_policies | An array of viewer protocol policies for all caches in this distribution; valid policy names are `allow-all` (which allows HTTP and HTTPS), `https-only` or `redirect-to-https`. | | ||
|custom\_origin\_ssl\_protocols | An array containing SSL/TLS protocols allowed by custom origins in this distribution. Empty if there are no custom origins (one or more standard S3 bucket origins). Current valid values: `SSLv3`, `TLSv1`, `TLSv1.1`, `TLSv1.2`. | | ||
|viewer\_certificate\_minimum\_ssl\_protocol | The minimum SSL/TLS protocol version in the Viewer Certificate. Current valid values: `SSLv3`, `TLSv1`, `TLSv1_2016`, `TLSv1.1_2016`, `TLSv1.2_2018`, `TLSv1.2_2019`, `TLSv1.2_2021`. | | ||
|s3\_origin\_config | True if there are any S3 origin configs in the distribution (i.e. standard S3 bucket origins), else false. | | ||
|
||
## Examples | ||
|
||
### Test that a CloudFront distribution has secure protocols configured | ||
|
||
describe aws_cloudfront_distribution('DISTRIBUTION_ID') do | ||
its('viewer_certificate_minimum_ssl_protocol') { should_not match /SSLv3|TLSv1$|TLSv1_2016/ } | ||
its('viewer_protocol_policies') { should_not include 'allow-all' } | ||
{SSLv3 TLSv1}.each do |protocol| | ||
its('custom_origin_ssl_protocols') { should_not include protocol } | ||
end | ||
end | ||
|
||
## Matchers | ||
|
||
This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/). | ||
|
||
### have_viewer_protocol_policies_allowing_http | ||
|
||
The `have_viewer_protocol_policies_allowing_http` matcher tests if any of the caches for origins, including the default cache, has its viewer_protocol_policy set to 'allow-all'. | ||
|
||
it { should_not have_viewer_protocol_policies_allowing_http } | ||
|
||
### have\_disallowed\_custom\_origin\_ssl\_protocols | ||
|
||
The `have_disallowed_custom_origin_ssl_protocols` matcher tests whether any of the the SSL/TLS protocols defined in the ssl_protocols for all custom origins in the distribution are present in the `disallowed_ssl_protocols` parameter (if provided), or in the default disallowed SSL/TLS protocol list (if not). | ||
|
||
it { should_not have_disallowed_custom_origin_ssl_protocols } | ||
|
||
### have\_disallowed\_viewer\_certificate\_minimum\_ssl\_protocol | ||
|
||
The `have_disallowed_viewer_minimum_ssl_protocol` matcher tests whether the minimum SSL/TLS protocol for the distribution's Viewer Certificate is in the `disallowed_ssl_protocols` parameter (if provided), or in the default disallowed SSL/TLS protocol list (if not). | ||
|
||
it { should_not have_disallowed_viewer_certificate_minimum_ssl_protocol } | ||
|
||
### have\_s3\_origin\_configs | ||
|
||
The `have_s3_origin_configs` matcher tests whether the distribution has a non-nil s3_origin_configs setting in any of its origins. | ||
|
||
it { should_not have_s3_origin_configs } | ||
|
||
### exist | ||
|
||
The control will pass if the describe returns at least one result. | ||
|
||
describe aws_cloudfront_distribution('EXISTING_DISTRIBUTION_ID') do | ||
it { should exist } | ||
end | ||
|
||
Use `should_not` to test the entity should not exist. | ||
|
||
describe cloudfront_distribution('NONEXISTING_DISTRIBUTION_ID') do | ||
it { should_not exist } | ||
end | ||
|
||
## AWS Permissions | ||
|
||
Your [Principal](https://docs.aws.amazon.com/IAM/latest/UserGuide/intro-structure.html#intro-structure-principal) will need the `cloudfront:GetDistribution` action set to Allow. | ||
|
||
You can find detailed documentation at [Identity and Access Management (IAM) in CloudFront](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/auth-and-access-control.html). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
title: About the aws_cloudfront_distributions Resource | ||
platform: aws | ||
--- | ||
|
||
# aws\_cloudfront\_distributions | ||
|
||
Use the `aws_cloudfront_distributions` InSpec audit resource to test properties of a collection of AWS CloudFront distributions. | ||
|
||
## Syntax | ||
|
||
Ensure that a particular CloudFront distribution exists in `aws_cloudfront_distributions`: | ||
|
||
describe aws_cloudfront_distributions do | ||
its('distribution_ids') { should include 'DISTRIBUTION_ID' } | ||
end | ||
|
||
## Parameters | ||
|
||
This resource does not expect any parameters. | ||
|
||
See also the [AWS API reference for CloudFront distributions](https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_distribution.html). | ||
|
||
## Properties | ||
|
||
|Property | Description| | ||
| --- | --- | | ||
|distribution_ids | The names of the CloudFront distributions. | | ||
|distribution_arns | The Amazon Resource Name (ARN) of the CloudFront distributions. | | ||
|statuses | The statuses of the CloudFront distributions (`InProgress` or `Deployed`). | | ||
|domain_names | The domain names for the CloudFront distributions. | | ||
|origin_domains_names | The domain names for the CloudFront distributions' origins (an array for each distribution). | | ||
|default_cache_viewer_protocol_policies | The viewer protocol policy for the default cache for each of the CloudFront distributions. Values: `http-only`, `redirect-to-https` or `allow-all`. | | ||
|cache_viewer_protocol_policies | The viewer protocol policy for all non-default caches for each of the CloudFront distributions (an array for each distribution). Values: `http-only`, `redirect-to-https` or `allow-all`. There may be an empty array for a distribution if no non-default caches are present.| | ||
|custom_origin_ssl_protocols | An array for each CloudFront distribution containing SSL/TLS protocols allowed by all of the custom origins in that distribution, empty where no custom origins exist for a distribution. Current SSL/TLS protocol identifiers: `SSLv3`, `TLSv1`, `TLSv1_1026`, `TLSv1.1_2016`, `TLSv1.2_2018`, `TLSv1.2_2019` and `TLSv1.2_2021`. | | ||
|s3_origin_config | Booleans indicating whether there are any S3 origin configs in a particular distribution (non-custom S3 bucket origins). | | ||
|price_classes | The price classes for distributions, which corresponds with the maximum price that you want to pay for CloudFront service. Valid Values: `PriceClass_100`, `PriceClass_200`, `PriceClass_All`. | | ||
|enabled | Booleans indicating whether the distributions are enabled. | | ||
|viewer_certificate_ssl_support_methods | The SSL support methods for Viewer Certificates for the distributions, only set for distributions with aliases. Valid values: `sni-only`, `vip` or `static-ip`. | | ||
|viewer_certificate_minimum_ssl_protocols | The minimum SSL/TLS protocol allowed by the Viewer Certificate in each distribution. Current valid values: `SSLv3`, `TLSv1`, `TLSv1_2016`, `TLSv1.1_2016`, `TLSv1.2_2018`, `TLSv1.2_2019`, `TLSv1.2_2021`. | | ||
|http_versions | The maximum HTTP versions that viewers may to use to communicate with CloudFront distributions. Valid values: `http1.1` or `http2`. | | ||
|ipv6_enabled | Booleans indicating whether IPv6 is enabled for CloudFront distributions. | | ||
|
||
## Examples | ||
|
||
### Test that a particular CloudFront distribution exists, and that no cache viewer protocol policies allow HTTP | ||
|
||
describe aws_cloudfront_distributions do | ||
its('distribution_ids') { should include 'DISTRIBUTION_ID' } | ||
its('default_cache_viewer_protocol_policies') { should_not include 'allow-all' } | ||
its('cache_viewer_protocol_policies') { should_not include 'allow-all' } | ||
end | ||
|
||
## Matchers | ||
|
||
This InSpec audit resource has no special matchers. For a full list of available matchers, please visit our [Universal Matchers page](https://www.inspec.io/docs/reference/matchers/). | ||
|
||
### exist | ||
|
||
The control will pass if the describe returns at least one result. | ||
|
||
Use `should_not` to test the entity should not exist. | ||
|
||
describe aws_cloudfront_distributions do | ||
it { should exist } | ||
end | ||
|
||
## AWS Permissions | ||
|
||
Your [Principal](https://docs.aws.amazon.com/IAM/latest/UserGuide/intro-structure.html#intro-structure-principal) will need the `cloudfront:Listdistributions` action set to Allow. | ||
|
||
You can find detailed documentation at [Identity and Access Management (IAM) in CloudFront](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/auth-and-access-control.html). |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inspec/train-aws#457 is merged.Please update Gemfile.