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

Warn when connection to Spamhaus times out #1817

Merged
merged 4 commits into from Jan 28, 2021

Conversation

fspoettel
Copy link
Contributor

@fspoettel fspoettel commented Sep 4, 2020

This prints a warning rather than an error when a Timeout is raised and query_dns() then returns "[timeout]".
Decided against explicit checks for Spamhaus error codes (zen dbl) for now to keep it simple.

closes #1816

management/status_checks.py Outdated Show resolved Hide resolved
management/status_checks.py Outdated Show resolved Hide resolved
Copy link
Contributor

@ddavness ddavness left a comment

Choose a reason for hiding this comment

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

Bumping this PR as I have a couple suggestions :^)

@@ -293,6 +293,8 @@ def run_network_checks(env, output):
zen = query_dns(rev_ip4+'.zen.spamhaus.org', 'A', nxdomain=None)
if zen is None:
output.print_ok("IP address is not blacklisted by zen.spamhaus.org.")
elif zen == "[timeout]":
output.print_warning("Connection to zen.spamhaus.org timed out. We could not determine whether your server's IP address is blacklisted. Please try again later.")
Copy link
Contributor

@ddavness ddavness Jan 18, 2021

Choose a reason for hiding this comment

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

Maybe we could add a the website endpoint that we point the users to when the IP/domain turns out to be legitimately blocked (http://www.spamhaus.org/query/ip/<ipv4>), for example:

Connection to zen.spamhaus.org timed out. We could not determine whether your server's IP address is blacklisted. Please try again later, or see http://www.spamhaus.org/query/ip/1.1.1.1

@@ -678,6 +680,8 @@ def check_mail_domain(domain, env, output):
dbl = query_dns(domain+'.dbl.spamhaus.org', "A", nxdomain=None)
if dbl is None:
output.print_ok("Domain is not blacklisted by dbl.spamhaus.org.")
elif dbl == "[timeout]":
output.print_warning("Connection to dbl.spamhaus.org timed out. We could not determine whether the domain {} is blacklisted. Please try again later.".format(domain))
Copy link
Contributor

@ddavness ddavness Jan 18, 2021

Choose a reason for hiding this comment

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

Same here: http://www.spamhaus.org/query/domain/example.com:

Connection to dbl.spamhaus.org timed out. We could not determine whether the domain example.com is blacklisted. Please try again later, or see http://www.spamhaus.org/query/domain/example.com

@JoshData
Copy link
Member

This issue has never happened for me and I assume it is intermittent, so we don't need to make the error message more informative. Merging!

@JoshData JoshData merged commit e3d98b7 into mail-in-a-box:master Jan 28, 2021
@ddavness
Copy link
Contributor

I think it may depend on who your providers are - for Hetzner, for whatever reason all Spamhaus queries take either very long (in the ballpark of the 30 seconds) or just time out.

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.

Spamhaus timeout leads to false positive
4 participants