Class Dnsruby::ZoneTransfer
In: lib/Dnsruby/zone_transfer.rb
Parent: Object

This class performs zone transfers as per RFC1034 (AXFR) and RFC1995 (IXFR).

Methods

compare_serial   new   transfer   tsig=  

Classes and Modules

Class Dnsruby::ZoneTransfer::Delta

Attributes

klass  [RW]  The class - defaults to IN
last_tsigstate  [R]  Returns the tsigstate of the last transfer (nil if no TSIG signed transfer has occurred)
port  [RW]  The port to connect to - defaults to 53
serial  [RW]  If using IXFR, this is the SOA serial number to start the incrementals from
server  [RW]  The nameserver to use for the zone transfer - defaults to system config
transfer_type  [RW]  What type of transfer to do (IXFR or AXFR) - defaults to AXFR
tsig  [R]  The TSIG record used to sign the transfer

Public Class methods

Public Instance methods

Compare two serials according to RFC 1982. Return 0 if equal, -1 if s1 is bigger, 1 if s1 is smaller.

Perform a zone transfer (RFC1995) If an IXFR query is unsuccessful, then AXFR is tried (and @transfer_type is set to AXFR) TCP is used as the only transport

If AXFR is performed, then the zone will be returned as a set of records :

      zt = Dnsruby::ZoneTransfer.new
      zt.transfer_type = Dnsruby::Types.AXFR
      zt.server = "ns0.validation-test-servers.nominet.org.uk"
      zone = zt.transfer("validation-test-servers.nominet.org.uk")
      soa = zone[0]
      rec1 = zone[1]
      print zone.to_s

If IXFR is performed, then the incrementals will be returned as a set of Deltas. Each Delta contains the start and end SOA serial number, as well as an array of adds and deletes that occurred between the start and end.

       zt = Dnsruby::ZoneTransfer.new
       zt.transfer_type = Dnsruby::Types.IXFR
       zt.server = "ns0.validation-test-servers.nominet.org.uk"
       zt.serial = 2007090401
       deltas = zt.transfer("validation-test-servers.nominet.org.uk")
       assert_equal("Should show up in transfer", deltas[0].adds[1].data)

Sets the TSIG to sign the zone transfer with. Pass in either a Dnsruby::RR::TSIG, or a key_name and key (or just a key) Pass in nil to stop tsig signing.

  • res.tsig=(tsig_rr)
  • res.tsig=(key_name, key)
  • res.tsig=nil # Don‘t sign the transfer

[Validate]