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

cnquery shell aws ec2 ssm not working #338

Closed
vjeffrey opened this issue Oct 19, 2022 · 2 comments · Fixed by #347
Closed

cnquery shell aws ec2 ssm not working #338

vjeffrey opened this issue Oct 19, 2022 · 2 comments · Fixed by #347

Comments

@vjeffrey
Copy link
Contributor

Describe the bug

[19/10/22 02:08:01] ❯ AWS_REGION=us-east-1 AWS_PROFILE="vvdefault" cnquery shell aws ec2 ssm ec2-user@50.19.150.22

→ loaded configuration from /Users/vj/.config/mondoo/mondoo.yml using source default
→ discover related assets for 1 asset(s)
→ resolved assets resolved-assets=0
x could not connect to asset error="operation error EC2: DescribeInstances, https response error StatusCode: 400, RequestID: 1164b9f9-09b7-43ee-b352-ec23afd26700, api error MissingParameter: The request must contain the parameter InstanceId" asset=
FTL could not resolve assets

vj@vj-macpro ~
[19/10/22 02:08:11] ❯ AWS_REGION=us-east-1 AWS_PROFILE="vvdefault" cnquery shell aws ec2 ssm ec2-user@i-0fd8fc27329747cca
→ loaded configuration from /Users/vj/.config/mondoo/mondoo.yml using source default
→ discover related assets for 1 asset(s)
→ resolved assets resolved-assets=0
x could not connect to asset error="operation error EC2: DescribeInstances, https response error StatusCode: 400, RequestID: 4c11312c-cf84-493f-a4d8-91af192018ac, api error MissingParameter: The request must contain the parameter InstanceId" asset=
FTL could not resolve assets

trying with instance connect works:

vj@vj-macpro ~
[19/10/22 02:08:19] ❯ AWS_REGION=us-east-1 AWS_PROFILE="vvdefault" cnquery shell aws ec2 instance-connect ec2-user@i-0fd8fc27329747cca
→ loaded configuration from /Users/vj/.config/mondoo/mondoo.yml using source default
→ discover related assets for 1 asset(s)
→ resolved assets resolved-assets=1
  ___ _ __   __ _ _   _  ___ _ __ _   _
 / __| '_ \ / _` | | | |/ _ \ '__| | | |
| (__| | | | (_| | |_| |  __/ |  | |_| |
 \___|_| |_|\__, |\__,_|\___|_|   \__, |
  mondoo™      |_|                |___/  interactive shell

cnquery>
@preslavgerchev
Copy link
Contributor

I am still getting errors:

AWS_REGION=us-east-1 AWS_PROFILE=preslav-dev cnquery shell aws ec2 ssm ubuntu@<ip>  
→ loaded configuration from /Users/preslavgerchev/.config/mondoo/mondoo.yml using source default
→ discover related assets for 1 asset(s)
→ resolved assets resolved-assets=0
x could not connect to asset error="operation error EC2: DescribeInstances, https response error StatusCode: 400, RequestID: 42281d27-9055-406d-8607-636caece9fda, api error InvalidInstanceID.Malformed: Invalid id:<ip>" asset=<ip>
FTL could not resolve assets

I believe it's related to us trying to retrieve instances, using the host param as an instance id

@preslavgerchev
Copy link
Contributor

Oh, now i see that the examples above also use instance id, I was looking at the first example only. Going to improve the help command for that in another PR:

Usage:
  cnquery scan aws ec2 ssm user@host [flags]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants