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

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sudo-jtcsec
Copy link

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
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