2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-25 11:38:29 +00:00

360 Commits

Author SHA1 Message Date
Evan Hunt
921043b541 prevent a possible buffer overflow in configuration check
corrected code that could have allowed a buffer overfow while
parsing named.conf.
2022-05-13 19:59:58 -07:00
Tony Finch
dc233bdb3f Remove remaining checks for rbt64
These checks have been redundant since the `rbtdb64` implementation
was removed in 2018 (commit 784087390ae8). It isn't possible to create
a zone that uses `database "rbt64"` now that the `rbt64` database
implementation has been removed, so the checks will always fail.
2022-05-03 00:41:42 +01:00
Tony Finch
496c02d32a More explicit dns64 prefix errors
Quote the dns64 prefix in error messages that complain about
problems with it, to avoid confusion with the following ACLs.

Closes #3210
2022-03-25 10:59:15 +01:00
Ondřej Surý
584f0d7a7e Simplify way we tag unreachable code with only ISC_UNREACHABLE()
Previously, the unreachable code paths would have to be tagged with:

    INSIST(0);
    ISC_UNREACHABLE();

There was also older parts of the code that used comment annotation:

    /* NOTREACHED */

Unify the handling of unreachable code paths to just use:

    UNREACHABLE();

The UNREACHABLE() macro now asserts when reached and also uses
__builtin_unreachable(); when such builtin is available in the compiler.
2022-03-25 08:33:43 +01:00
Ondřej Surý
d01562f22b Remove the keep-response-order ACL map
The keep-response-order option has been obsoleted, and in this commit,
remove the keep-response-order ACL map rendering the option no-op, the
call the isc_nm_sequential() and the now unused isc_nm_sequential()
function itself.
2022-02-18 09:16:03 +01:00
Ondřej Surý
58bd26b6cf Update the copyright information in all files in the repository
This commit converts the license handling to adhere to the REUSE
specification.  It specifically:

1. Adds used licnses to LICENSES/ directory

2. Add "isc" template for adding the copyright boilerplate

3. Changes all source files to include copyright and SPDX license
   header, this includes all the C sources, documentation, zone files,
   configuration files.  There are notes in the doc/dev/copyrights file
   on how to add correct headers to the new files.

4. Handle the rest that can't be modified via .reuse/dep5 file.  The
   binary (or otherwise unmodifiable) files could have license places
   next to them in <foo>.license file, but this would lead to cluttered
   repository and most of the files handled in the .reuse/dep5 file are
   system test files.
2022-01-11 09:05:02 +01:00
Mark Andrews
dc8595936c remove broken-nsec and reject-000-label options 2021-12-23 15:13:46 +11:00
Mark Andrews
3faccb16cc
Add server christmas tree test
This sets as many server options as possible at once to detect
cut-and-paste bugs when implementing new server options in peer.c.
Most of the accessor functions are similar and it is easy to miss
updating a macro name or structure element name when adding new
accessor functions.

checkconf/setup.sh is there to minimise the difference to branches
with optional server options where the list is updated at runtime.
2021-12-02 14:27:18 +01:00
Artem Boldariev
69cef39099 Add 'tls' validation for XoT enabled primaries
This commit ensure that the 'tls' name specified in the 'primaries'
clause of a 'zone' statement is a valid one.

Prior to that such a name would be silently accepted, leading to
silent XFRs-via-TLS failures.
2021-12-01 12:00:29 +02:00
Artem Boldariev
af2d065c21 Extend ACL syntax handling code with 'port' and 'transport' options
This commit extends ACL syntax handling code with 'port' and
'transport' options. Currently, the extended syntax is available only
for allow-transfer options.
2021-11-30 12:20:22 +02:00
Artem Boldariev
a19a519224 Be less strict regarding "tls" statements in the configuration file
In the 9.17.19 release "tls" statements verification code was
added. The code was too strict and assumed that every such a statement
should have both "cert-file" and "key-file" specified. This turned out
to be a regression, as in some cases we plan to use the "tls"
statement to specify TLS connection parameters.

