dnsruby 1.52 → 1.53
Sign up to get free protection for your applications and to get access to all the features.
- data/DNSSEC +10 -10
- data/README +59 -59
- data/lib/Dnsruby/Recursor.rb +61 -25
- data/lib/Dnsruby/Resolver.rb +2 -2
- data/lib/Dnsruby/code_mapper.rb +1 -1
- data/lib/Dnsruby/ipv4.rb +1 -1
- data/lib/Dnsruby/message.rb +34 -14
- data/lib/Dnsruby/resource/SOA.rb +5 -5
- data/lib/Dnsruby/resource/SSHFP.rb +5 -1
- data/lib/Dnsruby/resource/TXT.rb +2 -0
- data/lib/Dnsruby/resource/resource.rb +1 -1
- data/lib/Dnsruby/single_verifier.rb +24 -28
- data/lib/dnsruby.rb +1 -1
- data/test/tc_dnskey.rb +1 -1
- data/test/tc_name.rb +1 -1
- data/test/tc_resolver.rb +0 -1
- data/test/tc_rr-unknown.rb +1 -0
- data/test/tc_rrset.rb +3 -3
- metadata +16 -8
- data/lib/Dnsruby/iana_ports.rb +0 -5227
data/DNSSEC
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
DNSSEC support in Dnsruby
|
2
|
-
=========================
|
3
|
-
|
4
|
-
DNSSEC defines a set of security extensions to DNS which provide a way for a resolver to verify cryptographically the DNS RRSets returned by an upstream resolver. The main standard is defined in RFCs 4033, 4034 and 4035.
|
5
|
-
|
1
|
+
DNSSEC support in Dnsruby
|
2
|
+
=========================
|
3
|
+
|
4
|
+
DNSSEC defines a set of security extensions to DNS which provide a way for a resolver to verify cryptographically the DNS RRSets returned by an upstream resolver. The main standard is defined in RFCs 4033, 4034 and 4035.
|
5
|
+
|
6
6
|
Dnsruby provides a recursive, validating security-aware stub resolver which maintains a cache of trusted keys and verifies RRSIG-signed messages with those keys (adding new trusted keys from signed DNSKEY RRSets and DS records). If dnsruby does not currently have the required key, it will attempt to walk the tree from the nearest known trusted key.
|
7
7
|
|
8
8
|
The dnssec security status of a message is stored in Message#security_level (defined by Message::SecurityLevel).
|
9
9
|
|
10
10
|
It is possible to tell Dnsruby to use a Recursor or a defined (or system default) Resolver to perform the validation. The default is to use a Recursor, as many systems are behind dodgy servers which mangle the DNS records. Using a Recursor means that only authoritative nameservers are queried for the DNSSEC records.
|
11
11
|
|
12
|
-
In the absence of a signed root, Dnsruby has no trust anchor to validate messages against. It is possible to manually configure dnsruby with individual trust ancors. It is also possible to import a trust anchor repository (such as the one maintained by IANA), and configure the ISC DLV registry. Dnsruby contains basic methods to do this, although they are not currently secured. Clients are recommended to develop their own means of obtaining the initial trust anchors.
|
13
|
-
|
12
|
+
In the absence of a signed root, Dnsruby has no trust anchor to validate messages against. It is possible to manually configure dnsruby with individual trust ancors. It is also possible to import a trust anchor repository (such as the one maintained by IANA), and configure the ISC DLV registry. Dnsruby contains basic methods to do this, although they are not currently secured. Clients are recommended to develop their own means of obtaining the initial trust anchors.
|
13
|
+
|
14
14
|
It is possible to turn off dnssec validation on a per-message basis. Simply set Message#do_validation to false.
|
15
|
-
|
15
|
+
|
16
16
|
DNSSEC is on by default - if desired, you can turn it off with the dnssec flag in Dnsruby::(Single)Resolver if desired. EDNS0 support is also enabled by default - if desired, you can turn this off by setting the Dnsruby::(Single)Resolver#udp_packet_size property to be 512. There should generally be no need to do this.
|
17
17
|
|
18
|
-
Dnsruby maintains a cache of responses, and a cache of trusted keys. Once the initial keys have been downloaded, and a set of trusted keys built up, very little overhead is required to enjoy the benefits of DNSSEC. There is, however, some initial cost (to build up the caches).
|
19
|
-
|
18
|
+
Dnsruby maintains a cache of responses, and a cache of trusted keys. Once the initial keys have been downloaded, and a set of trusted keys built up, very little overhead is required to enjoy the benefits of DNSSEC. There is, however, some initial cost (to build up the caches).
|
19
|
+
|
data/README
CHANGED
@@ -1,59 +1,59 @@
|
|
1
|
-
Dnsruby
|
2
|
-
=======
|
3
|
-
|
4
|
-
Dnsruby is a pure Ruby DNS client library which implements a
|
5
|
-
stub resolver. It aims to comply with all DNS RFCs, including
|
6
|
-
DNSSEC NSEC3 support.
|
7
|
-
|
8
|
-
Dnsruby presents a new API for DNS. It is based on Ruby's core
|
9
|
-
resolv.rb Resolv API, but has been much extended to provide a
|
10
|
-
complete DNS implementation.
|
11
|
-
|
12
|
-
Dnsruby runs a single I/O thread to handle all concurrent
|
13
|
-
queries. It is therefore suitable for high volume DNS applications.
|
14
|
-
|
15
|
-
The following is a (non-exhaustive) list of features :
|
16
|
-
|
17
|
-
o Implemented RRs : A, AAAA, AFSDB, ANY, CERT, CNAME, DNAME,
|
18
|
-
HINFO, ISDN, LOC, MB, MG, MINFO, MR, MX, NAPTR, NS, NSAP,
|
19
|
-
OPT, PTR, PX, RP, RT, SOA, SPF, SRV, TKEY, TSIG, TXT, WKS,
|
20
|
-
X25, DNSKEY, RRSIG, NSEC, NSEC3, NSEC3PARAM, DS, DLV
|
21
|
-
|
22
|
-
o Generic RR types supported (RFC3597)
|
23
|
-
|
24
|
-
o (Signed) Zone transfer (AXFR and IXFR) supported
|
25
|
-
|
26
|
-
o (Signed) Dyamic updates supported
|
27
|
-
|
28
|
-
o DNSSEC validation supported
|
29
|
-
|
30
|
-
Dependencies
|
31
|
-
============
|
32
|
-
|
33
|
-
Dnsruby can run with no dependencies. However, if you wish to
|
34
|
-
use TSIG or DNSSEC then the OpenSSL library must be available.
|
35
|
-
This is a part of the Ruby standard library, but appears not to
|
36
|
-
be present on all Ruby platforms. If it is not available, then
|
37
|
-
the test code will not run the tests which require it. Code which
|
38
|
-
attempts to use the library (if it is not present) will raise an
|
39
|
-
exception.
|
40
|
-
|
41
|
-
Demo code
|
42
|
-
=========
|
43
|
-
|
44
|
-
The demo folder contains some example programs using Dnsruby.
|
45
|
-
These examples include a basic dig tool (rubydig) and a tool to
|
46
|
-
concurrently resolve many names, amongst others.
|
47
|
-
|
48
|
-
Online tests
|
49
|
-
============
|
50
|
-
|
51
|
-
Nominet operate a test server which the Dnsruby test code queries.
|
52
|
-
If this server is not available then some of the online tests will
|
53
|
-
not be run.
|
54
|
-
|
55
|
-
|
56
|
-
Contact
|
57
|
-
=======
|
58
|
-
|
59
|
-
Use dnsruby rubyforge forums, or contact : alexd@nominet.org.uk
|
1
|
+
Dnsruby
|
2
|
+
=======
|
3
|
+
|
4
|
+
Dnsruby is a pure Ruby DNS client library which implements a
|
5
|
+
stub resolver. It aims to comply with all DNS RFCs, including
|
6
|
+
DNSSEC NSEC3 support.
|
7
|
+
|
8
|
+
Dnsruby presents a new API for DNS. It is based on Ruby's core
|
9
|
+
resolv.rb Resolv API, but has been much extended to provide a
|
10
|
+
complete DNS implementation.
|
11
|
+
|
12
|
+
Dnsruby runs a single I/O thread to handle all concurrent
|
13
|
+
queries. It is therefore suitable for high volume DNS applications.
|
14
|
+
|
15
|
+
The following is a (non-exhaustive) list of features :
|
16
|
+
|
17
|
+
o Implemented RRs : A, AAAA, AFSDB, ANY, CERT, CNAME, DNAME,
|
18
|
+
HINFO, ISDN, LOC, MB, MG, MINFO, MR, MX, NAPTR, NS, NSAP,
|
19
|
+
OPT, PTR, PX, RP, RT, SOA, SPF, SRV, TKEY, TSIG, TXT, WKS,
|
20
|
+
X25, DNSKEY, RRSIG, NSEC, NSEC3, NSEC3PARAM, DS, DLV
|
21
|
+
|
22
|
+
o Generic RR types supported (RFC3597)
|
23
|
+
|
24
|
+
o (Signed) Zone transfer (AXFR and IXFR) supported
|
25
|
+
|
26
|
+
o (Signed) Dyamic updates supported
|
27
|
+
|
28
|
+
o DNSSEC validation supported
|
29
|
+
|
30
|
+
Dependencies
|
31
|
+
============
|
32
|
+
|
33
|
+
Dnsruby can run with no dependencies. However, if you wish to
|
34
|
+
use TSIG or DNSSEC then the OpenSSL library must be available.
|
35
|
+
This is a part of the Ruby standard library, but appears not to
|
36
|
+
be present on all Ruby platforms. If it is not available, then
|
37
|
+
the test code will not run the tests which require it. Code which
|
38
|
+
attempts to use the library (if it is not present) will raise an
|
39
|
+
exception.
|
40
|
+
|
41
|
+
Demo code
|
42
|
+
=========
|
43
|
+
|
44
|
+
The demo folder contains some example programs using Dnsruby.
|
45
|
+
These examples include a basic dig tool (rubydig) and a tool to
|
46
|
+
concurrently resolve many names, amongst others.
|
47
|
+
|
48
|
+
Online tests
|
49
|
+
============
|
50
|
+
|
51
|
+
Nominet operate a test server which the Dnsruby test code queries.
|
52
|
+
If this server is not available then some of the online tests will
|
53
|
+
not be run.
|
54
|
+
|
55
|
+
|
56
|
+
Contact
|
57
|
+
=======
|
58
|
+
|
59
|
+
Use dnsruby rubyforge forums, or contact : alexd@nominet.org.uk
|
data/lib/Dnsruby/Recursor.rb
CHANGED
@@ -162,6 +162,7 @@ module Dnsruby
|
|
162
162
|
@@hints = nil
|
163
163
|
@@authority_cache = Hash.new
|
164
164
|
@@zones_cache = nil
|
165
|
+
@@nameservers = nil
|
165
166
|
|
166
167
|
def initialize(res = nil)
|
167
168
|
if (res)
|
@@ -234,28 +235,41 @@ module Dnsruby
|
|
234
235
|
hints[server] = AddressCache.new
|
235
236
|
end
|
236
237
|
end
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
TheLog.debug(";; STORING IP6: #{server} IN AAAA "+rr.address.to_s+"\n")
|
255
|
-
hints[server].push([rr.address.to_s, rr.ttl])
|
238
|
+
if ((packet.additional.length == 0) ||
|
239
|
+
((packet.additional.length == 1) && (packet.additional()[0].type == Types.OPT)))
|
240
|
+
# Some resolvers (e.g. 8.8.8.8) do not send an additional section -
|
241
|
+
# need to make explicit queries for these :(
|
242
|
+
# Probably best to limit the number of outstanding queries - extremely bursty behaviour otherwise
|
243
|
+
# What happens if we select only name
|
244
|
+
q = Queue.new
|
245
|
+
hints.keys.each {|server|
|
246
|
+
# Query for the server address and add it to hints.
|
247
|
+
['A', 'AAAA'].each {|type|
|
248
|
+
msg = Message.new
|
249
|
+
msg.do_caching = @do_caching
|
250
|
+
msg.header.rd = false
|
251
|
+
msg.do_validation = false
|
252
|
+
msg.add_question(server, type, 'IN')
|
253
|
+
if (@dnssec)
|
254
|
+
msg.header.cd = true # We do our own validation by default
|
256
255
|
end
|
256
|
+
resolver.send_async(msg, q)
|
257
|
+
}
|
258
|
+
}
|
259
|
+
(hints.length * 2).times {
|
260
|
+
id, result, error = q.pop
|
261
|
+
if (result)
|
262
|
+
result.answer.each {|rr|
|
263
|
+
TheLog.debug(";; NS address: " + rr.inspect+"\n")
|
264
|
+
add_to_hints(hints, rr)
|
265
|
+
}
|
257
266
|
end
|
258
|
-
|
267
|
+
}
|
268
|
+
else
|
269
|
+
packet.additional.each do |rr|
|
270
|
+
TheLog.debug(";; ADDITIONAL: "+rr.inspect+"\n")
|
271
|
+
add_to_hints(hints, rr)
|
272
|
+
|
259
273
|
end
|
260
274
|
end
|
261
275
|
end
|
@@ -307,6 +321,28 @@ module Dnsruby
|
|
307
321
|
@@nameservers = @@hints.values
|
308
322
|
return @@nameservers
|
309
323
|
end
|
324
|
+
|
325
|
+
def Recursor.add_to_hints(hints, rr)
|
326
|
+
server = rr.name.to_s.downcase
|
327
|
+
server.sub!(/\.$/,"")
|
328
|
+
if (server)
|
329
|
+
if ( rr.type == Types::A)
|
330
|
+
#print ";; ADDITIONAL HELP: $server -> [".$rr->rdatastr."]\n" if $self->{'debug'};
|
331
|
+
if (hints[server]!=nil)
|
332
|
+
TheLog.debug(";; STORING IP: #{server} IN A "+rr.address.to_s+"\n")
|
333
|
+
hints[server].push([rr.address.to_s, rr.ttl])
|
334
|
+
end
|
335
|
+
end
|
336
|
+
if ( rr.type == Types::AAAA)
|
337
|
+
#print ";; ADDITIONAL HELP: $server -> [".$rr->rdatastr."]\n" if $self->{'debug'};
|
338
|
+
if (hints[server])
|
339
|
+
TheLog.debug(";; STORING IP6: #{server} IN AAAA "+rr.address.to_s+"\n")
|
340
|
+
hints[server].push([rr.address.to_s, rr.ttl])
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
end
|
345
|
+
end
|
310
346
|
|
311
347
|
|
312
348
|
#This method takes a code reference, which is then invoked each time a
|
@@ -315,9 +351,9 @@ module Dnsruby
|
|
315
351
|
#
|
316
352
|
# res.recursion_callback(Proc.new { |packet|
|
317
353
|
# print packet.additional.inspect
|
318
|
-
#
|
319
|
-
# print";; Received %d bytes from %s\n\n",
|
320
|
-
# packetanswersize,
|
354
|
+
#
|
355
|
+
# print";; Received %d bytes from %s\n\n",
|
356
|
+
# packetanswersize,
|
321
357
|
# packet.answerfrom);
|
322
358
|
# })
|
323
359
|
#
|
@@ -325,7 +361,7 @@ module Dnsruby
|
|
325
361
|
# if (sub && UNIVERSAL::isa(sub, 'CODE'))
|
326
362
|
@callback = sub
|
327
363
|
# end
|
328
|
-
end
|
364
|
+
end
|
329
365
|
|
330
366
|
def recursion_callback
|
331
367
|
return @callback
|
@@ -405,7 +441,7 @@ module Dnsruby
|
|
405
441
|
return name
|
406
442
|
end
|
407
443
|
}
|
408
|
-
return false if name=="."
|
444
|
+
return false if name=="."
|
409
445
|
# strip the name up to the first dot
|
410
446
|
first_dot = name.index(".")
|
411
447
|
if (first_dot == (name.length-1))
|
data/lib/Dnsruby/Resolver.rb
CHANGED
@@ -59,8 +59,8 @@ module Dnsruby
|
|
59
59
|
#Support for EventMachine has been deprecated.
|
60
60
|
class Resolver
|
61
61
|
DefaultQueryTimeout = 0
|
62
|
-
DefaultPacketTimeout =
|
63
|
-
DefaultRetryTimes =
|
62
|
+
DefaultPacketTimeout = 5
|
63
|
+
DefaultRetryTimes = 1
|
64
64
|
DefaultRetryDelay = 5
|
65
65
|
DefaultPort = 53
|
66
66
|
DefaultDnssec = true
|
data/lib/Dnsruby/code_mapper.rb
CHANGED
data/lib/Dnsruby/ipv4.rb
CHANGED
data/lib/Dnsruby/message.rb
CHANGED
@@ -1124,9 +1124,11 @@ module Dnsruby
|
|
1124
1124
|
def initialize(*args)
|
1125
1125
|
@qtype = Types::A
|
1126
1126
|
@qclass = Classes::IN
|
1127
|
+
type_given = false
|
1127
1128
|
if (args.length > 0)
|
1128
1129
|
if (args.length > 1)
|
1129
1130
|
@qtype = Types.new(args[1])
|
1131
|
+
type_given = true
|
1130
1132
|
if (args.length > 2)
|
1131
1133
|
@qclass = Classes.new(args[2])
|
1132
1134
|
end
|
@@ -1135,22 +1137,40 @@ module Dnsruby
|
|
1135
1137
|
raise ArgumentError.new("Must pass at least a name!")
|
1136
1138
|
end
|
1137
1139
|
# If the name looks like an IP address then do an appropriate
|
1138
|
-
# PTR query
|
1140
|
+
# PTR query, unless the user specified the qtype
|
1139
1141
|
@qname=args[0]
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1142
|
+
if (!type_given)
|
1143
|
+
case @qname.to_s
|
1144
|
+
when IPv4::Regex
|
1145
|
+
@qname = IPv4.create(@qname).to_name
|
1146
|
+
@qtype = Types.PTR
|
1147
|
+
when IPv6::Regex
|
1148
|
+
@qname = IPv6.create(@qname).to_name
|
1149
|
+
@qtype = Types.PTR
|
1150
|
+
when Name
|
1151
|
+
when IPv6
|
1152
|
+
@qtype = Types.PTR
|
1153
|
+
when IPv4
|
1154
|
+
@qtype = Types.PTR
|
1155
|
+
else
|
1156
|
+
@qname = Name.create(@qname)
|
1157
|
+
end
|
1152
1158
|
else
|
1153
|
-
|
1159
|
+
case @qtype
|
1160
|
+
when Types.PTR
|
1161
|
+
case @qname.to_s
|
1162
|
+
when IPv4::Regex
|
1163
|
+
@qname = IPv4.create(@qname).to_name
|
1164
|
+
when IPv6::Regex
|
1165
|
+
@qname = IPv6.create(@qname).to_name
|
1166
|
+
when IPv6
|
1167
|
+
when IPv4
|
1168
|
+
else
|
1169
|
+
@qname = Name.create(@qname)
|
1170
|
+
end
|
1171
|
+
else
|
1172
|
+
@qname = Name.create(@qname)
|
1173
|
+
end
|
1154
1174
|
end
|
1155
1175
|
end
|
1156
1176
|
|
data/lib/Dnsruby/resource/SOA.rb
CHANGED
@@ -49,11 +49,11 @@ module Dnsruby
|
|
49
49
|
def from_hash(hash)
|
50
50
|
@mname = Name.create(hash[:mname])
|
51
51
|
@rname = Name.create(hash[:rname])
|
52
|
-
@serial = hash[:serial]
|
53
|
-
@refresh = hash[:refresh]
|
54
|
-
@retry = hash[:retry]
|
55
|
-
@expire = hash[:expire]
|
56
|
-
@minimum = hash[:minimum]
|
52
|
+
@serial = hash[:serial].to_i
|
53
|
+
@refresh = hash[:refresh].to_i
|
54
|
+
@retry = hash[:retry].to_i
|
55
|
+
@expire = hash[:expire].to_i
|
56
|
+
@minimum = hash[:minimum].to_i
|
57
57
|
end
|
58
58
|
|
59
59
|
def from_string(input)
|
data/lib/Dnsruby/resource/TXT.rb
CHANGED
@@ -390,7 +390,7 @@ module Dnsruby
|
|
390
390
|
# strip out comments
|
391
391
|
# Test for non escaped ";" by means of the look-behind assertion
|
392
392
|
# (the backslash is escaped)
|
393
|
-
rrstring.gsub
|
393
|
+
rrstring = rrstring.gsub(/(\?<!\\);.*/o, "");
|
394
394
|
|
395
395
|
if ((rrstring =~/#{@@RR_REGEX}/xo) == nil)
|
396
396
|
raise Exception, "#{rrstring} did not match RR pat.\nPlease report this to the author!\n"
|
@@ -60,24 +60,24 @@ module Dnsruby
|
|
60
60
|
if (!defined?@@recursor)
|
61
61
|
if (defined?@@hints)
|
62
62
|
Recursor.set_hints(@@hints, Resolver.new)
|
63
|
-
|
63
|
+
@@recursor = Recursor.new()
|
64
64
|
else
|
65
|
-
|
65
|
+
@@recursor = Recursor.new
|
66
66
|
end
|
67
67
|
end
|
68
68
|
return @@recursor
|
69
69
|
end
|
70
70
|
|
71
71
|
def get_dlv_resolver # :nodoc:
|
72
|
-
# if (Dnssec.do_validation_with_recursor?)
|
73
|
-
# return Recursor.new
|
74
|
-
# else
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
# end
|
72
|
+
# if (Dnssec.do_validation_with_recursor?)
|
73
|
+
# return Recursor.new
|
74
|
+
# else
|
75
|
+
if (Dnssec.default_resolver)
|
76
|
+
return Dnssec.default_resolver
|
77
|
+
else
|
78
|
+
return Resolver.new
|
79
|
+
end
|
80
|
+
# end
|
81
81
|
end
|
82
82
|
def add_dlv_key(key)
|
83
83
|
# Is this a ZSK or a KSK?
|
@@ -121,7 +121,7 @@ module Dnsruby
|
|
121
121
|
# Add the
|
122
122
|
def add_trust_anchor_with_expiration(k, expiration)
|
123
123
|
if (k.type == Types.DNSKEY)
|
124
|
-
# k.flags = k.flags | RR::IN::DNSKEY::SEP_KEY
|
124
|
+
# k.flags = k.flags | RR::IN::DNSKEY::SEP_KEY
|
125
125
|
@trust_anchors.add_key_with_expiration(k, expiration)
|
126
126
|
# print "Adding trust anchor for #{k.name}\n"
|
127
127
|
TheLog.info("Adding trust anchor for #{k.name}")
|
@@ -706,7 +706,7 @@ module Dnsruby
|
|
706
706
|
check_rr_data(rrset, sigrec)
|
707
707
|
end
|
708
708
|
raise ArgumentError.new("Expecting DNSKEY, DLV, DS, RRSet, Array or nil for keys : got #{keys.class} instead") if
|
709
|
-
|
709
|
+
(keys && (![Array, RR::IN::DNSKEY, RR::IN::DLV, RR::IN::DS].include?keys.class) && (keys.class != RRSet))
|
710
710
|
|
711
711
|
keyrec = nil
|
712
712
|
sigrec = nil
|
@@ -941,7 +941,7 @@ module Dnsruby
|
|
941
941
|
# print "Follow chain from #{anchor.name} to #{name}\n"
|
942
942
|
TheLog.debug("Follow chain from #{anchor.name} to #{name}")
|
943
943
|
|
944
|
-
# res = nil
|
944
|
+
# res = nil
|
945
945
|
res = Dnssec.default_resolver
|
946
946
|
# while ((next_step != name) || (next_key.type != Types.DNSKEY))
|
947
947
|
while (true)
|
@@ -951,7 +951,7 @@ module Dnsruby
|
|
951
951
|
dont_move_on = true
|
952
952
|
end
|
953
953
|
next_key, res = get_anchor_for(next_step, parent, next_key, res)
|
954
|
-
if (next_step == name)
|
954
|
+
if (next_step.canonical.to_s == name.canonical.to_s)
|
955
955
|
# print "Returning #{next_key.type} for #{next_step}, #{(next_key.type != Types.DNSKEY)}\n"
|
956
956
|
return next_key
|
957
957
|
end
|
@@ -983,11 +983,12 @@ module Dnsruby
|
|
983
983
|
child_res = nil
|
984
984
|
if (Dnssec.do_validation_with_recursor?)
|
985
985
|
parent_res = get_recursor
|
986
|
+
child_res = get_recursor
|
986
987
|
end
|
987
988
|
begin
|
988
989
|
if (child!=parent)
|
989
990
|
if (!parent_res)
|
990
|
-
# print "No res passed - try to get nameservers for #{parent}\n"
|
991
|
+
# print "No res passed - try to get nameservers for #{parent}\n"
|
991
992
|
parent_res = get_nameservers_for(parent)
|
992
993
|
if (!parent_res)
|
993
994
|
if (Dnssec.do_validation_with_recursor?)
|
@@ -1021,12 +1022,14 @@ module Dnsruby
|
|
1021
1022
|
if (ds_rrset.rrs.length == 0)
|
1022
1023
|
# @TODO@ Check NSEC(3) records - still need to verify there are REALLY no ds records!
|
1023
1024
|
# print "NO DS RECORDS RETURNED FOR #{parent}\n"
|
1024
|
-
# child_res = parent_res
|
1025
|
+
# child_res = parent_res
|
1025
1026
|
else
|
1026
1027
|
begin
|
1027
|
-
if (verify(ds_rrset, current_anchor))
|
1028
|
+
if (verify(ds_rrset, current_anchor) || verify(ds_rrset))
|
1028
1029
|
# Try to make the resolver from the authority/additional NS RRSets in DS response
|
1029
|
-
|
1030
|
+
if (!Dnssec.do_validation_with_recursor?)
|
1031
|
+
child_res = get_nameservers_from_message(child, ds_ret)
|
1032
|
+
end
|
1030
1033
|
end
|
1031
1034
|
rescue VerifyError => e
|
1032
1035
|
# print "FAILED TO VERIFY DS RRSET FOR #{child}\n"
|
@@ -1099,13 +1102,6 @@ module Dnsruby
|
|
1099
1102
|
verified = false
|
1100
1103
|
end
|
1101
1104
|
end
|
1102
|
-
# if (!verify(key_rrset, ds_rrset))
|
1103
|
-
# if (!verify(key_rrset))
|
1104
|
-
# # if (!verify(key_ret))
|
1105
|
-
# verified = false
|
1106
|
-
# end
|
1107
|
-
# end
|
1108
|
-
|
1109
1105
|
end
|
1110
1106
|
|
1111
1107
|
# Try to make the resolver from the authority/additional NS RRSets in DNSKEY response
|
@@ -1115,14 +1111,14 @@ module Dnsruby
|
|
1115
1111
|
end
|
1116
1112
|
if (!verified)
|
1117
1113
|
TheLog.info("Failed to verify DNSKEY for #{child}")
|
1118
|
-
return false, new_res
|
1114
|
+
return false, nil # new_res
|
1119
1115
|
end
|
1120
1116
|
# Cache.add(key_ret)
|
1121
1117
|
return key_rrset, new_res
|
1122
1118
|
rescue VerifyError => e
|
1123
1119
|
# print "Verification error : #{e}\n"
|
1124
1120
|
TheLog.info("Verification error : #{e}\n")
|
1125
|
-
return false, new_res
|
1121
|
+
return false, nil # new_res
|
1126
1122
|
end
|
1127
1123
|
end
|
1128
1124
|
|