record_store 5.7.4 → 5.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba7d20a3308ebfcb99eefaf97e4dbc840c7e6f2f2621037b9381758b7b536d7d
4
- data.tar.gz: 04cedd42ea0b38deaceac0a6a0c68bc02b724c7bd406e0fa3bae394a9224cce5
3
+ metadata.gz: 3b33376f7cc95cbaab9a9d6e1c7bc635085a91578709b78e498c7e3719eef07a
4
+ data.tar.gz: 363acd2374cca032b28ea6dd4f9a6976176803f54f7cbad5a1206e5b0b7018bc
5
5
  SHA512:
6
- metadata.gz: dc50605f622949ca4907c4bed824379b8fbe192e0b0794c34878e7c6717b4071f218c15e78a276edb2b74d840228f40ef5360317a01c6b948f24db1b9c8471b9
7
- data.tar.gz: de9e9437dea4b1bc50b3aa7cca818942d807b264616990e24483ceebfa7613de437e01dabe9d064c4ddb7f71b30c2782845968399b2b635daa2eec2a43863c48
6
+ metadata.gz: d25cc0344334dbc59f1493a33568d660bdfee9797652f302f72aa0b8d8225daff4ab09216c5de2050475d75252a841af4dde39331b89389f426e5bd8391ded29
7
+ data.tar.gz: 76431cfa62e96ce5a362ff129cd28aeec3f198f89749952ef643eeeb6e12a1ec3fe5bf8b64bfba4fcbc84400888acdd270dc44ee3d331afd0f573ecb69381f56
@@ -872,9 +872,6 @@ Lint/EmptyEnsure:
872
872
  Lint/EmptyInterpolation:
873
873
  Enabled: true
874
874
 
875
- Lint/EndInMethod:
876
- Enabled: true
877
-
878
875
  Lint/EnsureReturn:
879
876
  Enabled: true
880
877
 
@@ -19,6 +19,7 @@ require 'record_store/record/caa'
19
19
  require 'record_store/record/cname'
20
20
  require 'record_store/record/mx'
21
21
  require 'record_store/record/ns'
22
+ require 'record_store/record/sshfp'
22
23
  require 'record_store/record/txt'
23
24
  require 'record_store/record/spf'
24
25
  require 'record_store/record/srv'
@@ -103,9 +103,16 @@ module RecordStore
103
103
  exit
104
104
  end
105
105
 
106
- zones.each do |zone|
107
- abort("Attempted to apply invalid zone: #{zone.name}") unless zone.valid?
106
+ invalid_zones = zones.select(&:invalid?)
107
+ unless invalid_zones.empty?
108
+ error_message = invalid_zones
109
+ .map { |z| "Attempted to apply invalid zone: #{z.name}: #{z.errors.full_messages.join(',')}" }
110
+ .join("\n")
111
+
112
+ abort(error_message)
113
+ end
108
114
 
115
+ zones.each do |zone|
109
116
  changesets = zone.build_changesets
110
117
  changesets.each(&:apply)
111
118
  end
@@ -54,7 +54,7 @@ module RecordStore
54
54
  end
55
55
 
56
56
  # returns an array of Record objects that match the records which exist in the provider
57
- def retrieve_current_records(zone:, stdout: $stdout) # rubocop:disable Lint/UnusedMethodArgument
57
+ def retrieve_current_records(zone:, stdout: $stdout)
58
58
  raise NotImplementedError
59
59
  end
60
60
 
@@ -104,15 +104,15 @@ module RecordStore
104
104
 
105
105
  private
106
106
 
107
- def add(record) # rubocop:disable Lint/UnusedMethodArgument
107
+ def add(record)
108
108
  raise NotImplementedError
109
109
  end
110
110
 
111
- def remove(record) # rubocop:disable Lint/UnusedMethodArgument
111
+ def remove(record)
112
112
  raise NotImplementedError
113
113
  end
114
114
 
115
- def update(id, record) # rubocop:disable Lint/UnusedMethodArgument
115
+ def update(id, record)
116
116
  raise NotImplementedError
117
117
  end
118
118
  end
@@ -3,6 +3,10 @@ require 'dnsimple'
3
3
  module RecordStore
4
4
  class Provider::DNSimple < Provider
5
5
  class << self
6
+ def record_types
7
+ super | Set.new(['SSHFP'])
8
+ end
9
+
6
10
  def supports_alias?
7
11
  true
8
12
  end
@@ -95,6 +99,13 @@ module RecordStore
95
99
  record.merge!(preference: api_record.priority, exchange: api_record.content)
96
100
  when 'NS'
97
101
  record.merge!(nsdname: api_record.content)