This commit fixes this behaviour; now a "tls" statement should either
have both "cert-file" and "key-file" specified, or both should be
omitted.
2021-10-30 11:54:33 +03:00
Mark Andrews
ae62e704bc Handle duplicate catalog zone entries gracefully
Duplicate catalog zone entries caused an assertion failure
in named during configuration.  This is now a soft error
that is detected earlier by named and also by named-checkconf.
2021-10-27 01:32:57 +11:00
Mark Andrews
93279bb4b3 Add {krb5,ms}-subdomain-self-rhs update policy rules
The new rules compare the target name in PTR and SRV records against
the machine name embedded in the kerberos principal.  This can be
used to further restrict what PTR and SRV records can be added or
deleted via dynamic updates if desired.
2021-10-15 11:18:41 +11:00
Evan Hunt
69e25f41ae cleanup references to ancient named.conf options
some removed options were still referenced in config.c or the ARM.
2021-10-12 14:01:57 -07:00
Matthijs Mekking
2af05beafa Replace "master/slave" terms in code
Replace some "master/slave" terminology in the code with the preferred
"primary/secondary" keywords. This also changes user output such as
log messages, and fixes a typo ("seconary") in cfg_test.c.

There are still some references to "master" and "slave" for various
reasons:

- The old syntax can still be used as a synonym.
- The master syntax is kept when it refers to master files and formats.
- This commit replaces mainly keywords that are local. If "master" or
  "slave" is used in for example a structure that is all over the
  place, it is considered out of scope for the moment.
2021-10-12 13:11:13 -07:00
Ondřej Surý
2e3a2eecfe Make isc_result a static enum
Remove the dynamic registration of result codes.  Convert isc_result_t
from unsigned + #defines into 32-bit enum type in grand unified
<isc/result.h> header.  Keep the existing values of the result codes
even at the expense of the description and identifier tables being
unnecessary large.

Additionally, add couple of:

    switch (result) {
    [...]
    default:
        break;
    }

