Commit graph

12561 commits

Author SHA1 Message Date
Diego Fronza
f2bf7beeb6 Added new logging category rpz-passthru
It is now possible to use the new logging category "rpz-passthru"
to redirect RPZ passthru activity to a dedicate logging channel.
2020-05-07 11:44:48 -03:00
Evan Hunt
f8d753d452 initialize sockaddrdscp to prevent spurious output from 'named-checkconf -p' 2020-05-05 12:48:31 -07:00
Evan Hunt
b89decfcc9 replace fputs() with fprintf() 2020-05-04 09:14:58 +02:00
Witold Kręcicki
fa02f6438b Don't set UDP recv/send buffer sizes - use system defaults (unless explicitly defined) 2020-05-01 17:04:00 +02:00
Ondřej Surý
09ba47b067 Use SO_REUSEPORT only on Linux, use SO_REUSEPORT_LB on FreeBSD
The SO_REUSEPORT socket option on Linux means something else on BSD
based systems.  On FreeBSD there's 1:1 option SO_REUSEPORT_LB, so we can
use that.
2020-05-01 15:20:55 +02:00
Aaron Thompson
6a9f20d031 Add engine support to OpenSSL EdDSA implementation. 2020-05-01 14:11:08 +02:00
Aaron Thompson
f9685b29f9 Use OpenSSL raw key functions for EdDSA keys. 2020-05-01 14:11:08 +02:00
Ondřej Surý
064d8b7a6d Simplify error handling 2020-05-01 10:36:45 +02:00
Ondřej Surý
aff61535c2 Add initial support for ECDSA keys via OpenSSL PKCS#11 engine 2020-05-01 10:36:45 +02:00
Mark Andrews
a66c6fc883 Mimic nzf_append from bin/named/server.c
nzf_append is conditionally compiled and this is intended to
catch error introduced by changes to the called functions on all
systems before the changes are run through the CI.
2020-05-01 06:51:05 +10:00
Mark Andrews
b02081d423 Escape double quote when printing quoted string.
When we were printing quoted string, the double quotes where unescaped
leading to prematurely ending the quoted string.
2020-05-01 06:51:05 +10:00
Aaron Thompson
2e6b7a56cc Update EdDSA implementation to PKCS#11 v3.0.
Per Current Mechanisms 2.3.5, the curve name is DER-encoded in the
EC_PARAMS attribute, and the public key value is DER-encoded in the
EC_POINT attribute.
2020-04-30 18:40:45 +02:00
Aaron Thompson
9b87fe1051 Fix EdDSA key sizes (key_size is in bits). 2020-04-30 18:40:45 +02:00
Witold Kręcicki
83049ceabf Don't free udp recv buffer if UV_UDP_MMSG_CHUNK is set 2020-04-30 17:30:37 +02:00
Ondřej Surý
d5356a40ff Use UV_UDP_RECVMMSG to enable mmsg support in libuv if available 2020-04-30 17:30:37 +02:00
Ondřej Surý
c86ebeebd2 As libltdl is convenience library, link it just into libisc 2020-04-30 15:33:44 +02:00
Ondřej Surý
86f322133f Fix the noinst_LTLIBRARIES -> check_LTLIBRARIES in libisc and libdns unit tests 2020-04-27 15:18:31 +02:00
Evan Hunt
17a1bafc08 Restore behaviour of "make test" and "make unit"
Add recursive "test" and "unit" rules, which execute "make check"
in specific directories - "make test" runs the system tests, and
"make unit" runs the unit tests.
2020-04-27 15:02:30 +02:00
Ondřej Surý
5f0efcbb3c Cleanup libirs APIs and slim down the library to just irs_resconf
The libirs contained own re-implementations of the getaddrinfo,
getnameinfo and gai_strerror + irs_context and irs_dnsconf API that was
unused anywhere in the BIND 9.

Keep just the irs_resonf API that is being extensively used to parse
/etc/resolv.conf by several of BIND 9 tools.
2020-04-24 08:33:34 +02:00
Ondřej Surý
6494665f08 Remove 'ephemeral' database implementation
The 'ephemeral' database implementation was used to provide a
lightweight database implemenation that doesn't cache results, and the
only place where it was really use is "samples" because delv is
overriding this to use "rbtdb" instead. Otherwise it was completely
unused.

 * The 'ephemeral' cache DB (ecdb) implementation.  An ecdb just provides
 * temporary storage for ongoing name resolution with the common DB interfaces.
 * It actually doesn't cache anything.  The implementation expects any stored
 * data is released within a short period, and does not care about the
 * scalability in terms of the number of nodes.
