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

⭐️ full IMDSv2 support for Amazon instances #1966

Merged
merged 4 commits into from
Oct 5, 2023

Conversation

vjeffrey
Copy link
Contributor

@vjeffrey vjeffrey commented Sep 28, 2023

fixes #1813

This change updates the platform detection to work well with IMDSv2 for both Linux and Windows. In addition it slickly tweaks the default platform ids:

  • machine-id is disable by default since it is not reliable
  • cloud-detect is enabled as default now

@vjeffrey vjeffrey marked this pull request as draft September 28, 2023 06:32
@chris-rock chris-rock force-pushed the vj/fix-identityparse-ec2 branch from c56fcd1 to bb8c4dd Compare October 4, 2023 16:57
@chris-rock
Copy link
Member

chris-rock commented Oct 4, 2023

Amazon Linux

cnquery shell ssh [email protected]
→ connected to Amazon Linux 2
  ___ _ __   __ _ _   _  ___ _ __ _   _ 
 / __| '_ \ / _` | | | |/ _ \ '__| | | |
| (__| | | | (_| | |_| |  __/ |  | |_| |
 \___|_| |_|\__, |\__,_|\___|_|   \__, |
  mondoo™      |_|                |___/  interactive shell

cnquery> asset.ids
asset.ids: [
  0: "//platformid.api.mondoo.app/hostname/ip-10-0-101-112.ec2.internal"
  1: "//platformid.api.mondoo.app/runtime/aws/ec2/v1/accounts/921877552404/regions/us-east-1/instances/i-03e3d4bbc86234179"
  2: "//platformid.api.mondoo.app/runtime/ssh/hostkey/SHA256-SWlgTvT4v/KTfqqGirAdSpazoggXuRWvU8Kc/UPQnmM"
]

Windows 2022

cnquery shell ssh [email protected]'
→ connected to Microsoft Windows Server 2022 Datacenter
  ___ _ __   __ _ _   _  ___ _ __ _   _ 
 / __| '_ \ / _` | | | |/ _ \ '__| | | |
| (__| | | | (_| | |_| |  __/ |  | |_| |
 \___|_| |_|\__, |\__,_|\___|_|   \__, |
  mondoo™      |_|                |___/  interactive shell

cnquery> asset.ids
asset.ids: [
  0: "//platformid.api.mondoo.app/hostname/EC2AMAZ-9J7J697"
  1: "//platformid.api.mondoo.app/runtime/aws/ec2/v1/accounts/921877552404/regions/us-east-1/instances/i-0d6c48ca58e8d8fce"
  2: "//platformid.api.mondoo.app/runtime/ssh/hostkey/SHA256-LqOQnEb2c+qD0ObaLSh5m0pNjx+Zyc/fN1Pq6DhTh88"
]

@chris-rock chris-rock marked this pull request as ready for review October 4, 2023 18:24
@chris-rock chris-rock changed the title 🐛 fix instance identity doc fetching for ec2 instances ⭐️ full IMDSv2 support for Amazon instances Oct 4, 2023
.vscode/launch.json Outdated Show resolved Hide resolved
Copy link
Contributor Author

@vjeffrey vjeffrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub won't let me +1 this because i opened it, but +1 , thank you for the updates! 🎉

@chris-rock chris-rock force-pushed the vj/fix-identityparse-ec2 branch from 04de2ce to 740f664 Compare October 4, 2023 19:24
Copy link
Member

@arlimus arlimus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noice!

@vjeffrey vjeffrey merged commit 133dab5 into main Oct 5, 2023
10 checks passed
@vjeffrey vjeffrey deleted the vj/fix-identityparse-ec2 branch October 5, 2023 05:30
@github-actions github-actions bot locked and limited conversation to collaborators Oct 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cloud detect failing for ec2
4 participants