record_store 6.0.1 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -1
- data/lib/record_store/cli.rb +4 -2
- data/lib/record_store/version.rb +1 -1
- data/lib/record_store/zone.rb +31 -12
- data/lib/record_store/zone/yaml_definitions.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6686f890657b7a250384d189c2c377519616711a8295f510bbb140abaefde22
|
4
|
+
data.tar.gz: 00066a49bd826aded557ba3c0a6cb60216ce53feb0c33efd89de9ae7792a5d7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 642f48f0c639da2f9c3f5cb16bc3265504c647797586bbc6d7aa06f3667dbfaefe8977a4744f8a390ffd7bb45b2567e0964e8e719793182bbca05ccb9143d1e2
|
7
|
+
data.tar.gz: 34e8d630d6b53dc22370f1472cd292b218e79136772151c403b46cc4eb027aa9377beebd17524dac6b37d47645ed7597a756f40f78511ebf0f5678ea9a61c74d
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# CHANGELOG
|
2
|
+
|
3
|
+
## 6.1.0
|
4
|
+
- sort zone files [FEATURE]
|
5
|
+
- CLI support for specifying zones for validate_authority [FEATURE]
|
6
|
+
- retry failed lookup using another nameserver if unreachable [BUGFIX]
|
7
|
+
- ignore records other than NS in authority section [BUGFIX]
|
8
|
+
|
2
9
|
## 6.0.1
|
3
|
-
- add API rate limiting to DNSimple provider
|
10
|
+
- add API rate limiting to DNSimple provider [FEATURE]
|
4
11
|
|
5
12
|
## 6.0.0
|
6
13
|
- add `--all` option for `record-store diff` to compare ignored records too [FEATURE]
|
data/lib/record_store/cli.rb
CHANGED
@@ -220,12 +220,14 @@ module RecordStore
|
|
220
220
|
end
|
221
221
|
end
|
222
222
|
|
223
|
-
desc 'validate_authority', 'Validates that authoritative nameservers match the providers'
|
223
|
+
desc 'validate_authority [ZONE ...]', 'Validates that authoritative nameservers match the providers'
|
224
224
|
option :verbose, desc: 'Include valid zones in output', aliases: '-v', type: :boolean, default: false
|
225
|
-
def validate_authority
|
225
|
+
def validate_authority(*zones)
|
226
226
|
verbose = options.fetch('verbose')
|
227
227
|
|
228
228
|
Zone.each do |name, zone|
|
229
|
+
next unless zones.empty? || zones.include?(name)
|
230
|
+
|
229
231
|
authority = zone.fetch_authority
|
230
232
|
|
231
233
|
delegation = Hash.new { |h, k| h[k] = [] }
|
data/lib/record_store/version.rb
CHANGED
data/lib/record_store/zone.rb
CHANGED
@@ -129,14 +129,12 @@ module RecordStore
|
|
129
129
|
)
|
130
130
|
|
131
131
|
def fetch_authority(nameserver = ROOT_SERVERS.sample)
|
132
|
-
authority =
|
133
|
-
|
134
|
-
break if reply.answer.any?
|
132
|
+
authority = fetch_soa(nameserver) do |reply, _name|
|
133
|
+
break if reply.answer.any?
|
135
134
|
|
136
|
-
|
135
|
+
raise "No authority found (#{name})" unless reply.authority.any?
|
137
136
|
|
138
|
-
|
139
|
-
end
|
137
|
+
break extract_authority(reply.authority)
|
140
138
|
end
|
141
139
|
|
142
140
|
# candidate DNS name is returned instead when NXDomain or other error
|
@@ -147,18 +145,39 @@ module RecordStore
|
|
147
145
|
|
148
146
|
private
|
149
147
|
|
150
|
-
def
|
151
|
-
|
148
|
+
def fetch_soa(nameserver)
|
149
|
+
Resolv::DNS.open(nameserver: nameserver) do |resolv|
|
150
|
+
resolv.fetch_resource(name, Resolv::DNS::Resource::IN::SOA) do |reply, name|
|
151
|
+
yield reply, name
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
152
155
|
|
153
|
-
|
154
|
-
|
156
|
+
def resolve_authority(authority)
|
157
|
+
nameservers = authority.map { |a| a.last.name.to_s }
|
158
|
+
|
159
|
+
begin
|
160
|
+
nameserver = nameservers.shift
|
161
|
+
fetch_authority(nameserver)
|
162
|
+
rescue Errno::EHOSTUNREACH => e
|
163
|
+
$stderr.puts "Warning: #{e} [host=#{nameserver}]"
|
164
|
+
raise if nameservers.empty?
|
165
|
+
retry
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def extract_authority(authority)
|
170
|
+
if unrooted_name.casecmp?(authority.first.first.to_s)
|
171
|
+
build_authority(authority)
|
155
172
|
else
|
156
|
-
|
173
|
+
resolve_authority(authority) || build_authority(authority)
|
157
174
|
end
|
158
175
|
end
|
159
176
|
|
160
177
|
def build_authority(authority)
|
161
|
-
authority.
|
178
|
+
ns = authority.select { |_name, _ttl, data| data.is_a?(Resolv::DNS::Resource::IN::NS) }
|
179
|
+
|
180
|
+
ns.map.with_index do |(name, ttl, data), index|
|
162
181
|
Record::NS.new(ttl: ttl, fqdn: name.to_s, nsdname: data.name.to_s, record_id: index)
|
163
182
|
end
|
164
183
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: record_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0
|
4
|
+
version: 6.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Willem van Bergen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-05-
|
12
|
+
date: 2020-05-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|