From: Wouter Wijngaards Date: Tue, 22 Sep 2009 14:04:43 +0000 (+0000) Subject: revocation of trust anchors works. X-Git-Tag: release-1.4.0rc1~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1f7304d14634bb4f8fdcc179fc6230dd6952c765;p=thirdparty%2Funbound.git revocation of trust anchors works. git-svn-id: file:///svn/unbound/trunk@1846 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/daemon/worker.c b/daemon/worker.c index 3785831bf..97cf40d0a 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -950,7 +950,8 @@ void worker_probe_timer_cb(void* arg) tv.tv_sec = (time_t)autr_probe_timer(&worker->env); tv.tv_usec = 0; #endif - comm_timer_set(worker->probe_timer, &tv); + if(tv.tv_sec != 0) + comm_timer_set(worker->probe_timer, &tv); } struct worker* diff --git a/doc/Changelog b/doc/Changelog index fc0edf3a7..6035ba557 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,11 @@ 22 September 2009: Wouter - autotrust test with algorithm rollover, new ordering of checks assists in orderly rollover. + - autotrust test with algorithm rollover to unknown algorithm. + checks if new keys are supported before adding them. + - autotrust test with trust point revocation, becomes unsigned. + - fix DNSSEC-missing-signature detection for minimal responses + for qtype DNSKEY (assumes DNSKEY occurs at zone apex). 18 September 2009: Wouter - autotrust tests, fix trustpoint timer deletion code. diff --git a/iterator/iter_utils.c b/iterator/iter_utils.c index 63b9a7d53..e28fcf413 100644 --- a/iterator/iter_utils.c +++ b/iterator/iter_utils.c @@ -605,6 +605,11 @@ int iter_msg_from_zone(struct dns_msg* msg, struct delegpt* dp, reply_find_rrset_section_ns(msg->rep, dp->name, dp->namelen, LDNS_RR_TYPE_NS, dclass)) return 1; + /* a DNSKEY set is expected at the zone apex as well */ + /* this is for 'minimal responses' for DNSKEYs */ + if(reply_find_rrset_section_an(msg->rep, dp->name, dp->namelen, + LDNS_RR_TYPE_DNSKEY, dclass)) + return 1; return 0; } diff --git a/testdata/autotrust_revtp.rpl b/testdata/autotrust_revtp.rpl new file mode 100644 index 000000000..9ba8092d8 --- /dev/null +++ b/testdata/autotrust_revtp.rpl @@ -0,0 +1,148 @@ +; config options +server: + target-fetch-policy: "0 0 0 0 0" + log-time-ascii: yes +stub-zone: + name: "." + stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET. +AUTOTRUST_FILE example.com +; autotrust trust anchor file +;;id: example.com. 1 +;;last_queried: 1258962400 ;;Mon Nov 23 08:46:40 2009 +;;last_success: 1258962400 ;;Mon Nov 23 08:46:40 2009 +;;next_probe_time: 1258967360 ;;Mon Nov 23 10:09:20 2009 +;;query_failed: 0 +;;query_interval: 5400 +;;retry_time: 3600 +example.com. 10800 IN DNSKEY 257 3 5 AwEAAas/cAhCFXvBUgTSNZCvQp0pLx1dY+7rXR0hH4/3EUgWmsmbYUpI1qD0xhwKD/oYGEwAm291fyWJ9c0oVxXDEK8= ;{id = 16486 (ksk), size = 512b} ;;state=2 [ VALID ] ;;count=0 ;;lastchange=1258962400 ;;Mon Nov 23 08:46:40 2009 +example.com. 10800 IN DNSKEY 257 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55582 (ksk), size = 512b} ;;state=2 [ VALID ] ;;count=0 ;;lastchange=1258962400 ;;Mon Nov 23 08:46:40 2009 +AUTOTRUST_END +CONFIG_END + +SCENARIO_BEGIN Test autotrust with trust point revocation + +; K-ROOT +RANGE_BEGIN 0 100 + ADDRESS 193.0.14.129 +ENTRY_BEGIN +MATCH opcode qname qtype +ADJUST copy_id copy_query +REPLY QR AA +SECTION QUESTION +. IN NS +SECTION ANSWER +. IN NS k.root-servers.net. +SECTION ADDITIONAL +k.root-servers.net IN A 193.0.14.129 +ENTRY_END + +ENTRY_BEGIN +MATCH opcode subdomain +ADJUST copy_id copy_query +REPLY QR +SECTION QUESTION +com. IN NS +SECTION AUTHORITY +com. IN NS a.gtld-servers.net. +SECTION ADDITIONAL +a.gtld-servers.net. IN A 192.5.6.30 +ENTRY_END +RANGE_END + +; a.gtld-servers.net. +RANGE_BEGIN 0 100 + ADDRESS 192.5.6.30 +ENTRY_BEGIN +MATCH opcode subdomain +ADJUST copy_id copy_query +REPLY QR +SECTION QUESTION +example.com. IN NS +SECTION AUTHORITY +example.com. IN NS ns.example.com. +SECTION ADDITIONAL +ns.example.com. IN A 1.2.3.4 +ENTRY_END +RANGE_END + +; ns.example.com. +RANGE_BEGIN 0 100 + ADDRESS 1.2.3.4 +ENTRY_BEGIN +MATCH opcode qname qtype +ADJUST copy_id +REPLY QR AA +SECTION QUESTION +example.com. IN DNSKEY +SECTION ANSWER + +; revoked keys + +example.com. 10800 IN DNSKEY 385 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55710 (ksk), size = 512b} +example.com. 10800 IN DNSKEY 385 3 5 AwEAAas/cAhCFXvBUgTSNZCvQp0pLx1dY+7rXR0hH4/3EUgWmsmbYUpI1qD0xhwKD/oYGEwAm291fyWJ9c0oVxXDEK8= ;{id = 16614 (ksk), size = 512b} +; signatures +example.com. 10800 IN RRSIG DNSKEY 5 2 10800 20091124111500 20091018111500 55710 example.com. zOSlB1iwtlP2lum1RK0WoDQrMVj0JKwk2E5Mu1okzV38hAx3Xm9IGMK6WrNkVVLmx4OkhYmdPVA95jVsFpwLMw== ;{id = 55710} +example.com. 10800 IN RRSIG DNSKEY 5 2 10800 20091124111500 20091018111500 16614 example.com. qP49cCYP3lvNnLBYty/JxAwHqBIGjpup5zQ7qpjPnaZpBb/TlpOhY17LBZrqD86VvBbEVz5tkxC9UrCy85ePDQ== ;{id = 16614} + +ENTRY_END + +ENTRY_BEGIN +MATCH opcode subdomain +ADJUST copy_id copy_query +REPLY QR +SECTION QUESTION +www.example.com. IN A +SECTION ANSWER +www.example.com. IN A 10.20.30.40 +ENTRY_END +RANGE_END + +RANGE_END + +; set date/time to Mon Nov 23 10:46:40 2009 +STEP 5 TIME_PASSES EVAL ${1258962400 + 7200} +STEP 6 TRAFFIC ; do the probe +STEP 7 ASSIGN t0 = ${time} +STEP 8 ASSIGN probe0 = ${range 0 ${timeout} 0} +STEP 9 ASSIGN tp = ${1258962400} + +; the auto probing should have been done now. +STEP 11 CHECK_AUTOTRUST example.com +FILE_BEGIN +; autotrust trust anchor file +;;REVOKED +; The zone has all keys revoked, and is +; considered as if it has no trust anchors. +; the remainder of the file is the last probe. +; to restart the trust anchor, overwrite this file. +; with one containing valid DNSKEYs or DSes. +;;id: example.com. 1 +;;last_queried: ${$t0} ;;${ctime $t0} +;;last_success: ${$t0} ;;${ctime $t0} +;;next_probe_time: ${0} ;;${ctime 0} +;;query_failed: 0 +;;query_interval: 5400 +;;retry_time: 3600 +example.com. 10800 IN DNSKEY 385 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55710 (ksk), size = 512b} ;;state=4 [ REVOKED ] ;;count=0 ;;lastchange=${$t0} ;;${ctime $t0} +example.com. 10800 IN DNSKEY 385 3 5 AwEAAas/cAhCFXvBUgTSNZCvQp0pLx1dY+7rXR0hH4/3EUgWmsmbYUpI1qD0xhwKD/oYGEwAm291fyWJ9c0oVxXDEK8= ;{id = 16614 (ksk), size = 512b} ;;state=4 [ REVOKED ] ;;count=0 ;;lastchange=${$t0} ;;${ctime $t0} +FILE_END + +STEP 20 QUERY +ENTRY_BEGIN +REPLY RD DO +SECTION QUESTION +www.example.com. IN A +ENTRY_END + +; correct unsigned response works after trust point revocation. +STEP 30 CHECK_ANSWER +ENTRY_BEGIN +MATCH all +REPLY QR RD RA NOERROR +SECTION QUESTION +www.example.com. IN A +SECTION ANSWER +www.example.com. IN A 10.20.30.40 +ENTRY_END + +SCENARIO_END diff --git a/testdata/autotrust_revtp_read.rpl b/testdata/autotrust_revtp_read.rpl new file mode 100644 index 000000000..b7ea63a8e --- /dev/null +++ b/testdata/autotrust_revtp_read.rpl @@ -0,0 +1,109 @@ +; config options +server: + target-fetch-policy: "0 0 0 0 0" + log-time-ascii: yes + val-override-date: '20091018111500' +stub-zone: + name: "." + stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET. +AUTOTRUST_FILE example.com +; autotrust trust anchor file +;;REVOKED +; The zone has all keys revoked, and is +; considered as if it has no trust anchors. +; the remainder of the file is the last probe. +; to restart the trust anchor, overwrite this file. +; with one containing valid DNSKEYs or DSes. +;;id: example.com. 1 +;;last_queried: 1258962400 ;;Mon Nov 23 08:46:40 2009 +;;last_success: 1258962400 ;;Mon Nov 23 08:46:40 2009 +;;next_probe_time: ${0} ;;${ctime 0} +;;query_failed: 0 +;;query_interval: 5400 +;;retry_time: 3600 +example.com. 10800 IN DNSKEY 385 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55710 (ksk), size = 512b} ;;state=4 [ REVOKED ] ;;count=0 ;;lastchange=1258962400 ;;Mon Nov 23 08:46:40 2009 +example.com. 10800 IN DNSKEY 385 3 5 AwEAAas/cAhCFXvBUgTSNZCvQp0pLx1dY+7rXR0hH4/3EUgWmsmbYUpI1qD0xhwKD/oYGEwAm291fyWJ9c0oVxXDEK8= ;{id = 16614 (ksk), size = 512b} ;;state=4 [ REVOKED ] ;;count=0 ;;lastchange=1258962400 ;;Mon Nov 23 08:46:40 2009 +AUTOTRUST_END +CONFIG_END + +SCENARIO_BEGIN Test autotrust with revoked trust point read back from config + +; K-ROOT +RANGE_BEGIN 0 100 + ADDRESS 193.0.14.129 +ENTRY_BEGIN +MATCH opcode qname qtype +ADJUST copy_id copy_query +REPLY QR AA +SECTION QUESTION +. IN NS +SECTION ANSWER +. IN NS k.root-servers.net. +SECTION ADDITIONAL +k.root-servers.net IN A 193.0.14.129 +ENTRY_END + +ENTRY_BEGIN +MATCH opcode subdomain +ADJUST copy_id copy_query +REPLY QR +SECTION QUESTION +com. IN NS +SECTION AUTHORITY +com. IN NS a.gtld-servers.net. +SECTION ADDITIONAL +a.gtld-servers.net. IN A 192.5.6.30 +ENTRY_END +RANGE_END + +; a.gtld-servers.net. +RANGE_BEGIN 0 100 + ADDRESS 192.5.6.30 +ENTRY_BEGIN +MATCH opcode subdomain +ADJUST copy_id copy_query +REPLY QR +SECTION QUESTION +example.com. IN NS +SECTION AUTHORITY +example.com. IN NS ns.example.com. +SECTION ADDITIONAL +ns.example.com. IN A 1.2.3.4 +ENTRY_END +RANGE_END + +; ns.example.com. +RANGE_BEGIN 0 100 + ADDRESS 1.2.3.4 +ENTRY_BEGIN +MATCH opcode subdomain +ADJUST copy_id copy_query +REPLY QR +SECTION QUESTION +www.example.com. IN A +SECTION ANSWER +www.example.com. IN A 10.20.30.40 +ENTRY_END +RANGE_END + +RANGE_END + +STEP 20 QUERY +ENTRY_BEGIN +REPLY RD DO +SECTION QUESTION +www.example.com. IN A +ENTRY_END + +; correct unsigned response works after trust point revocation. +STEP 30 CHECK_ANSWER +ENTRY_BEGIN +MATCH all +REPLY QR RD RA NOERROR +SECTION QUESTION +www.example.com. IN A +SECTION ANSWER +www.example.com. IN A 10.20.30.40 +ENTRY_END + +SCENARIO_END diff --git a/testdata/autotrust_revtp_use.rpl b/testdata/autotrust_revtp_use.rpl new file mode 100644 index 000000000..a96bf1819 --- /dev/null +++ b/testdata/autotrust_revtp_use.rpl @@ -0,0 +1,143 @@ +; config options +server: + target-fetch-policy: "0 0 0 0 0" + log-time-ascii: yes + val-override-date: '20091018111500' +stub-zone: + name: "." + stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET. +AUTOTRUST_FILE example.com +; autotrust trust anchor file +;;id: example.com. 1 +;;last_queried: 1258962400 ;;Mon Nov 23 08:46:40 2009 +;;last_success: 1258962400 ;;Mon Nov 23 08:46:40 2009 +;;next_probe_time: 1258967360 ;;Mon Nov 23 10:09:20 2009 +;;query_failed: 0 +;;query_interval: 5400 +;;retry_time: 3600 +example.com. 10800 IN DNSKEY 257 3 5 AwEAAas/cAhCFXvBUgTSNZCvQp0pLx1dY+7rXR0hH4/3EUgWmsmbYUpI1qD0xhwKD/oYGEwAm291fyWJ9c0oVxXDEK8= ;{id = 16486 (ksk), size = 512b} ;;state=2 [ VALID ] ;;count=0 ;;lastchange=1258962400 ;;Mon Nov 23 08:46:40 2009 +example.com. 10800 IN DNSKEY 257 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55582 (ksk), size = 512b} ;;state=2 [ VALID ] ;;count=0 ;;lastchange=1258962400 ;;Mon Nov 23 08:46:40 2009 +AUTOTRUST_END +CONFIG_END + +SCENARIO_BEGIN Test autotrust with trust point revocation and instant use +; so not a probe that discovers it but a user query. + +; K-ROOT +RANGE_BEGIN 0 100 + ADDRESS 193.0.14.129 +ENTRY_BEGIN +MATCH opcode qname qtype +ADJUST copy_id copy_query +REPLY QR AA +SECTION QUESTION +. IN NS +SECTION ANSWER +. IN NS k.root-servers.net. +SECTION ADDITIONAL +k.root-servers.net IN A 193.0.14.129 +ENTRY_END + +ENTRY_BEGIN +MATCH opcode subdomain +ADJUST copy_id copy_query +REPLY QR +SECTION QUESTION +com. IN NS +SECTION AUTHORITY +com. IN NS a.gtld-servers.net. +SECTION ADDITIONAL +a.gtld-servers.net. IN A 192.5.6.30 +ENTRY_END +RANGE_END + +; a.gtld-servers.net. +RANGE_BEGIN 0 100 + ADDRESS 192.5.6.30 +ENTRY_BEGIN +MATCH opcode subdomain +ADJUST copy_id copy_query +REPLY QR +SECTION QUESTION +example.com. IN NS +SECTION AUTHORITY +example.com. IN NS ns.example.com. +SECTION ADDITIONAL +ns.example.com. IN A 1.2.3.4 +ENTRY_END +RANGE_END + +; ns.example.com. +RANGE_BEGIN 0 100 + ADDRESS 1.2.3.4 +ENTRY_BEGIN +MATCH opcode qname qtype +ADJUST copy_id +REPLY QR AA +SECTION QUESTION +example.com. IN DNSKEY +SECTION ANSWER + +; revoked keys + +example.com. 10800 IN DNSKEY 385 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55710 (ksk), size = 512b} +example.com. 10800 IN DNSKEY 385 3 5 AwEAAas/cAhCFXvBUgTSNZCvQp0pLx1dY+7rXR0hH4/3EUgWmsmbYUpI1qD0xhwKD/oYGEwAm291fyWJ9c0oVxXDEK8= ;{id = 16614 (ksk), size = 512b} +; signatures +example.com. 10800 IN RRSIG DNSKEY 5 2 10800 20091124111500 20091018111500 55710 example.com. zOSlB1iwtlP2lum1RK0WoDQrMVj0JKwk2E5Mu1okzV38hAx3Xm9IGMK6WrNkVVLmx4OkhYmdPVA95jVsFpwLMw== ;{id = 55710} +example.com. 10800 IN RRSIG DNSKEY 5 2 10800 20091124111500 20091018111500 16614 example.com. qP49cCYP3lvNnLBYty/JxAwHqBIGjpup5zQ7qpjPnaZpBb/TlpOhY17LBZrqD86VvBbEVz5tkxC9UrCy85ePDQ== ;{id = 16614} + +ENTRY_END + +ENTRY_BEGIN +MATCH opcode subdomain +ADJUST copy_id copy_query +REPLY QR +SECTION QUESTION +www.example.com. IN A +SECTION ANSWER +www.example.com. IN A 10.20.30.40 +ENTRY_END +RANGE_END + +RANGE_END + +STEP 20 QUERY +ENTRY_BEGIN +REPLY RD DO +SECTION QUESTION +www.example.com. IN A +ENTRY_END + +; correct unsigned response works after trust point revocation. +STEP 30 CHECK_ANSWER +ENTRY_BEGIN +MATCH all +REPLY QR RD RA NOERROR +SECTION QUESTION +www.example.com. IN A +SECTION ANSWER +www.example.com. IN A 10.20.30.40 +ENTRY_END + +STEP 37 ASSIGN t0 = ${time} +STEP 41 CHECK_AUTOTRUST example.com +FILE_BEGIN +; autotrust trust anchor file +;;REVOKED +; The zone has all keys revoked, and is +; considered as if it has no trust anchors. +; the remainder of the file is the last probe. +; to restart the trust anchor, overwrite this file. +; with one containing valid DNSKEYs or DSes. +;;id: example.com. 1 +;;last_queried: ${$t0} ;;${ctime $t0} +;;last_success: ${$t0} ;;${ctime $t0} +;;next_probe_time: ${0} ;;${ctime 0} +;;query_failed: 0 +;;query_interval: 5400 +;;retry_time: 3600 +example.com. 10800 IN DNSKEY 385 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55710 (ksk), size = 512b} ;;state=4 [ REVOKED ] ;;count=0 ;;lastchange=${$t0} ;;${ctime $t0} +example.com. 10800 IN DNSKEY 385 3 5 AwEAAas/cAhCFXvBUgTSNZCvQp0pLx1dY+7rXR0hH4/3EUgWmsmbYUpI1qD0xhwKD/oYGEwAm291fyWJ9c0oVxXDEK8= ;{id = 16614 (ksk), size = 512b} ;;state=4 [ REVOKED ] ;;count=0 ;;lastchange=${$t0} ;;${ctime $t0} +FILE_END + +SCENARIO_END diff --git a/testdata/autotrust_rollalgo_unknown.rpl b/testdata/autotrust_rollalgo_unknown.rpl new file mode 100644 index 000000000..5660a8e8c --- /dev/null +++ b/testdata/autotrust_rollalgo_unknown.rpl @@ -0,0 +1,323 @@ +; config options +server: + target-fetch-policy: "0 0 0 0 0" + log-time-ascii: yes +stub-zone: + name: "." + stub-addr: 193.0.14.129 # K.ROOT-SERVERS.NET. +; initial content (say from dig example.com DNSKEY > example.com.key) +AUTOTRUST_FILE example.com +example.com. 10800 IN DNSKEY 257 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55582 (ksk), size = 512b} +example.com. 10800 IN DNSKEY 256 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3 ;{id = 30899 (zsk), size = 512b} +AUTOTRUST_END +CONFIG_END + +SCENARIO_BEGIN Test autotrust with algorithm rollover to unknown algo +; from RSASHA1(5) to 'unknown' (157) +; 157 is really the algocode for HMACMD5, which is not used for DNSSEC. +; the signatures are made with a DSA key (02855) but the algorithm is +; edited (afterwards) to be 157. So the RRSIGs do not verify. + +; K-ROOT +RANGE_BEGIN 0 100 + ADDRESS 193.0.14.129 +ENTRY_BEGIN +MATCH opcode qname qtype +ADJUST copy_id copy_query +REPLY QR AA +SECTION QUESTION +. IN NS +SECTION ANSWER +. IN NS k.root-servers.net. +SECTION ADDITIONAL +k.root-servers.net IN A 193.0.14.129 +ENTRY_END + +ENTRY_BEGIN +MATCH opcode subdomain +ADJUST copy_id copy_query +REPLY QR +SECTION QUESTION +com. IN NS +SECTION AUTHORITY +com. IN NS a.gtld-servers.net. +SECTION ADDITIONAL +a.gtld-servers.net. IN A 192.5.6.30 +ENTRY_END +RANGE_END + +; a.gtld-servers.net. +RANGE_BEGIN 0 100 + ADDRESS 192.5.6.30 +ENTRY_BEGIN +MATCH opcode subdomain +ADJUST copy_id copy_query +REPLY QR +SECTION QUESTION +example.com. IN NS +SECTION AUTHORITY +example.com. IN NS ns.example.com. +SECTION ADDITIONAL +ns.example.com. IN A 1.2.3.4 +ENTRY_END +RANGE_END + +; ns.example.com. KSK 55582 +RANGE_BEGIN 0 10 + ADDRESS 1.2.3.4 +ENTRY_BEGIN +MATCH opcode qname qtype +ADJUST copy_id +REPLY QR AA +SECTION QUESTION +www.example.com. IN A +SECTION ANSWER +www.example.com. 3600 IN A 10.20.30.40 +www.example.com. 3600 IN RRSIG A 5 3 3600 20090924111500 20090821111500 30899 example.com. pYGxVLsWUvOp1wSf0iwPap+JnECfC5GAm1lRqy3YEqecNGld7U7x/5Imo3CerbdZrVptUQs2oH0lcjwYJXMnsw== ;{id = 30899} +SECTION AUTHORITY +example.com. 3600 IN NS ns.example.com. +example.com. 3600 IN RRSIG NS 5 2 3600 20090924111500 20090821111500 30899 example.com. J5wxRq0jgwQL6yy530kvo9cHqNAUHV8IF4dvaYZL0bNraO2Oe6dVXqlJl4+cxNHI2TMsstwFPr2Zz8tv6Az2mQ== ;{id = 30899} +SECTION ADDITIONAL +ns.example.com. 3600 IN A 1.2.3.4 +ns.example.com. 3600 IN RRSIG A 5 3 3600 20090924111500 20090821111500 30899 example.com. JsXbS18oyc0zkVaOWGSFdIQuOsZKflT0GraT9afDPoWLCgH4ApF7jNgfJV7Pqy1sTBRajME5IUAhpANwGBuW4A== ;{id = 30899} +ENTRY_END + +ENTRY_BEGIN +MATCH opcode qname qtype +ADJUST copy_id +REPLY QR AA +SECTION QUESTION +example.com. IN DNSKEY +SECTION ANSWER +; KSK 1 +example.com. 10800 IN DNSKEY 257 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55582 (ksk), size = 512b} +; ZSK 1 +example.com. 10800 IN DNSKEY 256 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3 ;{id = 30899 (zsk), size = 512b} +; signatures +example.com. 10800 IN RRSIG DNSKEY 5 2 10800 20090924111500 20090821111500 30899 example.com. b/HK231jIQLX8IhlZfup3r0yhpXaasbPE6LzxoEVVvWaTZWcLmeV8jDIcn0qO7Yvs7bIJN20lwVAV0GcHH3hWQ== ;{id = 30899} +example.com. 10800 IN RRSIG DNSKEY 5 2 10800 20090924111500 20090821111500 55582 example.com. PCHme1QLoULxqjhg5tMlpR0qJlBfstEUVq18TtNoKQe9le1YhJ9caheXcTWoK+boLhXxg9u6Yyvq8FboQh0OjA== ;{id = 55582} +ENTRY_END +RANGE_END + +; ns.example.com. KSK 55582 and 02855 +RANGE_BEGIN 11 40 + ADDRESS 1.2.3.4 +ENTRY_BEGIN +MATCH opcode qname qtype +ADJUST copy_id +REPLY QR AA +SECTION QUESTION +example.com. IN DNSKEY +SECTION ANSWER +; KSK 1 +example.com. 10800 IN DNSKEY 257 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55582 (ksk), size = 512b} +; KSK 2 +example.com. 10800 IN DNSKEY 257 3 157 ALXLUsWqUrY3JYER3T4TBJIIs70j+sDS/UT2QRp61SE7S3EEXopNXoFE73JLRmvpi/UrOO/Vz4Se6wXv/CYCKjGw06U4WRgRYXcpEhJROyNapmdIKSxhOzfLVE1gqA0PweZR8dtY3aNQSRn3sPpwJr6Mi/PqQKAMMrZ9ckJpf1+bQMOOvxgzz2U1GS18b3yZKcgTMEaJzd/GZYzi/BN2DzQ0MsrSwYXfsNLFOBbs8PJMW4LYIxeeOe6rUgkWOF7CC9Dh/dduQ1QrsJhmZAEFfd6ByYV+ ;{id = 2855 (ksk), size = 1688b} +; and two ZSKs (omitted) for both algorithms. +; signatures +example.com. 10800 IN RRSIG DNSKEY 5 2 10800 20091024111500 20090921111500 55582 example.com. Wp40P+Odx5gh1Zpjwa1YBwwKnqhobPSkv55sEb21vvKpLE2NNt7B6vZqRLg+bBiW0T/vRdo4w+7whKANVuPrtA== ;{id = 55582} +example.com. 10800 IN RRSIG DNSKEY 157 2 10800 20091024111500 20090921111500 2855 example.com. AKdhmjqEbe0STsFNq/UxOidElaWHWCy2hSPQ7oN0Tsq56w6Hsk72PpM= ;{id = 2855} +ENTRY_END +RANGE_END + +; ns.example.com. KSK 55582 and 02855 (signatures updated) +RANGE_BEGIN 41 50 + ADDRESS 1.2.3.4 +ENTRY_BEGIN +MATCH opcode qname qtype +ADJUST copy_id +REPLY QR AA +SECTION QUESTION +example.com. IN DNSKEY +SECTION ANSWER +; KSK 1 +example.com. 10800 IN DNSKEY 257 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55582 (ksk), size = 512b} +; KSK 2 +example.com. 10800 IN DNSKEY 257 3 157 ALXLUsWqUrY3JYER3T4TBJIIs70j+sDS/UT2QRp61SE7S3EEXopNXoFE73JLRmvpi/UrOO/Vz4Se6wXv/CYCKjGw06U4WRgRYXcpEhJROyNapmdIKSxhOzfLVE1gqA0PweZR8dtY3aNQSRn3sPpwJr6Mi/PqQKAMMrZ9ckJpf1+bQMOOvxgzz2U1GS18b3yZKcgTMEaJzd/GZYzi/BN2DzQ0MsrSwYXfsNLFOBbs8PJMW4LYIxeeOe6rUgkWOF7CC9Dh/dduQ1QrsJhmZAEFfd6ByYV+ ;{id = 2855 (ksk), size = 1688b} +; signatures +example.com. 10800 IN RRSIG DNSKEY 5 2 10800 20091124111500 20091018111500 55582 example.com. FXY4N99Udr/2Q+9oU4Dil9B8XQCBcaU0NlqJ9HnwZoLqzKiPhtxNlldU2Ab5TmuXfnkTT1bTYvsq5Dz6P3ezbw== ;{id = 55582} +example.com. 10800 IN RRSIG DNSKEY 157 2 10800 20091124111500 20091018111500 2855 example.com. ABJyZ97htJyBFk5wsKml3YAz81FpXkQKdJeC++fB5ysvl3i+zKJFzTo= ;{id = 2855} +ENTRY_END +RANGE_END + +; ns.example.com. KSK 55582-REVOKED and 02855 +RANGE_BEGIN 51 60 + ADDRESS 1.2.3.4 +ENTRY_BEGIN +MATCH opcode qname qtype +ADJUST copy_id +REPLY QR AA +SECTION QUESTION +example.com. IN DNSKEY +SECTION ANSWER +; KSK 1 +example.com. 10800 IN DNSKEY 385 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55710 (ksk), size = 512b} +; KSK 2 +example.com. 10800 IN DNSKEY 257 3 157 ALXLUsWqUrY3JYER3T4TBJIIs70j+sDS/UT2QRp61SE7S3EEXopNXoFE73JLRmvpi/UrOO/Vz4Se6wXv/CYCKjGw06U4WRgRYXcpEhJROyNapmdIKSxhOzfLVE1gqA0PweZR8dtY3aNQSRn3sPpwJr6Mi/PqQKAMMrZ9ckJpf1+bQMOOvxgzz2U1GS18b3yZKcgTMEaJzd/GZYzi/BN2DzQ0MsrSwYXfsNLFOBbs8PJMW4LYIxeeOe6rUgkWOF7CC9Dh/dduQ1QrsJhmZAEFfd6ByYV+ ;{id = 2855 (ksk), size = 1688b} +; signatures +example.com. 10800 IN RRSIG DNSKEY 5 2 10800 20091224111500 20091118111500 55710 example.com. w5hXwGyeLHWTzdStx4yjB7LNzt86u9A+Qpl3rtQlTKN/qkWIT+Hxa3M32P6jhFTpf+Iq1K9T06mKM21L3TQAOg== ;{id = 55710} +example.com. 10800 IN RRSIG DNSKEY 157 2 10800 20091224111500 20091118111500 2855 example.com. AFAbqLJsTDBfwAipE84ETdFTfzKHs7pzdyzjTKHR2VXygGvHY4QsBaA= ;{id = 2855} +; wrong keytag: 55582 +ENTRY_END +RANGE_END + +; ns.example.com. KSK 02855 +RANGE_BEGIN 61 70 + ADDRESS 1.2.3.4 +ENTRY_BEGIN +MATCH opcode qname qtype +ADJUST copy_id +REPLY QR AA +SECTION QUESTION +example.com. IN DNSKEY +SECTION ANSWER +; KSK 2 +example.com. 10800 IN DNSKEY 257 3 157 ALXLUsWqUrY3JYER3T4TBJIIs70j+sDS/UT2QRp61SE7S3EEXopNXoFE73JLRmvpi/UrOO/Vz4Se6wXv/CYCKjGw06U4WRgRYXcpEhJROyNapmdIKSxhOzfLVE1gqA0PweZR8dtY3aNQSRn3sPpwJr6Mi/PqQKAMMrZ9ckJpf1+bQMOOvxgzz2U1GS18b3yZKcgTMEaJzd/GZYzi/BN2DzQ0MsrSwYXfsNLFOBbs8PJMW4LYIxeeOe6rUgkWOF7CC9Dh/dduQ1QrsJhmZAEFfd6ByYV+ ;{id = 2855 (ksk), size = 1688b} +; signatures +example.com. 10800 IN RRSIG DNSKEY 157 2 10800 20101224111500 20101118111500 2855 example.com. AJv9ujre3iUykHlhJpLYPqsXq12lmQp+AHUPSPpE5zuUhXAPjbnbewk= ;{id = 2855} +ENTRY_END +RANGE_END + +; set date/time to Aug 24 09:46:40 (2009). +STEP 5 TIME_PASSES ELAPSE 1251100000 +STEP 6 TRAFFIC ; the initial probe +STEP 7 ASSIGN t0 = ${time} +STEP 8 ASSIGN probe0 = ${range 4800 ${timeout} 5400} + +; the auto probing should have been done now. +STEP 10 CHECK_AUTOTRUST example.com +FILE_BEGIN +; autotrust trust anchor file +;;id: example.com. 1 +;;last_queried: ${$t0} ;;${ctime $t0} +;;last_success: ${$t0} ;;${ctime $t0} +;;next_probe_time: ${$t0 + $probe0} ;;${ctime $t0 + $probe0} +;;query_failed: 0 +;;query_interval: 5400 +;;retry_time: 3600 +example.com. 10800 IN DNSKEY 257 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55582 (ksk), size = 512b} ;;state=2 [ VALID ] ;;count=0 ;;lastchange=${$t0} ;;${ctime $t0} +FILE_END + +; key prepublished. First poll. 30 days later +STEP 11 TIME_PASSES EVAL ${30*24*3600} +STEP 12 TRAFFIC +STEP 13 ASSIGN t1 = ${time} +STEP 14 ASSIGN probe1 = ${range 4800 ${timeout} 5400} +STEP 15 CHECK_AUTOTRUST example.com +FILE_BEGIN +; autotrust trust anchor file +;;id: example.com. 1 +;;last_queried: ${$t1} ;;${ctime $t1} +;;last_success: ${$t1} ;;${ctime $t1} +;;next_probe_time: ${$t1 + $probe1} ;;${ctime $t1 + $probe1} +;;query_failed: 0 +;;query_interval: 5400 +;;retry_time: 3600 +example.com. 10800 IN DNSKEY 257 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55582 (ksk), size = 512b} ;;state=2 [ VALID ] ;;count=0 ;;lastchange=${$t0} ;;${ctime $t0} +FILE_END + +; Second poll. 10 days later +STEP 21 TIME_PASSES EVAL ${10*24*3600} +STEP 22 TRAFFIC +STEP 23 ASSIGN t2 = ${time} +STEP 24 ASSIGN probe2 = ${range 4800 ${timeout} 5400} +STEP 25 CHECK_AUTOTRUST example.com +FILE_BEGIN +; autotrust trust anchor file +;;id: example.com. 1 +;;last_queried: ${$t2} ;;${ctime $t2} +;;last_success: ${$t2} ;;${ctime $t2} +;;next_probe_time: ${$t2 + $probe2} ;;${ctime $t2 + $probe2} +;;query_failed: 0 +;;query_interval: 5400 +;;retry_time: 3600 +example.com. 10800 IN DNSKEY 257 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55582 (ksk), size = 512b} ;;state=2 [ VALID ] ;;count=0 ;;lastchange=${$t0} ;;${ctime $t0} +FILE_END + +; Third poll. 10 days later +STEP 31 TIME_PASSES EVAL ${10*24*3600} +STEP 32 TRAFFIC +STEP 33 ASSIGN t3 = ${time} +STEP 34 ASSIGN probe3 = ${range 4800 ${timeout} 5400} +STEP 35 CHECK_AUTOTRUST example.com +FILE_BEGIN +; autotrust trust anchor file +;;id: example.com. 1 +;;last_queried: ${$t3} ;;${ctime $t3} +;;last_success: ${$t3} ;;${ctime $t3} +;;next_probe_time: ${$t3 + $probe3} ;;${ctime $t3 + $probe3} +;;query_failed: 0 +;;query_interval: 5400 +;;retry_time: 3600 +example.com. 10800 IN DNSKEY 257 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55582 (ksk), size = 512b} ;;state=2 [ VALID ] ;;count=0 ;;lastchange=${$t0} ;;${ctime $t0} +FILE_END + +; 11 days later, hold down has lapsed. +STEP 41 TIME_PASSES EVAL ${11*24*3600} +STEP 42 TRAFFIC +STEP 43 ASSIGN t4 = ${time} +STEP 44 ASSIGN probe4 = ${range 4800 ${timeout} 5400} +STEP 45 CHECK_AUTOTRUST example.com +FILE_BEGIN +; autotrust trust anchor file +;;id: example.com. 1 +;;last_queried: ${$t4} ;;${ctime $t4} +;;last_success: ${$t4} ;;${ctime $t4} +;;next_probe_time: ${$t4 + $probe4} ;;${ctime $t4 + $probe4} +;;query_failed: 0 +;;query_interval: 5400 +;;retry_time: 3600 +example.com. 10800 IN DNSKEY 257 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55582 (ksk), size = 512b} ;;state=2 [ VALID ] ;;count=0 ;;lastchange=${$t0} ;;${ctime $t0} +FILE_END + +; 30 days later, the old key is revoked +STEP 51 TIME_PASSES EVAL ${30*24*3600} +STEP 52 TRAFFIC +STEP 53 ASSIGN t5 = ${time} +; no more timeout +STEP 54 ASSIGN probe5 = ${range 0 ${timeout} 0} +STEP 55 CHECK_AUTOTRUST example.com +FILE_BEGIN +; autotrust trust anchor file +;;REVOKED +; The zone has all keys revoked, and is +; considered as if it has no trust anchors. +; the remainder of the file is the last probe. +; to restart the trust anchor, overwrite this file. +; with one containing valid DNSKEYs or DSes. +;;id: example.com. 1 +;;last_queried: ${$t5} ;;${ctime $t5} +;;last_success: ${$t5} ;;${ctime $t5} +;;next_probe_time: 0 ;;${ctime 0} +;;query_failed: 0 +;;query_interval: 5400 +;;retry_time: 3600 +example.com. 10800 IN DNSKEY 385 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55710 (ksk), size = 512b} ;;state=4 [ REVOKED ] ;;count=0 ;;lastchange=${$t5} ;;${ctime $t5} +FILE_END + +; 370 days later, the old key is removed from storage +STEP 61 TIME_PASSES EVAL ${370*24*3600} +STEP 62 TRAFFIC +STEP 63 ASSIGN t6 = ${time} +STEP 64 ASSIGN probe6 = ${range 0 ${timeout} 0} +STEP 65 CHECK_AUTOTRUST example.com +FILE_BEGIN +; autotrust trust anchor file +;;REVOKED +; The zone has all keys revoked, and is +; considered as if it has no trust anchors. +; the remainder of the file is the last probe. +; to restart the trust anchor, overwrite this file. +; with one containing valid DNSKEYs or DSes. +;;id: example.com. 1 +;;last_queried: ${$t5} ;;${ctime $t5} +;;last_success: ${$t5} ;;${ctime $t5} +;;next_probe_time: 0 ;;${ctime 0} +;;query_failed: 0 +;;query_interval: 5400 +;;retry_time: 3600 +example.com. 10800 IN DNSKEY 385 3 5 AwEAAc3Z5DQDJpH4oPdNtC4BUQHk50XMD+dHr4r8psHmivIa83hxR5CRgCtd9sENCW9Ae8OIO19xw9t/RPaEAqQa+OE= ;{id = 55710 (ksk), size = 512b} ;;state=4 [ REVOKED ] ;;count=0 ;;lastchange=${$t5} ;;${ctime $t5} +FILE_END + + +SCENARIO_END diff --git a/validator/autotrust.c b/validator/autotrust.c index f74e9ba4b..a565b423b 100644 --- a/validator/autotrust.c +++ b/validator/autotrust.c @@ -1204,6 +1204,16 @@ update_events(struct module_env* env, struct trust_anchor* tp, * other revoked keys are not 'added' again */ continue; } + /* is a key of this type supported?. Note rr_list and + * packed_rrset are in the same order. */ + if(!dnskey_algo_is_supported(dnskey_rrset, i)) { + /* skip unknown algorithm key, it is useless to us */ + log_nametypeclass(VERB_DETAIL, "trust point has " + "unsupported algorithm at", + tp->name, LDNS_RR_TYPE_DNSKEY, tp->dclass); + continue; + } + /* is it new? if revocation bit set, find the unrevoked key */ if(!find_key(tp, rr, &ta)) { ldns_rr_list_deep_free(r); /* malloc fail in compare*/ @@ -1579,13 +1589,20 @@ set_next_probe(struct module_env* env, struct trust_anchor* tp, return 1; } -/** Delete trust point that was revoked */ +/** Revoke and Delete a trust point */ static void autr_tp_remove(struct module_env* env, struct trust_anchor* tp) { struct trust_anchor key; struct autr_point_data pd; time_t mold, mnew; + + log_nametypeclass(VERB_OPS, "trust point was revoked", + tp->name, LDNS_RR_TYPE_DNSKEY, tp->dclass); + tp->autr->revoked = 1; + tp->autr->next_probe_time = 0; /* no more probing for it */ + autr_write_file(env, tp); + /* save name */ memset(&key, 0, sizeof(key)); memset(&pd, 0, sizeof(pd)); @@ -1670,8 +1687,6 @@ int autr_process_prime(struct module_env* env, struct val_env* ve, /* no more keys, all are revoked */ /* this is a success! */ tp->autr->last_success = *env->now; - tp->autr->revoked = 1; - autr_write_file(env, tp); autr_tp_remove(env, tp); return 0; /* trust point removed */ } @@ -1727,8 +1742,6 @@ int autr_process_prime(struct module_env* env, struct val_env* ve, } if(!tp->ds_rrset && !tp->dnskey_rrset) { /* no more keys, all are revoked */ - tp->autr->revoked = 1; - autr_write_file(env, tp); autr_tp_remove(env, tp); return 0; /* trust point removed */ } @@ -1917,12 +1930,16 @@ autr_probe_timer(struct module_env* env) { struct trust_anchor* tp; uint32_t next_probe = 3600; + int num = 0; verbose(VERB_ALGO, "autotrust probe timer callback"); /* while there are still anchors to probe */ while( (tp = todo_probe(env, &next_probe)) ) { /* make a probe for this anchor */ probe_anchor(env, tp); + num++; } - verbose(VERB_ALGO, "autotrust probe timer callback done"); + if(num == 0) + return 0; /* no trust points to probe */ + verbose(VERB_ALGO, "autotrust probe timer %d callbacks done", num); return next_probe; } diff --git a/validator/autotrust.h b/validator/autotrust.h index d9a201543..1c3c9552b 100644 --- a/validator/autotrust.h +++ b/validator/autotrust.h @@ -145,6 +145,7 @@ size_t autr_get_num_anchors(struct val_anchors* anchors); * Process probe timer. Add new probes if needed. * @param env: module environment with time, with anchors and with the mesh. * @return time of next probe (in seconds from now). + * If 0, then there is no next probe anymore (trust points deleted). */ uint32_t autr_probe_timer(struct module_env* env);