prowler: [Bug]: Unable to complete scans for Chinese AWS accounts
What happened? I’ve tried to run all-checks scan using Prowler v3, however, prowler suddenly stops execution and is only able to show me the report for the 3 services:
Date: 2022-12-21 16:47:49
This report is being generated using credentials below:
AWS-CLI Profile: [default] AWS Filter Region: [all]
AWS Account: [xxxxxxxxxx] UserId: [XXXXXXXXXXX:xxxxxx]
Caller Identity ARN: [arn:aws-cn:sts::xxxxxxxxxx:assumed-role/xxx/xxx]
Executing 244 checks, please wait...
-> Scan completed! |▉▉▉▉▉▉▉⚠︎ | (!) 43/244 [18%] in 30.5s
Overview Results:
╭───────────────────┬───────────────────╮
│ 26.0% (13) Failed │ 68.0% (34) Passed │
╰───────────────────┴───────────────────╯
Account xxxxxxxxxx Scan Results (severity columns are for fails only):
╭────────────┬────────────┬───────────┬────────────┬────────┬──────────┬───────╮
│ Provider │ Service │ Status │ Critical │ High │ Medium │ Low │
├────────────┼────────────┼───────────┼────────────┼────────┼──────────┼───────┤
│ aws │ account │ PASS (3) │ 0 │ 0 │ 0 │ 0 │
├────────────┼────────────┼───────────┼────────────┼────────┼──────────┼───────┤
│ aws │ cloudwatch │ PASS (1) │ 0 │ 0 │ 0 │ 0 │
├────────────┼────────────┼───────────┼────────────┼────────┼──────────┼───────┤
│ aws │ iam │ FAIL (13) │ 2 │ 3 │ 6 │ 2 │
╰────────────┴────────────┴───────────┴────────────┴────────┴──────────┴───────╯
* You only see here those services that contains resources.
How to reproduce it Steps to reproduce the behavior:
- What command are you running?
prowler aws -M HTML - Environment you have, like single account, multi-account, organizations, etc. Single AWS account in the Chinese partition
- See error After I enabled log-level=DEBUG I can see the following errors for each set of checks:
2022-12-21 16:52:24,271 [File: check.py:343] [Module: check] ERROR: KeyError[325]: 'aws-cn'
2022-12-21 16:52:24,274 [File: check.py:343] [Module: check] ERROR: KeyError[325]: 'aws-cn'
2022-12-21 16:52:24,276 [File: check.py:343] [Module: check] ERROR: KeyError[325]: 'aws-cn'
Moreover, I can see some errors related to hitting the Global AWS endpoints instead of Chinese ones:
2022-12-21 16:52:23,503 [File: connectionpool.py:1001] [Module: connectionpool] DEBUG: Starting new HTTPS connection (1): globalaccelerator.us-west-2.amazonaws.com:443
2022-12-21 16:52:24,232 [File: connectionpool.py:456] [Module: connectionpool] DEBUG: https://globalaccelerator.us-west-2.amazonaws.com:443 "POST / HTTP/1.1" 400 106
2022-12-21 16:52:24,232 [File: parsers.py:240] [Module: parsers] DEBUG: Response headers: {'Date': 'Wed, 21 Dec 2022 14:52:24 GMT', 'Content-Type': 'application/x-amz-json-1.1', 'Content-Length': '106', 'Connection': 'keep-alive', 'x-amzn-RequestId': 'ab20be38-cf2a-4207-a87a-5bcad84bf168'}
2022-12-21 16:52:24,233 [File: parsers.py:241] [Module: parsers] DEBUG: Response body:
b'{"__type":"UnrecognizedClientException","message":"The security token included in the request is invalid"}'
2022-12-21 16:52:24,234 [File: hooks.py:238] [Module: hooks] DEBUG: Event needs-retry.global-accelerator.ListAccelerators: calling handler <botocore.retryhandler.RetryHandler object at 0x111af2370>
2022-12-21 16:52:24,234 [File: retryhandler.py:211] [Module: retryhandler] DEBUG: No retry needed.
2022-12-21 16:52:24,235 [File: globalaccelerator_service.py:40] [Module: globalaccelerator_service] ERROR: us-west-2 -- ClientError[27]: An error occurred (UnrecognizedClientException) when calling the ListAccelerators operation: The security token included in the request is invalid
It says token is invalid because the region is the wrong one for some reason.
Expected behavior Prowler v3 is able to scan Chinese AWS accounts
Screenshots or Logs
From where are you running Prowler? Please, complete the following information:
- Resource: workstation
- OS: MacOS Monterey
- AWS-CLI Version [
aws --version]:aws-cli/2.7.2 Python/3.9.12 Darwin/21.6.0 source/x86_64 prompt/off(I suppose it’s not needed anymore as you guys are using boto3 as an AWS client) - Prowler Version [
./prowler -V]:Prowler 3.0.0 - Shell and version:
zsh 5.8.1 (x86_64-apple-darwin21.0) - Others:
Additional context Add any other context about the problem here.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (17 by maintainers)
Awesome, thank you for all the help @daftkid ❤️ I close the issue since it is solved.
@sergargar please see below
Hi @sergargar Yep, I can run all of the checks, some of them are still failing but that will be fixed eventually I believe as almost all errors are related to the fact that some services are not available in the Chinese AWS partition.
One of the recent reports:
And I really like this great performance improvement 😄 (~3 mins instead of 25 with version 2)
@sergargar please see it here: https://gist.github.com/daftkid/52a5a9aefbaa2393245df02faec5d0c6 I executed it via
./prowler.pyinstead of justprowler