]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2968. [security] Named could fail to prove a data set was insecure
authorMark Andrews <marka@isc.org>
Tue, 16 Nov 2010 04:17:44 +0000 (04:17 +0000)
committerMark Andrews <marka@isc.org>
Tue, 16 Nov 2010 04:17:44 +0000 (04:17 +0000)
                        before marking it as insecure.  One set of conditions
                        that can trigger this occurs naturally when rolling
                        DNSKEY algorithms.  [RT #22309]

Had to adjust the test to use RSAMD5 -> RSASH1 as we need to use algorithms
supported by 9.4.

CHANGES
bin/tests/system/dnssec/ns1/root.db.in
bin/tests/system/dnssec/ns1/sign.sh
bin/tests/system/dnssec/ns2/algroll.db.in [new file with mode: 0644]
bin/tests/system/dnssec/ns2/named.conf
bin/tests/system/dnssec/ns2/sign.sh
bin/tests/system/dnssec/tests.sh
lib/dns/validator.c

diff --git a/CHANGES b/CHANGES
index 618694931021b6e8e0b6ff99da3fdbfc6e8b0b08..3f10800d13de1c12e2e9ee15aa88769f12ee0904 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+2968.  [security]      Named could fail to prove a data set was insecure
+                       before marking it as insecure.  One set of conditions
+                       that can trigger this occurs naturally when rolling
+                       DNSKEY algorithms.  [RT #22309]
+
 2966.  [bug]           isc_print_vsnprintf() failed to check if there was
                        space available in the buffer when adding a left
                        justified character with a non zero width,
index a7b7b311510ac4b3324a095a9fe61723252bb13a..a506cd1595b92f21b118b41ce99fc6ce60941b92 100644 (file)
@@ -13,7 +13,7 @@
 ; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 ; PERFORMANCE OF THIS SOFTWARE.
 
-; $Id: root.db.in,v 1.8 2004/03/10 02:19:53 marka Exp $
+; $Id: root.db.in,v 1.8.18.1 2010/11/16 04:17:43 marka Exp $
 
 $TTL 300
 .                      IN SOA  gson.nominum.com. a.root.servers.nil. (
@@ -30,3 +30,5 @@ example.              NS      ns2.example.
 ns2.example.           A       10.53.0.2
 dlv.                   NS      ns2.dlv.
 ns2.dlv.               A       10.53.0.2
+algroll                        NS      ns2.algroll
+ns2.algroll.           A       10.53.0.2
index 43748b44e2d397e41e4a60fa3c34db880a03038e..d291db14e7486ab094f01f9b5511c544a8136317 100644 (file)
@@ -15,7 +15,7 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: sign.sh,v 1.19.18.2 2006/01/04 00:37:23 marka Exp $
+# $Id: sign.sh,v 1.19.18.3 2010/11/16 04:17:44 marka Exp $
 
 SYSTEMTESTTOP=../..
 . $SYSTEMTESTTOP/conf.sh
@@ -28,15 +28,16 @@ zonefile=root.db
 
 (cd ../ns2 && sh sign.sh )
 
-cp ../ns2/keyset-example. .
-cp ../ns2/keyset-dlv. .
+cp ../ns2/dsset-example. .
+cp ../ns2/dsset-dlv. .
+grep "5 [12]" ../ns2/dsset-algroll. > dsset-algroll.
 
 keyname=`$KEYGEN -r $RANDFILE -a RSAMD5 -b 768 -n zone $zone`
 
-cat $infile $keyname.key > $zonefile
+cat $infile $keyname.key dsset-example. dsset-dlv. dsset-algroll. > $zonefile
 
-echo $SIGNER -g -r $RANDFILE -o $zone $zonefile
-$SIGNER -g -r $RANDFILE -o $zone $zonefile > /dev/null
+echo $SIGNER -r $RANDFILE -o $zone $zonefile
+$SIGNER -r $RANDFILE -o $zone $zonefile > /dev/null
 
 # Configure the resolving server with a trusted key.
 
diff --git a/bin/tests/system/dnssec/ns2/algroll.db.in b/bin/tests/system/dnssec/ns2/algroll.db.in
new file mode 100644 (file)
index 0000000..4afea0c
--- /dev/null
@@ -0,0 +1,32 @@
+; Copyright (C) 2004, 2007-2010  Internet Systems Consortium, Inc. ("ISC")
+; Copyright (C) 2000-2002  Internet Software Consortium.
+;
+; Permission to use, copy, modify, and/or distribute this software for any
+; purpose with or without fee is hereby granted, provided that the above
+; copyright notice and this permission notice appear in all copies.
+;
+; THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+; AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+; PERFORMANCE OF THIS SOFTWARE.
+
+; $Id: algroll.db.in,v 1.2.12.2 2010/11/16 04:17:44 marka Exp $
+
+$TTL 30        ; 5 minutes
+@                      IN SOA  mname1. . (
+                               2000042407 ; serial
+                               20         ; refresh (20 seconds)
+                               20         ; retry (20 seconds)
+                               1814400    ; expire (3 weeks)
+                               30       ; minimum (1 hour)
+                               )
+                       NS      ns2
+ns2                    A       10.53.0.2
+ns3                    A       10.53.0.3
+
+a                      A       10.0.0.1
+b                      A       10.0.0.2
+d                      A       10.0.0.4
index 8acdc776fa4f1cdf05864985764ad83877b669aa..b0b2a8a09d66f35e2ec0a6c81a103ee473bcd825 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: named.conf,v 1.23.18.3 2006/03/10 00:23:20 marka Exp $ */
+/* $Id: named.conf,v 1.23.18.4 2010/11/16 04:17:44 marka Exp $ */
 
 // NS2
 
@@ -69,4 +69,9 @@ zone "rfc2335.example" {
 };
 
 
+zone "algroll" {
+       type master;
+       file "algroll.db.signed";
+};
+
 include "trusted.conf";
index f9afc2bd87a621da3853336a997d80355b8a5346..a20f8e1d6f1feef46b20cb4df754b058d8a9efc3 100644 (file)
@@ -15,7 +15,7 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: sign.sh,v 1.24.18.4 2009/12/30 23:46:04 tbox Exp $
+# $Id: sign.sh,v 1.24.18.5 2010/11/16 04:17:44 marka Exp $
 
 SYSTEMTESTTOP=../..
 . $SYSTEMTESTTOP/conf.sh
@@ -113,3 +113,21 @@ dlvkeyname=`$KEYGEN -r $RANDFILE -a RSAMD5 -b 768 -n zone $dlvzone`
 cat $dlvinfile $dlvkeyname.key dlvset-$privzone > $dlvzonefile
 
 $SIGNER -g -r $RANDFILE -o $dlvzone $dlvzonefile > /dev/null
+
+#
+# algroll has just has the old DNSKEY records removed and is waiting
+# for them to be flushed from caches.  We still need to generate
+# RRSIGs for the old DNSKEY.
+#
+zone=algroll.
+infile=algroll.db.in
+zonefile=algroll.db
+
+keyold1=`$KEYGEN -r $RANDFILE -a RSAMD5 -b 1024 -n zone -f KSK $zone`
+keyold2=`$KEYGEN -r $RANDFILE -a RSAMD5 -b 1024 -n zone $zone`
+keynew1=`$KEYGEN -r $RANDFILE -a RSASHA1 -b 1024 -n zone -f KSK $zone`
+keynew2=`$KEYGEN -r $RANDFILE -a RSASHA1 -b 1024 -n zone $zone`
+
+cat $infile $keynew1.key $keynew2.key >$zonefile
+
+$SIGNER -r $RANDFILE -o $zone -k $keyold1 -k $keynew1 $zonefile $keyold1 $keyold2 $keynew1 $keynew2 > /dev/null
index f0fed5add7f23e564b8518812af8960709028438..bfec2c4e3860b196732f58e2b36c739e4349ed05 100644 (file)
@@ -15,7 +15,7 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: tests.sh,v 1.44.18.7 2009/12/30 23:46:03 tbox Exp $
+# $Id: tests.sh,v 1.44.18.8 2010/11/16 04:17:43 marka Exp $
 
 SYSTEMTESTTOP=..
 . $SYSTEMTESTTOP/conf.sh
@@ -509,6 +509,14 @@ n=`expr $n + 1`
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
+echo "I:checking that a zone finishing the transition from RSAMD5 to RSASHA1 validates secure ($n)"
+ret=0
+$DIG $DIGOPTS ns algroll. @10.53.0.4 > dig.out.ns4.test$n || ret=1
+grep "NOERROR" dig.out.ns4.test$n > /dev/null || ret=1
+grep "flags:[^;]* ad[^;]*;" dig.out.ns4.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo "I:failed"; fi
+status=`expr $status + $ret`
+
 # Run a minimal update test if possible.  This is really just
 # a regression test for RT #2399; more tests should be added.
 
index 6a1d0c9a04b44fb7678326fcc52c6c6fa4e4471f..bea5301773c28cf6b9b2ebec35f316a0565892ac 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: validator.c,v 1.119.18.59 2010/09/02 07:21:53 marka Exp $ */
+/* $Id: validator.c,v 1.119.18.60 2010/11/16 04:17:44 marka Exp $ */
 
 /*! \file */
 
@@ -304,6 +304,7 @@ fetch_callback_validator(isc_task_t *task, isc_event_t *event) {
        isc_boolean_t want_destroy;
        isc_result_t result;
        isc_result_t eresult;
+       isc_result_t saved_result;
 
        UNUSED(task);
        INSIST(event->ev_type == DNS_EVENT_FETCHDONE);
@@ -340,6 +341,17 @@ fetch_callback_validator(isc_task_t *task, isc_event_t *event) {
                                val->keyset = &val->frdataset;
                }
                result = validate(val, ISC_TRUE);
+               if (result == DNS_R_NOVALIDSIG &&
+                   (val->attributes & VALATTR_TRIEDVERIFY) == 0)
+               {
+                       saved_result = result;
+                       validator_log(val, ISC_LOG_DEBUG(3),
+                                     "falling back to insecurity proof");
+                       val->attributes |= VALATTR_INSECURITY;
+                       result = proveunsecure(val, ISC_FALSE, ISC_FALSE);
+                       if (result == DNS_R_NOTINSECURE)
+                               result = saved_result;
+               }
                if (result != DNS_R_WAIT)
                        validator_done(val, result);
        } else {
@@ -530,6 +542,7 @@ keyvalidated(isc_task_t *task, isc_event_t *event) {
        isc_boolean_t want_destroy;
        isc_result_t result;
        isc_result_t eresult;
+       isc_result_t saved_result;
 
        UNUSED(task);
        INSIST(event->ev_type == DNS_EVENT_VALIDATORDONE);
@@ -556,6 +569,17 @@ keyvalidated(isc_task_t *task, isc_event_t *event) {
                if (val->frdataset.trust >= dns_trust_secure)
                        (void) get_dst_key(val, val->siginfo, &val->frdataset);
                result = validate(val, ISC_TRUE);
+               if (result == DNS_R_NOVALIDSIG &&
+                   (val->attributes & VALATTR_TRIEDVERIFY) == 0)
+               {
+                       saved_result = result;
+                       validator_log(val, ISC_LOG_DEBUG(3),
+                                     "falling back to insecurity proof");
+                       val->attributes |= VALATTR_INSECURITY;
+                       result = proveunsecure(val, ISC_FALSE, ISC_FALSE);
+                       if (result == DNS_R_NOTINSECURE)
+                               result = saved_result;
+               }
                if (result != DNS_R_WAIT)
                        validator_done(val, result);
        } else {
@@ -1480,9 +1504,11 @@ validate(dns_validator_t *val, isc_boolean_t resume) {
                 * was known and "sufficiently good".
                 */
                if (!dns_resolver_algorithm_supported(val->view->resolver,
-                                                     event->name,
-                                                     val->siginfo->algorithm))
+                                                   event->name,
+                                                   val->siginfo->algorithm)) {
+                       resume = ISC_FALSE;
                        continue;
+               }
 
                if (!resume) {
                        result = get_key(val, val->siginfo);
@@ -1493,16 +1519,12 @@ validate(dns_validator_t *val, isc_boolean_t resume) {
                }
 
                /*
-                * The key is insecure, so mark the data as insecure also.
+                * There isn't a secure DNSKEY for this signature so move
+                * onto the next RRSIG.
                 */
                if (val->key == NULL) {
-                       if (val->mustbesecure) {
-                               validator_log(val, ISC_LOG_WARNING,
-                                             "must be secure failure");
-                               return (DNS_R_MUSTBESECURE);
-                       }
-                       markanswer(val, "validate");
-                       return (ISC_R_SUCCESS);
+                       resume = ISC_FALSE;
+                       continue;
                }
 
                do {
@@ -3123,6 +3145,20 @@ proveunsecure(dns_validator_t *val, isc_boolean_t have_ds, isc_boolean_t resume)
                                 */
                                result = DNS_R_NOVALIDNSEC;
                                goto out;
+                       } else if (DNS_TRUST_PENDING(val->frdataset.trust) ||
+                                  DNS_TRUST_ANSWER(val->frdataset.trust)) {
+                               /*
+                                * If we have "trust == answer" then this namespace
+                                * has switched from insecure to should be secure.
+                                */
+                               result = create_validator(val, tname,
+                                                         dns_rdatatype_ds,
+                                                         &val->frdataset,
+                                                         NULL, dsvalidated,
+                                                         "proveunsecure");
+                               if (result != ISC_R_SUCCESS)
+                                       goto out;
+                               return (DNS_R_WAIT);
                        } else if (val->frdataset.trust < dns_trust_secure) {
                                /*
                                 * This shouldn't happen, since the negative