2020-04-23 18:05:53 +02:00
Ondřej Surý
6a6a9f7afa Add OPENSSL_CFLAGS to libdns tests that include dst_internal.h
The three libdns tests directly include ../dst_internal.h which
in turn directly include openssl headers, thus there was a missing
path and build failure on systems where OpenSSL is not in the default
include path.
2020-04-23 15:53:03 +02:00
Ondřej Surý
bdca09aa8d Remove unused isc_lfsr API
The isc_lfsr API was used to generate message IDs in the past.
Currently, it's just cruft.
2020-04-23 12:16:22 +02:00
Evan Hunt
286e8cd7ea acquire maintenance lock when running incremental RPZ updates
this addresses a race that could occur during shutdown or when
reconfiguring to remove RPZ zones.

this change should ensure that the rpzs structure and the incremental
updates don't interfere with each other: rpzs->zones entries cannot
be set to NULL while an update quantum is running, and the
task should be destroyed and its queue purged so that no subsequent
quanta will run.
2020-04-21 15:53:58 -07:00
Ondřej Surý
978c7b2e89 Complete rewrite the BIND 9 build system
The rewrite of BIND 9 build system is a large work and cannot be reasonable
split into separate merge requests.  Addition of the automake has a positive
effect on the readability and maintainability of the build system as it is more
declarative, it allows conditional and we are able to drop all of the custom
make code that BIND 9 developed over the years to overcome the deficiencies of
autoconf + custom Makefile.in files.

This squashed commit contains following changes:

- conversion (or rather fresh rewrite) of all Makefile.in files to Makefile.am
  by using automake

