Commit Graph

33452 Commits

Author SHA1 Message Date
Mark Andrews
f89c282d73 Merge branch '2703-gcc-10-fanalyzer-reports-dereference-of-null-text-in-server-c-14721-v9_16' into 'v9_16'
Add DBC REQUIRE to check that 'text' is non NULL

See merge request isc-projects/bind9!5259
2021-07-12 06:11:13 +00:00
Mark Andrews
1f36600e5a Add DBC REQUIRE to check that 'text' is non NULL
for all control channel commands.  This should silence
gcc-10-analyzer reporting NULL pointer dereference of 'text'.

(cherry picked from commit ac0fc3c2de)
2021-07-12 14:55:46 +10:00
Mark Andrews
27c1aadb65 Merge branch '2753-timer_test-subtests-are-not-independent-v9_16' into 'v9_16'
Reset errcnt at the start of each subtest

See merge request isc-projects/bind9!5258
2021-07-12 04:26:59 +00:00
Mark Andrews
928af4c424 Reset errcnt at the start of each subtest
(cherry picked from commit 3945c289bb)
2021-07-12 13:57:34 +10:00
Mark Andrews
c27625bddf Merge branch '2808-v9_16-unchecked-returns-in-rbtdb_test-c-and-dnssec-signzone-c' into 'v9_16'
Resolve "v9_16 unchecked returns in rbtdb_test.c and dnssec-signzone.c"

See merge request isc-projects/bind9!5250
2021-07-12 03:23:41 +00:00
Mark Andrews
8538c762cb Fix unchecked returns of dns_name_fromtext 2021-07-12 02:40:25 +00:00
Mark Andrews
bcaf23dd27 Fix unchecked return of isc_rwlock_lock and isc_rwlock_unlock 2021-07-12 02:40:25 +00:00
Mark Andrews
f8a0a1d61f Merge branch '2810-silence-untrusted-loop-bound-v9_16' into 'v9_16'
Silence untrusted loop bound on nsec3param.iterations

