mirror of
https://github.com/internetee/registry.git
synced 2025-08-15 22:13:54 +02:00
Refactor dnssec to extension
This commit is contained in:
parent
7883b3775f
commit
6f12af5e0b
5 changed files with 54 additions and 31 deletions
|
@ -244,6 +244,7 @@ en:
|
||||||
codes:
|
codes:
|
||||||
domain_validation: 'Domain validation'
|
domain_validation: 'Domain validation'
|
||||||
domain_general: 'Domain general'
|
domain_general: 'Domain general'
|
||||||
|
dnskeys: 'DNS keys'
|
||||||
|
|
||||||
settings:
|
settings:
|
||||||
codes:
|
codes:
|
||||||
|
@ -251,6 +252,10 @@ en:
|
||||||
ns_max_count: 'Nameserver maximum count'
|
ns_max_count: 'Nameserver maximum count'
|
||||||
dnskeys_min_count: 'DNS keys minimum count'
|
dnskeys_min_count: 'DNS keys minimum count'
|
||||||
dnskeys_max_count: 'DNS keys maximum count'
|
dnskeys_max_count: 'DNS keys maximum count'
|
||||||
|
allow_ds_data: 'Allow DS data'
|
||||||
|
allow_ds_data_with_keys: 'Allow DS data with keys'
|
||||||
|
allow_key_data: 'Allow key data'
|
||||||
|
ds_algorithm: 'DS algorithm'
|
||||||
|
|
||||||
shared:
|
shared:
|
||||||
code: 'Code'
|
code: 'Code'
|
||||||
|
|
9
db/migrate/20141008134959_add_dnskey_settings.rb
Normal file
9
db/migrate/20141008134959_add_dnskey_settings.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
class AddDnskeySettings < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
sg = SettingGroup.create(code: 'dnskeys')
|
||||||
|
sg.settings << Setting.create(code: 'ds_algorithm', value: 1)
|
||||||
|
sg.settings << Setting.create(code: 'allow_ds_data', value: 1)
|
||||||
|
sg.settings << Setting.create(code: 'allow_ds_data_with_keys', value: 1)
|
||||||
|
sg.settings << Setting.create(code: 'allow_key_data', value: 1)
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20141006130306) do
|
ActiveRecord::Schema.define(version: 20141008134959) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
|
@ -16,19 +16,21 @@ describe 'EPP Helper', epp: true do
|
||||||
<domain:hostObj>ns2.example.net</domain:hostObj>
|
<domain:hostObj>ns2.example.net</domain:hostObj>
|
||||||
</domain:ns>
|
</domain:ns>
|
||||||
<domain:registrant>jd1234</domain:registrant>
|
<domain:registrant>jd1234</domain:registrant>
|
||||||
<domain:dnssec>
|
|
||||||
<domain:dnskey>
|
|
||||||
<domain:flags>257</domain:flags>
|
|
||||||
<domain:protocol>3</domain:protocol>
|
|
||||||
<domain:alg>5</domain:alg>
|
|
||||||
<domain:pubKey>AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8</domain:pubKey>
|
|
||||||
</domain:dnskey>
|
|
||||||
</domain:dnssec>
|
|
||||||
<domain:contact type="admin">sh8013</domain:contact>
|
<domain:contact type="admin">sh8013</domain:contact>
|
||||||
<domain:contact type="tech">sh8013</domain:contact>
|
<domain:contact type="tech">sh8013</domain:contact>
|
||||||
<domain:contact type="tech">sh801333</domain:contact>
|
<domain:contact type="tech">sh801333</domain:contact>
|
||||||
</domain:create>
|
</domain:create>
|
||||||
</create>
|
</create>
|
||||||
|
<extension>
|
||||||
|
<secDNS:create xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
|
||||||
|
<secDNS:keyData>
|
||||||
|
<secDNS:flags>257</secDNS:flags>
|
||||||
|
<secDNS:protocol>3</secDNS:protocol>
|
||||||
|
<secDNS:alg>5</secDNS:alg>
|
||||||
|
<secDNS:pubKey>AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8</secDNS:pubKey>
|
||||||
|
</secDNS:keyData>
|
||||||
|
</secDNS:create>
|
||||||
|
</extension>
|
||||||
<clTRID>ABC-12345</clTRID>
|
<clTRID>ABC-12345</clTRID>
|
||||||
</command>
|
</command>
|
||||||
</epp>
|
</epp>
|
||||||
|
@ -52,19 +54,21 @@ describe 'EPP Helper', epp: true do
|
||||||
<domain:hostObj>ns2.test.net</domain:hostObj>
|
<domain:hostObj>ns2.test.net</domain:hostObj>
|
||||||
</domain:ns>
|
</domain:ns>
|
||||||
<domain:registrant>32fsdaf</domain:registrant>
|
<domain:registrant>32fsdaf</domain:registrant>
|
||||||
<domain:dnssec>
|
|
||||||
<domain:dnskey>
|
|
||||||
<domain:flags>257</domain:flags>
|
|
||||||
<domain:protocol>3</domain:protocol>
|
|
||||||
<domain:alg>5</domain:alg>
|
|
||||||
<domain:pubKey>AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8</domain:pubKey>
|
|
||||||
</domain:dnskey>
|
|
||||||
</domain:dnssec>
|
|
||||||
<domain:contact type="admin">2323rafaf</domain:contact>
|
<domain:contact type="admin">2323rafaf</domain:contact>
|
||||||
<domain:contact type="tech">3dgxx</domain:contact>
|
<domain:contact type="tech">3dgxx</domain:contact>
|
||||||
<domain:contact type="tech">345xxv</domain:contact>
|
<domain:contact type="tech">345xxv</domain:contact>
|
||||||
</domain:create>
|
</domain:create>
|
||||||
</create>
|
</create>
|
||||||
|
<extension>
|
||||||
|
<secDNS:create xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
|
||||||
|
<secDNS:keyData>
|
||||||
|
<secDNS:flags>257</secDNS:flags>
|
||||||
|
<secDNS:protocol>3</secDNS:protocol>
|
||||||
|
<secDNS:alg>5</secDNS:alg>
|
||||||
|
<secDNS:pubKey>AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8</secDNS:pubKey>
|
||||||
|
</secDNS:keyData>
|
||||||
|
</secDNS:create>
|
||||||
|
</extension>
|
||||||
<clTRID>ABC-12345</clTRID>
|
<clTRID>ABC-12345</clTRID>
|
||||||
</command>
|
</command>
|
||||||
</epp>
|
</epp>
|
||||||
|
@ -109,9 +113,8 @@ describe 'EPP Helper', epp: true do
|
||||||
period: nil,
|
period: nil,
|
||||||
ns: nil,
|
ns: nil,
|
||||||
registrant: nil,
|
registrant: nil,
|
||||||
_other: nil,
|
_other: nil
|
||||||
dnssec: nil
|
}, false)
|
||||||
})
|
|
||||||
|
|
||||||
generated = Nokogiri::XML(xml).to_s.squish
|
generated = Nokogiri::XML(xml).to_s.squish
|
||||||
expect(generated).to eq(expected)
|
expect(generated).to eq(expected)
|
||||||
|
|
|
@ -52,7 +52,7 @@ module Epp
|
||||||
|
|
||||||
### REQUEST TEMPLATES ###
|
### REQUEST TEMPLATES ###
|
||||||
|
|
||||||
def domain_create_xml(xml_params = {})
|
def domain_create_xml(xml_params = {}, dnssec_params = {})
|
||||||
|
|
||||||
defaults = {
|
defaults = {
|
||||||
name: { value: 'example.ee' },
|
name: { value: 'example.ee' },
|
||||||
|
@ -62,16 +62,6 @@ module Epp
|
||||||
{ hostObj: { value: 'ns2.example.net' } }
|
{ hostObj: { value: 'ns2.example.net' } }
|
||||||
],
|
],
|
||||||
registrant: { value: 'jd1234' },
|
registrant: { value: 'jd1234' },
|
||||||
dnssec: [
|
|
||||||
{
|
|
||||||
dnskey: {
|
|
||||||
flags: { value: '257' },
|
|
||||||
protocol: { value: '3' },
|
|
||||||
alg: { value: '5' },
|
|
||||||
pubKey: { value: 'AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8' }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
_other: [
|
_other: [
|
||||||
{ contact: { value: 'sh8013', attrs: { type: 'admin' } } },
|
{ contact: { value: 'sh8013', attrs: { type: 'admin' } } },
|
||||||
{ contact: { value: 'sh8013', attrs: { type: 'tech' } } },
|
{ contact: { value: 'sh8013', attrs: { type: 'tech' } } },
|
||||||
|
@ -81,6 +71,17 @@ module Epp
|
||||||
|
|
||||||
xml_params = defaults.deep_merge(xml_params)
|
xml_params = defaults.deep_merge(xml_params)
|
||||||
|
|
||||||
|
dsnsec_defaults = {
|
||||||
|
keyData: [
|
||||||
|
flags: { value: '257' },
|
||||||
|
protocol: { value: '3' },
|
||||||
|
alg: { value: '5' },
|
||||||
|
pubKey: { value: 'AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
dnssec_params = dsnsec_defaults.deep_merge(dnssec_params) if dnssec_params != false
|
||||||
|
|
||||||
xml = Builder::XmlMarkup.new
|
xml = Builder::XmlMarkup.new
|
||||||
|
|
||||||
xml.instruct!(:xml, standalone: 'no')
|
xml.instruct!(:xml, standalone: 'no')
|
||||||
|
@ -91,6 +92,11 @@ module Epp
|
||||||
generate_xml_from_hash(xml_params, xml, 'domain')
|
generate_xml_from_hash(xml_params, xml, 'domain')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
xml.extension do
|
||||||
|
xml.tag!('secDNS:create', 'xmlns:secDNS' => 'urn:ietf:params:xml:ns:secDNS-1.1') do
|
||||||
|
generate_xml_from_hash(dnssec_params, xml, 'secDNS')
|
||||||
|
end
|
||||||
|
end if dnssec_params != false
|
||||||
xml.clTRID 'ABC-12345'
|
xml.clTRID 'ABC-12345'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue