Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mailinabox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mailinabox
Commits
1926bfa1
Commit
1926bfa1
authored
Nov 11, 2015
by
Joshua Tauberer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all DNS queries should have a timeout, fixes #591
parent
2b351208
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
dns_update.py
management/dns_update.py
+3
-1
status_checks.py
management/status_checks.py
+3
-0
No files found.
management/dns_update.py
View file @
1926bfa1
...
...
@@ -794,6 +794,7 @@ def set_custom_dns_record(qname, rtype, value, action, env):
def
get_secondary_dns
(
custom_dns
,
mode
=
None
):
resolver
=
dns
.
resolver
.
get_default_resolver
()
resolver
.
timeout
=
10
values
=
[]
for
qname
,
rtype
,
value
in
custom_dns
:
...
...
@@ -826,11 +827,12 @@ def set_secondary_dns(hostnames, env):
if
len
(
hostnames
)
>
0
:
# Validate that all hostnames are valid and that all zone-xfer IP addresses are valid.
resolver
=
dns
.
resolver
.
get_default_resolver
()
resolver
.
timeout
=
5
for
item
in
hostnames
:
if
not
item
.
startswith
(
"xfr:"
):
# Resolve hostname.
try
:
response
=
dns
.
resolver
.
query
(
item
,
"A"
)
response
=
resolver
.
query
(
item
,
"A"
)
except
(
dns
.
resolver
.
NoNameservers
,
dns
.
resolver
.
NXDOMAIN
,
dns
.
resolver
.
NoAnswer
):
raise
ValueError
(
"Could not resolve the IP address of
%
s."
%
item
)
else
:
...
...
management/status_checks.py
View file @
1926bfa1
...
...
@@ -594,6 +594,9 @@ def query_dns(qname, rtype, nxdomain='[Not Set]', at=None):
resolver
=
dns
.
resolver
.
Resolver
()
resolver
.
nameservers
=
[
at
]
# Set a timeout so that a non-responsive server doesn't hold us back.
resolver
.
timeout
=
5
# Do the query.
try
:
response
=
resolver
.
query
(
qname
,
rtype
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment