add: vm identity on discovery_sweep action - #133
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a best-effort cloud instance identity probe during discovery sweeps. It adds a new file cloud_identity.go containing the shell script and logic to query IMDS endpoints (AWS, GCP, Azure) over SSH on discovered hosts, along with corresponding unit tests in cloud_identity_test.go. The Proxy.handleSweep method in proxy.go is updated to trigger this enrichment when SSH credentials are configured, and the SweepHost struct in sweep.go is updated with a new CloudIdentity field to store the raw probe output. There are no review comments, and we have no feedback to provide.
mayankpande88
previously approved these changes
Aug 11, 2026
Wires SSH credentials (--user/--key/--password-env/--ssh-port) into `forager sweep`, so the cloud_identity probe added in 2a97d7a is reachable standalone, not just via discovery_sweep through a relay.
mayankpande88
approved these changes
Aug 11, 2026
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.
Description
Adds a cloud-instance-identity probe to
discovery_sweep: when SSHcredentials are supplied, every host that answers on the SSH port is
queried for AWS/GCP/Azure instance metadata (instance ID, region/zone,
public IP) over SSH, since IMDS endpoints are link-local and only
answer requests from the instance itself. Output is unparsed
key=valuelines per host — parsing stays server-side so a parser fixnever needs an agent release.
This is the host-reported identity source described as the strongest
VM match key in nudgebee/nudgebee-enterprise#36059 ("One VM shows as
two assets when found by both the cloud collector and the discovery
agent"): it names exactly one cloud resource and self-scopes to the
right account, so — unlike MAC or private-IP matching — it needs no
datasource-to-account association to be unambiguous. This PR only adds
the collector; account-scoped matching/merge on the server side is
tracked separately in that issue.
Two commits:
pkg/proxy/discovery/cloud_identity.go(+proxy.go,sweep.go):the probe itself, wired into
discovery_sweep, no-op when no SSHcredentials are configured on the datasource.
cmd/standalone.go(+docs): exposes--user/--key/--password-env/--ssh-porton standaloneforager sweep, so theprobe is reachable without a relay too.
Type of change
How Has This Been Tested?
Checklist
make validatepasses (fmt + lint + test)