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

Fix ipv6 support in domain lookups #575

Merged
merged 3 commits into from
Apr 24, 2024
Merged

Conversation

mrchrisadams
Copy link
Member

This PR is intended to resolve #573 , which came up when we realised that domain lookups that resolve to an ipv6 address were not working properly.

It covers both cases, and lays the path for a updating this to check ALL ip addresses a domain might resolve to in future, not just the first one.

We don't immediately moved to checking every domain, as I'm not sure of the performance implications, and there are a few places that expect just one ip address to be returned - we'd need to make quite a few changes elsewhere.

Copy link

gitpod-io bot commented Apr 24, 2024

@@ -228,13 +256,21 @@ def check_domain(self, domain: str) -> SiteCheck:
the best matching IP range for the ip address it resolves to,
or a 'grey' Sitecheck
"""
UNRESOLVED_ADDRESS = "0.0.0.0"
Copy link
Member Author

@mrchrisadams mrchrisadams Apr 24, 2024

Choose a reason for hiding this comment

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

I'm aware that 0.0.0.0 has a special meaning when we pass it to servers. I'm using this placeholder, as I'm not aware of an equivalent IP address that means "not a real address", and in a few places we always assume an ip address string is returned.

I think our workers expect an ip string when writing to the big greencheck table, and I don't want this PR to result in us needing to change out database schema.

# Ideally we'd check that ALL the IP addresses resolved are within our
# green IP ranges but until we know how much this impacts performance
# we choose the first one.
ip_info = socket.getaddrinfo(domain, None)
Copy link
Member Author

@mrchrisadams mrchrisadams Apr 24, 2024

Choose a reason for hiding this comment

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

As the comments around this say - we acknowledge that we really should check that every ip range is green. Ths priority is fixing this first, before adding that functionality in later. See #576 for more details, and future work.

@mrchrisadams
Copy link
Member Author

1 similar comment
@mrchrisadams
Copy link
Member Author

Copy link

sentry-io bot commented Apr 25, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ gaierror: [Errno -5] No address associated with hostname /admin/accounts/hostingprovider/{object_id}/cha... View Issue

Did you find this useful? React with a 👍 or 👎

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.

convert_domain_to_ip does not support ipv6, only ipv4
1 participant