statements where compiler now complains about missing enum values in the
switch statement.
2021-10-06 11:22:20 +02:00
Artem Boldariev
d45df0d923 Do not allow defining "http" clauses named "default"
This name is reserved for being used in 'listen-on' statements only.
2021-10-04 17:28:30 +03:00
Artem Boldariev
3b88d783a2 Add "ciphers" options to the "tls" clause
This commit adds support for setting TLS cipher list string in the
format specified in the OpenSSL
documentation (https://www.openssl.org/docs/man1.1.1/man1/ciphers.html).

The syntax of the cipher list is verified so that specifying the wrong
string will prevent the configuration from being loaded.
2021-10-01 15:50:43 +03:00
Artem Boldariev
992f815770 Add "protocols" options to the "tls" clause
This commit adds the ability to specify allowed TLS protocols versions
within the "tls" clause. If an unsupported TLS protocol version is
specified in a file, the configuration file will not pass
verification.

Also, this commit adds strict checks for "tls" clauses verification,
in particular:

- it ensures that loading configuration files containing duplicated
"tls" clauses is not allowed;

- it ensures that loading configuration files containing "tls" clauses
missing "cert-file" or "key-file" is not allowed;

- it ensures that loading configuration files containing "tls" clauses
named as "ephemeral" or "none" is not allowed.
2021-10-01 15:50:43 +03:00
Artem Boldariev
ef65d32594 Fix heap use after free when checking for "http" duplicates
This commit fixes heap use after free when checking BIND's
configuration files for errors with http clauses.  The old code
was unnecessarially copying the http element name and freeing
it to early.  The name is now used directly.
2021-09-30 11:56:10 +03:00
Ondřej Surý
edee9440d0 Remove the mastefile-format map option
As previously announced, this commit removes the masterfile-format
format 'map' from named, all the tools, the documentation and the
system tests.
2021-09-17 07:09:50 +02:00
Ondřej Surý
6b7a488cbc Mark the masterfile-format type 'map' as deprecated
The map masterfile-format is very fragile and it needs API bump every
time a RBTDB data structures changes.  Also while testing it, we found
out that files larger than 2GB weren't loading and nobody noticed, and
loading many map files were also failing (subject to kernel limits).

Thus we are marking the masterfile-format type 'map' as deprecated and
to be removed in the next stable BIND 9 release.
2021-09-17 05:58:02 +02:00
Mark Andrews
7f5f7b2d7b Specifying sig-signing-type causes named to fail
the range check error was being applied unconditionally
2021-09-16 18:17:22 +10:00
Evan Hunt
a27860ba57 mark "cache-file" as ancient and remove all code implementing it
"cache-file" was already documented as intended for testing
purposes only and not to be used, so we can remove it without
waiting.  this commit marks the option as "ancient", and
removes all the documentation and implementing code, including
dns_cache_setfilename() and dns_cache_dump().

it also removes the documentation for the '-x cachefile`
parameter to named, which had already been removed, but the man
page was not updated at the time.
2021-09-16 00:19:02 -07:00
Evan Hunt
14c8d7dfb7 check port in *-source and *-source-v6 options in named.conf
- when transfer-source(-v6), query-source(-v6), notify-source(-v6)
  or parental-source(-v6) are specified with a port number, issue a
  warning.
- when the port specified is the same as the DNS listener port (i.e.,
  53, or whatever was specified as "port" in "options"), issue a fatal
  error.
- check that "port" is in range. (previously this was only checked
  by named, not by named-checkconf.)
- added checkconf tests.
- incidental fix: removed dead code in check.c:bind9_check_namedconf().

(note: if the DNS port is specified on the command line with "named -p",
that is not conveyed to libbind9, so these checks will not take it into
account.)
2021-09-14 19:24:33 +02:00
Aram Sargsyan
ae53919154 Add synonym configuration options for catalog zones
This commit adds 'primaries' and 'default-primaries' catalog zones
configuration options synonyms for 'masters' and 'default-masters'
respectively.
2021-09-09 21:54:10 +00:00
Ondřej Surý
8cb2ba5dd3 Remove native PKCS#11 support
The native PKCS#11 support has been removed in favour of better
maintained, more performance and easier to use OpenSSL PKCS#11 engine
from the OpenSC project.
2021-09-09 15:35:39 +02:00
Evan Hunt
679f1c0dad change CFG_ZONE_MASTER and CFG_ZONE_SLAVE
these values have been renamed as CFG_ZONE_PRIMARY and
CFG_ZONE_SECONDARY.
2021-08-30 11:06:12 -07:00
Mark Andrews
eb8c1ed3c5 Check that primary tls names are syntactically valid 2021-08-25 15:21:14 +10:00
Mark Andrews
4fa9d8389a Check that primary key names are syntactically valid 2021-08-25 15:21:14 +10:00
Artem Boldariev
03a557a9bb Add (http-)listener-clients option (DoH quota mechanism)
This commit adds support for http-listener-clients global options as
well as ability to override the default in an HTTP server description,
like:

http local-http-server {
    ...
    listener-clients 100;
    ...
};

This way we have ability to specify per-listener active connections
quota globally and then override it when required. This is exactly
what AT&T requested us: they wanted a functionality to specify quota
globally and then override it for specific IPs. This change
functionality makes such a configuration possible.

It makes sense: for example, one could have different quotas for
internal and external clients. Or, for example, one could use BIND's
internal ability to serve encrypted DoH with some sane quota value for
internal clients, while having un-encrypted DoH listener without quota
to put BIND behind a load balancer doing TLS offloading for external
clients.

Moreover, the code no more shares the quota with TCP, which makes
little sense anyway (see tcp-clients option), because of the nature of
interaction of DoH clients: they tend to keep idle opened connections
for longer periods of time, preventing the TCP and TLS client from
being served. Thus, the need to have a separate, generally larger,
quota for them.

Also, the change makes any option within "http <name> { ... };"
statement optional, making it easier to override only required default
options.

By default, the DoH connections are limited to 300 per listener. I
hope that it is a good initial guesstimate.
2021-07-16 11:50:20 +03:00
Artem Boldariev
954240467d Verify HTTP paths both in incoming requests and in config file
This commit adds the code (and some tests) which allows verifying
validity of HTTP paths both in incoming HTTP requests and in BIND's
configuration file.
2021-07-16 10:28:08 +03:00
Ondřej Surý
29c2e52484 The isc/platform.h header has been completely removed
The isc/platform.h header was left empty which things either already
moved to config.h or to appropriate headers.  This is just the final
cleanup commit.
2021-07-06 05:33:48 +00:00
Ondřej Surý
bf4a0e26dc Move NAME_MAX and PATH_MAX from isc/platform.h to isc/dir.h
The last remaining defines needed for platforms without NAME_MAX and
PATH_MAX (I'm looking at you, GNU Hurd) were moved to isc/dir.h where
it's prevalently used.
2021-07-06 05:33:48 +00:00
Matthijs Mekking
2872d6a12e 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.
2021-06-30 17:28:48 +02:00
Matthijs Mekking
1e763e582b 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).
2021-06-30 17:28:48 +02:00
Matthijs Mekking
39a961112f 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).
2021-06-30 17:21:11 +02:00
Matthijs Mekking
75ec7d1d9f Fix checkconf dnssec-policy inheritance bug
Similar to #2778, the check for 'dnssec-policy' failed to account for
it being inheritable.
2021-06-24 09:31:59 +02:00
Mark Andrews
d1e283ede1 Checking of key-directory and dnssec-policy was broken
the checks failed to account for key-directory being inheritable.
2021-06-18 16:46:02 +10:00
Matthijs Mekking
494e8b2cbd Check key-directory duplicates for kasp zones
Don't allow the same zone with different dnssec-policies in separate
views have the same key-directory.

