zonefile 1.03 → 1.04
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/zonefile/zonefile.rb +157 -7
- data/tests/test-zone.db +23 -1
- data/tests/zonefile.rb +139 -2
- metadata +6 -8
data/lib/zonefile/zonefile.rb
CHANGED
@@ -27,6 +27,21 @@
|
|
27
27
|
# - :name, :ttl, :class, :host
|
28
28
|
# * SRV
|
29
29
|
# - :name, :ttl, :class, :pri, :weight, :port, :host
|
30
|
+
# * DS
|
31
|
+
# - :name, :ttl, :class, :key_tag, :algorithm, :digest_type, :digest
|
32
|
+
# * DNSKEY
|
33
|
+
# - :name, :ttl, :class, :flag, :protocol, :algorithm, :public_key
|
34
|
+
# * RRSIG
|
35
|
+
# - :name, :ttl, :class, :type_covered, :algorithm, :labels, :original_ttl,
|
36
|
+
# :expiration, :inception, :key_tag, :signer, :signature
|
37
|
+
# * NSEC
|
38
|
+
# - :name, :ttl, :class, :next, :types
|
39
|
+
# * NSEC3
|
40
|
+
# - :name, :ttl, :class, :algorithm, :flags, :iterations, :salt, :next, :types
|
41
|
+
# * NSEC3PARAM
|
42
|
+
# - :name, :ttl, :class, :algorithm, :flags, :iterations, :salt
|
43
|
+
# * NAPTR
|
44
|
+
# - :name, :ttl, :class, :order, :preference, :flags, :service, :regexp, :replacement
|
30
45
|
#
|
31
46
|
# == Examples
|
32
47
|
#
|
@@ -68,14 +83,22 @@
|
|
68
83
|
# # Print new zonefile
|
69
84
|
# puts "New Zonefile: \n#{zf.output}"
|
70
85
|
#
|
71
|
-
# ==
|
86
|
+
# == Name attribute magic
|
87
|
+
#
|
88
|
+
# Since 1.04 the :name attribute is preserved and returned as defined in a previous record if a zonefile entry
|
89
|
+
# omits it. This should be the expected behavior for most users.
|
90
|
+
# You can switch this off globally by calling Zonefile.preserve_name(false)
|
91
|
+
#
|
92
|
+
# == Authors
|
72
93
|
#
|
73
|
-
# Martin Boese, based on Simon Flack Perl library DNS::ZoneParse
|
94
|
+
# Martin Boese, based on Simon Flack Perl library DNS::ZoneParse
|
95
|
+
#
|
96
|
+
# Andy Newton, patch to support various additional records
|
74
97
|
#
|
75
98
|
|
76
99
|
class Zonefile
|
77
100
|
|
78
|
-
RECORDS = %w{ mx a a4 ns cname txt ptr srv soa }
|
101
|
+
RECORDS = %w{ mx a a4 ns cname txt ptr srv soa ds dnskey rrsig nsec nsec3 nsec3param naptr }
|
79
102
|
attr :records
|
80
103
|
attr :soa
|
81
104
|
attr :data
|
@@ -84,6 +107,15 @@ class Zonefile
|
|
84
107
|
# global $TTL option
|
85
108
|
attr :ttl
|
86
109
|
|
110
|
+
@@preserve_name = true
|
111
|
+
|
112
|
+
# For compatibility: This can switches off copying of the :name from the
|
113
|
+
# previous record in a zonefile if found omitted.
|
114
|
+
# This was zonefile's behavior in <= 1.03 .
|
115
|
+
def self.preserve_name(do_preserve_name)
|
116
|
+
@@preserve_name = do_preserve_name
|
117
|
+
end
|
118
|
+
|
87
119
|
def method_missing(m, *args)
|
88
120
|
mname = m.to_s.sub("=","")
|
89
121
|
return super unless RECORDS.include?(mname)
|
@@ -101,7 +133,7 @@ class Zonefile
|
|
101
133
|
# converts tabs into spaces etc...
|
102
134
|
def self.simplify(zf)
|
103
135
|
# concatenate everything split over multiple lines in parentheses - remove ;-comments in block
|
104
|
-
zf = zf.gsub(/(\([^\)]*?\))/) { |m| m.split(/\n/).map { |l| l.gsub(/\;.*$/, '') }.join("\n").gsub(/[\r\n]/, '') }
|
136
|
+
zf = zf.gsub(/(\([^\)]*?\))/) { |m| m.split(/\n/).map { |l| l.gsub(/\;.*$/, '') }.join("\n").gsub(/[\r\n]/, '').gsub( /[\(\)]/, '') }
|
105
137
|
|
106
138
|
zf.split(/\n/).map do |line|
|
107
139
|
r = line.gsub(/\t/, ' ')
|
@@ -145,6 +177,10 @@ class Zonefile
|
|
145
177
|
end
|
146
178
|
|
147
179
|
def add_record(type, data= {})
|
180
|
+
if @@preserve_name then
|
181
|
+
@lastname = data[:name] if data[:name].to_s != ''
|
182
|
+
data[:name] = @lastname if data[:name].to_s == ''
|
183
|
+
end
|
148
184
|
@records[type.downcase.intern] << data
|
149
185
|
end
|
150
186
|
|
@@ -172,6 +208,9 @@ class Zonefile
|
|
172
208
|
rr_type = /\b(?:NS|A|CNAME)\b/i
|
173
209
|
rr_ttl = /(?:\d+[wdhms]?)+/i
|
174
210
|
ttl_cls = Regexp.new("(?:(#{rr_ttl})\s)?(?:(#{rr_class})\s)?")
|
211
|
+
base64 = /([\s\w\+\/]*=*)/i
|
212
|
+
hexadeimal = /([\sA-F0-9]*)/i
|
213
|
+
quoted = /(\"[^\"]*\")/i
|
175
214
|
|
176
215
|
data = {}
|
177
216
|
if line =~ /^\$ORIGIN\s*(#{valid_name})/ix then
|
@@ -206,18 +245,94 @@ class Zonefile
|
|
206
245
|
/ix
|
207
246
|
add_record('srv', :name => $1, :ttl => $2, :class => $3, :pri => $4, :weight => $5,
|
208
247
|
:port => $6, :host => $7)
|
248
|
+
elsif line=~/^(#{valid_name})? \s*
|
249
|
+
#{ttl_cls}
|
250
|
+
DS \s
|
251
|
+
(\d+) \s
|
252
|
+
(\w+) \s
|
253
|
+
(\d+) \s
|
254
|
+
#{hexadeimal}
|
255
|
+
/ix
|
256
|
+
add_record( 'ds', :name => $1, :ttl => $2, :class => $3, :key_tag => $4.to_i, :algorithm => $5,
|
257
|
+
:digest_type => $6.to_i, :digest => $7.gsub( /\s/,'') )
|
258
|
+
elsif line=~/^(#{valid_name})? \s*
|
259
|
+
#{ttl_cls}
|
260
|
+
NSEC \s
|
261
|
+
(#{valid_name}) \s
|
262
|
+
([\s\w]*)
|
263
|
+
/ix
|
264
|
+
add_record( 'nsec', :name => $1, :ttl => $2, :class => $3, :next => $4, :types => $5.strip )
|
265
|
+
elsif line=~/^(#{valid_name})? \s*
|
266
|
+
#{ttl_cls}
|
267
|
+
NSEC3 \s
|
268
|
+
(\d+) \s
|
269
|
+
(\d+) \s
|
270
|
+
(\d+) \s
|
271
|
+
(-|[A-F0-9]*) \s
|
272
|
+
([A-Z2-7=]*) \s
|
273
|
+
([\s\w]*)
|
274
|
+
/ix
|
275
|
+
add_record( 'nsec3', :name => $1, :ttl => $2, :class => $3, :algorithm => $4, :flags => $5,
|
276
|
+
:iterations => $6, :salt => $7, :next => $8.strip, :types => $9.strip )
|
277
|
+
elsif line=~/^(#{valid_name})? \s*
|
278
|
+
#{ttl_cls}
|
279
|
+
NSEC3PARAM \s
|
280
|
+
(\d+) \s
|
281
|
+
(\d+) \s
|
282
|
+
(\d+) \s
|
283
|
+
(-|[A-F0-9]*)
|
284
|
+
/ix
|
285
|
+
add_record( 'nsec3param', :name => $1, :ttl => $2, :class => $3, :algorithm => $4, :flags => $5,
|
286
|
+
:iterations => $6, :salt => $7 )
|
287
|
+
elsif line=~/^(#{valid_name})? \s*
|
288
|
+
#{ttl_cls}
|
289
|
+
DNSKEY \s
|
290
|
+
(\d+) \s
|
291
|
+
(\d+) \s
|
292
|
+
(\w+) \s
|
293
|
+
#{base64}
|
294
|
+
/ix
|
295
|
+
add_record( 'dnskey', :name => $1, :ttl => $2, :class => $3, :flag => $4.to_i, :protocol => $5.to_i,
|
296
|
+
:algorithm => $6, :public_key => $7.gsub( /\s/,'') )
|
297
|
+
elsif line=~/^(#{valid_name})? \s*
|
298
|
+
#{ttl_cls}
|
299
|
+
RRSIG \s
|
300
|
+
(\w+) \s
|
301
|
+
(\w+) \s
|
302
|
+
(\d+) \s
|
303
|
+
(\d+) \s
|
304
|
+
(\d+) \s
|
305
|
+
(\d+) \s
|
306
|
+
(\d+) \s
|
307
|
+
(#{valid_name}) \s
|
308
|
+
#{base64}
|
309
|
+
/ix
|
310
|
+
add_record( 'rrsig', :name => $1, :ttl => $2, :class => $3, :type_covered => $4, :algorithm => $5,
|
311
|
+
:labels => $6.to_i, :original_ttl => $7.to_i, :expiration => $8.to_i, :inception => $9.to_i,
|
312
|
+
:key_tag => $10.to_i, :signer => $11, :signature => $12.gsub( /\s/,'') )
|
313
|
+
elsif line=~/^(#{valid_name})? \s*
|
314
|
+
#{ttl_cls}
|
315
|
+
NAPTR \s
|
316
|
+
(\d+) \s
|
317
|
+
(\d+) \s
|
318
|
+
#{quoted} \s
|
319
|
+
#{quoted} \s
|
320
|
+
#{quoted} \s
|
321
|
+
(#{valid_name})
|
322
|
+
/ix
|
323
|
+
add_record( 'naptr', :name => $1, :ttl => $2, :class => $3, :order => $4.to_i, :preference => $5.to_i,
|
324
|
+
:flags => $6, :service => $7, :regexp => $8, :replacement => $9 )
|
209
325
|
elsif line=~/^(#{valid_name}) \s+
|
210
326
|
#{ttl_cls}
|
211
327
|
SOA \s+
|
212
328
|
(#{valid_name}) \s+
|
213
329
|
(#{valid_name}) \s*
|
214
|
-
\
|
330
|
+
\s*
|
215
331
|
(#{rr_ttl}) \s+
|
216
332
|
(#{rr_ttl}) \s+
|
217
333
|
(#{rr_ttl}) \s+
|
218
334
|
(#{rr_ttl}) \s+
|
219
335
|
(#{rr_ttl}) \s*
|
220
|
-
\)?
|
221
336
|
/ix
|
222
337
|
ttl = @soa[:ttl] || $2 || ''
|
223
338
|
@soa[:origin] = $1
|
@@ -308,7 +423,42 @@ ENDH
|
|
308
423
|
self.ptr.each do |ptr|
|
309
424
|
out << "#{ptr[:name]} #{ptr[:ttl]} #{ptr[:class]} PTR #{ptr[:host]}\n"
|
310
425
|
end
|
311
|
-
|
426
|
+
|
427
|
+
out << "\n; Zone DS Records\n" unless self.ds.empty?
|
428
|
+
self.ds.each do |ds|
|
429
|
+
out << "#{ds[:name]} #{ds[:ttl]} #{ds[:class]} DS #{ds[:key_tag]} #{ds[:algorithm]} #{ds[:digest_type]} #{ds[:digest]}\n"
|
430
|
+
end
|
431
|
+
|
432
|
+
out << "\n; Zone NSEC Records\n" unless self.ds.empty?
|
433
|
+
self.nsec.each do |nsec|
|
434
|
+
out << "#{nsec[:name]} #{nsec[:ttl]} #{nsec[:class]} NSEC #{nsec[:next]} #{nsec[:types]}\n"
|
435
|
+
end
|
436
|
+
|
437
|
+
out << "\n; Zone NSEC3 Records\n" unless self.ds.empty?
|
438
|
+
self.nsec3.each do |nsec3|
|
439
|
+
out << "#{nsec3[:name]} #{nsec3[:ttl]} #{nsec3[:class]} NSEC3 #{nsec3[:algorithm]} #{nsec3[:flags]} #{nsec3[:iterations]} #{nsec3[:salt]} #{nsec3[:next]} #{nsec3[:types]}\n"
|
440
|
+
end
|
441
|
+
|
442
|
+
out << "\n; Zone NSEC3PARAM Records\n" unless self.ds.empty?
|
443
|
+
self.nsec3param.each do |nsec3param|
|
444
|
+
out << "#{nsec3param[:name]} #{nsec3param[:ttl]} #{nsec3param[:class]} NSEC3PARAM #{nsec3param[:algorithm]} #{nsec3param[:flags]} #{nsec3param[:iterations]} #{nsec3param[:salt]}\n"
|
445
|
+
end
|
446
|
+
|
447
|
+
out << "\n; Zone DNSKEY Records\n" unless self.ds.empty?
|
448
|
+
self.dnskey.each do |dnskey|
|
449
|
+
out << "#{dnskey[:name]} #{dnskey[:ttl]} #{dnskey[:class]} DNSKEY #{dnskey[:flag]} #{dnskey[:protocol]} #{dnskey[:algorithm]} #{dnskey[:public_key]}\n"
|
450
|
+
end
|
451
|
+
|
452
|
+
out << "\n; Zone RRSIG Records\n" unless self.ds.empty?
|
453
|
+
self.rrsig.each do |rrsig|
|
454
|
+
out << "#{rrsig[:name]} #{rrsig[:ttl]} #{rrsig[:class]} RRSIG #{rrsig[:type_covered]} #{rrsig[:algorithm]} #{rrsig[:labels]} #{rrsig[:original_ttl]} #{rrsig[:expiration]} #{rrsig[:inception]} #{rrsig[:key_tag]} #{rrsig[:signer]} #{rrsig[:signature]}\n"
|
455
|
+
end
|
456
|
+
|
457
|
+
out << "\n; Zone NAPTR Records\n" unless self.ds.empty?
|
458
|
+
self.naptr.each do |naptr|
|
459
|
+
out << "#{naptr[:name]} #{naptr[:ttl]} #{naptr[:class]} NAPTR #{naptr[:order]} #{naptr[:preference]} #{naptr[:flags]} #{naptr[:service]} #{naptr[:regexp]} #{naptr[:replacement]}\n"
|
460
|
+
end
|
461
|
+
|
312
462
|
out
|
313
463
|
end
|
314
464
|
|
data/tests/test-zone.db
CHANGED
@@ -32,4 +32,26 @@ txta TXT "t=y; o=-" ; Nasty Comment
|
|
32
32
|
_kerberos IN TXT maxnet.ao
|
33
33
|
_sip._tcp.example.com. 86400 IN SRV 0 5 5060 sipserver.example.com.
|
34
34
|
12.23.21.23.in-addr.arpa IN PTR www.myhost.example.com.
|
35
|
-
|
35
|
+
ds1 IN DS 31528 5 1 2274EACD70C5CD6862E1C0262E99D48D9FDEC271
|
36
|
+
ds2 IN DS 31528 5 1 ( 2BB183AF5F22588179A53B0A
|
37
|
+
98631FAD1A292118 )
|
38
|
+
example.com. 86400 IN DNSKEY 256 3 5 ( AQPSKmynfzW4kyBv015MUG2DeIQ3
|
39
|
+
Cbl+BBZH4b/0PY1kxkmvHjcZc8no
|
40
|
+
kfzj31GajIQKY+5CptLr3buXA10h
|
41
|
+
WqTkF7H6RfoRqXQeogmMHfpftf6z
|
42
|
+
Mv1LyBUgia7za6ZEzOJBOztyvhjL
|
43
|
+
742iU/TpPSEDhm2SNKLijfUppn1U
|
44
|
+
aNvv4w== )
|
45
|
+
example.net. 86400 IN DNSKEY 256 3 5 AQPSKmynfzW4kyBv015MUG2DeIQ3Cbl+BBZH4b/0PY1kxkmvHjcZc8nokfzj31GajIQKY+5CptLr3buXA10hWqTkF7H6RfoRqXQeogmMHfpftf6zMv1LyBUgia7za6ZEzOJBOztyvhjL742iU/TpPSEDhm2SNKLijfUppn1UaNvv4w==
|
46
|
+
host.example.com. 86400 IN RRSIG A 5 3 86400 20030322173103 (
|
47
|
+
20030220173103 2642 example.com.
|
48
|
+
oJB1W6WNGv+ldvQ3WDG0MQkg5IEhjRip8WTr
|
49
|
+
PYGv07h108dUKGMeDPKijVCHX3DDKdfb+v6o
|
50
|
+
B9wfuh3DTJXUAfI/M0zmO/zz8bW0Rznl8O3t
|
51
|
+
GNazPwQKkRN20XPXV6nwwfoXmJQbsLNrLfkG
|
52
|
+
J5D6fwFm8nN+6pBzeDQfsS3Ap3o= )
|
53
|
+
alfa.example.com. 86400 IN NSEC host.example.com. (
|
54
|
+
A MX RRSIG NSEC TYPE1234 )
|
55
|
+
IN NSEC3 1 1 12 aabbccdd ( 2vptu5timamqttgl4luu7kg2leoaor3s A RRSIG )
|
56
|
+
IN NSEC3PARAM 1 0 12 aabbccdd
|
57
|
+
urn.example.com. IN NAPTR 100 50 "s" "http+N2L+N2C+N2R" "" www.example.com.
|
data/tests/zonefile.rb
CHANGED
@@ -5,6 +5,8 @@ $: << File.expand_path(File.dirname(__FILE__) + '/../lib')
|
|
5
5
|
|
6
6
|
require 'zonefile'
|
7
7
|
|
8
|
+
# Zonefile.preserve_name(false)
|
9
|
+
|
8
10
|
$zonefile = ARGV[0] || 'test-zone.db'
|
9
11
|
|
10
12
|
class TC_Zonefile < Test::Unit::TestCase
|
@@ -60,7 +62,7 @@ class TC_Zonefile < Test::Unit::TestCase
|
|
60
62
|
|
61
63
|
a = @zf.a.find { |a| a[:host] == '10.0.0.3'}
|
62
64
|
assert_equal '43200', a[:ttl]
|
63
|
-
assert_equal '', a[:name].to_s
|
65
|
+
assert_equal 'www', a[:name].to_s # name preserved
|
64
66
|
|
65
67
|
begin
|
66
68
|
@swap_a = true
|
@@ -68,6 +70,19 @@ class TC_Zonefile < Test::Unit::TestCase
|
|
68
70
|
test_a
|
69
71
|
end unless @swap_a
|
70
72
|
end
|
73
|
+
|
74
|
+
def test_preserve_name
|
75
|
+
Zonefile.preserve_name(false)
|
76
|
+
setup
|
77
|
+
a = @zf.a.find { |a| a[:host] == '10.0.0.2'}
|
78
|
+
assert_nil a[:name] # no name preserved
|
79
|
+
assert_nil @zf.nsec3[0][:name] # same here
|
80
|
+
Zonefile.preserve_name(true)
|
81
|
+
setup
|
82
|
+
a = @zf.a.find { |a| a[:host] == '10.0.0.2'}
|
83
|
+
assert_equal 'www', a[:name] # now name IS preserved
|
84
|
+
assert_equal 'alfa.example.com.', @zf.nsec3[0][:name] # same here
|
85
|
+
end
|
71
86
|
|
72
87
|
def test_mx
|
73
88
|
assert_equal 2, @zf.mx.size
|
@@ -164,7 +179,129 @@ class TC_Zonefile < Test::Unit::TestCase
|
|
164
179
|
test_ptr
|
165
180
|
end unless @swap_ptr
|
166
181
|
end
|
167
|
-
|
182
|
+
|
183
|
+
def test_ds
|
184
|
+
assert_equal "ds1", @zf.ds[0][:name]
|
185
|
+
assert_equal 31528, @zf.ds[0][:key_tag]
|
186
|
+
assert_equal "5", @zf.ds[0][:algorithm]
|
187
|
+
assert_equal 1, @zf.ds[0][:digest_type]
|
188
|
+
assert_equal "2274EACD70C5CD6862E1C0262E99D48D9FDEC271", @zf.ds[0][:digest]
|
189
|
+
assert_equal "ds2", @zf.ds[1][:name]
|
190
|
+
assert_equal 31528, @zf.ds[1][:key_tag]
|
191
|
+
assert_equal "5", @zf.ds[1][:algorithm]
|
192
|
+
assert_equal 1, @zf.ds[1][:digest_type]
|
193
|
+
assert_equal "2BB183AF5F22588179A53B0A98631FAD1A292118", @zf.ds[1][:digest]
|
194
|
+
begin
|
195
|
+
@swap_ds = true
|
196
|
+
swap
|
197
|
+
test_ds
|
198
|
+
end unless @swap_ds
|
199
|
+
end
|
200
|
+
|
201
|
+
def test_nsec
|
202
|
+
assert_equal "alfa.example.com.", @zf.nsec[0][:name]
|
203
|
+
assert_equal "host.example.com.", @zf.nsec[0][:next]
|
204
|
+
assert_equal "A MX RRSIG NSEC TYPE1234", @zf.nsec[0][:types]
|
205
|
+
begin
|
206
|
+
@swap_nsec = true
|
207
|
+
swap
|
208
|
+
test_nsec
|
209
|
+
end unless @swap_nsec
|
210
|
+
end
|
211
|
+
|
212
|
+
def test_nsec3
|
213
|
+
assert_equal "1", @zf.nsec3[0][:algorithm]
|
214
|
+
assert_equal "1", @zf.nsec3[0][:flags]
|
215
|
+
assert_equal "12", @zf.nsec3[0][:iterations]
|
216
|
+
assert_equal "aabbccdd", @zf.nsec3[0][:salt]
|
217
|
+
assert_equal "2vptu5timamqttgl4luu7kg2leoaor3s", @zf.nsec3[0][:next]
|
218
|
+
assert_equal "A RRSIG", @zf.nsec3[0][:types]
|
219
|
+
begin
|
220
|
+
@swap_nsec3 = true
|
221
|
+
swap
|
222
|
+
test_nsec3
|
223
|
+
end unless @swap_nsec3
|
224
|
+
end
|
225
|
+
|
226
|
+
def test_nsec3param
|
227
|
+
assert_equal "1", @zf.nsec3param[0][:algorithm]
|
228
|
+
assert_equal "0", @zf.nsec3param[0][:flags]
|
229
|
+
assert_equal "12", @zf.nsec3param[0][:iterations]
|
230
|
+
assert_equal "aabbccdd", @zf.nsec3param[0][:salt]
|
231
|
+
begin
|
232
|
+
@swap_nsec3param = true
|
233
|
+
swap
|
234
|
+
test_nsec3param
|
235
|
+
end unless @swap_nsec3param
|
236
|
+
end
|
237
|
+
|
238
|
+
def test_naptr
|
239
|
+
assert_equal "urn.example.com.", @zf.naptr[0][:name]
|
240
|
+
assert_equal 100, @zf.naptr[0][:order]
|
241
|
+
assert_equal 50, @zf.naptr[0][:preference]
|
242
|
+
assert_equal "\"s\"", @zf.naptr[0][:flags]
|
243
|
+
assert_equal "\"http+N2L+N2C+N2R\"", @zf.naptr[0][:service]
|
244
|
+
assert_equal "\"\"", @zf.naptr[0][:regexp]
|
245
|
+
assert_equal "www.example.com.", @zf.naptr[0][:replacement]
|
246
|
+
begin
|
247
|
+
@swap_natpr = true
|
248
|
+
swap
|
249
|
+
test_naptr
|
250
|
+
end unless @swap_natpr
|
251
|
+
end
|
252
|
+
|
253
|
+
def test_dnskey
|
254
|
+
assert_equal "example.com.", @zf.dnskey[0][:name]
|
255
|
+
assert_equal 256, @zf.dnskey[0][:flag]
|
256
|
+
assert_equal 3, @zf.dnskey[0][:protocol]
|
257
|
+
assert_equal "5", @zf.dnskey[0][:algorithm]
|
258
|
+
pkey = <<PUBLIC_KEY.gsub( /\s+/,'').strip
|
259
|
+
AQPSKmynfzW4kyBv015MUG2DeIQ3
|
260
|
+
Cbl+BBZH4b/0PY1kxkmvHjcZc8no
|
261
|
+
kfzj31GajIQKY+5CptLr3buXA10h
|
262
|
+
WqTkF7H6RfoRqXQeogmMHfpftf6z
|
263
|
+
Mv1LyBUgia7za6ZEzOJBOztyvhjL
|
264
|
+
742iU/TpPSEDhm2SNKLijfUppn1U
|
265
|
+
aNvv4w==
|
266
|
+
PUBLIC_KEY
|
267
|
+
assert_equal pkey, @zf.dnskey[0][:public_key]
|
268
|
+
assert_equal "example.net.", @zf.dnskey[1][:name]
|
269
|
+
assert_equal 256, @zf.dnskey[1][:flag]
|
270
|
+
assert_equal 3, @zf.dnskey[1][:protocol]
|
271
|
+
assert_equal "5", @zf.dnskey[1][:algorithm]
|
272
|
+
assert_equal pkey, @zf.dnskey[1][:public_key]
|
273
|
+
begin
|
274
|
+
@swap_dnskey = true
|
275
|
+
swap
|
276
|
+
test_dnskey
|
277
|
+
end unless @swap_dnskey
|
278
|
+
end
|
279
|
+
|
280
|
+
def test_rrsig
|
281
|
+
assert_equal "host.example.com.", @zf.rrsig[0][:name]
|
282
|
+
assert_equal 'A', @zf.rrsig[0][:type_covered]
|
283
|
+
assert_equal "5", @zf.rrsig[0][:algorithm]
|
284
|
+
assert_equal 3, @zf.rrsig[0][:labels]
|
285
|
+
assert_equal 86400, @zf.rrsig[0][:original_ttl]
|
286
|
+
assert_equal 20030322173103, @zf.rrsig[0][:expiration]
|
287
|
+
assert_equal 20030220173103, @zf.rrsig[0][:inception]
|
288
|
+
assert_equal 2642, @zf.rrsig[0][:key_tag]
|
289
|
+
assert_equal "example.com.", @zf.rrsig[0][:signer]
|
290
|
+
sig = <<SIGNATURE.gsub( /\s+/,'').strip
|
291
|
+
oJB1W6WNGv+ldvQ3WDG0MQkg5IEhjRip8WTr
|
292
|
+
PYGv07h108dUKGMeDPKijVCHX3DDKdfb+v6o
|
293
|
+
B9wfuh3DTJXUAfI/M0zmO/zz8bW0Rznl8O3t
|
294
|
+
GNazPwQKkRN20XPXV6nwwfoXmJQbsLNrLfkG
|
295
|
+
J5D6fwFm8nN+6pBzeDQfsS3Ap3o=
|
296
|
+
SIGNATURE
|
297
|
+
assert_equal sig, @zf.rrsig[0][:signature]
|
298
|
+
begin
|
299
|
+
@swap_rrsig = true
|
300
|
+
swap
|
301
|
+
test_rrsig
|
302
|
+
end unless @swap_rrsig
|
303
|
+
end
|
304
|
+
|
168
305
|
def test_origin
|
169
306
|
assert_equal 'test-zone.db', @zf.origin
|
170
307
|
swap
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zonefile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 7
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: "1.
|
8
|
+
- 4
|
9
|
+
version: "1.04"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Martin Boese
|
@@ -14,8 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
18
|
-
default_executable:
|
17
|
+
date: 2013-02-06 00:00:00 Z
|
19
18
|
dependencies: []
|
20
19
|
|
21
20
|
description: |-
|
@@ -35,7 +34,6 @@ files:
|
|
35
34
|
- tests/test-zone.db
|
36
35
|
- tests/zonefile.rb
|
37
36
|
- CHANGELOG
|
38
|
-
has_rdoc: true
|
39
37
|
homepage: http://zonefile.rubyforge.org/
|
40
38
|
licenses: []
|
41
39
|
|
@@ -65,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
63
|
requirements: []
|
66
64
|
|
67
65
|
rubyforge_project: zonefile
|
68
|
-
rubygems_version: 1.
|
66
|
+
rubygems_version: 1.8.24
|
69
67
|
signing_key:
|
70
68
|
specification_version: 3
|
71
69
|
summary: BIND 8/9 Zonefile Reader and Writer
|