102
+ when 'SSHFP'
103
+ algorithm, fptype, fingerprint = api_record.content.split(' ')
104
+ record.merge!(
105
+ algorithm: algorithm.to_i,
106
+ fptype: fptype.to_i,
107
+ fingerprint: fingerprint,
108
+ )
98
109
  when 'SPF', 'TXT'
99
110
  record.merge!(txtdata: Record.unescape(api_record.content).gsub(';', '\;'))
100
111
  when 'SRV'
@@ -132,6 +143,8 @@ module RecordStore
132
143
  record_hash[:content] = record.exchange.chomp('.')
133
144
  when 'NS'
134
145
  record_hash[:content] = record.nsdname.chomp('.')
146
+ when 'SSHFP'
147
+ record_hash[:content] = record.rdata_txt
135
148
  when 'SPF', 'TXT'
136
149
  record_hash[:content] = Record.escape(record.txtdata).gsub('\;', ';')
137
150
  when 'SRV'
@@ -86,7 +86,11 @@ module RecordStore
86
86
  zone: zone,
87
87
  fqdn: record_fqdn,
88
88
  type: record.type,
89
- params: { answers: new_answers, ttl: record.ttl }
89
+ params: {
90
+ answers: new_answers,
91
+ ttl: record.ttl,
92
+ use_client_subnet: false, # only required for filter chains that are not supported by record_store
93
+ }
90
94
  )
91
95
  return
92
96
  end
@@ -0,0 +1,56 @@
1
+ module RecordStore
2
+ class Record::SSHFP < Record
3
+ attr_accessor :algorithm, :fptype, :fingerprint
4
+
5
+ # https://www.iana.org/assignments/dns-sshfp-rr-parameters/dns-sshfp-rr-parameters.xhtml
6
+ module Algorithms
7
+ RESERVED = 0
8
+ RSA = 1
9
+ DSA = 2
10
+ ECDSA = 3
11
+ ED25519 = 4
12
+ UNASSIGNED = 5
13
+ ED448 = 6
14
+ end
15
+
16
+ module FingerprintTypes
17
+ RESERVED = 0
18
+ SHA_1 = 1
19
+ SHA_256 = 2
20
+ end
21
+
22
+ FINGERPRINT_REGEX = /\A[[:xdigit:]]+\z/
23
+
24
+ class << self
25
+ private
26
+
27
+ def constants_defined_in(mod)
28
+ mod.constants(false).map(&mod.method(:const_get))
29
+ end
30
+ end
31
+
32
+ validates :algorithm, presence: true, inclusion: { in: constants_defined_in(Algorithms) }
33
+ validates :fingerprint, presence: true, format: { with: FINGERPRINT_REGEX }
34
+ validates :fptype, presence: true, inclusion: { in: constants_defined_in(FingerprintTypes) }
35
+
36
+ def initialize(record)
37
+ super
38
+
39
+ @algorithm = record.fetch(:algorithm)
40
+ @fptype = record.fetch(:fptype)
41
+ @fingerprint = record.fetch(:fingerprint)
42
+ end
43
+
44
+ def rdata
45
+ {
46
+ algorithm: algorithm,
47
+ fingerprint: fingerprint,
48
+ fptype: fptype,
49
+ }
50
+ end
51
+
52
+ def rdata_txt
53
+ "#{algorithm} #{fptype} #{fingerprint}"
54
+ end
55
+ end
56
+ end
@@ -1,3 +1,3 @@
1
1
  module RecordStore
2
- VERSION = '5.7.4'.freeze
2
+ VERSION = '5.8.0'.freeze
3
3
  end
@@ -181,7 +181,7 @@ module RecordStore
181
181
 
182
182
  providers.each do |provider|
183
183
  (record_types - provider.record_types).each do |record_type|
184
- errors.add(:records, "#{record_type} is a not a supported record type in #{provider}")
184
+ errors.add(:records, "#{record_type} is not a supported record type in #{provider}")
185
185
  end
186
186
  end
187
187
  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: 5.7.4
4
+ version: 5.8.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-03-02 00:00:00.000000000 Z
12
+ date: 2020-04-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -371,6 +371,7 @@ files:
371
371
  - lib/record_store/record/ns.rb
372
372
  - lib/record_store/record/spf.rb
373
373
  - lib/record_store/record/srv.rb
374
+ - lib/record_store/record/sshfp.rb
374
375
  - lib/record_store/record/txt.rb
375
376
  - lib/record_store/version.rb
376
377
  - lib/record_store/zone.rb
@@ -409,7 +410,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
409
410
  - !ruby/object:Gem::Version
410
411
  version: '0'
411
412
  requirements: []
412
- rubygems_version: 3.0.3
413
+ rubygems_version: 3.0.2
413
414
  signing_key:
414
415
  specification_version: 4
415
416
  summary: Manage DNS using git