Track zones plus key-directory in a symtab and if there is a match,
check the offending zone's dnssec-policy name. If the name is "none"
(there is no kasp for the offending zone), or if the name is the same
(the zone shares keys), it is fine, otherwise it is an error (zones
in views using different policies cannot share the same key-directory).
2021-05-18 15:47:02 +02:00
Matthijs Mekking
66f2cd228d Use isdigit instead of checking character range
When looking for key files, we could use isdigit rather than checking
if the character is within the range [0-9].

Use (unsigned char) cast to ensure the value is representable in the
unsigned char type (as suggested by the isdigit manpage).

Change " & 0xff" occurrences to the recommended (unsigned char) type
cast.
2021-05-05 19:15:33 +02:00
Matthijs Mekking
511bc1b882 Check for filename clashes /w dnssec-policy zones
Just like with dynamic and/or inline-signing zones, check if no two
or more zone configurations set the same filename. In these cases,
the zone files are not read-only and named-checkconf should catch
a configuration where multiple zone statements write to the same file.

Add some bad configuration tests where KASP zones reference the same
zone file.

Update the good-kasp test to allow for two zones configure the same
file name, dnssec-policy none.
2021-05-05 19:13:55 +02:00
Matthijs Mekking
22243ac804 Remove double "insecure" check
This was a conflict between dba13d280aacb1ee52de54b0607b3beb4ff1aa0e
and 636ff1e15cb15db9252bd664a6f051761db824ca.
2021-05-05 12:45:47 +02:00
Matthijs Mekking
636ff1e15c No longer need to strcmp for "none"
When we introduced "dnssec-policy insecure" we could have removed the
'strcmp' check for "none", because if it was set to "none", the 'kasp'
variable would have been set to NULL.
2021-05-05 11:23:53 +02:00
Mark Andrews
dba13d280a named-checkconf now detects redefinition of dnssec-policy 'insecure' 2021-05-05 16:23:19 +10:00
Matthijs Mekking
2710d9a11d Add built-in dnssec-policy "insecure"
Add a new built-in policy "insecure", to be used to gracefully unsign
a zone. Previously you could just remove the 'dnssec-policy'
configuration from your zone statement, or remove it.

The built-in policy "none" (or not configured) now actually means
no DNSSEC maintenance for the corresponding zone. So if you
immediately reconfigure your zone from whatever policy to "none",
your zone will temporarily be seen as bogus by validating resolvers.

This means we can remove the functions 'dns_zone_use_kasp()' and
'dns_zone_secure_to_insecure()' again. We also no longer have to
check for the existence of key state files to figure out if a zone
is transitioning to insecure.
2021-04-30 11:18:38 +02:00
Evan Hunt
2b2e1a02bd allow configuration of "default" http endpoint
specifying "http default" in a listen-on statement sets up
the default "/dns-query" endpoint. tests and documentation
have been updated.
2021-02-16 16:24:35 -08:00
Evan Hunt
957052eea5 move listen-on correctness checks into check.c
errors in listen-on and listen-on-v6 can now be detected
by named-checkconf.
2021-02-16 16:24:35 -08:00
Ondřej Surý
23c3bcc711 Stop including dnstap headers from <dns/dnstap.h>
The <fstrm.h> and <protobuf-c/protobuf-c.h> headers are only directly
included where used and we stopped exposing those headers from libdns
headers.
2021-02-16 01:04:46 +00:00
Matthijs Mekking
87744f218d Remove a lot of obsoleted options
These options were ancient or made obsolete a long time ago, it is
safe to remove them.

Also stop printing ancient options, they should be treated the same as
unknown options.

Removed options: lwres, geoip-use-ecs, sit-secret, use-ixfr,
acache-cleaning-interval, acache-enable, additional-from-auth,
additional-from-cache, allow-v6-synthesis, dnssec-enable,
max-acache-size, nosit-udp-size, queryport-pool-ports,
queryport-pool-updateinterval, request-sit, use-queryport-pool, and
support-ixfr.
2021-01-19 10:12:40 +01:00