Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ip2domain-dnsserver
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Recolic
ip2domain-dnsserver
Commits
e4e5cd71
There was an error fetching the commit references. Please try again later.
Commit
e4e5cd71
authored
4 years ago
by
Recolic K
Browse files
Options
Downloads
Patches
Plain Diff
allow caa record and remove recursive resolving
parent
93075dec
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
daemon.py
+11
-9
11 additions, 9 deletions
daemon.py
deprecated_donotuse.py
+0
-0
0 additions, 0 deletions
deprecated_donotuse.py
with
11 additions
and
9 deletions
better
.py
→
daemon
.py
+
11
−
9
View file @
e4e5cd71
#!/usr/bin/
env
python3
.6
#!/usr/bin/python3
import
json
import
logging
import
os
...
...
@@ -48,9 +48,10 @@ def gen_response(qt, qn):
global
serving_domains
prefix_
=
list
(
filter
(
lambda
d
:
qn
==
d
or
qn
.
endswith
(
'
.
'
+
d
),
serving_domains
))
if
len
(
prefix_
)
!=
1
:
print
(
"
Error: invalid request domain {} in {}
"
.
format
(
qn
,
serving_domains
))
#
print("Error: invalid request domain {} in {}".format(qn, serving_domains))
return
None
prefix
=
prefix_
[
0
]
print
(
'
REQ:
'
,
qt
,
qn
)
if
qt
==
'
SOA
'
:
generated_soa
=
dnslib
.
SOA
(
mname
=
"
todo.
"
+
domain_text
,
rname
=
"
root@recolic.net
"
,
times
=
(
...
...
@@ -121,8 +122,7 @@ class Resolver(ProxyResolver):
def
resolve
(
self
,
request
,
handler
):
qt
=
QTYPE
[
request
.
q
.
qtype
]
qn
=
str
(
request
.
q
.
qname
)
print
(
qt
,
qn
)
qn
=
str
(
request
.
q
.
qname
).
lower
()
reply
=
request
.
reply
()
resp
=
gen_response
(
qt
,
qn
)
...
...
@@ -134,13 +134,13 @@ class Resolver(ProxyResolver):
else
:
reply
.
add_answer
(
resp
)
if
reply
.
rr
:
logger
.
info
(
'
found zone for %s[%s], %d replies
'
,
qn
,
qt
,
len
(
reply
.
rr
))
if
reply
.
rr
or
qt
==
'
CAA
'
:
# CAA query should return empty reply. It's ok.
return
reply
logger
.
info
(
'
no local zone found, proxying %s[%s]
'
,
qn
,
qt
)
return
super
().
resolve
(
request
,
handler
)
# I don't want to support other records. Disable the fallback resolver and return empty.
# return super().resolve(request, handler)
return
reply
def
handle_sig
(
signum
,
frame
):
...
...
@@ -166,3 +166,5 @@ if __name__ == '__main__':
sleep
(
1
)
except
KeyboardInterrupt
:
pass
This diff is collapsed.
Click to expand it.
d
ns
.py
→
d
eprecated_donotuse
.py
+
0
−
0
View file @
e4e5cd71
File moved
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment