Skip to content
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

set explicit region for aws scanning #1047

Open
arudat opened this issue Jan 15, 2024 · 3 comments
Open

set explicit region for aws scanning #1047

arudat opened this issue Jan 15, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@arudat
Copy link

arudat commented Jan 15, 2024

Hi, I searched for an flag where I can set a region for scanning. I found in the offical docs
https://mondoo.com/docs/cnspec/cli/cnspec_scan_aws/
--region string AWS region to scan.
but cnspect scan aws --help says
--region string Region to use for authentication with the API. Note: this does not limit the discovery to the region

So what's the truth? :)

I believe the second one. So back to the question, is there any way to set the explicit region for scanning? I tried it with default region in aws config and also with the env key "AWS_DEFAULT REGION" but no change in my results

  • OS: linux/macOS
  • OS Version: archlinux
  • cnspec 9.14.0

Thank you

@chris-rock chris-rock added the enhancement New feature or request label Feb 5, 2024
@chris-rock
Copy link
Member

@arudat Thank you for the report. I think it would be great to add this to cnspec. Until then you can use export AWS_REGION=us-east-1 to set the region.

@chris-rock
Copy link
Member

I have to correct myself. The AWS_REGION is only relevant for the credentials. By default, cnquery & cnspec use all regions. We have the option to set the cnquery shell aws --filters but that does not work as intended for all cases right now.

I am going to turn this into a bug since the region filter does not work right now. Until then you can use:

cnquery shell aws --filters all:region=us-east-2 

We need to do the following:

  1. Update https://github.com/mondoohq/cnquery/blob/main/providers/aws/config/config.go#L96-L101 to include a better example
  2. Extract the region correctly https://github.com/mondoohq/cnquery/blob/main/providers/aws/provider/provider.go#L88-L100, there are three possible values cnquery shell aws --filters region=us-east-2 , cnquery shell aws --filters all:region=us-east-2 and cnquery shell aws --filters ec2:region=us-east-2
  3. Double-check why cnquery shell aws --filters ec2:region=us-east-2 does not work.

@chris-rock chris-rock added bug Something isn't working and removed enhancement New feature or request labels Feb 5, 2024
@vjeffrey
Copy link
Contributor

vjeffrey commented Feb 5, 2024

is the ec2 one not filtering at all? that's meant to filter the ec2 discovery when doing --discover instances

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants