Skip to content

Trim IPs returned to make sure only 1 is output#614

Open
sudo-jtcsec wants to merge 2 commits into
pry0cc:masterfrom
sudo-jtcsec:master
Open

Trim IPs returned to make sure only 1 is output#614
sudo-jtcsec wants to merge 2 commits into
pry0cc:masterfrom
sudo-jtcsec:master

Conversation

@sudo-jtcsec

Copy link
Copy Markdown

If other public IPs are configured (i.e. reserved IP) multiple IPs are output and breaks the SSH config generation which prevents scanning

I just opened issue #613 for this, but I think the solution is very simple. With DO reserved IPs, the droplet can be accessed via any that is returned and set to public (barring any host-specific configurations). For axiom's purposes, it doesn't matter which IP is used, so just get the first one that is returned and call it a day.

Quick verified it locally:

# doctl compute droplet list -o json | jq -r ".[]? | select(.name==\"recon-automation-manager-vm\") | .networks.v4[]? | select(.type==\"public\") | .ip_address"
137.184.x.y
167.172.x.y
167.172.x.y
# doctl compute droplet list -o json | jq -r ".[]? | select(.name==\"recon-automation-manager-vm\") | .networks.v4[]? | select(.type==\"public\") | .ip_address" | head -1
137.184.x.y
#

If other public IPs are configured (i.e. reserved IP) multiple IPs are output and breaks the SSH config generation which prevents scanning
Missed another function, as well as the generate_sshconfig function which manually parses IPs again rather then using function
@sudo-jtcsec

Copy link
Copy Markdown
Author

Further testing revealed that more changes were needed - since sshconfig was being regenerated the multiple-ips kept returning. inside the generate_sshconfig() function the IPs are manually grabbed again, rather then calling one of the other functions (though I updated them both anyways). I tested locally scanning without the cache option and the sshconfig file is being created properly now

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 this pull request may close these issues.

1 participant