feat(aws): CQ Policies to Validate IMDSv2 Usage and Enforcement across EC2, Lightsail, and AMIs#2807
Merged
kodiakhq[bot] merged 5 commits intocloudquery:mainfrom Oct 14, 2022
jsonpr:2646-queries-for-aws-imdsv2
Merged
feat(aws): CQ Policies to Validate IMDSv2 Usage and Enforcement across EC2, Lightsail, and AMIs#2807kodiakhq[bot] merged 5 commits intocloudquery:mainfrom jsonpr:2646-queries-for-aws-imdsv2
kodiakhq[bot] merged 5 commits intocloudquery:mainfrom
jsonpr:2646-queries-for-aws-imdsv2
Conversation
bbernays
reviewed
Oct 13, 2022
| \ir foundational_security/policy.sql | ||
| \ir public_egress/policy.sql | ||
| \ir publicly_available/policy.sql | ||
| \ir imds_v2/policy.sql No newline at end of file |
Collaborator
There was a problem hiding this comment.
Not sure if we want to run this policy on every invocation...
Contributor
Author
There was a problem hiding this comment.
I'm open to either running it at invocation of the broader policies_v1 policy or standalone within imds_v2. Went back and forth on that decision and ultimately, I initially left it in under policies_v1/policy.sql for completeness of running the rest of the queries, including public_egress, publicly_available, etc.
SCKelemen
approved these changes
Oct 14, 2022
kodiakhq bot
pushed a commit
that referenced
this pull request
Oct 16, 2022
🤖 I have created a release *beep* *boop* --- ## [3.0.0](plugins-source-aws-v2.5.2...plugins-source-aws-v3.0.0) (2022-10-16) ### ⚠ BREAKING CHANGES * More tag cleanup (#2837) ### Features * **aws:** CQ Policies to Validate IMDSv2 Usage and Enforcement across EC2, Lightsail, and AMIs ([#2807](#2807)) ([31d4f79](31d4f79)) * **aws:** Glacier resources ([#2703](#2703)) ([34e9f61](34e9f61)), closes [#2583](#2583) ### Bug Fixes * **aws:** Clean up tag fields ([#2776](#2776)) ([d071a0e](d071a0e)) * **deps:** Update plugin-sdk for aws to v0.13.8 ([#2848](#2848)) ([14e2571](14e2571)) * More tag cleanup ([#2837](#2837)) ([e781491](e781491)), closes [#2836](#2836) * Update endpoints ([#2831](#2831)) ([a3b289c](a3b289c)) * Update endpoints ([#2890](#2890)) ([2d3b885](2d3b885)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
To help customers with determining IMDSv2 usage and compliance, this PR includes a new policy and queries to consolidate results across the following 3 queries for IMDSv2:
Validation of AMIs works for now. I'm following up with AWS on this check.
This is a standalone policy outside of frameworks and while it may not be the future location for useful queries and consolidation of queries, I left it as a standalone policy for now and we can revisit how to structure and organize future policies and queries like this.
This follows up our addition of IMDSv2 fields for Lightsail and AMIs (EC2 already existed) for the recent IMDSv2 AWS releases:
Tests include both positive and negative test cases for each of the checks above and validation in the aws_policy_results from running the IMDSv2 policy and validating in tables for aws_ec2_instances, aws_ec2_images, and aws_lightsail_instances.
#2646