See merge request isc-projects/bind9!5256
2021-07-12 02:36:05 +00:00
Mark Andrews
5f82841098 Silence untrusted loop bound on nsec3param.iterations
630
   	    1. tainted_argument: Calling function dns_rdata_tostruct taints argument nsec3param.iterations. [show details]
    631        result = dns_rdata_tostruct(nsec3rdata, &nsec3param, NULL);
   	    2. Condition !!(result == 0), taking true branch.
   	    3. Condition !!(result == 0), taking true branch.
    632        RUNTIME_CHECK(result == ISC_R_SUCCESS);
    633
    634        dns_fixedname_init(&fixed);

            CID 281425 (#1 of 1): Untrusted loop bound (TAINTED_SCALAR)
            4. tainted_data: Passing tainted expression nsec3param.iterations to dns_nsec3_hashname, which uses it as a loop boundary. [show details]
   	    Ensure that tainted values are properly sanitized, by checking that their values are within a permissible range.
    635        result = dns_nsec3_hashname(&fixed, rawhash, &rhsize, vctx->origin,
    636                                    vctx->origin, nsec3param.hash,
    637                                    nsec3param.iterations, nsec3param.salt,
    638                                    nsec3param.salt_length);

(cherry picked from commit c5e1c35e45)
2021-07-12 12:16:29 +10:00
Mark Andrews
7616ee40df Merge branch '2807-coverity-reports-use-of-tainted-scalar-v9_16' into 'v9_16'
Silence use of tainted scalar

See merge request isc-projects/bind9!5255
2021-07-12 02:13:39 +00:00
Mark Andrews
ac34c3f552 Silence tainted scalar on rdlen
2042        ttl = isc_buffer_getuint32(&j->it.source);
    	    13. tainted_data_transitive: Call to function isc_buffer_getuint16 with tainted argument *j->it.source.base returns tainted data. [show details]
    	    14. var_assign: Assigning: rdlen = isc_buffer_getuint16(&j->it.source), which taints rdlen.
    2043        rdlen = isc_buffer_getuint16(&j->it.source);
    2044
    2045        /*
    2046         * Parse the rdata.
    2047         */
    	    15. Condition j->it.source.used - j->it.source.current != rdlen, taking false branch.
    2048        if (isc_buffer_remaininglength(&j->it.source) != rdlen) {
    2049                FAIL(DNS_R_FORMERR);
    2050        }
    	    16. var_assign_var: Assigning: j->it.source.active = j->it.source.current + rdlen. Both are now tainted.
    2051        isc_buffer_setactive(&j->it.source, rdlen);
    2052        dns_rdata_reset(&j->it.rdata);
    	    17. lower_bounds: Checking lower bounds of unsigned scalar j->it.source.active by taking the true branch of j->it.source.active > j->it.source.current.

    CID 316506 (#1 of 1): Untrusted loop bound (TAINTED_SCALAR)
    18. tainted_data: Passing tainted expression j->it.source.active to dns_rdata_fromwire, which uses it as a loop boundary. [show details]
    	    Ensure that tainted values are properly sanitized, by checking that their values are within a permissible range.
    2053        CHECK(dns_rdata_fromwire(&j->it.rdata, rdclass, rdtype, &j->it.source,
    2054                                 &j->it.dctx, 0, &j->it.target));

(cherry picked from commit f0fdca90f2)
2021-07-12 10:45:42 +10:00
Mark Andrews
b212d29a71 Silence use of tainted scalar
2607
            43. tainted_argument: Calling function journal_read_xhdr taints argument xhdr.size. [show details]
    2608                        result = journal_read_xhdr(j1, &xhdr);
            44. Condition rewrite, taking true branch.
            45. Condition result == 29, taking false branch.
    2609                        if (rewrite && result == ISC_R_NOMORE) {
    2610                                break;
    2611                        }
            46. Condition result != 0, taking false branch.
    2612                        CHECK(result);
    2613
            47. var_assign_var: Assigning: size = xhdr.size. Both are now tainted.
    2614                        size = xhdr.size;

            CID 331088 (#3 of 3): Untrusted allocation size (TAINTED_SCALAR)
            48. tainted_data: Passing tainted expression size to isc__mem_get, which uses it as an allocation size. [show details]
            Ensure that tainted values are properly sanitized, by checking that their values are within a permissible range.
    2615                        buf = isc_mem_get(mctx, size);

(cherry picked from commit 83fd38dd2c)
2021-07-12 10:45:42 +10:00
Evan Hunt
6f4ea63372 Merge branch '2756-rndc-multiple-algorithm-v9_16' into 'v9_16'
allow multiple key algorithms in the same control listener

See merge request isc-projects/bind9!5247
2021-07-06 20:36:07 +00:00
Evan Hunt
331b8aebe9 CHANGES
(cherry picked from commit a605a84b08)
2021-07-06 12:55:30 -07:00
Evan Hunt
68a40622ef allow multiple key algorithms in the same control listener
if a control channel listener was configured with more than one
key algorithm, message verification would be attempted with each
algorithm in turn. if the first key failed due to the wrong
signature length, the entire verification process was aborted,
rather than continuing on to try with another key.

(cherry picked from commit 841b557df8)
2021-07-06 12:55:28 -07:00
Mark Andrews
444585080c Merge branch 'marka-xmllint-html-v9_16' into 'v9_16'
Check for errors in html files

See merge request isc-projects/bind9!5243
2021-07-02 04:28:28 +00:00
Mark Andrews
80bc1b4715 Check for errors in html files
xmllint doesn't know about the HTML 5 <section> tag so filter
those out.

(cherry picked from commit ea0624b214)
2021-07-02 13:42:27 +10:00
Matthijs Mekking
71fc32ce8a Merge branch '2786-keyfile-locking-race-condition-deadlock-v9_16' into 'v9_16'
Fix possible deadlock when locking key files (9.16)

See merge request isc-projects/bind9!5240
2021-07-01 13:56:29 +00:00
Matthijs Mekking
c17010d390 Add release note and change for [#2786]
(cherry picked from commit be87edd249)
2021-07-01 15:45:17 +02:00
Matthijs Mekking
e36b6312de Merge branch '1126-checkds-v9_16' into 'v9_16'
Backport checkds to 9.16

See merge request isc-projects/bind9!5239
2021-07-01 13:44:30 +00:00
Matthijs Mekking
7e9fb5deda Fix CID 332468: Memory - illegal accesses (UNINIT)
*** CID 332468:  Memory - illegal accesses  (UNINIT)
/lib/dns/zone.c: 6613 in dns_zone_getdnsseckeys()
6607                 ISC_LIST_UNLINK(dnskeys, k1, link);
6608                 ISC_LIST_APPEND(*keys, k1, link);
6609             }
6610         }
6611     6612     failure:
>>>     CID 332468:  Memory - illegal accesses  (UNINIT)
>>>     Using uninitialized value "keyset.methods" when calling
>>>     "dns_rdataset_isassociated".
6613         if (dns_rdataset_isassociated(&keyset)) {
6614             dns_rdataset_disassociate(&keyset);
6615         }
6616         if (node != NULL) {
6617             dns_db_detachnode(db, &node);
6618         }

Fix by initializing the 'keyset' with 'dns_rdataset_init'.
2021-07-01 14:59:00 +02:00
Matthijs Mekking
e814422e23 Fix windows build
The checkds feature added new functions that required no specific
additional changes for Windows (because the Windows support has been
dropped), but for 9.16 we still need to define them in libdns.def.in.
2021-07-01 14:48:47 +02:00
Matthijs Mekking
d02002321c Move private_type_record() to conf.sh.common
The function 'private_type_record()' is now used in multiple system
setup scripts and should be moved to the common configuration script
conf.sh.common.

(cherry picked from commit c92128eada)
2021-07-01 14:48:47 +02:00
Matthijs Mekking
efb92dd98c Add change and release note for [#1126]
Seems pretty newsworthy.

(cherry picked from commit 22cd63bf81)
2021-07-01 14:48:47 +02:00
Matthijs Mekking
03894a1102 Update documentation
Update ARM and DNSSEC guide with the new checkds feature.

(cherry picked from commit b4c1f3b832)
2021-07-01 14:48:47 +02:00
Matthijs Mekking
dd92a7d5e3 Protect dst key metadata with lock
The DST key metadata can be written by several threads in parralel.
Protect the dst_key_get* and dst_key_set* functions with a mutex.

(cherry picked from commit 39df3f0475)
2021-07-01 14:48:47 +02:00
Matthijs Mekking
099a548340 Replace zone keyflock with zonemgr keymgmt
The old approach where each zone structure has its own mutex that
a thread needs to obtain multiple locks to do safe keyfile I/O
operations lead to a race condition ending in a possible deadlock.

Consider a zone in two views. Each such zone is stored in a separate
zone structure. A thread that needs to read or write the key files for
this zone needs to obtain both mutexes in seperate structures. If
another thread is working on the same zone in a different view, they
race to get the locks. It would be possible that thread1 grabs the
lock of the zone in view1, while thread2 wins the race for the lock
of the zone in view2. Now both threads try to get the other lock,  both
of them are already locked.

Ideally, when a thread wants to do key file operations, it only needs
to lock a single mutex. This commit introduces a key management hash
table, stored in the zonemgr structure. Each time a zone is being
managed, an object is added to the hash table (and removed when the
zone is being released). This object is identified by the zone name
and contains a mutex that needs to be locked prior to reading or
writing key files.

(cherry-picked from commit ef4619366d49efd46f9fae5f75c4a67c246ba2e6)

(cherry picked from commit 28c5179904)
2021-07-01 14:48:46 +02:00
Matthijs Mekking
d565dd6190 Add checkds code
Similar to notify, add code to send and keep track of checkds requests.

On every zone_rekey event, we will check the DS at parental agents
(but we will only actually query parental agents if theree is a DS
scheduled to be published/withdrawn).

On a zone_rekey event, we will first clear the ongoing checkds requests.
Reset the counter, to avoid continuing KSK rollover premature.

This has the risk that if zone_rekey events happen too soon after each
other, there are redundant DS queries to the parental agents. But
if TTLs and the configured durations in the dnssec-policy are sane (as
in not ridiculous short) the chance of this happening is low.

Update: Remove the TLS bits as this is not supported in 9.16

(cherry picked from commit f7872dbd20)
2021-07-01 14:48:23 +02:00
Matthijs Mekking
70cee781a1 Add checkds log notice
When the checkds published/withdrawn is activated, log a notice. Can
be used for testing, but also operationally useful.

(cherry picked from commit 1a50554963)
2021-07-01 14:48:23 +02:00
Matthijs Mekking
96d4f99a8f Add key metadata for DS published/withdrawn
In order to keep track of how many parents have the DS for a given key
published or withdrawn, keep a counter.

(cherry picked from commit 6e2c24be7c)
2021-07-01 14:48:23 +02:00
Matthijs Mekking
2dfd09fa3a Add missing VERIFY export
This makes the 'dnssec-verify' tool visible to the test environment.

(cherry picked from commit 4c337a8e72)
2021-07-01 14:48:23 +02:00
Matthijs Mekking
8ca6571ee9 Slightly improved dnssec tools fatal message
Return the offending key state identifier.

(cherry picked from commit 71d5932a14)
2021-07-01 14:48:23 +02:00
Matthijs Mekking
850aed0219 Add helpful function 'dns_zone_getdnsseckeys'
This code gathers DNSSEC keys from key files and from the DNSKEY RRset.
It is used for the 'rndc dnssec -status' command, but will also be
needed for "checkds". Turn it into a function.

(cherry picked from commit 40331a20c4)
2021-07-01 14:48:23 +02:00
Matthijs Mekking
9c0e252e2b Add "parental-source[-v6]" config option
Similar to "notify-source" and "transfer-source", add options to
set the source address when querying parental agents for DS records.

(manually picked from commit 2872d6a12e)
2021-07-01 14:48:23 +02:00
Matthijs Mekking
884750b66d Add dst_key_role function
Change the static function 'get_ksk_zsk' to a library function that
can be used to determine the role of a dst_key. Add checks if the
boolean parameters to store the role are not NULL. Rename to
'dst_key_role'.

(cherry picked from commit c9b7f62767)
2021-07-01 14:48:23 +02:00
Matthijs Mekking
63582dc778 Parse "parental-agents" configuration
Parse the new "parental-agents" configuration and store it in the zone
structure.

(cherry picked from commit 6f92d4b9a5)
2021-07-01 14:48:23 +02:00
Matthijs Mekking
72d97df483 Make "primaries" config parsing generic
Make the code to parse "primaries" configuration more generic so
it can be reused for "parental-agents".

(cherry picked from commit 6040c71478)
2021-07-01 14:48:23 +02:00
Matthijs Mekking
6369dec812 Remove stray "setup zone" in kasp system setup
(cherry picked from commit 8327cb7839)
2021-07-01 14:48:23 +02:00
Matthijs Mekking
7d877cea14 Add checkds system test
Add a Pytest based system test for the 'checkds' feature. There is
one nameserver (ns9, because it should be started the latest) that
has configured several zones with dnssec-policy. The zones are set
in such a state that they are waiting for DS publication or DS
withdrawal.

Then several other name servers act as parent servers that either have
the DS for these published, or not. Also one server in the mix is
to test a badly configured parental-agent.

There are tests for DS publication, DS publication error handling,
DS withdrawal and DS withdrawal error handling.

The tests ensures that the zone is DNSSEC valid, and that the
DSPublish/DSRemoved key metadata is set (or not in case of the error
handling).

It does not test if the rollover continues, this is already tested in
the kasp system test (that uses 'rndc -dnssec checkds' to set the
DSPublish/DSRemoved key metadata).

(manually picked from commit 56262db9cd)
2021-07-01 14:48:23 +02:00
Matthijs Mekking
514eccf730 Move checkds system test to checkdstool
There is a checkds system test in v9_16 that does not exist in the
main branch. This existing checkds system test checks the behaviour of
the dnssec-checkds tool. Before backporting the new checkds system
test, that tests the feature where BIND checks periodically the
parental agents if the DS for a given KSK has been published, move the
existing checkds system test to checkdstool.
2021-07-01 14:48:23 +02:00
Matthijs Mekking
ab26fc2d66 Check parental-agents config
Add checks for "parental-agents" configuration, checking for the option
being at wrong type of zone (only allowed for primaries and
secondaries), duplicate definitions, duplicate references, and
undefined parental clauses (the name referenced in the zone clause
does not have a matching "parental-agent" clause).

(cherry picked from commit 1e763e582b)
2021-07-01 14:48:23 +02:00
Matthijs Mekking
90ef2b9c81 Add parental-agents configuration
Introduce a way to configure parental agents that can be used to
query DS records to be used in automatic key rollovers.

(manually picked from commit 0311705d4b)
2021-07-01 14:48:23 +02:00
Matthijs Mekking
42da0e7790 Change primaries objects to remote-servers
Change the primaries configuration objects to the more generic
remote-servers, that we can reuse for other purposes (such as
parental-agents).

(manually picked from commit 39a961112f)
2021-07-01 14:48:21 +02:00
Mark Andrews
d9426f1308 Merge branch '2769-journal-rollforward-failed-journal-out-of-sync-with-zone-v9_16' into 'v9_16'
Handle placeholder KEYDATA record

See merge request isc-projects/bind9!5238
2021-07-01 05:20:48 +00:00
Mark Andrews
39028cf9dd Add CHANGES note for [GL #2769]
(cherry picked from commit 4b2b6fc42c)
2021-07-01 15:01:31 +10:00
Mark Andrews
8be9a67aec Handle placeholder KEYDATA record
A placeholder keydata record can appear in a zone file.  Allow them
to be read back in.

(cherry picked from commit c6fa8a1d45)
2021-07-01 15:01:05 +10:00
Ondřej Surý
ef0f010474 Merge branch 'ondrej/fix-some-spelling-v9_16' into 'v9_16'
Fix various typos in the documentation

See merge request isc-projects/bind9!5237
2021-06-29 18:45:02 +00:00
Ondřej Surý
8ea95021ba Fix various typos in the documentation
Generally, the issues fixed here are missing articles, wrong articles
and double articles.  We especially like "the the".

(cherry picked from commit 4ab9bb63ee)
2021-06-29 20:39:21 +02:00
Matthijs Mekking
8089445676 Merge branch '2791-busy-wait-setnsec3param-shutdown-hang-v9_16' into 'v9_16'
Fix setnsec3param shutdown hang (9.16)

See merge request isc-projects/bind9!5236
2021-06-28 09:48:18 +00:00
Matthijs Mekking
964199602b Add changes for [#2791]
(cherry picked from commit 2f270428fc)
2021-06-28 11:07:47 +02:00