Module: EPPClient::SecDNS

Defined in:
lib/epp-client/secdns.rb

Overview

This implements the DNSSEC bits.

Constant Summary collapse

SCHEMAS_SECDNS =
%w(
  secDNS-1.1
).freeze

Instance Method Summary collapse

Instance Method Details

#domain_create(domain) ⇒ Object

Extends the EPPClient::Domain#domain_create so that the specific secDNS create informations can be sent, the additionnal informations are :

either:

:keyData

containing an array of keyData objects as described in the domain_info function.

:dsData

containing an array of dsData objects as described in the domain_info function.

Optionnaly :

:maxSigLife

as described in the domain_info function.



94
95
96
# File 'lib/epp-client/secdns.rb', line 94

def domain_create(domain)
  super # placeholder so that I can add some doc
end

#domain_create_xml(domain) ⇒ Object

:nodoc:



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/epp-client/secdns.rb', line 98

def domain_create_xml(domain) #:nodoc:
  ret = super

  return ret unless domain.key?(:maxSigLife) || domain.key?(:dsData) || domain.key?(:keyData)

  ext = extension do |xml|
    xml.create(:xmlns => EPPClient::SCHEMAS_URL['secDNS']) do
      xml.maxSigLife(domain[:maxSigLife]) if domain.key?(:maxSigLife)
      if domain.key?(:dsData)
        domain[:dsData].each do |ds|
          make_ds_data(xml, ds)
        end
      elsif domain.key?(:keyData)
        domain[:keyData].each do |key|
          make_key_data(xml, key)
        end
      end
    end
  end

  insert_extension(ret, ext)
end

#domain_info(domain) ⇒ Object

Extends the EPPClient::Domain#domain_info so that the specific secDNS elements can be added.

either:

:keyData

containing an array of keyData objects with the following fields :

:flags

The flags field value as described in section 2.1.1 of RFC 4034.

:protocol

The protocol field value as described in section 2.1.2 of RFC 4034.

:alg

The algorithm number field value as described in section 2.1.3 of RFC 4034.

:pubKey

The encoded public key field value as described in Section 2.1.4 of RFC 4034.

:dsData

containing an array of dsData objects with the following fields :

:keyTag

The key tag value as described in Section 5.1.1 of RFC 4034.

:alg

The algorithm value as described in Section 5.1.2 of RFC 4034.

:digestType

The digest type value as described in Section 5.1.3 of RFC 4034.

:digest

The digest value as described in Section 5.1.1 of RFC 4034.

:keyData

An optional element that describes the key data used as input in the DS hash calculation for use in server validation. The :keyData element contains the child elements defined above.

Optionnaly :

:maxSigLife

An element that indicates a child’s preference for the number of seconds after signature generation when the parent’s signature on the DS information provided by the child will expire.



61
62
63
# File 'lib/epp-client/secdns.rb', line 61

def domain_info(domain)
  super # placeholder so that I can add some doc
end

#domain_info_process(xml) ⇒ Object

:nodoc:



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/epp-client/secdns.rb', line 65

def domain_info_process(xml) #:nodoc:
  ret = super
  ret_secdns = {}
  unless (maxSigLife = xml.xpath('epp:extension/secDNS:infData/secDNS:maxSigLife', EPPClient::SCHEMAS_URL)).empty?
    ret_secdns[:maxSigLife] = maxSigLife.text
  end
  ret_secdns[:dsData] = xml.xpath('epp:extension/secDNS:infData/secDNS:dsData', EPPClient::SCHEMAS_URL).map do |s|
    parse_ds_data(s)
  end
  ret_secdns[:keyData] = xml.xpath('epp:extension/secDNS:infData/secDNS:keyData', EPPClient::SCHEMAS_URL).map do |s|
    parse_key_data(s)
  end

  ret[:secDNS] = ret_secdns if ret_secdns.values.count(&:nil?) == 0
  ret
end

#domain_update(args) ⇒ Object

Extends the EPPClient::Domain#domain_update so that secDNS informations can be sent, the additionnal informations are contained in an :secDNS object :

:rem

To remove keys or ds from the delegation, with possible attributes one of :

:all

used to remove all DS and key data with a value of boolean true. A value of boolean false will do nothing. Removing all DS information can remove the ability of the parent to secure the delegation to the child zone.

:dsData

an array of dsData elements described in the domain_info function.

:keyData

an array of keyData elements as described in the domain_info function.

:add

To add keys or DS from the delegation, with possible attributes one of :

:dsData

an array of dsData elements described in the domain_info function.

:keyData

an array of keyData elements as described in the domain_info function.

:chg

contains security information to be changed, one of :

:maxSigLife

optional, as described in the domain_info function.



150
151
152
# File 'lib/epp-client/secdns.rb', line 150

def domain_update(args)
  super # placeholder so that I can add some doc
end

#domain_update_xml(domain) ⇒ Object

:nodoc:



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/epp-client/secdns.rb', line 154

def domain_update_xml(domain) #:nodoc:
  ret = super

  return ret unless domain.key?(:secDNS)

  sd = domain[:secDNS]

  ext = extension do |xml|
    xml.update(sd[:urgent] == true ? { :urgent => true } : {}, :xmlns => EPPClient::SCHEMAS_URL['secDNS']) do
      if sd.key?(:rem)
        xml.rem do
          if sd[:rem].key?(:all) && sd[:rem][:all] == true
            xml.all true
          elsif sd[:rem].key?(:dsData)
            sd[:rem][:dsData].each do |ds|
              make_ds_data(xml, ds)
            end
          elsif sd[:rem].key?(:keyData)
            sd[:rem][:keyData].each do |key|
              make_key_data(xml, key)
            end
          end
        end
      end
      if sd.key?(:add)
        xml.add do
          if sd[:add].key?(:dsData)
            sd[:add][:dsData].each do |ds|
              make_ds_data(xml, ds)
            end
          elsif sd[:add].key?(:keyData)
            sd[:add][:keyData].each do |key|
              make_key_data(xml, key)
            end
          end
        end
      end
      if sd.key?(:chg) && sd[:chg].key?(:maxSigLife)
        xml.chg do
          xml.maxSigLife sd[:chg][:maxSigLife]
        end
      end
    end
  end

  insert_extension(ret, ext)
end

#initialize(args) ⇒ Object



14
15
16
17
# File 'lib/epp-client/secdns.rb', line 14

def initialize(args)
  super
  @extensions << EPPClient::SCHEMAS_URL['secDNS-1.1']
end