- the libtool is now properly integrated with automake (the way we used it
  was rather hackish as the only official way how to use libtool is via
  automake

- the dynamic module loading was rewritten from a custom patchwork to libtool's
  libltdl (which includes the patchwork to support module loading on different
  systems internally)

- conversion of the unit test executor from kyua to automake parallel driver

- conversion of the system test executor from custom make/shell to automake
  parallel driver

- The GSSAPI has been refactored, the custom SPNEGO on the basis that
  all major KRB5/GSSAPI (mit-krb5, heimdal and Windows) implementations
  support SPNEGO mechanism.

- The various defunct tests from bin/tests have been removed:
  bin/tests/optional and bin/tests/pkcs11

- The text files generated from the MD files have been removed, the
  MarkDown has been designed to be readable by both humans and computers

- The xsl header is now generated by a simple sed command instead of
  perl helper

- The <irs/platform.h> header has been removed

- cleanups of configure.ac script to make it more simpler, addition of multiple
  macros (there's still work to be done though)

- the tarball can now be prepared with `make dist`

- the system tests are partially able to run in oot build

Here's a list of unfinished work that needs to be completed in subsequent merge
requests:

- `make distcheck` doesn't yet work (because of system tests oot run is not yet
  finished)

- documentation is not yet built, there's a different merge request with docbook
  to sphinx-build rst conversion that needs to be rebased and adapted on top of
  the automake

- msvc build is non functional yet and we need to decide whether we will just
  cross-compile bind9 using mingw-w64 or fix the msvc build

- contributed dlz modules are not included neither in the autoconf nor automake
2020-04-21 14:19:48 +02:00
Ondřej Surý
4df5a5832c Remove files generated by autotools 2020-04-21 14:19:30 +02:00
Ondřej Surý
98b3b93791 Remove python based tools (dnssec-keymgr, dnssec-coverage, dnssec-checkds)
With the introduction of dnssec-policy, the aforementioned tools were
either rendered obsolete, or they will be replaced with dnssec-policy
based tools.  Remove the tools and the requirement to have Python
installed.  Python 3 is still being used for tests, so keep the autoconf
test, but make it much simpler.
2020-04-21 14:19:30 +02:00
Witold Kręcicki
62f738ba48 Fix detaching the extra quotas in the quota_test 2020-04-21 14:17:20 +02:00
Ondřej Surý
54defc8b78 Enable quota_test in Kyuafile 2020-04-21 12:30:11 +02:00
Ondřej Surý
cf30e7d0d1 Use switch instead of if when evaluating curves
Previously, the code would do:

    REQUIRE(alg == CURVE1 || alg == CURVE2);

    [...]

    if (alg == CURVE1) { /* code for CURVE1 */ }
    else { /* code for CURVE2 */ }

This approach is less extensible and also more prone to errors in case
the initial REQUIRE() is forgotten.  The code has been refactored to
use:

    REQUIRE(alg == CURVE1 || alg == CURVE2);

    [...]

    switch (alg) {
    case CURVE1: /* code for CURVE1 */; break;
    case CURVE2: /* code for CURVE2 */; break;
    default: INSIST(0);
    }
2020-04-20 11:40:42 +02:00
Ondřej Surý
da38bd0e1d Refactor the code using the pk11 ECC constants.
The pk11/constants.h header contained static CK_BYTE arrays and
we had to use #defines to pull only those we need.  This commit
changes the constants to only define byte arrays with the content
and either use them directly or define the CK_BYTE arrays locally
where used.
2020-04-20 11:40:42 +02:00
Aaron Thompson
541d7bafe6 Fix a segfault when a PKCS#11 token is not found. 2020-04-20 11:40:42 +02:00
Aaron Thompson
46cae09023 Fix bad syntax in pkcs11eddsa_link.c.
Introduced in 994e656977.
2020-04-20 11:40:41 +02:00
Aaron Thompson
3e685fe01a Update to PKCS#11 v3.0 EdDSA macros. 2020-04-20 11:40:41 +02:00
Aaron Thompson
2ef379d911 Fix compiler warnings about unused pk11 constants. 2020-04-20 11:40:41 +02:00
Aaron Thompson
d28c7dadbb Remove remaining PKCS#11 DH references.
Missed in 0a73c9f137 and 8efd394c80.
2020-04-20 11:40:41 +02:00
Aaron Thompson
6a6485a531 Remove unnecessary forward declarations. 2020-04-20 11:40:41 +02:00
Aaron Thompson
7744aece03 Finish refactoring pkcs11eddsa_link.c after isc_buffer_allocate change.
Left over after c73e5866c4.
2020-04-20 11:40:41 +02:00
Aaron Thompson
b4a7bfd55e Remove unreachable label in pkcs11eddsa_link.c.
Missed in ae83801e2b.
2020-04-20 11:40:41 +02:00
Aaron Thompson
7fc4f926fb Finish refactoring after the removal of --with-ecdsa and --with-eddsa.
Missed in c3b8130fe8.
2020-04-20 11:40:41 +02:00
Aaron Thompson
bb158e8a4c Finish replacing OP_EC with OP_ECDSA/OP_EDDSA.
Missed in c3b8130fe8.
2020-04-20 11:40:41 +02:00
Mark Andrews
eeeaf9dbd4 Move structure declarations from dns/peer.h into peer.c 2020-04-20 08:59:09 +00:00
Mark Andrews
33eee6572a Reject AXFR streams where the message id is not consistent. 2020-04-20 18:24:12 +10:00
Matthijs Mekking
564f9dca35 Address Coverity warnings in keymgr.c
Coverity showed that the return value of `dst_key_gettime` was
unchecked in INITIALIZE_STATE. If DST_TIME_CREATED was not set we
would set the state to be initialized to a weird last changed time.

This would normally not happen because DST_TIME_CREATED is always
set. However, we would rather set the time to now (as the comment
also indicates) not match the creation time.

The comment on INITIALIZE_STATE also needs updating as we no
longer always initialize to HIDDEN.
2020-04-20 09:21:40 +02:00
Tinderbox User
bf2020a171 prep 9.17.1 2020-04-16 23:03:54 +02:00
Aaron Thompson
850d8ae019 Fix/improve some comments in buffer.h.
isc_buffer_dup now cannot fail as a result of c73e5866c4.
2020-04-16 15:57:33 +02:00
Matthijs Mekking
644f0d958a dnssec-policy: to sign inline or not
When dnssec-policy was introduced, it implicitly set inline-signing.
But DNSSEC maintenance required either inline-signing to be enabled,
or a dynamic zone.  In other words, not in all cases you want to
DNSSEC maintain your zone with inline-signing.

Change the behavior and determine whether inline-signing is
required: if the zone is dynamic, don't use inline-signing,
otherwise implicitly set it.

You can also explicitly set inline-signing to yes with dnssec-policy,
the restriction that both inline-signing and dnssec-policy cannot
be set at the same time is now lifted.

However, 'inline-signing no;' on a non-dynamic zone with a
dnssec-policy is not possible.
2020-04-16 14:22:47 +02:00
Ondřej Surý
e3076c4caa Align the irs_getnameinfo() declaration and definition on Windows 2020-04-15 14:03:40 +02:00
Ondřej Surý
b6c2012d93 Disable MSB8028 warning
All our MSVS Project files share the same intermediate directory.  We
know that this doesn't cause any problems, so we can just disable the
detection in the project files.

Example of the warning:

  warning MSB8028: The intermediate directory (.\Release\) contains files shared from another project (dnssectool.vcxproj).  This can lead to incorrect clean and rebuild behavior.
2020-04-15 13:37:12 +02:00
Ondřej Surý
4ffe725585 Fix the discrepancy between cfg_pluginlist_foreach declaration and definition
There was a missing indirection for the pluginlist_cb_t *callback in the
declaration of the cfg_pluginlist_foreach function.  Reported by MSVC as:

  lib\isccfg\parser.c(4057): warning C4028: formal parameter 4 different from declaration
2020-04-15 12:50:28 +02:00
Ondřej Surý
60c632ab91 Workaround MSVC warning C4477
Due to a way the stdatomic.h shim is implemented on Windows, the MSVC
always things that the outside type is the largest - atomic_(u)int_fast64_t.
This can lead to false positives as this one:

  lib\dns\adb.c(3678): warning C4477: 'fprintf' : format string '%u' requires an argument of type 'unsigned int', but variadic argument 2 has type 'unsigned __int64'

We workaround the issue by loading the value in a scoped local variable
with correct type first.
2020-04-15 12:47:42 +02:00