xfrin_bind10.feature 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. Feature: Xfrin
  2. Tests for Xfrin, specific for BIND 10 behaviour.
  3. Scenario: Retransfer command
  4. # Standard check to test (non-)existence of a file.
  5. # This file is actually automatically created.
  6. The file data/test_nonexistent_db.sqlite3 should not exist
  7. Given I have bind10 running with configuration xfrin/retransfer_master.conf with cmdctl port 56174 as master
  8. And wait for master stderr message BIND10_STARTED_CC
  9. And wait for master stderr message CMDCTL_STARTED
  10. And wait for master stderr message AUTH_SERVER_STARTED
  11. And wait for master stderr message XFROUT_STARTED
  12. And wait for master stderr message ZONEMGR_STARTED
  13. And I have bind10 running with configuration xfrin/retransfer_slave.conf
  14. And wait for bind10 stderr message BIND10_STARTED_CC
  15. And wait for bind10 stderr message CMDCTL_STARTED
  16. And wait for bind10 stderr message AUTH_SERVER_STARTED
  17. And wait for bind10 stderr message XFRIN_STARTED
  18. And wait for bind10 stderr message ZONEMGR_STARTED
  19. # Now we use the first step again to see if the file has been created.
  20. # The DB currently doesn't know anything about the zone, so we install
  21. # an empty zone for xfrin.
  22. The file data/test_nonexistent_db.sqlite3 should exist
  23. A query for www.example.org to [::1]:56176 should have rcode REFUSED
  24. Then make empty zone example.org in DB file data/test_nonexistent_db.sqlite3
  25. When I send bind10 the command Xfrin retransfer example.org IN ::1 56177
  26. # The data we receive contain a NS RRset that refers to three names in the
  27. # example.org. zone. All these three are nonexistent in the data, producing
  28. # 3 separate warning messages in the log.
  29. And wait for new bind10 stderr message XFRIN_ZONE_WARN
  30. And wait for new bind10 stderr message XFRIN_ZONE_WARN
  31. And wait for new bind10 stderr message XFRIN_ZONE_WARN
  32. # But after complaining, the zone data should be accepted.
  33. Then wait for new bind10 stderr message XFRIN_TRANSFER_SUCCESS not XFRIN_XFR_PROCESS_FAILURE
  34. # there's no guarantee this is logged before XFRIN_TRANSFER_SUCCESS, so
  35. # we can't reliably use 'wait for new'. In this case this should be the
  36. # only occurrence of this message, so this should be okay.
  37. Then wait for bind10 stderr message ZONEMGR_RECEIVE_XFRIN_SUCCESS
  38. A query for www.example.org to [::1]:56176 should have rcode NOERROR
  39. # The transferred zone should have 11 non-NSEC3 RRs and 1 NSEC3 RR.
  40. # The following check will get these by AXFR, so the total # of RRs
  41. # should be 13, counting the duplicated SOA.
  42. # At this point we can confirm both in and out of AXFR for a zone
  43. # containing an NSEC3 RR.
  44. # We don't have to specify the address/port here; the defaults will work.
  45. When I do an AXFR transfer of example.org
  46. Then transfer result should have 13 rrs
  47. # Now try to offer another update. However, the validation of
  48. # data should fail. The old version shoud still be available.
  49. When I send bind10 the following commands with cmdctl port 56174:
  50. """
  51. config set data_sources/classes/IN[0]/params/database_file data/example.org-nons.sqlite3
  52. config set Auth/database_file data/example.org-nons.sqlite3
  53. config commit
  54. """
  55. Then I send bind10 the command Xfrin retransfer example.org IN ::1 56177
  56. And wait for new bind10 stderr message XFRIN_ZONE_INVALID
  57. And wait for new bind10 stderr message XFRIN_INVALID_ZONE_DATA
  58. # We can't use 'wait for new' here; see above.
  59. Then wait for bind10 stderr message ZONEMGR_RECEIVE_XFRIN_FAILED
  60. A query for example.org type NS to [::1]:56176 should have rcode NOERROR
  61. And transfer result should have 13 rrs
  62. Scenario: Transfer with TSIG
  63. # Similar setup to the test above, but this time, we add TSIG configuration
  64. # In order to check that the tests don't give false positives because config
  65. # happens to be right (like no TSIG on either side), we take an existing
  66. # non-TSIG config, add TSIG on the master side, see it fail, add TSIG
  67. # on the slave side, then check again.
  68. Given I have bind10 running with configuration xfrin/retransfer_master.conf with cmdctl port 56174 as master
  69. And wait for master stderr message AUTH_SERVER_STARTED
  70. And wait for master stderr message XFROUT_STARTED
  71. And I have bind10 running with configuration xfrin/retransfer_slave.conf
  72. And wait for bind10 stderr message CMDCTL_STARTED
  73. And wait for bind10 stderr message XFRIN_STARTED
  74. # For xfrin make the data source aware of the zone (with empty data)
  75. Then make empty zone example.org in DB file data/test_nonexistent_db.sqlite3
  76. # Set slave config for 'automatic' xfrin
  77. When I set bind10 configuration Xfrin/zones to [{"master_port": 56176, "name": "example.org", "master_addr": "::1"}]
  78. # Make sure it is fully open
  79. When I send bind10 the command Xfrin retransfer example.org
  80. Then wait for new bind10 stderr message XFRIN_TRANSFER_SUCCESS not XFRIN_XFR_PROCESS_FAILURE
  81. # this can't be 'wait for new'; see above.
  82. And wait for bind10 stderr message ZONEMGR_RECEIVE_XFRIN_SUCCESS
  83. # First to master, a transfer should then fail
  84. When I send bind10 the following commands with cmdctl port 56174:
  85. """
  86. config add tsig_keys/keys "example.key.:c2VjcmV0"
  87. config set Xfrout/zone_config[0]/transfer_acl [{"action": "ACCEPT", "from": "::1", "key": "example.key."}]
  88. config commit
  89. """
  90. # Transfer should fail
  91. When I send bind10 the command Xfrin retransfer example.org
  92. Then wait for new bind10 stderr message XFRIN_XFR_TRANSFER_PROTOCOL_VIOLATION not XFRIN_TRANSFER_SUCCESS
  93. # Set client to use TSIG as well
  94. When I send bind10 the following commands:
  95. """
  96. config add tsig_keys/keys "example.key.:c2VjcmV0"
  97. config set Xfrin/zones[0]/tsig_key "example.key."
  98. config commit
  99. """
  100. # Transwer should succeed now
  101. When I send bind10 the command Xfrin retransfer example.org
  102. Then wait for new bind10 stderr message XFRIN_TRANSFER_SUCCESS not XFRIN_XFR_PROCESS_FAILURE
  103. Scenario: Validation fails
  104. # In this test, the source data of the XFR is invalid (missing NS record
  105. # at the origin). We check it is rejected after the transfer.
  106. #
  107. # We use abuse the fact that we do not check data when we read it from
  108. # the sqlite3 database (unless we load into in-memory, which we don't
  109. # do here).
  110. The file data/test_nonexistent_db.sqlite3 should not exist
  111. Given I have bind10 running with configuration xfrin/retransfer_master_nons.conf with cmdctl port 56174 as master
  112. And wait for master stderr message BIND10_STARTED_CC
  113. And wait for master stderr message CMDCTL_STARTED
  114. And wait for master stderr message AUTH_SERVER_STARTED
  115. And wait for master stderr message XFROUT_STARTED
  116. And wait for master stderr message ZONEMGR_STARTED
  117. And I have bind10 running with configuration xfrin/retransfer_slave.conf
  118. And wait for bind10 stderr message BIND10_STARTED_CC
  119. And wait for bind10 stderr message CMDCTL_STARTED
  120. And wait for bind10 stderr message AUTH_SERVER_STARTED
  121. And wait for bind10 stderr message XFRIN_STARTED
  122. And wait for bind10 stderr message ZONEMGR_STARTED
  123. # Now we use the first step again to see if the file has been created,
  124. # then install empty zone data
  125. The file data/test_nonexistent_db.sqlite3 should exist
  126. A query for www.example.org to [::1]:56176 should have rcode REFUSED
  127. Then make empty zone example.org in DB file data/test_nonexistent_db.sqlite3
  128. When I send bind10 the command Xfrin retransfer example.org IN ::1 56177
  129. # It should complain once about invalid data, then again that the whole
  130. # zone is invalid and then reject it.
  131. And wait for new bind10 stderr message XFRIN_ZONE_INVALID
  132. And wait for new bind10 stderr message XFRIN_INVALID_ZONE_DATA
  133. # This can't be 'wait for new'
  134. Then wait for bind10 stderr message ZONEMGR_RECEIVE_XFRIN_FAILED
  135. # The zone still doesn't exist as it is rejected.
  136. # FIXME: This step fails. Probably an empty zone is created in the data
  137. # source :-|. This should be REFUSED, not SERVFAIL.
  138. A query for www.example.org to [::1]:56176 should have rcode SERVFAIL
  139. # TODO:
  140. # * IXFR - generate an sqlite db that contains the journal. Check it was
  141. # IXFR by logs.
  142. # * IXFR->AXFR fallback if IXFR is not available (even rejected or
  143. # something, not just the differences missing).
  144. # * Retransfer with short refresh time (without notify).
  145. Scenario: With differences
  146. # We transfer from one bind10 to other, just like in the Retransfer command
  147. # scenario. Just this time, the master contains the differences table
  148. # and the slave has a previous version of the zone, so we use the IXFR.
  149. Given I have bind10 running with configuration xfrin/retransfer_master_diffs.conf with cmdctl port 56174 as master
  150. And wait for master stderr message BIND10_STARTED_CC
  151. And wait for master stderr message CMDCTL_STARTED
  152. And wait for master stderr message AUTH_SERVER_STARTED
  153. And wait for master stderr message XFROUT_STARTED
  154. And wait for master stderr message ZONEMGR_STARTED
  155. And I have bind10 running with configuration xfrin/retransfer_slave_diffs.conf
  156. And wait for bind10 stderr message BIND10_STARTED_CC
  157. And wait for bind10 stderr message CMDCTL_STARTED
  158. And wait for bind10 stderr message AUTH_SERVER_STARTED
  159. And wait for bind10 stderr message XFRIN_STARTED
  160. And wait for bind10 stderr message ZONEMGR_STARTED
  161. A query for example. type SOA to [::1]:56176 should have rcode NOERROR
  162. The answer section of the last query response should be
  163. """
  164. example. 3600 IN SOA ns1.example. hostmaster.example. 94 3600 900 7200 300
  165. """
  166. # To invoke IXFR we need to use refresh command
  167. When I send bind10 the command Xfrin refresh example. IN ::1 56177
  168. Then wait for new bind10 stderr message XFRIN_GOT_INCREMENTAL_RESP
  169. Then wait for new bind10 stderr message XFRIN_IXFR_TRANSFER_SUCCESS not XFRIN_XFR_PROCESS_FAILURE
  170. # This can't be 'wait for new'
  171. Then wait for bind10 stderr message ZONEMGR_RECEIVE_XFRIN_SUCCESS
  172. A query for example. type SOA to [::1]:56176 should have rcode NOERROR
  173. The answer section of the last query response should be
  174. """
  175. example. 3600 IN SOA ns1.example. hostmaster.example. 100 3600 900 7200 300
  176. """