Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3878c145c9 | ||
|
|
4acbfbc2d1 | ||
|
|
1ef9a32de7 | ||
|
|
6c738fe323 |
+86
-121
@@ -56,16 +56,6 @@ variables:
|
||||
# Some jobs may clean up the build artifacts unless this is set to 0.
|
||||
CLEAN_BUILD_ARTIFACTS_ON_SUCCESS: 1
|
||||
|
||||
# DNS Shotgun performance testing defaults
|
||||
SHOTGUN_ROUNDS: 1
|
||||
SHOTGUN_DURATION: 120
|
||||
# allow unlimited improvements against baseline
|
||||
SHOTGUN_EVAL_THRESHOLD_CPU_MIN: '-inf'
|
||||
SHOTGUN_EVAL_THRESHOLD_MEMORY_MIN: '-inf'
|
||||
SHOTGUN_EVAL_THRESHOLD_RCODE_MAX: '+inf'
|
||||
SHOTGUN_EVAL_THRESHOLD_LATENCY_PCTL_MIN: '-inf'
|
||||
SHOTGUN_EVAL_THRESHOLD_LATENCY_PCTL_DRIFT_MIN: '-inf'
|
||||
|
||||
default:
|
||||
# Allow all running CI jobs to be automatically canceled when a new
|
||||
# version of a branch is pushed.
|
||||
@@ -117,55 +107,16 @@ stages:
|
||||
- runner-manager
|
||||
- aarch64
|
||||
|
||||
.freebsd-autoscaler-13-amd64-tags: &freebsd_autoscaler_13_amd64_tags
|
||||
# Autoscaling GitLab Runner on AWS EC2 (FreeBSD)
|
||||
|
||||
.freebsd-stress-amd64: &freebsd_stress_amd64
|
||||
tags:
|
||||
- amd64
|
||||
- autoscaler
|
||||
- bsd-stress-test
|
||||
- aws
|
||||
- bsd-stress-test-1
|
||||
- autoscaler
|
||||
- shell
|
||||
- stress-test
|
||||
|
||||
.freebsd-autoscaler-14-amd64-tags: &freebsd_autoscaler_14_amd64_tags
|
||||
tags:
|
||||
- amd64
|
||||
- autoscaler
|
||||
- aws
|
||||
- bsd-stress-test-2
|
||||
- shell
|
||||
- stress-test
|
||||
|
||||
.freebsd-autoscaler-amd64: &freebsd_autoscaler_amd64
|
||||
variables:
|
||||
CC: clang
|
||||
CFLAGS: "${CFLAGS_COMMON} -Og"
|
||||
# Even though there's only one job per runtime environment, the GitLab
|
||||
# "instance" executor insists on cloning the Git repository to a path that
|
||||
# contains a variable number from zero to the "maximum concurrent instances
|
||||
# count" allowed on the GitLab Runner. See the "0" directory in this
|
||||
# example path: /home/ec2-user/builds/t1_4FZzvz/0/isc-projects/bind9/.git/.
|
||||
#
|
||||
# This is not a problem for isolated jobs like "stress" tests that depend
|
||||
# on no other jobs. However, it is a problem for jobs that need other jobs'
|
||||
# artifacts. For example, a system test job that has its Git repo cloned to
|
||||
# the "/1/" sub-path will fail if it downloads build job artifacts that
|
||||
# have ./configure output files with "/0/" in its sub-path recorded.
|
||||
GIT_CLONE_PATH: "/home/ec2-user/builds/${CI_PROJECT_PATH}/"
|
||||
# Use MIT Kerberos5 for BIND 9 GSS-API support because of FreeBSD Heimdal
|
||||
# incompatibility; see https://bugs.freebsd.org/275241.
|
||||
EXTRA_CONFIGURE: "${WITH_READLINE_EDITLINE} --with-gssapi=/usr/local/bin/krb5-config"
|
||||
|
||||
# Autoscaling GitLab Runner on AWS EC2 (FreeBSD 13)
|
||||
|
||||
.freebsd-autoscaler-13-amd64: &freebsd_autoscaler_13_amd64
|
||||
<<: *freebsd_autoscaler_amd64
|
||||
<<: *freebsd_autoscaler_13_amd64_tags
|
||||
|
||||
# Autoscaling GitLab Runner on AWS EC2 (FreeBSD 14)
|
||||
|
||||
.freebsd-autoscaler-14-amd64: &freebsd_autoscaler_14_amd64
|
||||
<<: *freebsd_autoscaler_amd64
|
||||
<<: *freebsd_autoscaler_14_amd64_tags
|
||||
|
||||
### Docker Image Templates
|
||||
|
||||
@@ -253,6 +204,14 @@ stages:
|
||||
|
||||
### QCOW2 Image Templates
|
||||
|
||||
.freebsd-13-amd64: &freebsd_13_amd64_image
|
||||
image: "freebsd-13.4-x86_64"
|
||||
<<: *libvirt_amd64
|
||||
|
||||
.freebsd-14-amd64: &freebsd_14_amd64_image
|
||||
image: "freebsd-14.2-x86_64"
|
||||
<<: *libvirt_amd64
|
||||
|
||||
.openbsd-amd64: &openbsd_amd64_image
|
||||
image: "openbsd-7.6-x86_64"
|
||||
<<: *libvirt_amd64
|
||||
@@ -260,18 +219,31 @@ stages:
|
||||
### Job Templates
|
||||
|
||||
.api-pipelines-schedules-tags-triggers-web-triggering-rules: &api_pipelines_schedules_tags_triggers_web_triggering_rules
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE =~ /^(api|pipeline|schedule|trigger|web)$/'
|
||||
- if: '$CI_COMMIT_TAG != null'
|
||||
only:
|
||||
- api
|
||||
- pipelines
|
||||
- schedules
|
||||
- tags
|
||||
- triggers
|
||||
- web
|
||||
|
||||
.api-pipelines-schedules-triggers-web-triggering-rules: &api_pipelines_schedules_triggers_web_triggering_rules
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE =~ /^(api|pipeline|schedule|trigger|web)$/'
|
||||
only:
|
||||
- api
|
||||
- pipelines
|
||||
- schedules
|
||||
- triggers
|
||||
- web
|
||||
|
||||
.default-triggering-rules: &default_triggering_rules
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE =~ /^(api|merge_request_event|pipeline|schedule|trigger|web)$/'
|
||||
- if: '$CI_COMMIT_TAG != null'
|
||||
only:
|
||||
- api
|
||||
- merge_requests
|
||||
- pipelines
|
||||
- schedules
|
||||
- tags
|
||||
- triggers
|
||||
- web
|
||||
|
||||
.precheck: &precheck_job
|
||||
<<: *default_triggering_rules
|
||||
@@ -371,38 +343,18 @@ stages:
|
||||
|
||||
.shotgun: &shotgun_job
|
||||
<<: *base_image
|
||||
<<: *api_pipelines_schedules_tags_triggers_web_triggering_rules
|
||||
stage: performance
|
||||
rules:
|
||||
- &shotgun_rule_mr
|
||||
if: '$CI_MERGE_REQUEST_DIFF_BASE_SHA != null'
|
||||
variables:
|
||||
BASELINE: '$CI_MERGE_REQUEST_DIFF_BASE_SHA'
|
||||
- &shotgun_rule_tag
|
||||
if: '$CI_COMMIT_TAG != null'
|
||||
variables:
|
||||
SHOTGUN_ROUNDS: 3
|
||||
- &shotgun_rule_other
|
||||
if: '$CI_PIPELINE_SOURCE =~ /^(api|pipeline|schedule|trigger|web)$/'
|
||||
script:
|
||||
- if [ -z "$BASELINE" ]; then export BASELINE=$BIND_BASELINE_VERSION; fi # this dotenv variable can't be set in the rules section, because rules are evaluated before any jobs run
|
||||
- if [ -z "$CI_COMMIT_TAG" ]; then export SHOTGUN_ROUNDS=1; else export SHOTGUN_ROUNDS=3; fi
|
||||
- PIPELINE_ID=$(curl -s -X POST --fail
|
||||
-F "token=$CI_JOB_TOKEN"
|
||||
-F ref=main
|
||||
-F "variables[SHOTGUN_TEST_VERSION]=['$CI_COMMIT_REF_NAME', '$BASELINE']"
|
||||
-F "variables[SHOTGUN_TEST_VERSION]=['$CI_COMMIT_REF_NAME', '$BIND_BASELINE_VERSION']"
|
||||
-F "variables[SHOTGUN_DURATION]=300"
|
||||
-F "variables[SHOTGUN_ROUNDS]=$SHOTGUN_ROUNDS"
|
||||
-F "variables[SHOTGUN_TRAFFIC_MULTIPLIER]=$SHOTGUN_TRAFFIC_MULTIPLIER"
|
||||
-F "variables[SHOTGUN_SCENARIO]=$SHOTGUN_SCENARIO"
|
||||
-F "variables[SHOTGUN_EVAL_THRESHOLD_CPU_MIN]=$SHOTGUN_EVAL_THRESHOLD_CPU_MIN"
|
||||
-F "variables[SHOTGUN_EVAL_THRESHOLD_CPU_MAX]=$SHOTGUN_EVAL_THRESHOLD_CPU_MAX"
|
||||
-F "variables[SHOTGUN_EVAL_THRESHOLD_MEMORY_MIN]=$SHOTGUN_EVAL_THRESHOLD_MEMORY_MIN"
|
||||
-F "variables[SHOTGUN_EVAL_THRESHOLD_MEMORY_MAX]=$SHOTGUN_EVAL_THRESHOLD_MEMORY_MAX"
|
||||
-F "variables[SHOTGUN_EVAL_THRESHOLD_RCODE_MIN]=$SHOTGUN_EVAL_THRESHOLD_RCODE_MIN"
|
||||
-F "variables[SHOTGUN_EVAL_THRESHOLD_RCODE_MAX]=$SHOTGUN_EVAL_THRESHOLD_RCODE_MAX"
|
||||
-F "variables[SHOTGUN_EVAL_THRESHOLD_LATENCY_PCTL_MIN]=$SHOTGUN_EVAL_THRESHOLD_LATENCY_PCTL_MIN"
|
||||
-F "variables[SHOTGUN_EVAL_THRESHOLD_LATENCY_PCTL_MAX]=$SHOTGUN_EVAL_THRESHOLD_LATENCY_PCTL_MAX"
|
||||
-F "variables[SHOTGUN_EVAL_THRESHOLD_LATENCY_PCTL_DRIFT_MIN]=$SHOTGUN_EVAL_THRESHOLD_LATENCY_PCTL_DRIFT_MIN"
|
||||
-F "variables[SHOTGUN_EVAL_THRESHOLD_LATENCY_PCTL_DRIFT_MAX]=$SHOTGUN_EVAL_THRESHOLD_LATENCY_PCTL_DRIFT_MAX"
|
||||
https://gitlab.isc.org/api/v4/projects/188/trigger/pipeline | jq .id)
|
||||
- util/ci-wait-shotgun.py $PIPELINE_ID
|
||||
needs:
|
||||
@@ -559,8 +511,6 @@ misc:
|
||||
- if git grep SYSTEMTESTTOP -- ':!.gitlab-ci.yml'; then echo 'Please use relative paths instead of $SYSTEMTESTTOP.'; exit 1; fi
|
||||
- bash util/unused-headers.sh
|
||||
- bash util/xmllint-html.sh
|
||||
# Check dangling symlinks in the repository
|
||||
- if find . -xtype l | grep .; then exit 1; fi
|
||||
needs: []
|
||||
artifacts:
|
||||
paths:
|
||||
@@ -669,8 +619,9 @@ danger:
|
||||
script:
|
||||
- pip install git+https://gitlab.isc.org/isc-projects/hazard.git
|
||||
- hazard
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
only:
|
||||
refs:
|
||||
- merge_requests
|
||||
|
||||
checkbashisms:
|
||||
<<: *precheck_job
|
||||
@@ -1338,7 +1289,7 @@ gcc:tsan:
|
||||
variables:
|
||||
CC: gcc
|
||||
CFLAGS: "${CFLAGS_COMMON} -Wno-stringop-overread -ggdb -O2 -fsanitize=thread"
|
||||
LDFLAGS: "-fsanitize=thread -Wl,--disable-new-dtags"
|
||||
LDFLAGS: "-fsanitize=thread"
|
||||
EXTRA_CONFIGURE: "--with-libidn2 --enable-pthread-rwlock --without-jemalloc PKG_CONFIG_PATH=/opt/tsan/lib/pkgconfig"
|
||||
<<: *tsan_fedora_41_amd64_image
|
||||
<<: *build_job
|
||||
@@ -1367,8 +1318,7 @@ clang:tsan:
|
||||
variables:
|
||||
CC: "${CLANG}"
|
||||
CFLAGS: "${CFLAGS_COMMON} -ggdb -O2 -fsanitize=thread"
|
||||
# -Wl,--disable-new-dtags ensures that Clang creates valid TSAN reports
|
||||
LDFLAGS: "-fsanitize=thread -Wl,--disable-new-dtags"
|
||||
LDFLAGS: "-fsanitize=thread"
|
||||
EXTRA_CONFIGURE: "--with-libidn2 --enable-pthread-rwlock --without-jemalloc PKG_CONFIG_PATH=/opt/tsan/lib/pkgconfig"
|
||||
|
||||
system:clang:tsan:
|
||||
@@ -1447,19 +1397,27 @@ unit:clang:bookworm:amd64:
|
||||
# Jobs for Clang builds on FreeBSD 13 (amd64)
|
||||
|
||||
clang:freebsd13:amd64:
|
||||
variables:
|
||||
CFLAGS: "${CFLAGS_COMMON}"
|
||||
# Use MIT Kerberos5 for BIND 9 GSS-API support because of FreeBSD Heimdal
|
||||
# incompatibility; see https://bugs.freebsd.org/275241.
|
||||
EXTRA_CONFIGURE: "${WITH_READLINE_LIBEDIT} --with-gssapi=/usr/local/bin/krb5-config"
|
||||
USER: gitlab-runner
|
||||
<<: *freebsd_13_amd64_image
|
||||
<<: *build_job
|
||||
<<: *freebsd_autoscaler_13_amd64
|
||||
|
||||
system:clang:freebsd13:amd64:
|
||||
<<: *freebsd_13_amd64_image
|
||||
<<: *system_test_job
|
||||
<<: *freebsd_autoscaler_13_amd64
|
||||
variables:
|
||||
USER: gitlab-runner
|
||||
needs:
|
||||
- job: clang:freebsd13:amd64
|
||||
artifacts: true
|
||||
|
||||
unit:clang:freebsd13:amd64:
|
||||
<<: *freebsd_13_amd64_image
|
||||
<<: *unit_test_job
|
||||
<<: *freebsd_autoscaler_13_amd64
|
||||
needs:
|
||||
- job: clang:freebsd13:amd64
|
||||
artifacts: true
|
||||
@@ -1467,19 +1425,27 @@ unit:clang:freebsd13:amd64:
|
||||
# Jobs for Clang builds on FreeBSD 14 (amd64)
|
||||
|
||||
clang:freebsd14:amd64:
|
||||
variables:
|
||||
CFLAGS: "${CFLAGS_COMMON}"
|
||||
# Use MIT Kerberos5 for BIND 9 GSS-API support because of FreeBSD Heimdal
|
||||
# incompatibility; see https://bugs.freebsd.org/275241.
|
||||
EXTRA_CONFIGURE: "${WITH_READLINE_EDITLINE} --with-gssapi=/usr/local/bin/krb5-config"
|
||||
USER: gitlab-runner
|
||||
<<: *freebsd_14_amd64_image
|
||||
<<: *build_job
|
||||
<<: *freebsd_autoscaler_14_amd64
|
||||
|
||||
system:clang:freebsd14:amd64:
|
||||
<<: *freebsd_14_amd64_image
|
||||
<<: *system_test_job
|
||||
<<: *freebsd_autoscaler_14_amd64
|
||||
variables:
|
||||
USER: gitlab-runner
|
||||
needs:
|
||||
- job: clang:freebsd14:amd64
|
||||
artifacts: true
|
||||
|
||||
unit:clang:freebsd14:amd64:
|
||||
<<: *freebsd_14_amd64_image
|
||||
<<: *unit_test_job
|
||||
<<: *freebsd_autoscaler_14_amd64
|
||||
needs:
|
||||
- job: clang:freebsd14:amd64
|
||||
artifacts: true
|
||||
@@ -1528,8 +1494,8 @@ release:
|
||||
artifacts: true
|
||||
- job: docs
|
||||
artifacts: true
|
||||
rules:
|
||||
- if: '$CI_COMMIT_TAG != null'
|
||||
only:
|
||||
- tags
|
||||
artifacts:
|
||||
paths:
|
||||
- "*-release"
|
||||
@@ -1572,8 +1538,8 @@ sign:
|
||||
needs:
|
||||
- job: release
|
||||
artifacts: true
|
||||
rules:
|
||||
- if: '$CI_COMMIT_TAG != null'
|
||||
only:
|
||||
- tags
|
||||
when: manual
|
||||
allow_failure: false
|
||||
|
||||
@@ -1625,8 +1591,10 @@ coverity:
|
||||
- cov-int.tar.gz
|
||||
expire_in: "1 week"
|
||||
when: on_failure
|
||||
rules:
|
||||
- if: '$COVERITY_SCAN_PROJECT_NAME != null && $COVERITY_SCAN_TOKEN != null'
|
||||
only:
|
||||
variables:
|
||||
- $COVERITY_SCAN_PROJECT_NAME
|
||||
- $COVERITY_SCAN_TOKEN
|
||||
|
||||
# Respdiff tests
|
||||
|
||||
@@ -1661,9 +1629,9 @@ respdiff:tsan:
|
||||
<<: *default_triggering_rules
|
||||
<<: *tsan_debian_bookworm_amd64_image
|
||||
variables:
|
||||
CC: "${CLANG}"
|
||||
CFLAGS: "${CFLAGS_COMMON} -ggdb -O2 -fsanitize=thread"
|
||||
LDFLAGS: "-fsanitize=thread -Wl,--disable-new-dtags"
|
||||
CC: gcc
|
||||
CFLAGS: "${CFLAGS_COMMON} -Og -fsanitize=thread"
|
||||
LDFLAGS: "-fsanitize=thread"
|
||||
EXTRA_CONFIGURE: "--enable-pthread-rwlock --without-jemalloc PKG_CONFIG_PATH=/opt/tsan/lib/pkgconfig"
|
||||
MAX_DISAGREEMENTS_PERCENTAGE: "0.15"
|
||||
TSAN_OPTIONS: "${TSAN_OPTIONS_DEBIAN}"
|
||||
@@ -1702,28 +1670,24 @@ shotgun:tcp:
|
||||
variables:
|
||||
SHOTGUN_SCENARIO: tcp
|
||||
SHOTGUN_TRAFFIC_MULTIPLIER: 13
|
||||
when: delayed
|
||||
start_in: 5 minutes
|
||||
|
||||
shotgun:dot:
|
||||
<<: *shotgun_job
|
||||
variables:
|
||||
SHOTGUN_SCENARIO: dot
|
||||
SHOTGUN_TRAFFIC_MULTIPLIER: 6
|
||||
rules: &shotgun_rules_manual_mr
|
||||
- if: '$CI_MERGE_REQUEST_DIFF_BASE_SHA != null'
|
||||
variables:
|
||||
BASELINE: '$CI_MERGE_REQUEST_DIFF_BASE_SHA'
|
||||
when: manual # don't run on each MR unless requested
|
||||
allow_failure: true
|
||||
- *shotgun_rule_tag
|
||||
- *shotgun_rule_other
|
||||
when: delayed
|
||||
start_in: 5 minutes
|
||||
|
||||
shotgun:doh-get:
|
||||
<<: *shotgun_job
|
||||
variables:
|
||||
SHOTGUN_SCENARIO: doh-get
|
||||
SHOTGUN_TRAFFIC_MULTIPLIER: 3
|
||||
SHOTGUN_EVAL_THRESHOLD_LATENCY_PCTL_MAX: 0.3 # bump from the default due to increased tail-end jitter
|
||||
rules: *shotgun_rules_manual_mr
|
||||
when: delayed
|
||||
start_in: 5 minutes
|
||||
|
||||
.stress-test: &stress_test
|
||||
stage: performance
|
||||
@@ -1762,8 +1726,8 @@ fsck:
|
||||
- git clone https://gitlab.isc.org/isc-projects/bind9.git bind9-full-clone
|
||||
- cd bind9-full-clone/
|
||||
- git fsck
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
||||
only:
|
||||
- schedules
|
||||
needs: []
|
||||
|
||||
gcov:
|
||||
@@ -1815,8 +1779,9 @@ pairwise:
|
||||
- pairwise-model.txt
|
||||
- pairwise-output.*.txt
|
||||
when: on_failure
|
||||
rules:
|
||||
- if: '$PAIRWISE_TESTING != null'
|
||||
only:
|
||||
variables:
|
||||
- $PAIRWISE_TESTING
|
||||
|
||||
.post_merge_template: &post_merge
|
||||
<<: *base_image
|
||||
|
||||
@@ -761,7 +761,7 @@ cleanup:
|
||||
}
|
||||
|
||||
if (mctx != NULL) {
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
}
|
||||
|
||||
return result == ISC_R_SUCCESS ? 0 : 1;
|
||||
|
||||
@@ -577,7 +577,7 @@ main(int argc, char **argv) {
|
||||
fprintf(errout, "OK\n");
|
||||
}
|
||||
destroy();
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return (result == ISC_R_SUCCESS) ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ options {\n\
|
||||
isc_mem_stats(mctx, stderr);
|
||||
}
|
||||
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ nsupdate -k <keyfile>\n");
|
||||
isc_mem_stats(mctx, stderr);
|
||||
}
|
||||
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+36
-2
@@ -26,12 +26,16 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <openssl/opensslv.h>
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/provider.h>
|
||||
#endif
|
||||
|
||||
#include <isc/async.h>
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/base64.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/crypto.h>
|
||||
#include <isc/fips.h>
|
||||
#include <isc/hex.h>
|
||||
#include <isc/lib.h>
|
||||
#include <isc/log.h>
|
||||
@@ -163,6 +167,10 @@ static dns_fixedname_t qfn;
|
||||
/* Default trust anchors */
|
||||
static char anchortext[] = TRUST_ANCHORS;
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
static OSSL_PROVIDER *fips = NULL, *base = NULL;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Static function prototypes
|
||||
*/
|
||||
@@ -1611,7 +1619,24 @@ preparse_args(int argc, char **argv) {
|
||||
while (strpbrk(option, single_dash_opts) == &option[0]) {
|
||||
switch (option[0]) {
|
||||
case 'F':
|
||||
if (isc_crypto_fips_enable() != ISC_R_SUCCESS) {
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
fips = OSSL_PROVIDER_load(NULL, "fips");
|
||||
if (fips == NULL) {
|
||||
ERR_clear_error();
|
||||
fatal("Failed to load FIPS provider");
|
||||
}
|
||||
base = OSSL_PROVIDER_load(NULL, "base");
|
||||
if (base == NULL) {
|
||||
OSSL_PROVIDER_unload(fips);
|
||||
ERR_clear_error();
|
||||
fatal("Failed to load base provider");
|
||||
}
|
||||
#endif
|
||||
/* Already in FIPS mode? */
|
||||
if (isc_fips_mode()) {
|
||||
break;
|
||||
}
|
||||
if (isc_fips_set_mode(1) != ISC_R_SUCCESS) {
|
||||
fatal("setting FIPS mode failed");
|
||||
}
|
||||
break;
|
||||
@@ -2284,5 +2309,14 @@ cleanup:
|
||||
|
||||
isc_managers_destroy(&mctx, &loopmgr, &netmgr);
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
if (base != NULL) {
|
||||
OSSL_PROVIDER_unload(base);
|
||||
}
|
||||
if (fips != NULL) {
|
||||
OSSL_PROVIDER_unload(fips);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+36
-2
@@ -20,8 +20,8 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/crypto.h>
|
||||
#include <isc/dir.h>
|
||||
#include <isc/fips.h>
|
||||
#include <isc/lib.h>
|
||||
#include <isc/loop.h>
|
||||
#include <isc/netaddr.h>
|
||||
@@ -73,6 +73,14 @@ static bool short_form = false, printcmd = true, plusquest = false,
|
||||
static uint32_t splitwidth = 0xffffffff;
|
||||
|
||||
#include <openssl/opensslv.h>
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/provider.h>
|
||||
#endif
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
static OSSL_PROVIDER *fips = NULL, *base = NULL;
|
||||
#endif
|
||||
|
||||
/*% opcode text */
|
||||
static const char *const opcodetext[] = {
|
||||
@@ -2923,7 +2931,24 @@ preparse_args(int argc, char **argv) {
|
||||
debugging = true;
|
||||
break;
|
||||
case 'F':
|
||||
if (isc_crypto_fips_enable() != ISC_R_SUCCESS) {
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
fips = OSSL_PROVIDER_load(NULL, "fips");
|
||||
if (fips == NULL) {
|
||||
ERR_clear_error();
|
||||
fatal("Failed to load FIPS provider");
|
||||
}
|
||||
base = OSSL_PROVIDER_load(NULL, "base");
|
||||
if (base == NULL) {
|
||||
OSSL_PROVIDER_unload(fips);
|
||||
ERR_clear_error();
|
||||
fatal("Failed to load base provider");
|
||||
}
|
||||
#endif
|
||||
/* Already in FIPS mode? */
|
||||
if (isc_fips_mode()) {
|
||||
break;
|
||||
}
|
||||
if (isc_fips_set_mode(1) != ISC_R_SUCCESS) {
|
||||
fatal("setting FIPS mode failed");
|
||||
}
|
||||
break;
|
||||
@@ -3451,5 +3476,14 @@ main(int argc, char **argv) {
|
||||
dig_startup();
|
||||
dig_shutdown();
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
if (base != NULL) {
|
||||
OSSL_PROVIDER_unload(base);
|
||||
}
|
||||
if (fips != NULL) {
|
||||
OSSL_PROVIDER_unload(fips);
|
||||
}
|
||||
#endif
|
||||
|
||||
return exitcode;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/condition.h>
|
||||
#include <isc/lib.h>
|
||||
#include <isc/loop.h>
|
||||
#include <isc/netaddr.h>
|
||||
|
||||
@@ -41,14 +41,6 @@ dnssec_keygen_LDADD = \
|
||||
$(LDADD) \
|
||||
$(OPENSSL_LIBS)
|
||||
|
||||
dnssec_ksr_CPPFLAGS= \
|
||||
$(AM_CPPFLAGS) \
|
||||
$(OPENSSL_CFLAGS)
|
||||
|
||||
dnssec_ksr_LDADD = \
|
||||
$(LDADD) \
|
||||
$(OPENSSL_LIBS)
|
||||
|
||||
dnssec_signzone_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) \
|
||||
$(OPENSSL_CFLAGS)
|
||||
|
||||
@@ -1075,7 +1075,7 @@ cleanup(void) {
|
||||
if (print_mem_stats && verbose > 10) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -543,7 +543,7 @@ main(int argc, char **argv) {
|
||||
if (verbose > 10) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
fflush(stdout);
|
||||
if (ferror(stdout)) {
|
||||
|
||||
@@ -456,7 +456,7 @@ main(int argc, char **argv) {
|
||||
if (verbose > 10) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
fflush(stdout);
|
||||
if (ferror(stdout)) {
|
||||
|
||||
@@ -746,7 +746,7 @@ main(int argc, char **argv) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
isc_mem_free(mctx, label);
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
if (freeit != NULL) {
|
||||
free(freeit);
|
||||
|
||||
+47
-11
@@ -38,7 +38,7 @@
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/crypto.h>
|
||||
#include <isc/fips.h>
|
||||
#include <isc/lib.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/mem.h>
|
||||
@@ -58,6 +58,11 @@
|
||||
|
||||
#include <dst/dst.h>
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/provider.h>
|
||||
#endif
|
||||
|
||||
#include "dnssectool.h"
|
||||
|
||||
const char *program = "dnssec-keygen";
|
||||
@@ -146,7 +151,7 @@ usage(void) {
|
||||
fprintf(stderr, " -l <file>: configuration file with dnssec-policy "
|
||||
"statement\n");
|
||||
fprintf(stderr, " -a <algorithm>:\n");
|
||||
if (!isc_crypto_fips_mode()) {
|
||||
if (!isc_fips_mode()) {
|
||||
fprintf(stderr, " RSASHA1 | NSEC3RSASHA1 |\n");
|
||||
}
|
||||
fprintf(stderr, " RSASHA256 | RSASHA512 |\n");
|
||||
@@ -154,7 +159,7 @@ usage(void) {
|
||||
fprintf(stderr, " ED25519 | ED448\n");
|
||||
fprintf(stderr, " -3: use NSEC3-capable algorithm\n");
|
||||
fprintf(stderr, " -b <key size in bits>:\n");
|
||||
if (!isc_crypto_fips_mode()) {
|
||||
if (!isc_fips_mode()) {
|
||||
fprintf(stderr, " RSASHA1:\t[%d..%d]\n", min_rsa,
|
||||
MAX_RSA);
|
||||
fprintf(stderr, " NSEC3RSASHA1:\t[%d..%d]\n", min_rsa,
|
||||
@@ -283,7 +288,7 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
|
||||
fatal("unsupported algorithm: %s", algstr);
|
||||
}
|
||||
|
||||
if (isc_crypto_fips_mode()) {
|
||||
if (isc_fips_mode()) {
|
||||
/* verify only in FIPS mode */
|
||||
switch (ctx->alg) {
|
||||
case DST_ALG_RSASHA1:
|
||||
@@ -336,7 +341,7 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
|
||||
switch (ctx->alg) {
|
||||
case DST_ALG_RSASHA1:
|
||||
case DST_ALG_NSEC3RSASHA1:
|
||||
if (isc_crypto_fips_mode()) {
|
||||
if (isc_fips_mode()) {
|
||||
fatal("key size not specified (-b "
|
||||
"option)");
|
||||
}
|
||||
@@ -496,7 +501,7 @@ keygen(keygen_ctx_t *ctx, isc_mem_t *mctx, int argc, char **argv) {
|
||||
switch (ctx->alg) {
|
||||
case DNS_KEYALG_RSASHA1:
|
||||
case DNS_KEYALG_NSEC3RSASHA1:
|
||||
if (isc_crypto_fips_mode()) {
|
||||
if (isc_fips_mode()) {
|
||||
fatal("SHA1 based keys not supported in FIPS mode");
|
||||
}
|
||||
FALLTHROUGH;
|
||||
@@ -842,6 +847,10 @@ main(int argc, char **argv) {
|
||||
isc_textregion_t r;
|
||||
unsigned char c;
|
||||
int ch;
|
||||
bool set_fips_mode = false;
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
OSSL_PROVIDER *fips = NULL, *base = NULL;
|
||||
#endif
|
||||
|
||||
keygen_ctx_t ctx = {
|
||||
.options = DST_TYPE_PRIVATE | DST_TYPE_PUBLIC,
|
||||
@@ -1100,9 +1109,7 @@ main(int argc, char **argv) {
|
||||
ctx.prepub = strtottl(isc_commandline_argument);
|
||||
break;
|
||||
case 'F':
|
||||
if (isc_crypto_fips_enable() != ISC_R_SUCCESS) {
|
||||
fatal("setting FIPS mode failed");
|
||||
}
|
||||
set_fips_mode = true;
|
||||
break;
|
||||
case '?':
|
||||
if (isc_commandline_option != '?') {
|
||||
@@ -1129,11 +1136,32 @@ main(int argc, char **argv) {
|
||||
ctx.quiet = true;
|
||||
}
|
||||
|
||||
if (set_fips_mode) {
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
fips = OSSL_PROVIDER_load(NULL, "fips");
|
||||
if (fips == NULL) {
|
||||
ERR_clear_error();
|
||||
fatal("Failed to load FIPS provider");
|
||||
}
|
||||
base = OSSL_PROVIDER_load(NULL, "base");
|
||||
if (base == NULL) {
|
||||
OSSL_PROVIDER_unload(fips);
|
||||
ERR_clear_error();
|
||||
fatal("Failed to load base provider");
|
||||
}
|
||||
#endif
|
||||
if (!isc_fips_mode()) {
|
||||
if (isc_fips_set_mode(1) != ISC_R_SUCCESS) {
|
||||
fatal("setting FIPS mode failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The DST subsystem will set FIPS mode if requested at build time.
|
||||
* The minimum sizes are both raised to 2048.
|
||||
*/
|
||||
if (isc_crypto_fips_mode()) {
|
||||
if (isc_fips_mode()) {
|
||||
min_rsa = min_dh = 2048;
|
||||
}
|
||||
|
||||
@@ -1280,8 +1308,16 @@ main(int argc, char **argv) {
|
||||
if (verbose > 10) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
if (base != NULL) {
|
||||
OSSL_PROVIDER_unload(base);
|
||||
}
|
||||
if (fips != NULL) {
|
||||
OSSL_PROVIDER_unload(fips);
|
||||
}
|
||||
#endif
|
||||
if (freeit != NULL) {
|
||||
free(freeit);
|
||||
}
|
||||
|
||||
+27
-6
@@ -18,7 +18,7 @@
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/crypto.h>
|
||||
#include <isc/fips.h>
|
||||
#include <isc/lex.h>
|
||||
#include <isc/lib.h>
|
||||
#include <isc/mem.h>
|
||||
@@ -362,7 +362,7 @@ create_key(ksr_ctx_t *ksr, dns_kasp_t *kasp, dns_kasp_key_t *kaspkey,
|
||||
switch (ksr->alg) {
|
||||
case DST_ALG_RSASHA1:
|
||||
case DST_ALG_NSEC3RSASHA1:
|
||||
if (isc_crypto_fips_mode()) {
|
||||
if (isc_fips_mode()) {
|
||||
/* verify-only in FIPS mode */
|
||||
fatal("unsupported algorithm: %s", algstr);
|
||||
}
|
||||
@@ -1348,6 +1348,10 @@ main(int argc, char *argv[]) {
|
||||
isc_buffer_t buf;
|
||||
int ch;
|
||||
char *endp;
|
||||
bool set_fips_mode = false;
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
OSSL_PROVIDER *fips = NULL, *base = NULL;
|
||||
#endif
|
||||
ksr_ctx_t ksr = {
|
||||
.now = isc_stdtime_now(),
|
||||
};
|
||||
@@ -1367,9 +1371,7 @@ main(int argc, char *argv[]) {
|
||||
ksr.now, &ksr.setend);
|
||||
break;
|
||||
case 'F':
|
||||
if (isc_crypto_fips_enable() != ISC_R_SUCCESS) {
|
||||
fatal("setting FIPS mode failed");
|
||||
}
|
||||
set_fips_mode = true;
|
||||
break;
|
||||
case 'f':
|
||||
ksr.file = isc_commandline_argument;
|
||||
@@ -1423,12 +1425,31 @@ main(int argc, char *argv[]) {
|
||||
* The DST subsystem will set FIPS mode if requested at build time.
|
||||
* The minimum sizes are both raised to 2048.
|
||||
*/
|
||||
if (isc_crypto_fips_mode()) {
|
||||
if (isc_fips_mode()) {
|
||||
min_rsa = min_dh = 2048;
|
||||
}
|
||||
|
||||
setup_logging();
|
||||
|
||||
if (set_fips_mode) {
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
fips = OSSL_PROVIDER_load(NULL, "fips");
|
||||
if (fips == NULL) {
|
||||
fatal("Failed to load FIPS provider");
|
||||
}
|
||||
base = OSSL_PROVIDER_load(NULL, "base");
|
||||
if (base == NULL) {
|
||||
OSSL_PROVIDER_unload(fips);
|
||||
fatal("Failed to load base provider");
|
||||
}
|
||||
#endif
|
||||
if (!isc_fips_mode()) {
|
||||
if (isc_fips_set_mode(1) != ISC_R_SUCCESS) {
|
||||
fatal("setting FIPS mode failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* zone */
|
||||
namestr = argv[1];
|
||||
name = dns_fixedname_initname(&fname);
|
||||
|
||||
@@ -248,7 +248,7 @@ cleanup:
|
||||
if (dir != NULL) {
|
||||
isc_mem_free(mctx, dir);
|
||||
}
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -949,7 +949,7 @@ main(int argc, char **argv) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
isc_mem_free(mctx, directory);
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/dir.h>
|
||||
#include <isc/file.h>
|
||||
#include <isc/fips.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/hex.h>
|
||||
#include <isc/lib.h>
|
||||
@@ -89,6 +90,10 @@
|
||||
#include <dns/zoneverify.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/provider.h>
|
||||
#endif
|
||||
|
||||
#include "dnssectool.h"
|
||||
|
||||
@@ -3375,6 +3380,10 @@ main(int argc, char *argv[]) {
|
||||
bool set_optout = false;
|
||||
bool set_iter = false;
|
||||
bool nonsecify = false;
|
||||
bool set_fips_mode = false;
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
OSSL_PROVIDER *fips = NULL, *base = NULL;
|
||||
#endif
|
||||
|
||||
atomic_init(&shuttingdown, false);
|
||||
atomic_init(&finished, false);
|
||||
@@ -3663,9 +3672,7 @@ main(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
if (isc_crypto_fips_enable() != ISC_R_SUCCESS) {
|
||||
fatal("setting FIPS mode failed");
|
||||
}
|
||||
set_fips_mode = true;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
@@ -3736,6 +3743,27 @@ main(int argc, char *argv[]) {
|
||||
|
||||
isc_managers_create(&mctx, nloops, &loopmgr, &netmgr);
|
||||
|
||||
if (set_fips_mode) {
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
fips = OSSL_PROVIDER_load(NULL, "fips");
|
||||
if (fips == NULL) {
|
||||
ERR_clear_error();
|
||||
fatal("Failed to load FIPS provider");
|
||||
}
|
||||
base = OSSL_PROVIDER_load(NULL, "base");
|
||||
if (base == NULL) {
|
||||
OSSL_PROVIDER_unload(fips);
|
||||
ERR_clear_error();
|
||||
fatal("Failed to load base provider");
|
||||
}
|
||||
#endif
|
||||
if (!isc_fips_mode()) {
|
||||
if (isc_fips_set_mode(1) != ISC_R_SUCCESS) {
|
||||
fatal("setting FIPS mode failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setup_logging();
|
||||
|
||||
argc -= isc_commandline_index;
|
||||
@@ -4107,6 +4135,15 @@ main(int argc, char *argv[]) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
if (base != NULL) {
|
||||
OSSL_PROVIDER_unload(base);
|
||||
}
|
||||
if (fips != NULL) {
|
||||
OSSL_PROVIDER_unload(fips);
|
||||
}
|
||||
#endif
|
||||
|
||||
isc_managers_destroy(&mctx, &loopmgr, &netmgr);
|
||||
|
||||
if (printstats) {
|
||||
|
||||
@@ -330,7 +330,7 @@ main(int argc, char *argv[]) {
|
||||
if (verbose > 10) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return result == ISC_R_SUCCESS ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/condition.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/loop.h>
|
||||
#include <isc/mutex.h>
|
||||
|
||||
@@ -86,6 +86,7 @@ EXTERN named_server_t *named_g_server INIT(NULL);
|
||||
/*
|
||||
* Logging.
|
||||
*/
|
||||
EXTERN bool named_g_logging INIT(false);
|
||||
EXTERN unsigned int named_g_debuglevel INIT(0);
|
||||
|
||||
/*
|
||||
|
||||
@@ -52,6 +52,8 @@ named_log_init(bool safe) {
|
||||
named_log_setdefaultsslkeylogfile(lcfg);
|
||||
rcu_read_unlock();
|
||||
|
||||
named_g_logging = true;
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
|
||||
cleanup:
|
||||
|
||||
+110
-37
@@ -30,6 +30,7 @@
|
||||
#include <isc/crypto.h>
|
||||
#include <isc/dir.h>
|
||||
#include <isc/file.h>
|
||||
#include <isc/fips.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/httpd.h>
|
||||
#include <isc/lib.h>
|
||||
@@ -90,6 +91,10 @@
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/opensslv.h>
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/provider.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIBXML2
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
@@ -150,13 +155,24 @@ static bool transferstuck = false;
|
||||
static bool disable6 = false;
|
||||
static bool disable4 = false;
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
static OSSL_PROVIDER *fips = NULL, *base = NULL;
|
||||
#endif
|
||||
|
||||
void
|
||||
named_main_earlywarning(const char *format, ...) {
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
isc_log_vwrite(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_WARNING, format, args);
|
||||
if (named_g_logging) {
|
||||
isc_log_vwrite(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_WARNING, format, args);
|
||||
} else {
|
||||
fprintf(stderr, "%s: ", program_name);
|
||||
vfprintf(stderr, format, args);
|
||||
fprintf(stderr, "\n");
|
||||
fflush(stderr);
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
@@ -165,10 +181,18 @@ named_main_earlyfatal(const char *format, ...) {
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
isc_log_vwrite(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_CRITICAL, format, args);
|
||||
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_CRITICAL, "exiting (due to early fatal error)");
|
||||
if (named_g_logging) {
|
||||
isc_log_vwrite(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_CRITICAL, format, args);
|
||||
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_CRITICAL,
|
||||
"exiting (due to early fatal error)");
|
||||
} else {
|
||||
fprintf(stderr, "%s: ", program_name);
|
||||
vfprintf(stderr, format, args);
|
||||
fprintf(stderr, "\n");
|
||||
fflush(stderr);
|
||||
}
|
||||
va_end(args);
|
||||
|
||||
_exit(EXIT_FAILURE);
|
||||
@@ -185,19 +209,26 @@ assertion_failed(const char *file, int line, isc_assertiontype_t type,
|
||||
* Handle assertion failures.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Reset the assertion callback in case it is the log
|
||||
* routines causing the assertion.
|
||||
*/
|
||||
isc_assertion_setcallback(NULL);
|
||||
if (named_g_logging) {
|
||||
/*
|
||||
* Reset the assertion callback in case it is the log
|
||||
* routines causing the assertion.
|
||||
*/
|
||||
isc_assertion_setcallback(NULL);
|
||||
|
||||
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_CRITICAL, "%s:%d: %s(%s) failed", file, line,
|
||||
isc_assertion_typetotext(type), cond);
|
||||
isc_backtrace_log(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_CRITICAL);
|
||||
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_CRITICAL, "exiting (due to assertion failure)");
|
||||
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_CRITICAL, "%s:%d: %s(%s) failed", file,
|
||||
line, isc_assertion_typetotext(type), cond);
|
||||
isc_backtrace_log(NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_MAIN, ISC_LOG_CRITICAL);
|
||||
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_CRITICAL,
|
||||
"exiting (due to assertion failure)");
|
||||
} else {
|
||||
fprintf(stderr, "%s:%d: %s(%s) failed\n", file, line,
|
||||
isc_assertion_typetotext(type), cond);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
if (named_g_coreok) {
|
||||
abort();
|
||||
@@ -216,20 +247,27 @@ library_fatal_error(const char *file, int line, const char *func,
|
||||
* Handle isc_error_fatal() calls from our libraries.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Reset the error callback in case it is the log
|
||||
* routines causing the assertion.
|
||||
*/
|
||||
isc_error_setfatal(NULL);
|
||||
if (named_g_logging) {
|
||||
/*
|
||||
* Reset the error callback in case it is the log
|
||||
* routines causing the assertion.
|
||||
*/
|
||||
isc_error_setfatal(NULL);
|
||||
|
||||
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_CRITICAL, "%s:%d:%s(): fatal error: ", file, line,
|
||||
func);
|
||||
isc_log_vwrite(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_CRITICAL, format, args);
|
||||
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_CRITICAL,
|
||||
"exiting (due to fatal error in library)");
|
||||
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_CRITICAL,
|
||||
"%s:%d:%s(): fatal error: ", file, line, func);
|
||||
isc_log_vwrite(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_CRITICAL, format, args);
|
||||
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_CRITICAL,
|
||||
"exiting (due to fatal error in library)");
|
||||
} else {
|
||||
fprintf(stderr, "%s:%d:%s(): fatal error: ", file, line, func);
|
||||
vfprintf(stderr, format, args);
|
||||
fprintf(stderr, "\n");
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
if (named_g_coreok) {
|
||||
abort();
|
||||
@@ -249,11 +287,19 @@ library_unexpected_error(const char *file, int line, const char *func,
|
||||
* Handle isc_error_unexpected() calls from our libraries.
|
||||
*/
|
||||
|
||||
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_ERROR, "%s:%d:%s(): unexpected error: ", file,
|
||||
line, func);
|
||||
isc_log_vwrite(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_ERROR, format, args);
|
||||
if (named_g_logging) {
|
||||
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_ERROR,
|
||||
"%s:%d:%s(): unexpected error: ", file, line,
|
||||
func);
|
||||
isc_log_vwrite(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN,
|
||||
ISC_LOG_ERROR, format, args);
|
||||
} else {
|
||||
fprintf(stderr, "%s:%d:%s(): fatal error: ", file, line, func);
|
||||
vfprintf(stderr, format, args);
|
||||
fprintf(stderr, "\n");
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -906,7 +952,25 @@ parse_command_line(int argc, char *argv[]) {
|
||||
named_main_earlyfatal("option '-X' has been removed");
|
||||
break;
|
||||
case 'F':
|
||||
if (isc_crypto_fips_enable() != ISC_R_SUCCESS) {
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
fips = OSSL_PROVIDER_load(NULL, "fips");
|
||||
if (fips == NULL) {
|
||||
ERR_clear_error();
|
||||
named_main_earlyfatal(
|
||||
"Failed to load FIPS provider");
|
||||
}
|
||||
base = OSSL_PROVIDER_load(NULL, "base");
|
||||
if (base == NULL) {
|
||||
OSSL_PROVIDER_unload(fips);
|
||||
ERR_clear_error();
|
||||
named_main_earlyfatal(
|
||||
"Failed to load base provider");
|
||||
}
|
||||
#endif
|
||||
if (isc_fips_mode()) { /* Already in FIPS mode. */
|
||||
break;
|
||||
}
|
||||
if (isc_fips_set_mode(1) != ISC_R_SUCCESS) {
|
||||
named_main_earlyfatal(
|
||||
"setting FIPS mode failed");
|
||||
}
|
||||
@@ -1510,6 +1574,15 @@ main(int argc, char *argv[]) {
|
||||
|
||||
named_os_shutdown();
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
if (base != NULL) {
|
||||
OSSL_PROVIDER_unload(base);
|
||||
}
|
||||
if (fips != NULL) {
|
||||
OSSL_PROVIDER_unload(fips);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GPERFTOOLS_PROFILER
|
||||
ProfilerStop();
|
||||
#endif /* ifdef HAVE_GPERFTOOLS_PROFILER */
|
||||
|
||||
+2
-1
@@ -38,6 +38,7 @@
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/dir.h>
|
||||
#include <isc/file.h>
|
||||
#include <isc/fips.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/hex.h>
|
||||
#include <isc/hmac.h>
|
||||
@@ -9376,7 +9377,7 @@ view_loaded(void *arg) {
|
||||
|
||||
isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
|
||||
ISC_LOG_NOTICE, "FIPS mode is %s",
|
||||
isc_crypto_fips_mode() ? "enabled" : "disabled");
|
||||
isc_fips_mode() ? "enabled" : "disabled");
|
||||
|
||||
#if HAVE_LIBSYSTEMD
|
||||
sd_notifyf(0,
|
||||
|
||||
@@ -1617,13 +1617,9 @@ xfrin_xmlrender(dns_zone_t *zone, void *arg) {
|
||||
isc_sockaddr_format(addrp, addr_buf, sizeof(addr_buf));
|
||||
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR addr_buf));
|
||||
} else if (is_presoa) {
|
||||
if (dns_zone_getprimaryaddr(zone, &addr) == ISC_R_SUCCESS) {
|
||||
isc_sockaddr_format(&addr, addr_buf, sizeof(addr_buf));
|
||||
TRY0(xmlTextWriterWriteString(writer,
|
||||
ISC_XMLCHAR addr_buf));
|
||||
} else {
|
||||
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR "-"));
|
||||
}
|
||||
addr = dns_zone_getprimaryaddr(zone);
|
||||
isc_sockaddr_format(&addr, addr_buf, sizeof(addr_buf));
|
||||
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR addr_buf));
|
||||
} else {
|
||||
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR "-"));
|
||||
}
|
||||
@@ -2675,15 +2671,10 @@ xfrin_jsonrender(dns_zone_t *zone, void *arg) {
|
||||
json_object_object_add(xfrinobj, "remoteaddr",
|
||||
json_object_new_string(addr_buf));
|
||||
} else if (is_presoa) {
|
||||
if (dns_zone_getprimaryaddr(zone, &addr) == ISC_R_SUCCESS) {
|
||||
isc_sockaddr_format(&addr, addr_buf, sizeof(addr_buf));
|
||||
json_object_object_add(
|
||||
xfrinobj, "remoteaddr",
|
||||
json_object_new_string(addr_buf));
|
||||
} else {
|
||||
json_object_object_add(xfrinobj, "remoteaddr",
|
||||
json_object_new_string("-"));
|
||||
}
|
||||
addr = dns_zone_getprimaryaddr(zone);
|
||||
isc_sockaddr_format(&addr, addr_buf, sizeof(addr_buf));
|
||||
json_object_object_add(xfrinobj, "remoteaddr",
|
||||
json_object_new_string(addr_buf));
|
||||
} else {
|
||||
json_object_object_add(xfrinobj, "remoteaddr",
|
||||
json_object_new_string("-"));
|
||||
|
||||
@@ -140,7 +140,6 @@ TESTS = \
|
||||
redirect \
|
||||
resolver \
|
||||
rndc \
|
||||
rollover \
|
||||
rootkeysentinel \
|
||||
rpzextra \
|
||||
rrchecker \
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <openssl/provider.h>
|
||||
#endif
|
||||
|
||||
#include <isc/crypto.h>
|
||||
#include <isc/fips.h>
|
||||
#include <isc/lib.h>
|
||||
#include <isc/md.h>
|
||||
#include <isc/mem.h>
|
||||
@@ -134,7 +134,7 @@ main(int argc, char **argv) {
|
||||
return 1;
|
||||
#endif
|
||||
#else
|
||||
if (isc_crypto_fips_mode()) {
|
||||
if (isc_fips_mode()) {
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
return 0;
|
||||
#else
|
||||
@@ -149,7 +149,7 @@ main(int argc, char **argv) {
|
||||
#if defined(ENABLE_FIPS_MODE)
|
||||
return 0;
|
||||
#else
|
||||
return isc_crypto_fips_mode() ? 0 : 1;
|
||||
return isc_fips_mode() ? 0 : 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
import difflib
|
||||
import shutil
|
||||
from typing import Optional
|
||||
|
||||
@@ -98,28 +97,6 @@ def zones_equal(
|
||||
assert found_rdataset.ttl == rdataset.ttl
|
||||
|
||||
|
||||
def zone_contains(
|
||||
zone: dns.zone.Zone, rrset: dns.rrset.RRset, compare_ttl=False
|
||||
) -> bool:
|
||||
"""Check if a zone contains RRset"""
|
||||
|
||||
def compare_rrs(rr1, rrset):
|
||||
rr2 = next((other_rr for other_rr in rrset if rr1 == other_rr), None)
|
||||
if rr2 is None:
|
||||
return False
|
||||
if compare_ttl:
|
||||
return rr1.ttl == rr2.ttl
|
||||
return True
|
||||
|
||||
for _, node in zone.nodes.items():
|
||||
for rdataset in node:
|
||||
for rr in rdataset:
|
||||
if compare_rrs(rr, rrset):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def is_executable(cmd: str, errmsg: str) -> None:
|
||||
executable = shutil.which(cmd)
|
||||
assert executable is not None, errmsg
|
||||
@@ -151,32 +128,3 @@ def is_response_to(response: dns.message.Message, query: dns.message.Message) ->
|
||||
single_question(response)
|
||||
single_question(query)
|
||||
assert query.is_response(response), str(response)
|
||||
|
||||
|
||||
def file_contents_contain(file, substr):
|
||||
with open(file, "r", encoding="utf-8") as fp:
|
||||
for line in fp:
|
||||
if f"{substr}" in line:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def file_contents_equal(file1, file2):
|
||||
def normalize_line(line):
|
||||
# remove trailing&leading whitespace and replace multiple whitespaces
|
||||
return " ".join(line.split())
|
||||
|
||||
def read_lines(file_path):
|
||||
with open(file_path, "r", encoding="utf-8") as file:
|
||||
return [normalize_line(line) for line in file.readlines()]
|
||||
|
||||
lines1 = read_lines(file1)
|
||||
lines2 = read_lines(file2)
|
||||
|
||||
differ = difflib.Differ()
|
||||
diff = differ.compare(lines1, lines2)
|
||||
|
||||
for line in diff:
|
||||
assert not line.startswith("+ ") and not line.startswith(
|
||||
"- "
|
||||
), f'file contents of "{file1}" and "{file2}" differ'
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -89,6 +89,13 @@ zone "unlimited.kasp" {
|
||||
dnssec-policy "unlimited";
|
||||
};
|
||||
|
||||
/* Manual rollover. */
|
||||
zone "manual-rollover.kasp" {
|
||||
type primary;
|
||||
file "manual-rollover.kasp.db";
|
||||
dnssec-policy "manual-rollover";
|
||||
};
|
||||
|
||||
/* A zone that inherits dnssec-policy. */
|
||||
zone "inherit.kasp" {
|
||||
type primary;
|
||||
@@ -204,6 +211,25 @@ zone "rumoured.kasp" {
|
||||
dnssec-policy "rsasha256";
|
||||
};
|
||||
|
||||
/* RFC 8901 Multi-signer Model 2. */
|
||||
zone "multisigner-model2.kasp" {
|
||||
type primary;
|
||||
file "multisigner-model2.kasp.db";
|
||||
dnssec-policy "multisigner-model2";
|
||||
allow-update { any; };
|
||||
};
|
||||
|
||||
/*
|
||||
* A zone that starts with keys that have tags that are
|
||||
* outside of the desired multi-signer key tag range.
|
||||
*/
|
||||
zone "single-to-multisigner.kasp" {
|
||||
type primary;
|
||||
file "single-to-multisigner.kasp.db";
|
||||
dnssec-policy "multisigner-model2";
|
||||
allow-update { any; };
|
||||
};
|
||||
|
||||
/*
|
||||
* Different algorithms.
|
||||
*/
|
||||
@@ -237,6 +263,17 @@ zone "max-zone-ttl.kasp" {
|
||||
dnssec-policy "ttl";
|
||||
};
|
||||
|
||||
/*
|
||||
* Zone for testing GL #2375: Three is a crowd.
|
||||
*/
|
||||
zone "three-is-a-crowd.kasp" {
|
||||
type primary;
|
||||
file "three-is-a-crowd.kasp.db";
|
||||
inline-signing yes;
|
||||
/* Use same policy as KSK rollover test zones. */
|
||||
dnssec-policy "ksk-doubleksk";
|
||||
};
|
||||
|
||||
/*
|
||||
* Zones in different signing states.
|
||||
*/
|
||||
@@ -312,3 +349,175 @@ zone "zsk-retired.autosign" {
|
||||
file "zsk-retired.autosign.db";
|
||||
dnssec-policy "autosign";
|
||||
};
|
||||
|
||||
/*
|
||||
* Zones for testing enabling DNSSEC.
|
||||
*/
|
||||
zone "step1.enable-dnssec.autosign" {
|
||||
type primary;
|
||||
file "step1.enable-dnssec.autosign.db";
|
||||
dnssec-policy "enable-dnssec";
|
||||
};
|
||||
zone "step2.enable-dnssec.autosign" {
|
||||
type primary;
|
||||
file "step2.enable-dnssec.autosign.db";
|
||||
dnssec-policy "enable-dnssec";
|
||||
};
|
||||
zone "step3.enable-dnssec.autosign" {
|
||||
type primary;
|
||||
file "step3.enable-dnssec.autosign.db";
|
||||
dnssec-policy "enable-dnssec";
|
||||
};
|
||||
zone "step4.enable-dnssec.autosign" {
|
||||
type primary;
|
||||
file "step4.enable-dnssec.autosign.db";
|
||||
dnssec-policy "enable-dnssec";
|
||||
};
|
||||
|
||||
/*
|
||||
* Zones for testing ZSK Pre-Publication steps.
|
||||
*/
|
||||
zone "step1.zsk-prepub.autosign" {
|
||||
type primary;
|
||||
file "step1.zsk-prepub.autosign.db";
|
||||
dnssec-policy "zsk-prepub";
|
||||
};
|
||||
zone "step2.zsk-prepub.autosign" {
|
||||
type primary;
|
||||
file "step2.zsk-prepub.autosign.db";
|
||||
dnssec-policy "zsk-prepub";
|
||||
};
|
||||
zone "step3.zsk-prepub.autosign" {
|
||||
type primary;
|
||||
file "step3.zsk-prepub.autosign.db";
|
||||
dnssec-policy "zsk-prepub";
|
||||
};
|
||||
zone "step4.zsk-prepub.autosign" {
|
||||
type primary;
|
||||
file "step4.zsk-prepub.autosign.db";
|
||||
dnssec-policy "zsk-prepub";
|
||||
};
|
||||
zone "step5.zsk-prepub.autosign" {
|
||||
type primary;
|
||||
file "step5.zsk-prepub.autosign.db";
|
||||
dnssec-policy "zsk-prepub";
|
||||
};
|
||||
zone "step6.zsk-prepub.autosign" {
|
||||
type primary;
|
||||
file "step6.zsk-prepub.autosign.db";
|
||||
dnssec-policy "zsk-prepub";
|
||||
};
|
||||
|
||||
/*
|
||||
* Zones for testing KSK Double-KSK steps.
|
||||
*/
|
||||
zone "step1.ksk-doubleksk.autosign" {
|
||||
type primary;
|
||||
file "step1.ksk-doubleksk.autosign.db";
|
||||
dnssec-policy "ksk-doubleksk";
|
||||
};
|
||||
zone "step2.ksk-doubleksk.autosign" {
|
||||
type primary;
|
||||
file "step2.ksk-doubleksk.autosign.db";
|
||||
dnssec-policy "ksk-doubleksk";
|
||||
};
|
||||
zone "step3.ksk-doubleksk.autosign" {
|
||||
type primary;
|
||||
file "step3.ksk-doubleksk.autosign.db";
|
||||
dnssec-policy "ksk-doubleksk";
|
||||
};
|
||||
zone "step4.ksk-doubleksk.autosign" {
|
||||
type primary;
|
||||
file "step4.ksk-doubleksk.autosign.db";
|
||||
dnssec-policy "ksk-doubleksk";
|
||||
};
|
||||
zone "step5.ksk-doubleksk.autosign" {
|
||||
type primary;
|
||||
file "step5.ksk-doubleksk.autosign.db";
|
||||
dnssec-policy "ksk-doubleksk";
|
||||
};
|
||||
zone "step6.ksk-doubleksk.autosign" {
|
||||
type primary;
|
||||
file "step6.ksk-doubleksk.autosign.db";
|
||||
dnssec-policy "ksk-doubleksk";
|
||||
};
|
||||
|
||||
/*
|
||||
* Zones for testing CSK rollover steps.
|
||||
*/
|
||||
zone "step1.csk-roll.autosign" {
|
||||
type primary;
|
||||
file "step1.csk-roll.autosign.db";
|
||||
dnssec-policy "csk-roll";
|
||||
};
|
||||
zone "step2.csk-roll.autosign" {
|
||||
type primary;
|
||||
file "step2.csk-roll.autosign.db";
|
||||
dnssec-policy "csk-roll";
|
||||
};
|
||||
zone "step3.csk-roll.autosign" {
|
||||
type primary;
|
||||
file "step3.csk-roll.autosign.db";
|
||||
dnssec-policy "csk-roll";
|
||||
};
|
||||
zone "step4.csk-roll.autosign" {
|
||||
type primary;
|
||||
file "step4.csk-roll.autosign.db";
|
||||
dnssec-policy "csk-roll";
|
||||
};
|
||||
zone "step5.csk-roll.autosign" {
|
||||
type primary;
|
||||
file "step5.csk-roll.autosign.db";
|
||||
dnssec-policy "csk-roll";
|
||||
};
|
||||
zone "step6.csk-roll.autosign" {
|
||||
type primary;
|
||||
file "step6.csk-roll.autosign.db";
|
||||
dnssec-policy "csk-roll";
|
||||
};
|
||||
zone "step7.csk-roll.autosign" {
|
||||
type primary;
|
||||
file "step7.csk-roll.autosign.db";
|
||||
dnssec-policy "csk-roll";
|
||||
};
|
||||
zone "step8.csk-roll.autosign" {
|
||||
type primary;
|
||||
file "step8.csk-roll.autosign.db";
|
||||
dnssec-policy "csk-roll";
|
||||
};
|
||||
|
||||
zone "step1.csk-roll2.autosign" {
|
||||
type primary;
|
||||
file "step1.csk-roll2.autosign.db";
|
||||
dnssec-policy "csk-roll2";
|
||||
};
|
||||
zone "step2.csk-roll2.autosign" {
|
||||
type primary;
|
||||
file "step2.csk-roll2.autosign.db";
|
||||
dnssec-policy "csk-roll2";
|
||||
};
|
||||
zone "step3.csk-roll2.autosign" {
|
||||
type primary;
|
||||
file "step3.csk-roll2.autosign.db";
|
||||
dnssec-policy "csk-roll2";
|
||||
};
|
||||
zone "step4.csk-roll2.autosign" {
|
||||
type primary;
|
||||
file "step4.csk-roll2.autosign.db";
|
||||
dnssec-policy "csk-roll2";
|
||||
};
|
||||
zone "step5.csk-roll2.autosign" {
|
||||
type primary;
|
||||
file "step5.csk-roll2.autosign.db";
|
||||
dnssec-policy "csk-roll2";
|
||||
};
|
||||
zone "step6.csk-roll2.autosign" {
|
||||
type primary;
|
||||
file "step6.csk-roll2.autosign.db";
|
||||
dnssec-policy "csk-roll2";
|
||||
};
|
||||
zone "step7.csk-roll2.autosign" {
|
||||
type primary;
|
||||
file "step7.csk-roll2.autosign.db";
|
||||
dnssec-policy "csk-roll2";
|
||||
};
|
||||
|
||||
@@ -24,3 +24,113 @@ dnssec-policy "autosign" {
|
||||
zsk key-directory lifetime P1Y algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
};
|
||||
|
||||
dnssec-policy "enable-dnssec" {
|
||||
|
||||
signatures-refresh P1W;
|
||||
signatures-validity P2W;
|
||||
signatures-validity-dnskey P2W;
|
||||
|
||||
dnskey-ttl 300;
|
||||
max-zone-ttl PT12H;
|
||||
zone-propagation-delay PT5M;
|
||||
retire-safety PT20M;
|
||||
publish-safety PT5M;
|
||||
|
||||
parent-propagation-delay 1h;
|
||||
parent-ds-ttl 2h;
|
||||
|
||||
keys {
|
||||
csk lifetime unlimited algorithm @DEFAULT_ALGORITHM_NUMBER@;
|
||||
};
|
||||
};
|
||||
|
||||
dnssec-policy "zsk-prepub" {
|
||||
|
||||
signatures-refresh P1W;
|
||||
signatures-validity P2W;
|
||||
signatures-validity-dnskey P2W;
|
||||
|
||||
dnskey-ttl 3600;
|
||||
publish-safety P1D;
|
||||
retire-safety P2D;
|
||||
purge-keys PT1H;
|
||||
|
||||
keys {
|
||||
ksk key-directory lifetime P2Y algorithm @DEFAULT_ALGORITHM@;
|
||||
zsk key-directory lifetime P30D algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
|
||||
zone-propagation-delay PT1H;
|
||||
max-zone-ttl 1d;
|
||||
};
|
||||
|
||||
dnssec-policy "ksk-doubleksk" {
|
||||
|
||||
signatures-refresh P1W;
|
||||
signatures-validity P2W;
|
||||
signatures-validity-dnskey P2W;
|
||||
|
||||
dnskey-ttl 2h;
|
||||
publish-safety P1D;
|
||||
retire-safety P2D;
|
||||
purge-keys PT1H;
|
||||
|
||||
cdnskey no;
|
||||
keys {
|
||||
ksk key-directory lifetime P60D algorithm @DEFAULT_ALGORITHM@;
|
||||
zsk key-directory lifetime P1Y algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
|
||||
zone-propagation-delay PT1H;
|
||||
max-zone-ttl 1d;
|
||||
|
||||
parent-ds-ttl 3600;
|
||||
parent-propagation-delay PT1H;
|
||||
};
|
||||
|
||||
dnssec-policy "csk-roll" {
|
||||
|
||||
signatures-refresh P5D;
|
||||
signatures-validity 30d;
|
||||
signatures-validity-dnskey 30d;
|
||||
|
||||
dnskey-ttl 1h;
|
||||
publish-safety PT1H;
|
||||
retire-safety 2h;
|
||||
purge-keys PT1H;
|
||||
|
||||
cds-digest-types { "sha-384"; }; // use a different digest type for testing purposes
|
||||
keys {
|
||||
csk key-directory lifetime P6M algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
|
||||
zone-propagation-delay 1h;
|
||||
max-zone-ttl P1D;
|
||||
|
||||
parent-ds-ttl 1h;
|
||||
parent-propagation-delay 1h;
|
||||
};
|
||||
|
||||
dnssec-policy "csk-roll2" {
|
||||
|
||||
signatures-refresh 12h;
|
||||
signatures-validity P1D;
|
||||
signatures-validity-dnskey P1D;
|
||||
|
||||
dnskey-ttl 1h;
|
||||
publish-safety PT1H;
|
||||
retire-safety 1h;
|
||||
purge-keys 0;
|
||||
|
||||
cds-digest-types { "sha-256"; "sha-384"; }; // use two digest type for testing purposes
|
||||
keys {
|
||||
csk key-directory lifetime P6M algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
|
||||
zone-propagation-delay PT1H;
|
||||
max-zone-ttl 1d;
|
||||
|
||||
parent-ds-ttl PT1H;
|
||||
parent-propagation-delay P1W;
|
||||
};
|
||||
|
||||
@@ -23,6 +23,25 @@ dnssec-policy "default-dynamic" {
|
||||
inline-signing no;
|
||||
};
|
||||
|
||||
dnssec-policy "manual-rollover" {
|
||||
dnskey-ttl 3600;
|
||||
|
||||
keys {
|
||||
ksk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
|
||||
zsk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
};
|
||||
|
||||
dnssec-policy "multisigner-model2" {
|
||||
dnskey-ttl 3600;
|
||||
inline-signing no;
|
||||
|
||||
keys {
|
||||
ksk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@ tag-range 32768 65535;
|
||||
zsk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@ tag-range 32768 65535;
|
||||
};
|
||||
};
|
||||
|
||||
dnssec-policy "migrate-to-dnssec-policy" {
|
||||
dnskey-ttl 1234;
|
||||
|
||||
|
||||
+1282
-29
File diff suppressed because it is too large
Load Diff
@@ -44,8 +44,82 @@ zone "." {
|
||||
file "../../_common/root.hint.blackhole";
|
||||
};
|
||||
|
||||
/* This zone switch from dynamic to inline-signing. */
|
||||
zone "dynamic2inline.kasp" {
|
||||
type primary;
|
||||
file "dynamic2inline.kasp.db";
|
||||
allow-update { any; };
|
||||
dnssec-policy "default";
|
||||
};
|
||||
|
||||
/* These zones are going insecure. */
|
||||
zone "step1.going-insecure.kasp" {
|
||||
type primary;
|
||||
file "step1.going-insecure.kasp.db";
|
||||
dnssec-policy "unsigning";
|
||||
};
|
||||
|
||||
zone "step1.going-insecure-dynamic.kasp" {
|
||||
type primary;
|
||||
file "step1.going-insecure-dynamic.kasp.db";
|
||||
dnssec-policy "unsigning";
|
||||
inline-signing no;
|
||||
allow-update { any; };
|
||||
};
|
||||
|
||||
zone "step1.going-straight-to-none.kasp" {
|
||||
type primary;
|
||||
file "step1.going-straight-to-none.kasp.db";
|
||||
dnssec-policy "default";
|
||||
};
|
||||
|
||||
zone "step1.going-straight-to-none-dynamic.kasp" {
|
||||
type primary;
|
||||
file "step1.going-straight-to-none-dynamic.kasp.db.signed";
|
||||
inline-signing no;
|
||||
dnssec-policy "default";
|
||||
allow-update { any; };
|
||||
};
|
||||
|
||||
/* These are alorithm rollover test zones. */
|
||||
zone "step1.algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step1.algorithm-roll.kasp.db";
|
||||
dnssec-policy "rsasha256";
|
||||
};
|
||||
|
||||
zone "step1.csk-algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step1.csk-algorithm-roll.kasp.db";
|
||||
dnssec-policy "csk-algoroll";
|
||||
};
|
||||
|
||||
zone example {
|
||||
type primary;
|
||||
file "example.db";
|
||||
dnssec-policy modified;
|
||||
};
|
||||
|
||||
zone longer-lifetime {
|
||||
type primary;
|
||||
file "longer-lifetime.db";
|
||||
dnssec-policy short-lifetime;
|
||||
};
|
||||
|
||||
zone shorter-lifetime {
|
||||
type primary;
|
||||
file "shorter-lifetime.db";
|
||||
dnssec-policy long-lifetime;
|
||||
};
|
||||
|
||||
zone limit-lifetime {
|
||||
type primary;
|
||||
file "limit-lifetime.db";
|
||||
dnssec-policy unlimited-lifetime;
|
||||
};
|
||||
|
||||
zone unlimit-lifetime {
|
||||
type primary;
|
||||
file "unlimit-lifetime.db";
|
||||
dnssec-policy short-lifetime;
|
||||
};
|
||||
|
||||
@@ -43,8 +43,161 @@ zone "." {
|
||||
file "../../_common/root.hint.blackhole";
|
||||
};
|
||||
|
||||
/* This zone switch from dynamic to inline-signing. */
|
||||
zone "dynamic2inline.kasp" {
|
||||
type primary;
|
||||
file "dynamic2inline.kasp.db";
|
||||
allow-update { any; };
|
||||
dnssec-policy "default";
|
||||
};
|
||||
|
||||
/* Zones for testing going insecure. */
|
||||
zone "step1.going-insecure.kasp" {
|
||||
type primary;
|
||||
file "step1.going-insecure.kasp.db";
|
||||
dnssec-policy "insecure";
|
||||
};
|
||||
|
||||
zone "step2.going-insecure.kasp" {
|
||||
type primary;
|
||||
file "step2.going-insecure.kasp.db";
|
||||
dnssec-policy "insecure";
|
||||
};
|
||||
|
||||
zone "step1.going-insecure-dynamic.kasp" {
|
||||
type primary;
|
||||
file "step1.going-insecure-dynamic.kasp.db";
|
||||
inline-signing no;
|
||||
dnssec-policy "insecure";
|
||||
allow-update { any; };
|
||||
};
|
||||
|
||||
zone "step2.going-insecure-dynamic.kasp" {
|
||||
type primary;
|
||||
file "step2.going-insecure-dynamic.kasp.db";
|
||||
inline-signing no;
|
||||
dnssec-policy "insecure";
|
||||
allow-update { any; };
|
||||
};
|
||||
|
||||
zone "step1.going-straight-to-none.kasp" {
|
||||
type primary;
|
||||
file "step1.going-straight-to-none.kasp.db";
|
||||
dnssec-policy "none";
|
||||
};
|
||||
|
||||
zone "step1.going-straight-to-none-dynamic.kasp" {
|
||||
type primary;
|
||||
file "step1.going-straight-to-none-dynamic.kasp.db.signed";
|
||||
inline-signing no;
|
||||
dnssec-policy "none";
|
||||
allow-update { any; };
|
||||
};
|
||||
|
||||
/*
|
||||
* Zones for testing KSK/ZSK algorithm roll.
|
||||
*/
|
||||
zone "step1.algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step1.algorithm-roll.kasp.db";
|
||||
dnssec-policy "ecdsa256";
|
||||
};
|
||||
|
||||
zone "step2.algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step2.algorithm-roll.kasp.db";
|
||||
dnssec-policy "ecdsa256";
|
||||
};
|
||||
|
||||
zone "step3.algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step3.algorithm-roll.kasp.db";
|
||||
dnssec-policy "ecdsa256";
|
||||
};
|
||||
|
||||
zone "step4.algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step4.algorithm-roll.kasp.db";
|
||||
dnssec-policy "ecdsa256";
|
||||
};
|
||||
|
||||
zone "step5.algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step5.algorithm-roll.kasp.db";
|
||||
dnssec-policy "ecdsa256";
|
||||
};
|
||||
|
||||
zone "step6.algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step6.algorithm-roll.kasp.db";
|
||||
dnssec-policy "ecdsa256";
|
||||
};
|
||||
|
||||
/*
|
||||
* Zones for testing CSK algorithm roll.
|
||||
*/
|
||||
zone "step1.csk-algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step1.csk-algorithm-roll.kasp.db";
|
||||
dnssec-policy "csk-algoroll";
|
||||
};
|
||||
|
||||
zone "step2.csk-algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step2.csk-algorithm-roll.kasp.db";
|
||||
dnssec-policy "csk-algoroll";
|
||||
};
|
||||
|
||||
zone "step3.csk-algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step3.csk-algorithm-roll.kasp.db";
|
||||
dnssec-policy "csk-algoroll";
|
||||
};
|
||||
|
||||
zone "step4.csk-algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step4.csk-algorithm-roll.kasp.db";
|
||||
dnssec-policy "csk-algoroll";
|
||||
};
|
||||
|
||||
zone "step5.csk-algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step5.csk-algorithm-roll.kasp.db";
|
||||
dnssec-policy "csk-algoroll";
|
||||
};
|
||||
|
||||
zone "step6.csk-algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step6.csk-algorithm-roll.kasp.db";
|
||||
dnssec-policy "csk-algoroll";
|
||||
};
|
||||
|
||||
zone example {
|
||||
type primary;
|
||||
file "example.db";
|
||||
dnssec-policy modified;
|
||||
};
|
||||
|
||||
zone longer-lifetime {
|
||||
type primary;
|
||||
file "longer-lifetime.db";
|
||||
dnssec-policy long-lifetime;
|
||||
};
|
||||
|
||||
zone shorter-lifetime {
|
||||
type primary;
|
||||
file "shorter-lifetime.db";
|
||||
dnssec-policy short-lifetime;
|
||||
};
|
||||
|
||||
zone limit-lifetime {
|
||||
type primary;
|
||||
file "limit-lifetime.db";
|
||||
dnssec-policy short-lifetime;
|
||||
};
|
||||
|
||||
zone unlimit-lifetime {
|
||||
type primary;
|
||||
file "unlimit-lifetime.db";
|
||||
dnssec-policy unlimited-lifetime;
|
||||
};
|
||||
|
||||
@@ -11,6 +11,15 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
dnssec-policy "unsigning" {
|
||||
dnskey-ttl 7200;
|
||||
|
||||
keys {
|
||||
ksk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
|
||||
zsk key-directory lifetime P60D algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
};
|
||||
|
||||
dnssec-policy "nsec3" {
|
||||
nsec3param iterations 0 optout no salt-length 0;
|
||||
};
|
||||
@@ -37,3 +46,41 @@ dnssec-policy "long-lifetime" {
|
||||
csk lifetime P1Y algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
};
|
||||
|
||||
dnssec-policy "rsasha256" {
|
||||
signatures-refresh P5D;
|
||||
signatures-validity 30d;
|
||||
signatures-validity-dnskey 30d;
|
||||
|
||||
keys {
|
||||
ksk lifetime unlimited algorithm rsasha256;
|
||||
zsk lifetime unlimited algorithm rsasha256;
|
||||
};
|
||||
|
||||
dnskey-ttl 1h;
|
||||
publish-safety PT1H;
|
||||
retire-safety 2h;
|
||||
zone-propagation-delay 3600;
|
||||
max-zone-ttl 6h;
|
||||
parent-propagation-delay pt1h;
|
||||
parent-ds-ttl 7200;
|
||||
};
|
||||
|
||||
dnssec-policy "ecdsa256" {
|
||||
signatures-refresh P5D;
|
||||
signatures-validity 30d;
|
||||
signatures-validity-dnskey 30d;
|
||||
|
||||
keys {
|
||||
ksk lifetime unlimited algorithm ecdsa256;
|
||||
zsk lifetime unlimited algorithm ecdsa256;
|
||||
};
|
||||
|
||||
dnskey-ttl 1h;
|
||||
publish-safety PT1H;
|
||||
retire-safety 2h;
|
||||
zone-propagation-delay 3600;
|
||||
max-zone-ttl 6h;
|
||||
parent-propagation-delay pt1h;
|
||||
parent-ds-ttl 7200;
|
||||
};
|
||||
|
||||
@@ -16,8 +16,410 @@
|
||||
|
||||
echo_i "ns6/setup.sh"
|
||||
|
||||
setup() {
|
||||
zone="$1"
|
||||
echo_i "setting up zone: $zone"
|
||||
zonefile="${zone}.db"
|
||||
infile="${zone}.db.infile"
|
||||
}
|
||||
|
||||
# Make lines shorter by storing key states in environment variables.
|
||||
H="HIDDEN"
|
||||
R="RUMOURED"
|
||||
O="OMNIPRESENT"
|
||||
U="UNRETENTIVE"
|
||||
|
||||
for zn in shorter-lifetime longer-lifetime limit-lifetime unlimit-lifetime; do
|
||||
setup $zn
|
||||
cp template.db.in $zonefile
|
||||
done
|
||||
|
||||
# The child zones (step1, step2) beneath these zones represent the various
|
||||
# steps of unsigning a zone.
|
||||
for zn in going-insecure.kasp going-insecure-dynamic.kasp; do
|
||||
# Step 1:
|
||||
# Set up a zone with dnssec-policy that is going insecure.
|
||||
setup step1.$zn
|
||||
echo "$zone" >>zones
|
||||
T="now-10d"
|
||||
ksktimes="-P $T -A $T -P sync $T"
|
||||
zsktimes="-P $T -A $T"
|
||||
KSK=$($KEYGEN -a $DEFAULT_ALGORITHM -L 7200 -f KSK $ksktimes $zone 2>keygen.out.$zone.1)
|
||||
ZSK=$($KEYGEN -a $DEFAULT_ALGORITHM -L 7200 $zsktimes $zone 2>keygen.out.$zone.2)
|
||||
cat template.db.in "${KSK}.key" "${ZSK}.key" >"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 2:
|
||||
# Set up a zone with dnssec-policy that is going insecure. Don't add
|
||||
# this zone to the zones file, because this zone is no longer expected
|
||||
# to be fully signed.
|
||||
setup step2.$zn
|
||||
# The DS was withdrawn from the parent zone 26 hours ago.
|
||||
Trem="now-26h"
|
||||
ksktimes="-P $T -A $T -P sync $T"
|
||||
zsktimes="-P $T -A $T"
|
||||
KSK=$($KEYGEN -a $DEFAULT_ALGORITHM -L 7200 -f KSK $ksktimes $zone 2>keygen.out.$zone.1)
|
||||
ZSK=$($KEYGEN -a $DEFAULT_ALGORITHM -L 7200 $zsktimes $zone 2>keygen.out.$zone.2)
|
||||
$SETTIME -s -g $H -k $O $T -r $O $T -d $U $Trem -D ds $Trem "$KSK" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $H -k $O $T -z $O $T "$ZSK" >settime.out.$zone.2 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${KSK}.state"
|
||||
echo "Lifetime: 5184000" >>"${ZSK}.state"
|
||||
cat template.db.in "${KSK}.key" "${ZSK}.key" >"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
done
|
||||
|
||||
# This zone is going straight to "none" policy. This is undefined behavior.
|
||||
setup step1.going-straight-to-none.kasp
|
||||
echo "$zone" >>zones
|
||||
TactN="now"
|
||||
csktimes="-P ${TactN} -A ${TactN} -P sync ${TactN}"
|
||||
CSK=$($KEYGEN -k default $csktimes $zone 2>keygen.out.$zone.1)
|
||||
$SETTIME -s -g $O -k $O $TactN -z $O $TactN -r $O $TactN -d $O $TactN "$CSK" >settime.out.$zone.1 2>&1
|
||||
cat template.db.in "${CSK}.key" >"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -z -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# This zone is going straight to "none" policy. This is undefined behavior.
|
||||
setup step1.going-straight-to-none-dynamic.kasp
|
||||
echo "$zone" >>zones
|
||||
TactN="now"
|
||||
csktimes="-P ${TactN} -A ${TactN} -P sync ${TactN}"
|
||||
CSK=$($KEYGEN -k default $csktimes $zone 2>keygen.out.$zone.1)
|
||||
$SETTIME -s -g $O -k $O $TactN -z $O $TactN -r $O $TactN -d $O $TactN "$CSK" >settime.out.$zone.1 2>&1
|
||||
cat template.db.in "${CSK}.key" >"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -z -x -s now-1h -e now+2w -o $zone -O full -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
#
|
||||
# The zones at algorithm-roll.kasp represent the various steps of a ZSK/KSK
|
||||
# algorithm rollover.
|
||||
#
|
||||
|
||||
# Step 1:
|
||||
# Introduce the first key. This will immediately be active.
|
||||
setup step1.algorithm-roll.kasp
|
||||
echo "$zone" >>zones
|
||||
TactN="now"
|
||||
ksktimes="-P ${TactN} -A ${TactN} -P sync ${TactN}"
|
||||
zsktimes="-P ${TactN} -A ${TactN}"
|
||||
KSK=$($KEYGEN -a RSASHA256 -L 3600 -f KSK $ksktimes $zone 2>keygen.out.$zone.1)
|
||||
ZSK=$($KEYGEN -a RSASHA256 -L 3600 $zsktimes $zone 2>keygen.out.$zone.2)
|
||||
$SETTIME -s -g $O -k $O $TactN -r $O $TactN -d $O $TactN "$KSK" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $O -k $O $TactN -z $O $TactN "$ZSK" >settime.out.$zone.2 2>&1
|
||||
cat template.db.in "${KSK}.key" "${ZSK}.key" >"$infile"
|
||||
private_type_record $zone 8 "$KSK" >>"$infile"
|
||||
private_type_record $zone 8 "$ZSK" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 2:
|
||||
# After the publication interval has passed the DNSKEY is OMNIPRESENT.
|
||||
setup step2.algorithm-roll.kasp
|
||||
# The time passed since the new algorithm keys have been introduced is 3 hours.
|
||||
TactN="now-3h"
|
||||
TpubN1="now-3h"
|
||||
# Tsbm(N+1) = TpubN1 + Ipub = now + TTLsig + Dprp + publish-safety =
|
||||
# now - 3h + 6h + 1h + 1h = now + 5h
|
||||
TsbmN1="now+5h"
|
||||
ksk1times="-P ${TactN} -A ${TactN} -P sync ${TactN} -I now"
|
||||
zsk1times="-P ${TactN} -A ${TactN} -I now"
|
||||
ksk2times="-P ${TpubN1} -A ${TpubN1} -P sync ${TsbmN1}"
|
||||
zsk2times="-P ${TpubN1} -A ${TpubN1}"
|
||||
KSK1=$($KEYGEN -a RSASHA256 -L 3600 -f KSK $ksk1times $zone 2>keygen.out.$zone.1)
|
||||
ZSK1=$($KEYGEN -a RSASHA256 -L 3600 $zsk1times $zone 2>keygen.out.$zone.2)
|
||||
KSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 -f KSK $ksk2times $zone 2>keygen.out.$zone.3)
|
||||
ZSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 $zsk2times $zone 2>keygen.out.$zone.4)
|
||||
$SETTIME -s -g $H -k $O $TactN -r $O $TactN -d $O $TactN "$KSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $H -k $O $TactN -z $O $TactN "$ZSK1" >settime.out.$zone.2 2>&1
|
||||
$SETTIME -s -g $O -k $R $TpubN1 -r $R $TpubN1 -d $H $TpubN1 "$KSK2" >settime.out.$zone.3 2>&1
|
||||
$SETTIME -s -g $O -k $R $TpubN1 -z $R $TpubN1 "$ZSK2" >settime.out.$zone.4 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${KSK1}.state"
|
||||
echo "Lifetime: 0" >>"${ZSK1}.state"
|
||||
cat template.db.in "${KSK1}.key" "${ZSK1}.key" "${KSK2}.key" "${ZSK2}.key" >"$infile"
|
||||
private_type_record $zone 8 "$KSK1" >>"$infile"
|
||||
private_type_record $zone 8 "$ZSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK2" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 3:
|
||||
# The zone signatures are also OMNIPRESENT.
|
||||
setup step3.algorithm-roll.kasp
|
||||
# The time passed since the new algorithm keys have been introduced is 9 hours.
|
||||
TactN="now-9h"
|
||||
TretN="now-6h"
|
||||
TpubN1="now-9h"
|
||||
TsbmN1="now-1h"
|
||||
ksk1times="-P ${TactN} -A ${TactN} -P sync ${TactN} -I ${TretN}"
|
||||
zsk1times="-P ${TactN} -A ${TactN} -I ${TretN}"
|
||||
ksk2times="-P ${TpubN1} -A ${TpubN1} -P sync ${TsbmN1}"
|
||||
zsk2times="-P ${TpubN1} -A ${TpubN1}"
|
||||
KSK1=$($KEYGEN -a RSASHA256 -L 3600 -f KSK $ksk1times $zone 2>keygen.out.$zone.1)
|
||||
ZSK1=$($KEYGEN -a RSASHA256 -L 3600 $zsk1times $zone 2>keygen.out.$zone.2)
|
||||
KSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 -f KSK $ksk2times $zone 2>keygen.out.$zone.3)
|
||||
ZSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 $zsk2times $zone 2>keygen.out.$zone.4)
|
||||
$SETTIME -s -g $H -k $O $TactN -r $O $TactN -d $O $TactN "$KSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $H -k $O $TactN -z $O $TactN "$ZSK1" >settime.out.$zone.2 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -r $O $TpubN1 -d $H $TpubN1 "$KSK2" >settime.out.$zone.3 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -z $R $TpubN1 "$ZSK2" >settime.out.$zone.4 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${KSK1}.state"
|
||||
echo "Lifetime: 0" >>"${ZSK1}.state"
|
||||
cat template.db.in "${KSK1}.key" "${ZSK1}.key" "${KSK2}.key" "${ZSK2}.key" >"$infile"
|
||||
private_type_record $zone 8 "$KSK1" >>"$infile"
|
||||
private_type_record $zone 8 "$ZSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK2" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 4:
|
||||
# The DS is swapped and can become OMNIPRESENT.
|
||||
setup step4.algorithm-roll.kasp
|
||||
# The time passed since the DS has been swapped is 29 hours.
|
||||
TactN="now-38h"
|
||||
TretN="now-35h"
|
||||
TpubN1="now-38h"
|
||||
TsbmN1="now-30h"
|
||||
TactN1="now-29h"
|
||||
ksk1times="-P ${TactN} -A ${TactN} -P sync ${TactN} -I ${TretN}"
|
||||
zsk1times="-P ${TactN} -A ${TactN} -I ${TretN}"
|
||||
ksk2times="-P ${TpubN1} -A ${TpubN1} -P sync ${TsbmN1}"
|
||||
zsk2times="-P ${TpubN1} -A ${TpubN1}"
|
||||
KSK1=$($KEYGEN -a RSASHA256 -L 3600 -f KSK $ksk1times $zone 2>keygen.out.$zone.1)
|
||||
ZSK1=$($KEYGEN -a RSASHA256 -L 3600 $zsk1times $zone 2>keygen.out.$zone.2)
|
||||
KSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 -f KSK $ksk2times $zone 2>keygen.out.$zone.3)
|
||||
ZSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 $zsk2times $zone 2>keygen.out.$zone.4)
|
||||
$SETTIME -s -g $H -k $O $TactN -r $O $TactN -d $U $TactN1 -D ds $TactN1 "$KSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $H -k $O $TactN -z $O $TactN "$ZSK1" >settime.out.$zone.2 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -r $O $TpubN1 -d $R $TactN1 -P ds $TactN1 "$KSK2" >settime.out.$zone.3 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -z $R $TpubN1 "$ZSK2" >settime.out.$zone.4 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${KSK1}.state"
|
||||
echo "Lifetime: 0" >>"${ZSK1}.state"
|
||||
cat template.db.in "${KSK1}.key" "${ZSK1}.key" "${KSK2}.key" "${ZSK2}.key" >"$infile"
|
||||
private_type_record $zone 8 "$KSK1" >>"$infile"
|
||||
private_type_record $zone 8 "$ZSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK2" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 5:
|
||||
# The DNSKEY is removed long enough to be HIDDEN.
|
||||
setup step5.algorithm-roll.kasp
|
||||
# The time passed since the DNSKEY has been removed is 2 hours.
|
||||
TactN="now-40h"
|
||||
TretN="now-37h"
|
||||
TremN="now-2h"
|
||||
TpubN1="now-40h"
|
||||
TsbmN1="now-32h"
|
||||
TactN1="now-31h"
|
||||
ksk1times="-P ${TactN} -A ${TactN} -P sync ${TactN} -I ${TretN}"
|
||||
zsk1times="-P ${TactN} -A ${TactN} -I ${TretN}"
|
||||
ksk2times="-P ${TpubN1} -A ${TpubN1} -P sync ${TsbmN1}"
|
||||
zsk2times="-P ${TpubN1} -A ${TpubN1}"
|
||||
KSK1=$($KEYGEN -a RSASHA256 -L 3600 -f KSK $ksk1times $zone 2>keygen.out.$zone.1)
|
||||
ZSK1=$($KEYGEN -a RSASHA256 -L 3600 $zsk1times $zone 2>keygen.out.$zone.2)
|
||||
KSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 -f KSK $ksk2times $zone 2>keygen.out.$zone.3)
|
||||
ZSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 $zsk2times $zone 2>keygen.out.$zone.4)
|
||||
$SETTIME -s -g $H -k $U $TremN -r $U $TremN -d $H $TactN1 "$KSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $H -k $U $TremN -z $U $TremN "$ZSK1" >settime.out.$zone.2 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -r $O $TpubN1 -d $O $TactN1 "$KSK2" >settime.out.$zone.3 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -z $R $TpubN1 "$ZSK2" >settime.out.$zone.4 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${KSK1}.state"
|
||||
echo "Lifetime: 0" >>"${ZSK1}.state"
|
||||
cat template.db.in "${KSK1}.key" "${ZSK1}.key" "${KSK2}.key" "${ZSK2}.key" >"$infile"
|
||||
private_type_record $zone 8 "$KSK1" >>"$infile"
|
||||
private_type_record $zone 8 "$ZSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK2" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 6:
|
||||
# The RRSIGs have been removed long enough to be HIDDEN.
|
||||
setup step6.algorithm-roll.kasp
|
||||
# Additional time passed: 7h.
|
||||
TactN="now-47h"
|
||||
TretN="now-44h"
|
||||
TremN="now-7h"
|
||||
TpubN1="now-47h"
|
||||
TsbmN1="now-39h"
|
||||
TactN1="now-38h"
|
||||
TdeaN="now-9h"
|
||||
ksk1times="-P ${TactN} -A ${TactN} -P sync ${TactN} -I ${TretN}"
|
||||
zsk1times="-P ${TactN} -A ${TactN} -I ${TretN}"
|
||||
ksk2times="-P ${TpubN1} -A ${TpubN1} -P sync ${TsbmN1}"
|
||||
zsk2times="-P ${TpubN1} -A ${TpubN1}"
|
||||
KSK1=$($KEYGEN -a RSASHA256 -L 3600 -f KSK $ksk1times $zone 2>keygen.out.$zone.1)
|
||||
ZSK1=$($KEYGEN -a RSASHA256 -L 3600 $zsk1times $zone 2>keygen.out.$zone.2)
|
||||
KSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 -f KSK $ksk2times $zone 2>keygen.out.$zone.3)
|
||||
ZSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 $zsk2times $zone 2>keygen.out.$zone.4)
|
||||
$SETTIME -s -g $H -k $H $TremN -r $U $TdeaN -d $H $TactN1 "$KSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $H -k $H $TremN -z $U $TdeaN "$ZSK1" >settime.out.$zone.2 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -r $O $TpubN1 -d $O $TactN1 "$KSK2" >settime.out.$zone.3 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -z $R $TpubN1 "$ZSK2" >settime.out.$zone.4 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${KSK1}.state"
|
||||
echo "Lifetime: 0" >>"${ZSK1}.state"
|
||||
cat template.db.in "${KSK1}.key" "${ZSK1}.key" "${KSK2}.key" "${ZSK2}.key" >"$infile"
|
||||
private_type_record $zone 8 "$KSK1" >>"$infile"
|
||||
private_type_record $zone 8 "$ZSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK2" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
#
|
||||
# The zones at csk-algorithm-roll.kasp represent the various steps of a CSK
|
||||
# algorithm rollover.
|
||||
#
|
||||
|
||||
# Step 1:
|
||||
# Introduce the first key. This will immediately be active.
|
||||
setup step1.csk-algorithm-roll.kasp
|
||||
echo "$zone" >>zones
|
||||
TactN="now"
|
||||
csktimes="-P ${TactN} -P sync ${TactN} -A ${TactN}"
|
||||
CSK=$($KEYGEN -k csk-algoroll -l policies/csk1.conf $csktimes $zone 2>keygen.out.$zone.1)
|
||||
$SETTIME -s -g $O -k $O $TactN -r $O $TactN -z $O $TactN -d $O $TactN "$CSK" >settime.out.$zone.1 2>&1
|
||||
cat template.db.in "${CSK}.key" >"$infile"
|
||||
private_type_record $zone 5 "$CSK" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -z -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 2:
|
||||
# After the publication interval has passed the DNSKEY is OMNIPRESENT.
|
||||
setup step2.csk-algorithm-roll.kasp
|
||||
# The time passed since the new algorithm keys have been introduced is 3 hours.
|
||||
TactN="now-3h"
|
||||
TpubN1="now-3h"
|
||||
csktimes="-P ${TactN} -A ${TactN} -P sync ${TactN} -I now"
|
||||
newtimes="-P ${TpubN1} -A ${TpubN1}"
|
||||
CSK1=$($KEYGEN -k csk-algoroll -l policies/csk1.conf $csktimes $zone 2>keygen.out.$zone.1)
|
||||
CSK2=$($KEYGEN -k csk-algoroll -l policies/csk2.conf $newtimes $zone 2>keygen.out.$zone.2)
|
||||
$SETTIME -s -g $H -k $O $TactN -r $O $TactN -z $O $TactN -d $O $TactN "$CSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $O -k $R $TpubN1 -r $R $TpubN1 -z $R $TpubN1 -d $H $TpubN1 "$CSK2" >settime.out.$zone.2 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${CSK1}.state"
|
||||
cat template.db.in "${CSK1}.key" "${CSK2}.key" >"$infile"
|
||||
private_type_record $zone 5 "$CSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -z -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 3:
|
||||
# The zone signatures are also OMNIPRESENT.
|
||||
setup step3.csk-algorithm-roll.kasp
|
||||
# The time passed since the new algorithm keys have been introduced is 9 hours.
|
||||
TactN="now-9h"
|
||||
TretN="now-6h"
|
||||
TpubN1="now-9h"
|
||||
TactN1="now-6h"
|
||||
csktimes="-P ${TactN} -A ${TactN} -P sync ${TactN} -I ${TretN}"
|
||||
newtimes="-P ${TpubN1} -A ${TpubN1}"
|
||||
CSK1=$($KEYGEN -k csk-algoroll -l policies/csk1.conf $csktimes $zone 2>keygen.out.$zone.1)
|
||||
CSK2=$($KEYGEN -k csk-algoroll -l policies/csk2.conf $newtimes $zone 2>keygen.out.$zone.2)
|
||||
$SETTIME -s -g $H -k $O $TactN -r $O $TactN -z $O $TactN -d $O $TactN "$CSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $O -k $O $TactN1 -r $O $TactN1 -z $R $TpubN1 -d $H $TpubN1 "$CSK2" >settime.out.$zone.2 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${CSK1}.state"
|
||||
cat template.db.in "${CSK1}.key" "${CSK2}.key" >"$infile"
|
||||
private_type_record $zone 5 "$CSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -z -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 4:
|
||||
# The DS is swapped and can become OMNIPRESENT.
|
||||
setup step4.csk-algorithm-roll.kasp
|
||||
# The time passed since the DS has been swapped is 29 hours.
|
||||
TactN="now-38h"
|
||||
TretN="now-35h"
|
||||
TpubN1="now-38h"
|
||||
TactN1="now-35h"
|
||||
TsubN1="now-29h"
|
||||
csktimes="-P ${TactN} -A ${TactN} -P sync ${TactN} -I ${TretN}"
|
||||
newtimes="-P ${TpubN1} -A ${TpubN1}"
|
||||
CSK1=$($KEYGEN -k csk-algoroll -l policies/csk1.conf $csktimes $zone 2>keygen.out.$zone.1)
|
||||
CSK2=$($KEYGEN -k csk-algoroll -l policies/csk2.conf $newtimes $zone 2>keygen.out.$zone.2)
|
||||
$SETTIME -s -g $H -k $O $TactN -r $O $TactN -z $O $TactN -d $U $TactN1 -D ds $TactN1 "$CSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $O -k $O $TactN1 -r $O $TactN1 -z $O $TsubN1 -d $R $TsubN1 -P ds $TsubN1 "$CSK2" >settime.out.$zone.2 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${CSK1}.state"
|
||||
cat template.db.in "${CSK1}.key" "${CSK2}.key" >"$infile"
|
||||
private_type_record $zone 5 "$CSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -z -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 5:
|
||||
# The DNSKEY is removed long enough to be HIDDEN.
|
||||
setup step5.csk-algorithm-roll.kasp
|
||||
# The time passed since the DNSKEY has been removed is 2 hours.
|
||||
TactN="now-40h"
|
||||
TretN="now-37h"
|
||||
TremN="now-2h"
|
||||
TpubN1="now-40h"
|
||||
TactN1="now-37h"
|
||||
TsubN1="now-31h"
|
||||
csktimes="-P ${TactN} -A ${TactN} -P sync ${TactN} -I ${TretN}"
|
||||
newtimes="-P ${TpubN1} -A ${TpubN1}"
|
||||
CSK1=$($KEYGEN -k csk-algoroll -l policies/csk1.conf $csktimes $zone 2>keygen.out.$zone.1)
|
||||
CSK2=$($KEYGEN -k csk-algoroll -l policies/csk2.conf $newtimes $zone 2>keygen.out.$zone.2)
|
||||
$SETTIME -s -g $H -k $U $TremN -r $U $TremN -z $U $TremN -d $H $TremN "$CSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $O -k $O $TactN1 -r $O $TactN1 -z $O $TsubN1 -d $O $TremN "$CSK2" >settime.out.$zone.2 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${CSK1}.state"
|
||||
cat template.db.in "${CSK1}.key" "${CSK2}.key" >"$infile"
|
||||
private_type_record $zone 5 "$CSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -z -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 6:
|
||||
# The RRSIGs have been removed long enough to be HIDDEN.
|
||||
setup step6.csk-algorithm-roll.kasp
|
||||
# Additional time passed: 7h.
|
||||
TactN="now-47h"
|
||||
TretN="now-44h"
|
||||
TdeaN="now-9h"
|
||||
TremN="now-7h"
|
||||
TpubN1="now-47h"
|
||||
TactN1="now-44h"
|
||||
TsubN1="now-38h"
|
||||
csktimes="-P ${TactN} -A ${TactN} -P sync ${TactN} -I ${TretN}"
|
||||
newtimes="-P ${TpubN1} -A ${TpubN1}"
|
||||
CSK1=$($KEYGEN -k csk-algoroll -l policies/csk1.conf $csktimes $zone 2>keygen.out.$zone.1)
|
||||
CSK2=$($KEYGEN -k csk-algoroll -l policies/csk2.conf $newtimes $zone 2>keygen.out.$zone.2)
|
||||
$SETTIME -s -g $H -k $H $TremN -r $U $TdeaN -z $U $TdeaN -d $H $TactN1 "$CSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $O -k $O $TactN1 -r $O $TactN1 -z $O $TsubN1 -d $O $TactN1 "$CSK2" >settime.out.$zone.2 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${CSK1}.state"
|
||||
cat template.db.in "${CSK1}.key" "${CSK2}.key" >"$infile"
|
||||
private_type_record $zone 5 "$CSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -z -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
#
|
||||
# Reload testing
|
||||
#
|
||||
echo "example" >>zones
|
||||
cp example.db.in example.db
|
||||
|
||||
setup "dynamic2inline.kasp"
|
||||
cp template.db.in $zonefile
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
. ../conf.sh
|
||||
|
||||
if test -n "$PYTHON"; then
|
||||
if $PYTHON -c "from dns.update import UpdateMessage" 2>/dev/null; then
|
||||
:
|
||||
else
|
||||
echo_i "This test requires the dnspython >= 2.0.0 module." >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo_i "This test requires Python and the dnspython module." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,65 @@
|
||||
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.extra_artifacts(
|
||||
[
|
||||
"K*.private",
|
||||
"K*.key",
|
||||
"K*.state",
|
||||
"K*.cmp",
|
||||
"*.created",
|
||||
"dig.out*",
|
||||
"keyevent.out.*",
|
||||
"keygen.out.*",
|
||||
"keys",
|
||||
"published.test*",
|
||||
"python.out.*",
|
||||
"retired.test*",
|
||||
"rndc.dnssec.*.out.*",
|
||||
"rndc.zonestatus.out.*",
|
||||
"rrsig.out.*",
|
||||
"created.key-*",
|
||||
"unused.key-*",
|
||||
"verify.out.*",
|
||||
"zone.out.*",
|
||||
"ns*/K*.private",
|
||||
"ns*/K*.key",
|
||||
"ns*/K*.state",
|
||||
"ns*/*.db",
|
||||
"ns*/*.db.infile",
|
||||
"ns*/*.db.signed",
|
||||
"ns*/*.jbk",
|
||||
"ns*/*.jnl",
|
||||
"ns*/dsset-*",
|
||||
"ns*/keygen.out.*",
|
||||
"ns*/keys",
|
||||
"ns*/ksk",
|
||||
"ns*/ksk/K*",
|
||||
"ns*/zsk",
|
||||
"ns*/zsk",
|
||||
"ns*/zsk/K*",
|
||||
"ns*/named-fips.conf",
|
||||
"ns*/settime.out.*",
|
||||
"ns*/signer.out.*",
|
||||
"ns*/zones",
|
||||
"ns*/policies/*.conf",
|
||||
"ns*/*.zsk1",
|
||||
"ns*/*.zsk2",
|
||||
"ns3/legacy-keys.*",
|
||||
"ns3/dynamic-signed-inline-signing.kasp.db.signed.signed",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def test_kasp(run_tests_sh):
|
||||
run_tests_sh()
|
||||
@@ -10,14 +10,19 @@
|
||||
# information regarding copyright ownership.
|
||||
|
||||
from datetime import timedelta
|
||||
import difflib
|
||||
import os
|
||||
import shutil
|
||||
import time
|
||||
from typing import List, Optional
|
||||
|
||||
import pytest
|
||||
|
||||
import isctest
|
||||
from isctest.kasp import KeyTimingMetadata
|
||||
from isctest.kasp import (
|
||||
Key,
|
||||
KeyTimingMetadata,
|
||||
)
|
||||
|
||||
pytestmark = pytest.mark.extra_artifacts(
|
||||
[
|
||||
@@ -84,6 +89,31 @@ def between(value, start, end):
|
||||
return start < value < end
|
||||
|
||||
|
||||
def check_file_contents_equal(file1, file2):
|
||||
def normalize_line(line):
|
||||
# remove trailing&leading whitespace and replace multiple whitespaces
|
||||
return " ".join(line.split())
|
||||
|
||||
def read_lines(file_path):
|
||||
with open(file_path, "r", encoding="utf-8") as file:
|
||||
return [normalize_line(line) for line in file.readlines()]
|
||||
|
||||
lines1 = read_lines(file1)
|
||||
lines2 = read_lines(file2)
|
||||
|
||||
differ = difflib.Differ()
|
||||
diff = differ.compare(lines1, lines2)
|
||||
|
||||
for line in diff:
|
||||
assert not line.startswith("+ ") and not line.startswith(
|
||||
"- "
|
||||
), f'file contents of "{file1}" and "{file2}" differ'
|
||||
|
||||
|
||||
def keystr_to_keylist(keystr: str, keydir: Optional[str] = None) -> List[Key]:
|
||||
return [Key(name, keydir) for name in keystr.split()]
|
||||
|
||||
|
||||
def ksr(zone, policy, action, options="", raise_on_exception=True):
|
||||
ksr_command = [
|
||||
os.environ.get("KSR"),
|
||||
@@ -485,14 +515,14 @@ def test_ksr_common(servers):
|
||||
# create ksk
|
||||
kskdir = "ns1/offline"
|
||||
out, _ = ksr(zone, policy, "keygen", options=f"-K {kskdir} -i now -e +1y -o")
|
||||
ksks = isctest.kasp.keystr_to_keylist(out, kskdir)
|
||||
ksks = keystr_to_keylist(out, kskdir)
|
||||
assert len(ksks) == 1
|
||||
|
||||
check_keys(ksks, None)
|
||||
|
||||
# check that 'dnssec-ksr keygen' pregenerates right amount of keys
|
||||
out, _ = ksr(zone, policy, "keygen", options="-i now -e +1y")
|
||||
zsks = isctest.kasp.keystr_to_keylist(out)
|
||||
zsks = keystr_to_keylist(out)
|
||||
assert len(zsks) == 2
|
||||
|
||||
lifetime = timedelta(days=31 * 6)
|
||||
@@ -502,7 +532,7 @@ def test_ksr_common(servers):
|
||||
# in the given key directory
|
||||
zskdir = "ns1"
|
||||
out, _ = ksr(zone, policy, "keygen", options=f"-K {zskdir} -i now -e +1y")
|
||||
zsks = isctest.kasp.keystr_to_keylist(out, zskdir)
|
||||
zsks = keystr_to_keylist(out, zskdir)
|
||||
assert len(zsks) == 2
|
||||
|
||||
lifetime = timedelta(days=31 * 6)
|
||||
@@ -545,22 +575,18 @@ def test_ksr_common(servers):
|
||||
# check that 'dnssec-ksr keygen' selects pregenerated keys for
|
||||
# the same time bundle
|
||||
out, _ = ksr(zone, policy, "keygen", options=f"-K {zskdir} -i {now} -e +1y")
|
||||
selected_zsks = isctest.kasp.keystr_to_keylist(out, zskdir)
|
||||
selected_zsks = keystr_to_keylist(out, zskdir)
|
||||
assert len(selected_zsks) == 2
|
||||
for index, key in enumerate(selected_zsks):
|
||||
assert zsks[index] == key
|
||||
isctest.check.file_contents_equal(
|
||||
f"{key.path}.private", f"{key.path}.private.backup"
|
||||
)
|
||||
isctest.check.file_contents_equal(f"{key.path}.key", f"{key.path}.key.backup")
|
||||
isctest.check.file_contents_equal(
|
||||
f"{key.path}.state", f"{key.path}.state.backup"
|
||||
)
|
||||
check_file_contents_equal(f"{key.path}.private", f"{key.path}.private.backup")
|
||||
check_file_contents_equal(f"{key.path}.key", f"{key.path}.key.backup")
|
||||
check_file_contents_equal(f"{key.path}.state", f"{key.path}.state.backup")
|
||||
|
||||
# check that 'dnssec-ksr keygen' generates only necessary keys for
|
||||
# overlapping time bundle
|
||||
out, err = ksr(zone, policy, "keygen", options=f"-K {zskdir} -i {now} -e +2y -v 1")
|
||||
overlapping_zsks = isctest.kasp.keystr_to_keylist(out, zskdir)
|
||||
overlapping_zsks = keystr_to_keylist(out, zskdir)
|
||||
assert len(overlapping_zsks) == 4
|
||||
|
||||
verbose = err.split()
|
||||
@@ -576,19 +602,15 @@ def test_ksr_common(servers):
|
||||
for index, key in enumerate(overlapping_zsks):
|
||||
if index < 2:
|
||||
assert zsks[index] == key
|
||||
isctest.check.file_contents_equal(
|
||||
check_file_contents_equal(
|
||||
f"{key.path}.private", f"{key.path}.private.backup"
|
||||
)
|
||||
isctest.check.file_contents_equal(
|
||||
f"{key.path}.key", f"{key.path}.key.backup"
|
||||
)
|
||||
isctest.check.file_contents_equal(
|
||||
f"{key.path}.state", f"{key.path}.state.backup"
|
||||
)
|
||||
check_file_contents_equal(f"{key.path}.key", f"{key.path}.key.backup")
|
||||
check_file_contents_equal(f"{key.path}.state", f"{key.path}.state.backup")
|
||||
|
||||
# run 'dnssec-ksr keygen' again with verbosity 0
|
||||
out, _ = ksr(zone, policy, "keygen", options=f"-K {zskdir} -i {now} -e +2y")
|
||||
overlapping_zsks2 = isctest.kasp.keystr_to_keylist(out, zskdir)
|
||||
overlapping_zsks2 = keystr_to_keylist(out, zskdir)
|
||||
assert len(overlapping_zsks2) == 4
|
||||
check_keys(overlapping_zsks2, lifetime)
|
||||
for index, key in enumerate(overlapping_zsks2):
|
||||
@@ -669,9 +691,9 @@ def test_ksr_common(servers):
|
||||
# - check keys
|
||||
check_keys(overlapping_zsks, lifetime, with_state=True)
|
||||
# - check apex
|
||||
isctest.kasp.check_apex(ns1, zone, ksks, overlapping_zsks, offline_ksk=True)
|
||||
isctest.kasp.check_apex(ns1, zone, ksks, overlapping_zsks)
|
||||
# - check subdomain
|
||||
isctest.kasp.check_subdomain(ns1, zone, ksks, overlapping_zsks, offline_ksk=True)
|
||||
isctest.kasp.check_subdomain(ns1, zone, ksks, overlapping_zsks)
|
||||
|
||||
|
||||
def test_ksr_lastbundle(servers):
|
||||
@@ -683,7 +705,7 @@ def test_ksr_lastbundle(servers):
|
||||
kskdir = "ns1/offline"
|
||||
offset = -timedelta(days=365)
|
||||
out, _ = ksr(zone, policy, "keygen", options=f"-K {kskdir} -i -1y -e +1d -o")
|
||||
ksks = isctest.kasp.keystr_to_keylist(out, kskdir)
|
||||
ksks = keystr_to_keylist(out, kskdir)
|
||||
assert len(ksks) == 1
|
||||
|
||||
check_keys(ksks, None, offset=offset)
|
||||
@@ -691,7 +713,7 @@ def test_ksr_lastbundle(servers):
|
||||
# check that 'dnssec-ksr keygen' pregenerates right amount of keys
|
||||
zskdir = "ns1"
|
||||
out, _ = ksr(zone, policy, "keygen", options=f"-K {zskdir} -i -1y -e +1d")
|
||||
zsks = isctest.kasp.keystr_to_keylist(out, zskdir)
|
||||
zsks = keystr_to_keylist(out, zskdir)
|
||||
assert len(zsks) == 2
|
||||
|
||||
lifetime = timedelta(days=31 * 6)
|
||||
@@ -744,9 +766,9 @@ def test_ksr_lastbundle(servers):
|
||||
# - check keys
|
||||
check_keys(zsks, lifetime, offset=offset, with_state=True)
|
||||
# - check apex
|
||||
isctest.kasp.check_apex(ns1, zone, ksks, zsks, offline_ksk=True)
|
||||
isctest.kasp.check_apex(ns1, zone, ksks, zsks)
|
||||
# - check subdomain
|
||||
isctest.kasp.check_subdomain(ns1, zone, ksks, zsks, offline_ksk=True)
|
||||
isctest.kasp.check_subdomain(ns1, zone, ksks, zsks)
|
||||
|
||||
# check that last bundle warning is logged
|
||||
warning = "last bundle in skr, please import new skr file"
|
||||
@@ -762,7 +784,7 @@ def test_ksr_inthemiddle(servers):
|
||||
kskdir = "ns1/offline"
|
||||
offset = -timedelta(days=365)
|
||||
out, _ = ksr(zone, policy, "keygen", options=f"-K {kskdir} -i -1y -e +1y -o")
|
||||
ksks = isctest.kasp.keystr_to_keylist(out, kskdir)
|
||||
ksks = keystr_to_keylist(out, kskdir)
|
||||
assert len(ksks) == 1
|
||||
|
||||
check_keys(ksks, None, offset=offset)
|
||||
@@ -770,7 +792,7 @@ def test_ksr_inthemiddle(servers):
|
||||
# check that 'dnssec-ksr keygen' pregenerates right amount of keys
|
||||
zskdir = "ns1"
|
||||
out, _ = ksr(zone, policy, "keygen", options=f"-K {zskdir} -i -1y -e +1y")
|
||||
zsks = isctest.kasp.keystr_to_keylist(out, zskdir)
|
||||
zsks = keystr_to_keylist(out, zskdir)
|
||||
assert len(zsks) == 4
|
||||
|
||||
lifetime = timedelta(days=31 * 6)
|
||||
@@ -824,9 +846,9 @@ def test_ksr_inthemiddle(servers):
|
||||
# - check keys
|
||||
check_keys(zsks, lifetime, offset=offset, with_state=True)
|
||||
# - check apex
|
||||
isctest.kasp.check_apex(ns1, zone, ksks, zsks, offline_ksk=True)
|
||||
isctest.kasp.check_apex(ns1, zone, ksks, zsks)
|
||||
# - check subdomain
|
||||
isctest.kasp.check_subdomain(ns1, zone, ksks, zsks, offline_ksk=True)
|
||||
isctest.kasp.check_subdomain(ns1, zone, ksks, zsks)
|
||||
|
||||
# check that no last bundle warning is logged
|
||||
warning = "last bundle in skr, please import new skr file"
|
||||
@@ -842,13 +864,13 @@ def check_ksr_rekey_logs_error(server, zone, policy, offset, end):
|
||||
then = now + offset
|
||||
until = now + end
|
||||
out, _ = ksr(zone, policy, "keygen", options=f"-K {kskdir} -i {then} -e {until} -o")
|
||||
ksks = isctest.kasp.keystr_to_keylist(out, kskdir)
|
||||
ksks = keystr_to_keylist(out, kskdir)
|
||||
assert len(ksks) == 1
|
||||
|
||||
# key generation
|
||||
zskdir = "ns1"
|
||||
out, _ = ksr(zone, policy, "keygen", options=f"-K {zskdir} -i {then} -e {until}")
|
||||
zsks = isctest.kasp.keystr_to_keylist(out, zskdir)
|
||||
zsks = keystr_to_keylist(out, zskdir)
|
||||
assert len(zsks) == 2
|
||||
|
||||
# create request
|
||||
@@ -915,7 +937,7 @@ def test_ksr_unlimited(servers):
|
||||
# create ksk
|
||||
kskdir = "ns1/offline"
|
||||
out, _ = ksr(zone, policy, "keygen", options=f"-K {kskdir} -i now -e +2y -o")
|
||||
ksks = isctest.kasp.keystr_to_keylist(out, kskdir)
|
||||
ksks = keystr_to_keylist(out, kskdir)
|
||||
assert len(ksks) == 1
|
||||
|
||||
check_keys(ksks, None)
|
||||
@@ -923,7 +945,7 @@ def test_ksr_unlimited(servers):
|
||||
# check that 'dnssec-ksr keygen' pregenerates right amount of keys
|
||||
zskdir = "ns1"
|
||||
out, _ = ksr(zone, policy, "keygen", options=f"-K {zskdir} -i now -e +2y")
|
||||
zsks = isctest.kasp.keystr_to_keylist(out, zskdir)
|
||||
zsks = keystr_to_keylist(out, zskdir)
|
||||
assert len(zsks) == 1
|
||||
|
||||
lifetime = None
|
||||
@@ -1019,9 +1041,9 @@ def test_ksr_unlimited(servers):
|
||||
# - check keys
|
||||
check_keys(zsks, lifetime, with_state=True)
|
||||
# - check apex
|
||||
isctest.kasp.check_apex(ns1, zone, ksks, zsks, offline_ksk=True)
|
||||
isctest.kasp.check_apex(ns1, zone, ksks, zsks)
|
||||
# - check subdomain
|
||||
isctest.kasp.check_subdomain(ns1, zone, ksks, zsks, offline_ksk=True)
|
||||
isctest.kasp.check_subdomain(ns1, zone, ksks, zsks)
|
||||
|
||||
|
||||
def test_ksr_twotone(servers):
|
||||
@@ -1032,7 +1054,7 @@ def test_ksr_twotone(servers):
|
||||
# create ksk
|
||||
kskdir = "ns1/offline"
|
||||
out, _ = ksr(zone, policy, "keygen", options=f"-K {kskdir} -i now -e +1y -o")
|
||||
ksks = isctest.kasp.keystr_to_keylist(out, kskdir)
|
||||
ksks = keystr_to_keylist(out, kskdir)
|
||||
assert len(ksks) == 2
|
||||
|
||||
ksks_defalg = []
|
||||
@@ -1056,7 +1078,7 @@ def test_ksr_twotone(servers):
|
||||
# check that 'dnssec-ksr keygen' pregenerates right amount of keys
|
||||
zskdir = "ns1"
|
||||
out, _ = ksr(zone, policy, "keygen", options=f"-K {zskdir} -i now -e +1y")
|
||||
zsks = isctest.kasp.keystr_to_keylist(out, zskdir)
|
||||
zsks = keystr_to_keylist(out, zskdir)
|
||||
# First algorithm keys have a lifetime of 3 months, so there should
|
||||
# be 4 created keys. Second algorithm keys have a lifetime of 5
|
||||
# months, so there should be 3 created keys. While only two time
|
||||
@@ -1137,9 +1159,9 @@ def test_ksr_twotone(servers):
|
||||
lifetime = timedelta(days=31 * 5)
|
||||
check_keys(zsks_altalg, lifetime, alg, size, with_state=True)
|
||||
# - check apex
|
||||
isctest.kasp.check_apex(ns1, zone, ksks, zsks, offline_ksk=True)
|
||||
isctest.kasp.check_apex(ns1, zone, ksks, zsks)
|
||||
# - check subdomain
|
||||
isctest.kasp.check_subdomain(ns1, zone, ksks, zsks, offline_ksk=True)
|
||||
isctest.kasp.check_subdomain(ns1, zone, ksks, zsks)
|
||||
|
||||
|
||||
def test_ksr_kskroll(servers):
|
||||
@@ -1150,7 +1172,7 @@ def test_ksr_kskroll(servers):
|
||||
# create ksk
|
||||
kskdir = "ns1/offline"
|
||||
out, _ = ksr(zone, policy, "keygen", options=f"-K {kskdir} -i now -e +1y -o")
|
||||
ksks = isctest.kasp.keystr_to_keylist(out, kskdir)
|
||||
ksks = keystr_to_keylist(out, kskdir)
|
||||
assert len(ksks) == 2
|
||||
|
||||
lifetime = timedelta(days=31 * 6)
|
||||
@@ -1159,7 +1181,7 @@ def test_ksr_kskroll(servers):
|
||||
# check that 'dnssec-ksr keygen' pregenerates right amount of keys
|
||||
zskdir = "ns1"
|
||||
out, _ = ksr(zone, policy, "keygen", options=f"-K {zskdir} -i now -e +1y")
|
||||
zsks = isctest.kasp.keystr_to_keylist(out, zskdir)
|
||||
zsks = keystr_to_keylist(out, zskdir)
|
||||
assert len(zsks) == 1
|
||||
|
||||
check_keys(zsks, None)
|
||||
@@ -1211,6 +1233,6 @@ def test_ksr_kskroll(servers):
|
||||
# - check keys
|
||||
check_keys(zsks, None, with_state=True)
|
||||
# - check apex
|
||||
isctest.kasp.check_apex(ns1, zone, ksks, zsks, offline_ksk=True)
|
||||
isctest.kasp.check_apex(ns1, zone, ksks, zsks)
|
||||
# - check subdomain
|
||||
isctest.kasp.check_subdomain(ns1, zone, ksks, zsks, offline_ksk=True)
|
||||
isctest.kasp.check_subdomain(ns1, zone, ksks, zsks)
|
||||
|
||||
@@ -111,7 +111,7 @@ cleanup:
|
||||
}
|
||||
|
||||
if (mctx != NULL) {
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
}
|
||||
|
||||
return result != ISC_R_SUCCESS ? 1 : 0;
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
dnssec-policy "manual-rollover" {
|
||||
dnskey-ttl 3600;
|
||||
|
||||
keys {
|
||||
ksk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
|
||||
zsk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
};
|
||||
|
||||
dnssec-policy "multisigner-model2" {
|
||||
dnskey-ttl 3600;
|
||||
inline-signing no;
|
||||
|
||||
keys {
|
||||
ksk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@ tag-range 32768 65535;
|
||||
zsk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@ tag-range 32768 65535;
|
||||
};
|
||||
};
|
||||
|
||||
dnssec-policy "enable-dnssec" {
|
||||
signatures-refresh P1W;
|
||||
signatures-validity P2W;
|
||||
signatures-validity-dnskey P2W;
|
||||
|
||||
dnskey-ttl 300;
|
||||
max-zone-ttl PT12H;
|
||||
zone-propagation-delay PT5M;
|
||||
retire-safety PT20M;
|
||||
publish-safety PT5M;
|
||||
|
||||
parent-propagation-delay 1h;
|
||||
parent-ds-ttl 2h;
|
||||
|
||||
keys {
|
||||
csk lifetime unlimited algorithm @DEFAULT_ALGORITHM_NUMBER@;
|
||||
};
|
||||
};
|
||||
|
||||
dnssec-policy "zsk-prepub" {
|
||||
signatures-refresh P1W;
|
||||
signatures-validity P2W;
|
||||
signatures-validity-dnskey P2W;
|
||||
|
||||
dnskey-ttl 3600;
|
||||
publish-safety P1D;
|
||||
retire-safety P2D;
|
||||
purge-keys PT1H;
|
||||
|
||||
keys {
|
||||
ksk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
|
||||
zsk key-directory lifetime P30D algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
|
||||
zone-propagation-delay PT1H;
|
||||
max-zone-ttl 1d;
|
||||
};
|
||||
|
||||
dnssec-policy "ksk-doubleksk" {
|
||||
signatures-refresh P1W;
|
||||
signatures-validity P2W;
|
||||
signatures-validity-dnskey P2W;
|
||||
|
||||
dnskey-ttl 2h;
|
||||
publish-safety P1D;
|
||||
retire-safety P2D;
|
||||
purge-keys PT1H;
|
||||
|
||||
cdnskey no;
|
||||
keys {
|
||||
ksk key-directory lifetime P60D algorithm @DEFAULT_ALGORITHM@;
|
||||
zsk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
|
||||
zone-propagation-delay PT1H;
|
||||
max-zone-ttl 1d;
|
||||
|
||||
parent-ds-ttl 3600;
|
||||
parent-propagation-delay PT1H;
|
||||
};
|
||||
|
||||
dnssec-policy "csk-roll1" {
|
||||
signatures-refresh P5D;
|
||||
signatures-validity 30d;
|
||||
signatures-validity-dnskey 30d;
|
||||
|
||||
dnskey-ttl 1h;
|
||||
publish-safety PT1H;
|
||||
retire-safety 2h;
|
||||
purge-keys PT1H;
|
||||
|
||||
cds-digest-types { "sha-384"; }; // use a different digest type for testing purposes
|
||||
keys {
|
||||
csk key-directory lifetime P6M algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
|
||||
zone-propagation-delay 1h;
|
||||
max-zone-ttl P1D;
|
||||
|
||||
parent-ds-ttl 1h;
|
||||
parent-propagation-delay 1h;
|
||||
};
|
||||
|
||||
dnssec-policy "csk-roll2" {
|
||||
signatures-refresh 12h;
|
||||
signatures-validity P1D;
|
||||
signatures-validity-dnskey P1D;
|
||||
|
||||
dnskey-ttl 1h;
|
||||
publish-safety PT1H;
|
||||
retire-safety 1h;
|
||||
purge-keys 0;
|
||||
|
||||
cds-digest-types { "sha-256"; "sha-384"; }; // use two digest type for testing purposes
|
||||
keys {
|
||||
csk key-directory lifetime P6M algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
|
||||
zone-propagation-delay PT1H;
|
||||
max-zone-ttl 1d;
|
||||
|
||||
parent-ds-ttl PT1H;
|
||||
parent-propagation-delay P1W;
|
||||
};
|
||||
@@ -1,252 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
// NS3
|
||||
|
||||
include "kasp.conf";
|
||||
|
||||
options {
|
||||
query-source address 10.53.0.3;
|
||||
notify-source 10.53.0.3;
|
||||
transfer-source 10.53.0.3;
|
||||
port @PORT@;
|
||||
pid-file "named.pid";
|
||||
listen-on { 10.53.0.3; };
|
||||
listen-on-v6 { none; };
|
||||
allow-transfer { any; };
|
||||
recursion no;
|
||||
dnssec-validation no;
|
||||
};
|
||||
|
||||
key rndc_key {
|
||||
secret "1234abcd8765";
|
||||
algorithm @DEFAULT_HMAC@;
|
||||
};
|
||||
|
||||
controls {
|
||||
inet 10.53.0.3 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
|
||||
};
|
||||
|
||||
zone "." {
|
||||
type hint;
|
||||
file "../../_common/root.hint.blackhole";
|
||||
};
|
||||
|
||||
/* Manual rollover. */
|
||||
zone "manual-rollover.kasp" {
|
||||
type primary;
|
||||
file "manual-rollover.kasp.db";
|
||||
dnssec-policy "manual-rollover";
|
||||
};
|
||||
|
||||
/* RFC 8901 Multi-signer Model 2. */
|
||||
zone "multisigner-model2.kasp" {
|
||||
type primary;
|
||||
file "multisigner-model2.kasp.db";
|
||||
dnssec-policy "multisigner-model2";
|
||||
allow-update { any; };
|
||||
};
|
||||
|
||||
/*
|
||||
* A zone that starts with keys that have tags that are
|
||||
* outside of the desired multi-signer key tag range.
|
||||
*/
|
||||
zone "single-to-multisigner.kasp" {
|
||||
type primary;
|
||||
file "single-to-multisigner.kasp.db";
|
||||
dnssec-policy "multisigner-model2";
|
||||
allow-update { any; };
|
||||
};
|
||||
|
||||
/*
|
||||
* Zones for testing enabling DNSSEC.
|
||||
*/
|
||||
zone "step1.enable-dnssec.autosign" {
|
||||
type primary;
|
||||
file "step1.enable-dnssec.autosign.db";
|
||||
dnssec-policy "enable-dnssec";
|
||||
};
|
||||
zone "step2.enable-dnssec.autosign" {
|
||||
type primary;
|
||||
file "step2.enable-dnssec.autosign.db";
|
||||
dnssec-policy "enable-dnssec";
|
||||
};
|
||||
zone "step3.enable-dnssec.autosign" {
|
||||
type primary;
|
||||
file "step3.enable-dnssec.autosign.db";
|
||||
dnssec-policy "enable-dnssec";
|
||||
};
|
||||
zone "step4.enable-dnssec.autosign" {
|
||||
type primary;
|
||||
file "step4.enable-dnssec.autosign.db";
|
||||
dnssec-policy "enable-dnssec";
|
||||
};
|
||||
|
||||
/*
|
||||
* Zones for testing ZSK Pre-Publication steps.
|
||||
*/
|
||||
zone "step1.zsk-prepub.autosign" {
|
||||
type primary;
|
||||
file "step1.zsk-prepub.autosign.db";
|
||||
dnssec-policy "zsk-prepub";
|
||||
};
|
||||
zone "step2.zsk-prepub.autosign" {
|
||||
type primary;
|
||||
file "step2.zsk-prepub.autosign.db";
|
||||
dnssec-policy "zsk-prepub";
|
||||
};
|
||||
zone "step3.zsk-prepub.autosign" {
|
||||
type primary;
|
||||
file "step3.zsk-prepub.autosign.db";
|
||||
dnssec-policy "zsk-prepub";
|
||||
};
|
||||
zone "step4.zsk-prepub.autosign" {
|
||||
type primary;
|
||||
file "step4.zsk-prepub.autosign.db";
|
||||
dnssec-policy "zsk-prepub";
|
||||
};
|
||||
zone "step5.zsk-prepub.autosign" {
|
||||
type primary;
|
||||
file "step5.zsk-prepub.autosign.db";
|
||||
dnssec-policy "zsk-prepub";
|
||||
};
|
||||
zone "step6.zsk-prepub.autosign" {
|
||||
type primary;
|
||||
file "step6.zsk-prepub.autosign.db";
|
||||
dnssec-policy "zsk-prepub";
|
||||
};
|
||||
|
||||
/*
|
||||
* Zones for testing KSK Double-KSK steps.
|
||||
*/
|
||||
zone "step1.ksk-doubleksk.autosign" {
|
||||
type primary;
|
||||
file "step1.ksk-doubleksk.autosign.db";
|
||||
dnssec-policy "ksk-doubleksk";
|
||||
};
|
||||
zone "step2.ksk-doubleksk.autosign" {
|
||||
type primary;
|
||||
file "step2.ksk-doubleksk.autosign.db";
|
||||
dnssec-policy "ksk-doubleksk";
|
||||
};
|
||||
zone "step3.ksk-doubleksk.autosign" {
|
||||
type primary;
|
||||
file "step3.ksk-doubleksk.autosign.db";
|
||||
dnssec-policy "ksk-doubleksk";
|
||||
};
|
||||
zone "step4.ksk-doubleksk.autosign" {
|
||||
type primary;
|
||||
file "step4.ksk-doubleksk.autosign.db";
|
||||
dnssec-policy "ksk-doubleksk";
|
||||
};
|
||||
zone "step5.ksk-doubleksk.autosign" {
|
||||
type primary;
|
||||
file "step5.ksk-doubleksk.autosign.db";
|
||||
dnssec-policy "ksk-doubleksk";
|
||||
};
|
||||
zone "step6.ksk-doubleksk.autosign" {
|
||||
type primary;
|
||||
file "step6.ksk-doubleksk.autosign.db";
|
||||
dnssec-policy "ksk-doubleksk";
|
||||
};
|
||||
|
||||
/*
|
||||
* Zone for testing GL #2375: Three is a crowd.
|
||||
*/
|
||||
zone "three-is-a-crowd.kasp" {
|
||||
type primary;
|
||||
file "three-is-a-crowd.kasp.db";
|
||||
inline-signing yes;
|
||||
/* Use same policy as KSK rollover test zones. */
|
||||
dnssec-policy "ksk-doubleksk";
|
||||
};
|
||||
|
||||
/*
|
||||
* Zones for testing CSK rollover steps.
|
||||
*/
|
||||
zone "step1.csk-roll1.autosign" {
|
||||
type primary;
|
||||
file "step1.csk-roll1.autosign.db";
|
||||
dnssec-policy "csk-roll1";
|
||||
};
|
||||
zone "step2.csk-roll1.autosign" {
|
||||
type primary;
|
||||
file "step2.csk-roll1.autosign.db";
|
||||
dnssec-policy "csk-roll1";
|
||||
};
|
||||
zone "step3.csk-roll1.autosign" {
|
||||
type primary;
|
||||
file "step3.csk-roll1.autosign.db";
|
||||
dnssec-policy "csk-roll1";
|
||||
};
|
||||
zone "step4.csk-roll1.autosign" {
|
||||
type primary;
|
||||
file "step4.csk-roll1.autosign.db";
|
||||
dnssec-policy "csk-roll1";
|
||||
};
|
||||
zone "step5.csk-roll1.autosign" {
|
||||
type primary;
|
||||
file "step5.csk-roll1.autosign.db";
|
||||
dnssec-policy "csk-roll1";
|
||||
};
|
||||
zone "step6.csk-roll1.autosign" {
|
||||
type primary;
|
||||
file "step6.csk-roll1.autosign.db";
|
||||
dnssec-policy "csk-roll1";
|
||||
};
|
||||
zone "step7.csk-roll1.autosign" {
|
||||
type primary;
|
||||
file "step7.csk-roll1.autosign.db";
|
||||
dnssec-policy "csk-roll1";
|
||||
};
|
||||
zone "step8.csk-roll1.autosign" {
|
||||
type primary;
|
||||
file "step8.csk-roll1.autosign.db";
|
||||
dnssec-policy "csk-roll1";
|
||||
};
|
||||
|
||||
zone "step1.csk-roll2.autosign" {
|
||||
type primary;
|
||||
file "step1.csk-roll2.autosign.db";
|
||||
dnssec-policy "csk-roll2";
|
||||
};
|
||||
zone "step2.csk-roll2.autosign" {
|
||||
type primary;
|
||||
file "step2.csk-roll2.autosign.db";
|
||||
dnssec-policy "csk-roll2";
|
||||
};
|
||||
zone "step3.csk-roll2.autosign" {
|
||||
type primary;
|
||||
file "step3.csk-roll2.autosign.db";
|
||||
dnssec-policy "csk-roll2";
|
||||
};
|
||||
zone "step4.csk-roll2.autosign" {
|
||||
type primary;
|
||||
file "step4.csk-roll2.autosign.db";
|
||||
dnssec-policy "csk-roll2";
|
||||
};
|
||||
zone "step5.csk-roll2.autosign" {
|
||||
type primary;
|
||||
file "step5.csk-roll2.autosign.db";
|
||||
dnssec-policy "csk-roll2";
|
||||
};
|
||||
zone "step6.csk-roll2.autosign" {
|
||||
type primary;
|
||||
file "step6.csk-roll2.autosign.db";
|
||||
dnssec-policy "csk-roll2";
|
||||
};
|
||||
zone "step7.csk-roll2.autosign" {
|
||||
type primary;
|
||||
file "step7.csk-roll2.autosign.db";
|
||||
dnssec-policy "csk-roll2";
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,27 +0,0 @@
|
||||
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
;
|
||||
; SPDX-License-Identifier: MPL-2.0
|
||||
;
|
||||
; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
;
|
||||
; See the COPYRIGHT file distributed with this work for additional
|
||||
; information regarding copyright ownership.
|
||||
|
||||
$TTL 300
|
||||
@ IN SOA mname1. . (
|
||||
1 ; serial
|
||||
20 ; refresh (20 seconds)
|
||||
20 ; retry (20 seconds)
|
||||
1814400 ; expire (3 weeks)
|
||||
3600 ; minimum (1 hour)
|
||||
)
|
||||
|
||||
NS ns3
|
||||
ns3 A 10.53.0.3
|
||||
|
||||
a A 10.0.0.1
|
||||
b A 10.0.0.2
|
||||
c A 10.0.0.3
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
dnssec-policy "csk-algoroll" {
|
||||
signatures-refresh P5D;
|
||||
signatures-validity 30d;
|
||||
signatures-validity-dnskey 30d;
|
||||
|
||||
keys {
|
||||
csk lifetime unlimited algorithm rsasha256;
|
||||
};
|
||||
|
||||
dnskey-ttl 1h;
|
||||
publish-safety PT1H;
|
||||
retire-safety 2h;
|
||||
zone-propagation-delay 3600;
|
||||
max-zone-ttl 6h;
|
||||
parent-propagation-delay pt1h;
|
||||
parent-ds-ttl 7200;
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
dnssec-policy "csk-algoroll" {
|
||||
signatures-refresh P5D;
|
||||
signatures-validity 30d;
|
||||
signatures-validity-dnskey 30d;
|
||||
|
||||
keys {
|
||||
csk lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
|
||||
dnskey-ttl 1h;
|
||||
publish-safety PT1H;
|
||||
retire-safety 2h;
|
||||
zone-propagation-delay 3600;
|
||||
max-zone-ttl 6h;
|
||||
parent-propagation-delay pt1h;
|
||||
parent-ds-ttl 7200;
|
||||
};
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
dnssec-policy "unlimited-lifetime" {
|
||||
keys {
|
||||
csk lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
};
|
||||
dnssec-policy "short-lifetime" {
|
||||
keys {
|
||||
csk lifetime P6M algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
};
|
||||
|
||||
dnssec-policy "long-lifetime" {
|
||||
keys {
|
||||
csk lifetime P1Y algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
};
|
||||
|
||||
dnssec-policy "unsigning" {
|
||||
dnskey-ttl 7200;
|
||||
|
||||
keys {
|
||||
ksk key-directory lifetime unlimited algorithm @DEFAULT_ALGORITHM@;
|
||||
zsk key-directory lifetime P60D algorithm @DEFAULT_ALGORITHM@;
|
||||
};
|
||||
};
|
||||
|
||||
dnssec-policy "rsasha256" {
|
||||
signatures-refresh P5D;
|
||||
signatures-validity 30d;
|
||||
signatures-validity-dnskey 30d;
|
||||
|
||||
keys {
|
||||
ksk lifetime unlimited algorithm rsasha256;
|
||||
zsk lifetime unlimited algorithm rsasha256;
|
||||
};
|
||||
|
||||
dnskey-ttl 1h;
|
||||
publish-safety PT1H;
|
||||
retire-safety 2h;
|
||||
zone-propagation-delay 3600;
|
||||
max-zone-ttl 6h;
|
||||
parent-propagation-delay pt1h;
|
||||
parent-ds-ttl 7200;
|
||||
};
|
||||
|
||||
dnssec-policy "ecdsa256" {
|
||||
signatures-refresh P5D;
|
||||
signatures-validity 30d;
|
||||
signatures-validity-dnskey 30d;
|
||||
|
||||
keys {
|
||||
ksk lifetime unlimited algorithm ecdsa256;
|
||||
zsk lifetime unlimited algorithm ecdsa256;
|
||||
};
|
||||
|
||||
dnskey-ttl 1h;
|
||||
publish-safety PT1H;
|
||||
retire-safety 2h;
|
||||
zone-propagation-delay 3600;
|
||||
max-zone-ttl 6h;
|
||||
parent-propagation-delay pt1h;
|
||||
parent-ds-ttl 7200;
|
||||
};
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
include "kasp-fips.conf";
|
||||
|
||||
dnssec-policy "rsasha1" {
|
||||
signatures-refresh P5D;
|
||||
signatures-validity 30d;
|
||||
signatures-validity-dnskey 30d;
|
||||
|
||||
keys {
|
||||
ksk lifetime unlimited algorithm rsasha1;
|
||||
zsk lifetime unlimited algorithm rsasha1;
|
||||
};
|
||||
|
||||
dnskey-ttl 1h;
|
||||
publish-safety PT1H;
|
||||
retire-safety 2h;
|
||||
zone-propagation-delay 3600;
|
||||
max-zone-ttl 6h;
|
||||
parent-propagation-delay pt1h;
|
||||
parent-ds-ttl 7200;
|
||||
};
|
||||
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
// NS6
|
||||
|
||||
include "kasp.conf";
|
||||
include "csk1.conf";
|
||||
|
||||
options {
|
||||
query-source address 10.53.0.6;
|
||||
notify-source 10.53.0.6;
|
||||
transfer-source 10.53.0.6;
|
||||
port @PORT@;
|
||||
pid-file "named.pid";
|
||||
listen-on { 10.53.0.6; };
|
||||
listen-on-v6 { none; };
|
||||
allow-transfer { any; };
|
||||
recursion no;
|
||||
key-directory ".";
|
||||
dnssec-validation no;
|
||||
};
|
||||
|
||||
key rndc_key {
|
||||
secret "1234abcd8765";
|
||||
algorithm @DEFAULT_HMAC@;
|
||||
};
|
||||
|
||||
controls {
|
||||
inet 10.53.0.6 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
|
||||
};
|
||||
|
||||
zone "." {
|
||||
type hint;
|
||||
file "../../_common/root.hint.blackhole";
|
||||
};
|
||||
|
||||
/* This zone switch from dynamic to inline-signing. */
|
||||
zone "dynamic2inline.kasp" {
|
||||
type primary;
|
||||
file "dynamic2inline.kasp.db";
|
||||
allow-update { any; };
|
||||
dnssec-policy "default";
|
||||
};
|
||||
|
||||
/* Lifetime changes. */
|
||||
zone longer-lifetime {
|
||||
type primary;
|
||||
file "longer-lifetime.db";
|
||||
dnssec-policy short-lifetime;
|
||||
};
|
||||
|
||||
zone shorter-lifetime {
|
||||
type primary;
|
||||
file "shorter-lifetime.db";
|
||||
dnssec-policy long-lifetime;
|
||||
};
|
||||
|
||||
zone limit-lifetime {
|
||||
type primary;
|
||||
file "limit-lifetime.db";
|
||||
dnssec-policy unlimited-lifetime;
|
||||
};
|
||||
|
||||
zone unlimit-lifetime {
|
||||
type primary;
|
||||
file "unlimit-lifetime.db";
|
||||
dnssec-policy short-lifetime;
|
||||
};
|
||||
|
||||
/* These zones are going insecure. */
|
||||
zone "step1.going-insecure.kasp" {
|
||||
type primary;
|
||||
file "step1.going-insecure.kasp.db";
|
||||
dnssec-policy "unsigning";
|
||||
};
|
||||
|
||||
zone "step1.going-insecure-dynamic.kasp" {
|
||||
type primary;
|
||||
file "step1.going-insecure-dynamic.kasp.db";
|
||||
dnssec-policy "unsigning";
|
||||
inline-signing no;
|
||||
allow-update { any; };
|
||||
};
|
||||
|
||||
zone "step1.going-straight-to-none.kasp" {
|
||||
type primary;
|
||||
file "step1.going-straight-to-none.kasp.db";
|
||||
dnssec-policy "default";
|
||||
};
|
||||
|
||||
zone "step1.going-straight-to-none-dynamic.kasp" {
|
||||
type primary;
|
||||
file "step1.going-straight-to-none-dynamic.kasp.db.signed";
|
||||
inline-signing no;
|
||||
dnssec-policy "default";
|
||||
allow-update { any; };
|
||||
};
|
||||
|
||||
/* These are alorithm rollover test zones. */
|
||||
zone "step1.algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step1.algorithm-roll.kasp.db";
|
||||
dnssec-policy "rsasha256";
|
||||
};
|
||||
|
||||
zone "step1.csk-algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step1.csk-algorithm-roll.kasp.db";
|
||||
dnssec-policy "csk-algoroll";
|
||||
};
|
||||
@@ -1,198 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
// NS6
|
||||
|
||||
include "kasp.conf";
|
||||
include "csk2.conf";
|
||||
|
||||
options {
|
||||
query-source address 10.53.0.6;
|
||||
notify-source 10.53.0.6;
|
||||
transfer-source 10.53.0.6;
|
||||
port @PORT@;
|
||||
pid-file "named.pid";
|
||||
listen-on { 10.53.0.6; };
|
||||
listen-on-v6 { none; };
|
||||
allow-transfer { any; };
|
||||
recursion no;
|
||||
dnssec-validation no;
|
||||
};
|
||||
|
||||
key rndc_key {
|
||||
secret "1234abcd8765";
|
||||
algorithm @DEFAULT_HMAC@;
|
||||
};
|
||||
|
||||
controls {
|
||||
inet 10.53.0.6 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
|
||||
};
|
||||
|
||||
zone "." {
|
||||
type hint;
|
||||
file "../../_common/root.hint.blackhole";
|
||||
};
|
||||
|
||||
/* This zone switch from dynamic to inline-signing. */
|
||||
zone "dynamic2inline.kasp" {
|
||||
type primary;
|
||||
file "dynamic2inline.kasp.db";
|
||||
allow-update { any; };
|
||||
dnssec-policy "default";
|
||||
};
|
||||
|
||||
/* Lifetime changes. */
|
||||
zone longer-lifetime {
|
||||
type primary;
|
||||
file "longer-lifetime.db";
|
||||
dnssec-policy long-lifetime;
|
||||
};
|
||||
|
||||
zone shorter-lifetime {
|
||||
type primary;
|
||||
file "shorter-lifetime.db";
|
||||
dnssec-policy short-lifetime;
|
||||
};
|
||||
|
||||
zone limit-lifetime {
|
||||
type primary;
|
||||
file "limit-lifetime.db";
|
||||
dnssec-policy short-lifetime;
|
||||
};
|
||||
|
||||
zone unlimit-lifetime {
|
||||
type primary;
|
||||
file "unlimit-lifetime.db";
|
||||
dnssec-policy unlimited-lifetime;
|
||||
};
|
||||
|
||||
/* Zones for testing going insecure. */
|
||||
zone "step1.going-insecure.kasp" {
|
||||
type primary;
|
||||
file "step1.going-insecure.kasp.db";
|
||||
dnssec-policy "insecure";
|
||||
};
|
||||
|
||||
zone "step2.going-insecure.kasp" {
|
||||
type primary;
|
||||
file "step2.going-insecure.kasp.db";
|
||||
dnssec-policy "insecure";
|
||||
};
|
||||
|
||||
zone "step1.going-insecure-dynamic.kasp" {
|
||||
type primary;
|
||||
file "step1.going-insecure-dynamic.kasp.db";
|
||||
inline-signing no;
|
||||
dnssec-policy "insecure";
|
||||
allow-update { any; };
|
||||
};
|
||||
|
||||
zone "step2.going-insecure-dynamic.kasp" {
|
||||
type primary;
|
||||
file "step2.going-insecure-dynamic.kasp.db";
|
||||
inline-signing no;
|
||||
dnssec-policy "insecure";
|
||||
allow-update { any; };
|
||||
};
|
||||
|
||||
zone "step1.going-straight-to-none.kasp" {
|
||||
type primary;
|
||||
file "step1.going-straight-to-none.kasp.db";
|
||||
dnssec-policy "none";
|
||||
};
|
||||
|
||||
zone "step1.going-straight-to-none-dynamic.kasp" {
|
||||
type primary;
|
||||
file "step1.going-straight-to-none-dynamic.kasp.db.signed";
|
||||
inline-signing no;
|
||||
dnssec-policy "none";
|
||||
allow-update { any; };
|
||||
};
|
||||
|
||||
/*
|
||||
* Zones for testing KSK/ZSK algorithm roll.
|
||||
*/
|
||||
zone "step1.algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step1.algorithm-roll.kasp.db";
|
||||
dnssec-policy "ecdsa256";
|
||||
};
|
||||
|
||||
zone "step2.algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step2.algorithm-roll.kasp.db";
|
||||
dnssec-policy "ecdsa256";
|
||||
};
|
||||
|
||||
zone "step3.algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step3.algorithm-roll.kasp.db";
|
||||
dnssec-policy "ecdsa256";
|
||||
};
|
||||
|
||||
zone "step4.algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step4.algorithm-roll.kasp.db";
|
||||
dnssec-policy "ecdsa256";
|
||||
};
|
||||
|
||||
zone "step5.algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step5.algorithm-roll.kasp.db";
|
||||
dnssec-policy "ecdsa256";
|
||||
};
|
||||
|
||||
zone "step6.algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step6.algorithm-roll.kasp.db";
|
||||
dnssec-policy "ecdsa256";
|
||||
};
|
||||
|
||||
/*
|
||||
* Zones for testing CSK algorithm roll.
|
||||
*/
|
||||
zone "step1.csk-algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step1.csk-algorithm-roll.kasp.db";
|
||||
dnssec-policy "csk-algoroll";
|
||||
};
|
||||
|
||||
zone "step2.csk-algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step2.csk-algorithm-roll.kasp.db";
|
||||
dnssec-policy "csk-algoroll";
|
||||
};
|
||||
|
||||
zone "step3.csk-algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step3.csk-algorithm-roll.kasp.db";
|
||||
dnssec-policy "csk-algoroll";
|
||||
};
|
||||
|
||||
zone "step4.csk-algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step4.csk-algorithm-roll.kasp.db";
|
||||
dnssec-policy "csk-algoroll";
|
||||
};
|
||||
|
||||
zone "step5.csk-algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step5.csk-algorithm-roll.kasp.db";
|
||||
dnssec-policy "csk-algoroll";
|
||||
};
|
||||
|
||||
zone "step6.csk-algorithm-roll.kasp" {
|
||||
type primary;
|
||||
file "step6.csk-algorithm-roll.kasp.db";
|
||||
dnssec-policy "csk-algoroll";
|
||||
};
|
||||
@@ -1,390 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
# shellcheck source=conf.sh
|
||||
. ../../conf.sh
|
||||
|
||||
echo_i "ns6/setup.sh"
|
||||
|
||||
setup() {
|
||||
zone="$1"
|
||||
echo_i "setting up zone: $zone"
|
||||
zonefile="${zone}.db"
|
||||
infile="${zone}.db.infile"
|
||||
}
|
||||
|
||||
# Make lines shorter by storing key states in environment variables.
|
||||
H="HIDDEN"
|
||||
R="RUMOURED"
|
||||
O="OMNIPRESENT"
|
||||
U="UNRETENTIVE"
|
||||
|
||||
for zn in dynamic2inline.kasp shorter-lifetime longer-lifetime limit-lifetime \
|
||||
unlimit-lifetime; do
|
||||
setup $zn
|
||||
cp template.db.in $zonefile
|
||||
done
|
||||
|
||||
# The child zones (step1, step2) beneath these zones represent the various
|
||||
# steps of unsigning a zone.
|
||||
for zn in going-insecure.kasp going-insecure-dynamic.kasp; do
|
||||
# Step 1:
|
||||
# Set up a zone with dnssec-policy that is going insecure.
|
||||
setup step1.$zn
|
||||
echo "$zone" >>zones
|
||||
T="now-10d"
|
||||
S="now-12955mi"
|
||||
keytimes="-P $T -A $T"
|
||||
cdstimes="-P sync $S"
|
||||
KSK=$($KEYGEN -a $DEFAULT_ALGORITHM -L 7200 -f KSK $keytimes $cdstimes $zone 2>keygen.out.$zone.1)
|
||||
ZSK=$($KEYGEN -a $DEFAULT_ALGORITHM -L 7200 $keytimes $zone 2>keygen.out.$zone.2)
|
||||
cat template.db.in "${KSK}.key" "${ZSK}.key" >"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 2:
|
||||
# Set up a zone with dnssec-policy that is going insecure. Don't add
|
||||
# this zone to the zones file, because this zone is no longer expected
|
||||
# to be fully signed.
|
||||
setup step2.$zn
|
||||
# The DS was withdrawn from the parent zone 26 hours ago.
|
||||
D="now-26h"
|
||||
keytimes="-P $T -A $T -I $D -D now"
|
||||
cdstimes="-P sync $S -D sync $D"
|
||||
KSK=$($KEYGEN -a $DEFAULT_ALGORITHM -L 7200 -f KSK $keytimes $cdstimes $zone 2>keygen.out.$zone.1)
|
||||
ZSK=$($KEYGEN -a $DEFAULT_ALGORITHM -L 7200 $keytimes $zone 2>keygen.out.$zone.2)
|
||||
$SETTIME -s -g $H -k $O $T -r $O $T -d $U $D -D ds $D "$KSK" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $H -k $O $T -z $O $T "$ZSK" >settime.out.$zone.2 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${KSK}.state"
|
||||
echo "Lifetime: 5184000" >>"${ZSK}.state"
|
||||
cat template.db.in "${KSK}.key" "${ZSK}.key" >"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
done
|
||||
|
||||
# These zones are going straight to "none" policy. This is undefined behavior.
|
||||
T="now-10d"
|
||||
S="now-12955mi"
|
||||
csktimes="-P $T -A $T -P sync $S"
|
||||
|
||||
setup step1.going-straight-to-none.kasp
|
||||
echo "$zone" >>zones
|
||||
CSK=$($KEYGEN -k default $csktimes $zone 2>keygen.out.$zone.1)
|
||||
$SETTIME -s -g $O -k $O $TactN -z $O $TactN -r $O $TactN -d $O $TactN "$CSK" >settime.out.$zone.1 2>&1
|
||||
cat template.db.in "${CSK}.key" >"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -z -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
setup step1.going-straight-to-none-dynamic.kasp
|
||||
echo "$zone" >>zones
|
||||
CSK=$($KEYGEN -k default $csktimes $zone 2>keygen.out.$zone.1)
|
||||
$SETTIME -s -g $O -k $O $TactN -z $O $TactN -r $O $TactN -d $O $TactN "$CSK" >settime.out.$zone.1 2>&1
|
||||
cat template.db.in "${CSK}.key" >"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -z -x -s now-1h -e now+2w -o $zone -O full -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
#
|
||||
# The zones at algorithm-roll.kasp represent the various steps of a ZSK/KSK
|
||||
# algorithm rollover.
|
||||
#
|
||||
|
||||
# Step 1:
|
||||
# Introduce the first key. This will immediately be active.
|
||||
setup step1.algorithm-roll.kasp
|
||||
echo "$zone" >>zones
|
||||
TactN="now-7d"
|
||||
TsbmN="now-161h"
|
||||
ksktimes="-P ${TactN} -A ${TactN}"
|
||||
zsktimes="-P ${TactN} -A ${TactN}"
|
||||
KSK=$($KEYGEN -a RSASHA256 -L 3600 -f KSK $ksktimes $zone 2>keygen.out.$zone.1)
|
||||
ZSK=$($KEYGEN -a RSASHA256 -L 3600 $zsktimes $zone 2>keygen.out.$zone.2)
|
||||
$SETTIME -s -g $O -k $O $TactN -r $O $TactN -d $O $TactN "$KSK" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $O -k $O $TactN -z $O $TactN "$ZSK" >settime.out.$zone.2 2>&1
|
||||
cat template.db.in "${KSK}.key" "${ZSK}.key" >"$infile"
|
||||
private_type_record $zone 8 "$KSK" >>"$infile"
|
||||
private_type_record $zone 8 "$ZSK" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 2:
|
||||
# After the publication interval has passed the DNSKEY is OMNIPRESENT.
|
||||
setup step2.algorithm-roll.kasp
|
||||
# The time passed since the new algorithm keys have been introduced is 3 hours.
|
||||
TpubN1="now-3h"
|
||||
# Tsbm(N+1) = TpubN1 + Ipub = now + TTLsig + Dprp = now - 3h + 6h + 1h = now + 4h
|
||||
TsbmN1="now+4h"
|
||||
ksk1times="-P ${TactN} -A ${TactN} -P sync ${TsbmN} -I ${TsbmN1}"
|
||||
zsk1times="-P ${TactN} -A ${TactN} -I ${TsbmN1}"
|
||||
ksk2times="-P ${TpubN1} -A ${TpubN1} -P sync ${TsbmN1}"
|
||||
zsk2times="-P ${TpubN1} -A ${TpubN1}"
|
||||
KSK1=$($KEYGEN -a RSASHA256 -L 3600 -f KSK $ksk1times $zone 2>keygen.out.$zone.1)
|
||||
ZSK1=$($KEYGEN -a RSASHA256 -L 3600 $zsk1times $zone 2>keygen.out.$zone.2)
|
||||
KSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 -f KSK $ksk2times $zone 2>keygen.out.$zone.3)
|
||||
ZSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 $zsk2times $zone 2>keygen.out.$zone.4)
|
||||
$SETTIME -s -g $H -k $O $TactN -r $O $TactN -d $O $TactN "$KSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $H -k $O $TactN -z $O $TactN "$ZSK1" >settime.out.$zone.2 2>&1
|
||||
$SETTIME -s -g $O -k $R $TpubN1 -r $R $TpubN1 -d $H $TpubN1 "$KSK2" >settime.out.$zone.3 2>&1
|
||||
$SETTIME -s -g $O -k $R $TpubN1 -z $R $TpubN1 "$ZSK2" >settime.out.$zone.4 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${KSK1}.state"
|
||||
echo "Lifetime: 0" >>"${ZSK1}.state"
|
||||
cat template.db.in "${KSK1}.key" "${ZSK1}.key" "${KSK2}.key" "${ZSK2}.key" >"$infile"
|
||||
private_type_record $zone 8 "$KSK1" >>"$infile"
|
||||
private_type_record $zone 8 "$ZSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK2" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 3:
|
||||
# The zone signatures are also OMNIPRESENT.
|
||||
setup step3.algorithm-roll.kasp
|
||||
# The time passed since the new algorithm keys have been introduced is 7 hours.
|
||||
TpubN1="now-7h"
|
||||
TsbmN1="now"
|
||||
ksk1times="-P ${TactN} -A ${TactN} -P sync ${TsbmN} -I ${TsbmN1}"
|
||||
zsk1times="-P ${TactN} -A ${TactN} -I ${TsbmN1}"
|
||||
ksk2times="-P ${TpubN1} -A ${TpubN1} -P sync ${TsbmN1}"
|
||||
zsk2times="-P ${TpubN1} -A ${TpubN1}"
|
||||
KSK1=$($KEYGEN -a RSASHA256 -L 3600 -f KSK $ksk1times $zone 2>keygen.out.$zone.1)
|
||||
ZSK1=$($KEYGEN -a RSASHA256 -L 3600 $zsk1times $zone 2>keygen.out.$zone.2)
|
||||
KSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 -f KSK $ksk2times $zone 2>keygen.out.$zone.3)
|
||||
ZSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 $zsk2times $zone 2>keygen.out.$zone.4)
|
||||
$SETTIME -s -g $H -k $O $TactN -r $O $TactN -d $O $TactN "$KSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $H -k $O $TactN -z $O $TactN "$ZSK1" >settime.out.$zone.2 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -r $O $TpubN1 -d $H $TpubN1 "$KSK2" >settime.out.$zone.3 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -z $R $TpubN1 "$ZSK2" >settime.out.$zone.4 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${KSK1}.state"
|
||||
echo "Lifetime: 0" >>"${ZSK1}.state"
|
||||
cat template.db.in "${KSK1}.key" "${ZSK1}.key" "${KSK2}.key" "${ZSK2}.key" >"$infile"
|
||||
private_type_record $zone 8 "$KSK1" >>"$infile"
|
||||
private_type_record $zone 8 "$ZSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK2" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 4:
|
||||
# The DS is swapped and can become OMNIPRESENT.
|
||||
setup step4.algorithm-roll.kasp
|
||||
# The time passed since the DS has been swapped is 3 hours.
|
||||
TpubN1="now-10h"
|
||||
TsbmN1="now-3h"
|
||||
ksk1times="-P ${TactN} -A ${TactN} -P sync ${TsbmN} -I ${TsbmN1}"
|
||||
zsk1times="-P ${TactN} -A ${TactN} -I ${TsbmN1}"
|
||||
ksk2times="-P ${TpubN1} -A ${TpubN1} -P sync ${TsbmN1}"
|
||||
zsk2times="-P ${TpubN1} -A ${TpubN1}"
|
||||
KSK1=$($KEYGEN -a RSASHA256 -L 3600 -f KSK $ksk1times $zone 2>keygen.out.$zone.1)
|
||||
ZSK1=$($KEYGEN -a RSASHA256 -L 3600 $zsk1times $zone 2>keygen.out.$zone.2)
|
||||
KSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 -f KSK $ksk2times $zone 2>keygen.out.$zone.3)
|
||||
ZSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 $zsk2times $zone 2>keygen.out.$zone.4)
|
||||
$SETTIME -s -g $H -k $O $TactN -r $O $TactN -d $U $TsbmN1 -D ds $TsbmN1 "$KSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $H -k $O $TactN -z $O $TactN "$ZSK1" >settime.out.$zone.2 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -r $O $TpubN1 -d $R $TsbmN1 -P ds $TsbmN1 "$KSK2" >settime.out.$zone.3 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -z $R $TpubN1 "$ZSK2" >settime.out.$zone.4 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${KSK1}.state"
|
||||
echo "Lifetime: 0" >>"${ZSK1}.state"
|
||||
cat template.db.in "${KSK1}.key" "${ZSK1}.key" "${KSK2}.key" "${ZSK2}.key" >"$infile"
|
||||
private_type_record $zone 8 "$KSK1" >>"$infile"
|
||||
private_type_record $zone 8 "$ZSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK2" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 5:
|
||||
# The DNSKEY is removed long enough to be HIDDEN.
|
||||
setup step5.algorithm-roll.kasp
|
||||
# The time passed since the DNSKEY has been removed is 2 hours.
|
||||
TpubN1="now-12h"
|
||||
TsbmN1="now-5h"
|
||||
ksk1times="-P ${TactN} -A ${TactN} -P sync ${TsbmN} -I ${TsbmN1}"
|
||||
zsk1times="-P ${TactN} -A ${TactN} -I ${TsbmN1}"
|
||||
ksk2times="-P ${TpubN1} -A ${TpubN1} -P sync ${TsbmN1}"
|
||||
zsk2times="-P ${TpubN1} -A ${TpubN1}"
|
||||
KSK1=$($KEYGEN -a RSASHA256 -L 3600 -f KSK $ksk1times $zone 2>keygen.out.$zone.1)
|
||||
ZSK1=$($KEYGEN -a RSASHA256 -L 3600 $zsk1times $zone 2>keygen.out.$zone.2)
|
||||
KSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 -f KSK $ksk2times $zone 2>keygen.out.$zone.3)
|
||||
ZSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 $zsk2times $zone 2>keygen.out.$zone.4)
|
||||
$SETTIME -s -g $H -k $U $TsbmN1 -r $U $TsbmN1 -d $H $TsbmN1 "$KSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $H -k $U $TsbmN1 -z $U $TsbmN1 "$ZSK1" >settime.out.$zone.2 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -r $O $TpubN1 -d $O $TsbmN1 "$KSK2" >settime.out.$zone.3 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -z $R $TpubN1 "$ZSK2" >settime.out.$zone.4 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${KSK1}.state"
|
||||
echo "Lifetime: 0" >>"${ZSK1}.state"
|
||||
cat template.db.in "${KSK1}.key" "${ZSK1}.key" "${KSK2}.key" "${ZSK2}.key" >"$infile"
|
||||
private_type_record $zone 8 "$KSK1" >>"$infile"
|
||||
private_type_record $zone 8 "$ZSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK2" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 6:
|
||||
# The RRSIGs have been removed long enough to be HIDDEN.
|
||||
setup step6.algorithm-roll.kasp
|
||||
# Additional time passed: 7h.
|
||||
TpubN1="now-19h"
|
||||
TsbmN1="now-12h"
|
||||
ksk1times="-P ${TactN} -A ${TactN} -P sync ${TsbmN} -I ${TsbmN1}"
|
||||
zsk1times="-P ${TactN} -A ${TactN} -I ${TsbmN1}"
|
||||
ksk2times="-P ${TpubN1} -A ${TpubN1} -P sync ${TsbmN1}"
|
||||
zsk2times="-P ${TpubN1} -A ${TpubN1}"
|
||||
KSK1=$($KEYGEN -a RSASHA256 -L 3600 -f KSK $ksk1times $zone 2>keygen.out.$zone.1)
|
||||
ZSK1=$($KEYGEN -a RSASHA256 -L 3600 $zsk1times $zone 2>keygen.out.$zone.2)
|
||||
KSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 -f KSK $ksk2times $zone 2>keygen.out.$zone.3)
|
||||
ZSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 $zsk2times $zone 2>keygen.out.$zone.4)
|
||||
$SETTIME -s -g $H -k $H $TsbmN1 -r $U $TsbmN1 -d $H $TsbmN1 "$KSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $H -k $H $TsbmN1 -z $U $TsbmN1 "$ZSK1" >settime.out.$zone.2 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -r $O $TpubN1 -d $O $TsbmN1 "$KSK2" >settime.out.$zone.3 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -z $R $TpubN1 "$ZSK2" >settime.out.$zone.4 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${KSK1}.state"
|
||||
echo "Lifetime: 0" >>"${ZSK1}.state"
|
||||
cat template.db.in "${KSK1}.key" "${ZSK1}.key" "${KSK2}.key" "${ZSK2}.key" >"$infile"
|
||||
private_type_record $zone 8 "$KSK1" >>"$infile"
|
||||
private_type_record $zone 8 "$ZSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK2" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
#
|
||||
# The zones at csk-algorithm-roll.kasp represent the various steps of a CSK
|
||||
# algorithm rollover.
|
||||
#
|
||||
|
||||
# Step 1:
|
||||
# Introduce the first key. This will immediately be active.
|
||||
setup step1.csk-algorithm-roll.kasp
|
||||
echo "$zone" >>zones
|
||||
TactN="now-7d"
|
||||
TsbmN="now-161h"
|
||||
csktimes="-P ${TactN} -A ${TactN}"
|
||||
CSK=$($KEYGEN -k csk-algoroll -l csk1.conf $csktimes $zone 2>keygen.out.$zone.1)
|
||||
$SETTIME -s -g $O -k $O $TactN -r $O $TactN -z $O $TactN -d $O $TactN "$CSK" >settime.out.$zone.1 2>&1
|
||||
cat template.db.in "${CSK}.key" >"$infile"
|
||||
private_type_record $zone 5 "$CSK" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -z -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 2:
|
||||
# After the publication interval has passed the DNSKEY is OMNIPRESENT.
|
||||
setup step2.csk-algorithm-roll.kasp
|
||||
# The time passed since the new algorithm keys have been introduced is 3 hours.
|
||||
TpubN1="now-3h"
|
||||
# Tsbm(N+1) = TpubN1 + Ipub = now + TTLsig + Dprp = now - 3h + 6h + 1h = now + 4h
|
||||
TsbmN1="now+4h"
|
||||
csktimes="-P ${TactN} -A ${TactN} -P sync ${TsbmN} -I now"
|
||||
newtimes="-P ${TpubN1} -A ${TpubN1}"
|
||||
CSK1=$($KEYGEN -k csk-algoroll -l csk1.conf $csktimes $zone 2>keygen.out.$zone.1)
|
||||
CSK2=$($KEYGEN -k csk-algoroll -l csk2.conf $newtimes $zone 2>keygen.out.$zone.2)
|
||||
$SETTIME -s -g $H -k $O $TactN -r $O $TactN -z $O $TactN -d $O $TactN "$CSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $O -k $R $TpubN1 -r $R $TpubN1 -z $R $TpubN1 -d $H $TpubN1 "$CSK2" >settime.out.$zone.2 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${CSK1}.state"
|
||||
cat template.db.in "${CSK1}.key" "${CSK2}.key" >"$infile"
|
||||
private_type_record $zone 5 "$CSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -z -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 3:
|
||||
# The zone signatures are also OMNIPRESENT.
|
||||
setup step3.csk-algorithm-roll.kasp
|
||||
# The time passed since the new algorithm keys have been introduced is 7 hours.
|
||||
TpubN1="now-7h"
|
||||
TsbmN1="now"
|
||||
ckstimes="-P ${TactN} -A ${TactN} -P sync ${TsbmN} -I ${TsbmN1}"
|
||||
newtimes="-P ${TpubN1} -A ${TpubN1} -P sync ${TsbmN1}"
|
||||
CSK1=$($KEYGEN -k csk-algoroll -l csk1.conf $csktimes $zone 2>keygen.out.$zone.1)
|
||||
CSK2=$($KEYGEN -k csk-algoroll -l csk2.conf $newtimes $zone 2>keygen.out.$zone.2)
|
||||
$SETTIME -s -g $H -k $O $TactN -r $O $TactN -z $O $TactN -d $O $TactN "$CSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -r $O $TpubN1 -z $R $TpubN1 -d $H $TpubN1 "$CSK2" >settime.out.$zone.2 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${CSK1}.state"
|
||||
cat template.db.in "${CSK1}.key" "${CSK2}.key" >"$infile"
|
||||
private_type_record $zone 5 "$CSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -z -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 4:
|
||||
# The DS is swapped and can become OMNIPRESENT.
|
||||
setup step4.csk-algorithm-roll.kasp
|
||||
# The time passed since the DS has been swapped is 3 hours.
|
||||
TpubN1="now-10h"
|
||||
TsbmN1="now-3h"
|
||||
csktimes="-P ${TactN} -A ${TactN} -P sync ${TsbmN} -I ${TsbmN1}"
|
||||
newtimes="-P ${TpubN1} -A ${TpubN1} -P sync ${TsbmN1}"
|
||||
CSK1=$($KEYGEN -k csk-algoroll -l csk1.conf $csktimes $zone 2>keygen.out.$zone.1)
|
||||
CSK2=$($KEYGEN -k csk-algoroll -l csk2.conf $newtimes $zone 2>keygen.out.$zone.2)
|
||||
$SETTIME -s -g $H -k $O $TactN -r $O $TactN -z $O $TsbmN1 -d $U $TsbmN1 -D ds $TsbmN1 "$CSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -r $O $TpubN1 -z $O $TsbmN1 -d $R $TsbmN1 -P ds $TsbmN1 "$CSK2" >settime.out.$zone.2 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${CSK1}.state"
|
||||
cat template.db.in "${CSK1}.key" "${CSK2}.key" >"$infile"
|
||||
private_type_record $zone 5 "$CSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -z -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 5:
|
||||
# The DNSKEY is removed long enough to be HIDDEN.
|
||||
setup step5.csk-algorithm-roll.kasp
|
||||
# The time passed since the DNSKEY has been removed is 2 hours.
|
||||
TpubN1="now-12h"
|
||||
TsbmN1="now-5h"
|
||||
csktimes="-P ${TactN} -A ${TactN} -P sync ${TsbmN} -I ${TsbmN1}"
|
||||
newtimes="-P ${TpubN1} -A ${TpubN1} -P sync ${TsbmN1}"
|
||||
CSK1=$($KEYGEN -k csk-algoroll -l csk1.conf $csktimes $zone 2>keygen.out.$zone.1)
|
||||
CSK2=$($KEYGEN -k csk-algoroll -l csk2.conf $newtimes $zone 2>keygen.out.$zone.2)
|
||||
$SETTIME -s -g $H -k $U $TactN -r $U $TactN -z $U $TsbmN1 -d $H $TsbmN1 "$CSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $O -k $O $TpubN1 -r $O $TpubN1 -z $O $TsbmN1 -d $O $TsbmN1 "$CSK2" >settime.out.$zone.2 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${CSK1}.state"
|
||||
cat template.db.in "${CSK1}.key" "${CSK2}.key" >"$infile"
|
||||
private_type_record $zone 5 "$CSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -z -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 6:
|
||||
# The RRSIGs have been removed long enough to be HIDDEN.
|
||||
setup step6.csk-algorithm-roll.kasp
|
||||
# Additional time passed: 7h.
|
||||
TpubN1="now-19h"
|
||||
TsbmN1="now-12h"
|
||||
csktimes="-P ${TactN} -A ${TactN} -P sync ${TsbmN} -I ${TsbmN1}"
|
||||
newtimes="-P ${TpubN1} -A ${TpubN1} -P sync ${TsbmN1}"
|
||||
CSK1=$($KEYGEN -k csk-algoroll -l csk1.conf $csktimes $zone 2>keygen.out.$zone.1)
|
||||
CSK2=$($KEYGEN -k csk-algoroll -l csk2.conf $newtimes $zone 2>keygen.out.$zone.2)
|
||||
$SETTIME -s -g $H -k $H $TactN -r $U $TactN -z $U $TactN -d $H $TsbmN1 "$CSK1" >settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $O -k $O $TactN1 -r $O $TactN1 -z $O $TsubN1 -d $O $TsbmN1 "$CSK2" >settime.out.$zone.2 2>&1
|
||||
# Fake lifetime of old algorithm keys.
|
||||
echo "Lifetime: 0" >>"${CSK1}.state"
|
||||
cat template.db.in "${CSK1}.key" "${CSK2}.key" >"$infile"
|
||||
private_type_record $zone 5 "$CSK1" >>"$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK2" >>"$infile"
|
||||
cp $infile $zonefile
|
||||
$SIGNER -S -x -z -s now-1h -e now+2w -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
|
||||
@@ -1,27 +0,0 @@
|
||||
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
;
|
||||
; SPDX-License-Identifier: MPL-2.0
|
||||
;
|
||||
; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
;
|
||||
; See the COPYRIGHT file distributed with this work for additional
|
||||
; information regarding copyright ownership.
|
||||
|
||||
$TTL 300
|
||||
@ IN SOA mname1. . (
|
||||
1 ; serial
|
||||
20 ; refresh (20 seconds)
|
||||
20 ; retry (20 seconds)
|
||||
1814400 ; expire (3 weeks)
|
||||
3600 ; minimum (1 hour)
|
||||
)
|
||||
|
||||
NS ns6
|
||||
ns6 A 10.53.0.6
|
||||
|
||||
a A 10.0.0.1
|
||||
b A 10.0.0.2
|
||||
c A 10.0.0.3
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
. ../conf.sh
|
||||
|
||||
if test -n "$PYTHON"; then
|
||||
if $PYTHON -c "from dns.update import UpdateMessage" 2>/dev/null; then
|
||||
:
|
||||
else
|
||||
echo_i "This test requires the dnspython >= 2.0.0 module." >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo_i "This test requires Python and the dnspython module." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
# shellcheck source=conf.sh
|
||||
. ../conf.sh
|
||||
|
||||
set -e
|
||||
|
||||
copy_setports ns3/named.conf.in ns3/named.conf
|
||||
copy_setports ns3/kasp.conf.in ns3/kasp.conf
|
||||
|
||||
copy_setports ns6/named.conf.in ns6/named.conf
|
||||
copy_setports ns6/named2.conf.in ns6/named2.conf
|
||||
copy_setports ns6/csk1.conf.in ns6/csk1.conf
|
||||
copy_setports ns6/csk2.conf.in ns6/csk2.conf
|
||||
copy_setports ns6/kasp-fips.conf.in ns6/kasp-fips.conf
|
||||
copy_setports ns6/kasp.conf.in ns6/kasp.conf
|
||||
if [ $RSASHA1_SUPPORTED = 0 ]; then
|
||||
cp ns6/kasp-fips.conf ns6/kasp.conf
|
||||
fi
|
||||
|
||||
(
|
||||
cd ns3
|
||||
$SHELL setup.sh
|
||||
)
|
||||
(
|
||||
cd ns6
|
||||
$SHELL setup.sh
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -102,23 +102,6 @@ def test_rpz_passthru_logging():
|
||||
dns.rrset.from_text("allowed.", 300, "IN", "A", "10.53.0.2")
|
||||
]
|
||||
|
||||
# Should also generate a log entry into rpz_passthru.txt
|
||||
msg_allowed_any = dns.message.make_query("allowed.", "ANY")
|
||||
res_allowed_any = isctest.query.udp(
|
||||
msg_allowed_any,
|
||||
resolver_ip,
|
||||
source="10.53.0.1",
|
||||
expected_rcode=dns.rcode.NOERROR,
|
||||
)
|
||||
assert res_allowed_any.answer == [
|
||||
dns.rrset.from_text("allowed.", 300, "IN", "NS", "ns1.allowed."),
|
||||
dns.rrset.from_text("allowed.", 300, "IN", "A", "10.53.0.2"),
|
||||
]
|
||||
# The comparison above doesn't compare the TTL values, and we want to
|
||||
# make sure that the "passthru" rpz doesn't cap the TTL with max-policy-ttl.
|
||||
assert res_allowed_any.answer[0].ttl > 200
|
||||
assert res_allowed_any.answer[1].ttl > 200
|
||||
|
||||
# baddomain.com isn't allowed (CNAME .), should return NXDOMAIN
|
||||
# Should generate a log entry into rpz.txt
|
||||
msg_not_allowed = dns.message.make_query("baddomain.", "A")
|
||||
|
||||
@@ -140,7 +140,7 @@ main(int argc, char **argv) {
|
||||
printf("%s\n", filename);
|
||||
dst_key_free(&key);
|
||||
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ sub construct_ns_command {
|
||||
$command = "taskset $taskset $NAMED ";
|
||||
} elsif ($ENV{'USE_RR'}) {
|
||||
$ENV{'_RR_TRACE_DIR'} = ".";
|
||||
$command = "$ENV{'TOP_BUILDDIR'}/libtool --mode=execute rr record --chaos $NAMED ";
|
||||
$command = "rr record --chaos $NAMED ";
|
||||
} else {
|
||||
$command = "$NAMED ";
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ main(int argc, char *argv[]) {
|
||||
if (printmemstats) {
|
||||
isc_mem_stats(mctx, stdout);
|
||||
}
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@ cleanup:
|
||||
if (message != NULL) {
|
||||
dns_message_detach(&message);
|
||||
}
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
exit(rv);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ cleanup(void) {
|
||||
isc_lex_destroy(&lex);
|
||||
}
|
||||
if (mctx != NULL) {
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -886,6 +886,31 @@ AC_CHECK_HEADERS([execinfo.h],
|
||||
[AC_SEARCH_LIBS([backtrace_symbols], [execinfo],
|
||||
[AC_CHECK_FUNCS([backtrace_symbols])])])
|
||||
|
||||
#
|
||||
# We do the IPv6 compilation checking after libtool so that we can put
|
||||
# the right suffix on the files.
|
||||
#
|
||||
AC_MSG_CHECKING([for IPv6 structures])
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
]],
|
||||
[[
|
||||
struct sockaddr_in6 sin6;
|
||||
struct in6_addr in6;
|
||||
struct in6_pktinfo in6_pi;
|
||||
struct sockaddr_storage storage;
|
||||
in6 = in6addr_any;
|
||||
in6 = in6addr_loopback;
|
||||
sin6.sin6_scope_id = 0;
|
||||
return (0);
|
||||
]])],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_FAILURE([IPv6 support is mandatory])])
|
||||
|
||||
#
|
||||
# Allow forcibly disabling TCP Fast Open support as autodetection might yield
|
||||
# confusing results on some systems (e.g. FreeBSD; see set_tcp_fastopen()
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ main(int argc, char **argv) {
|
||||
if (memstats) {
|
||||
isc_mem_stats(mctx, stderr);
|
||||
}
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
fflush(stdout);
|
||||
if (ferror(stdout)) {
|
||||
|
||||
@@ -74,6 +74,6 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
|
||||
end:
|
||||
dns_db_detach(&db);
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+1
-1
@@ -211,7 +211,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
}
|
||||
|
||||
dns_qp_destroy(&qp);
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
isc_mem_checkdestroyed(stderr);
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(item); i++) {
|
||||
|
||||
@@ -145,6 +145,6 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
cleanup:
|
||||
isc_lex_close(lex);
|
||||
isc_lex_destroy(&lex);
|
||||
isc_mem_detach(&mctx);
|
||||
isc_mem_destroy(&mctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -567,6 +567,14 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset,
|
||||
rdataset->ttl = ttlclamp(rdataset->ttl);
|
||||
}
|
||||
|
||||
if (rdtype != dns_rdatatype_a && rdtype != dns_rdatatype_aaaa) {
|
||||
char rb[DNS_RDATATYPE_FORMATSIZE];
|
||||
char nb[DNS_NAME_FORMATSIZE];
|
||||
dns_rdatatype_format(rdtype, rb, sizeof(rb));
|
||||
dns_name_format(adbname->name, nb, sizeof(nb));
|
||||
isc_log_write(DNS_LOGCATEGORY_RESOLVER, DNS_LOGMODULE_RESOLVER, ISC_LOG_NOTICE,
|
||||
"%s has %s", nb, rb);
|
||||
}
|
||||
REQUIRE(rdtype == dns_rdatatype_a || rdtype == dns_rdatatype_aaaa);
|
||||
|
||||
for (result = dns_rdataset_first(rdataset); result == ISC_R_SUCCESS;
|
||||
|
||||
+2
-2
@@ -38,9 +38,9 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/crypto.h>
|
||||
#include <isc/dir.h>
|
||||
#include <isc/file.h>
|
||||
#include <isc/fips.h>
|
||||
#include <isc/lex.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/once.h>
|
||||
@@ -226,7 +226,7 @@ dst__lib_shutdown(void) {
|
||||
}
|
||||
}
|
||||
|
||||
isc_mem_detach(&dst__mctx);
|
||||
isc_mem_destroy(&dst__mctx);
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
+8
-8
@@ -43,7 +43,7 @@ struct dyndb_implementation {
|
||||
dns_dyndb_destroy_t *destroy_func;
|
||||
char *name;
|
||||
void *inst;
|
||||
ISC_LINK(dyndb_implementation_t) link;
|
||||
LINK(dyndb_implementation_t) link;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -52,7 +52,7 @@ struct dyndb_implementation {
|
||||
* These are stored here so they can be cleaned up on shutdown.
|
||||
* (The order in which they are stored is not important.)
|
||||
*/
|
||||
static ISC_LIST(dyndb_implementation_t) dyndb_implementations;
|
||||
static LIST(dyndb_implementation_t) dyndb_implementations;
|
||||
|
||||
/* Locks dyndb_implementations. */
|
||||
static isc_mutex_t dyndb_lock;
|
||||
@@ -60,7 +60,7 @@ static isc_mutex_t dyndb_lock;
|
||||
void
|
||||
dns__dyndb_initialize(void) {
|
||||
isc_mutex_init(&dyndb_lock);
|
||||
ISC_LIST_INIT(dyndb_implementations);
|
||||
INIT_LIST(dyndb_implementations);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -135,7 +135,7 @@ load_library(isc_mem_t *mctx, const char *filename, const char *instname,
|
||||
|
||||
isc_mem_attach(mctx, &imp->mctx);
|
||||
|
||||
ISC_LINK_INIT(imp, link);
|
||||
INIT_LINK(imp, link);
|
||||
|
||||
r = uv_dlopen(filename, &imp->handle);
|
||||
if (r != 0) {
|
||||
@@ -225,7 +225,7 @@ dns_dyndb_load(const char *libname, const char *name, const char *parameters,
|
||||
CHECK(implementation->register_func(mctx, name, parameters, file, line,
|
||||
dctx, &implementation->inst));
|
||||
|
||||
ISC_LIST_APPEND(dyndb_implementations, implementation, link);
|
||||
APPEND(dyndb_implementations, implementation, link);
|
||||
result = ISC_R_SUCCESS;
|
||||
|
||||
cleanup:
|
||||
@@ -245,10 +245,10 @@ dns_dyndb_cleanup(void) {
|
||||
dyndb_implementation_t *prev;
|
||||
|
||||
LOCK(&dyndb_lock);
|
||||
elem = ISC_LIST_TAIL(dyndb_implementations);
|
||||
elem = TAIL(dyndb_implementations);
|
||||
while (elem != NULL) {
|
||||
prev = ISC_LIST_PREV(elem, link);
|
||||
ISC_LIST_UNLINK(dyndb_implementations, elem, link);
|
||||
prev = PREV(elem, link);
|
||||
UNLINK(dyndb_implementations, elem, link);
|
||||
isc_log_write(DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DYNDB,
|
||||
ISC_LOG_INFO, "unloading DynDB instance '%s'",
|
||||
elem->name);
|
||||
|
||||
@@ -54,21 +54,16 @@
|
||||
isc_result_t
|
||||
dns_ncache_add(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
|
||||
dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t minttl,
|
||||
dns_ttl_t maxttl, dns_rdataset_t *addedrdataset);
|
||||
isc_result_t
|
||||
dns_ncache_addoptout(dns_message_t *message, dns_db_t *cache,
|
||||
dns_dbnode_t *node, dns_rdatatype_t covers,
|
||||
isc_stdtime_t now, dns_ttl_t minttl, dns_ttl_t maxttl,
|
||||
bool optout, dns_rdataset_t *addedrdataset);
|
||||
dns_ttl_t maxttl, bool optout, bool secure,
|
||||
dns_rdataset_t *addedrdataset);
|
||||
/*%<
|
||||
* Convert the authority data from 'message' into a negative cache
|
||||
* rdataset, and store it in 'cache' at 'node' with a TTL limited to
|
||||
* 'maxttl'.
|
||||
*
|
||||
* \li dns_ncache_add produces a negative cache entry with a trust of no
|
||||
* more than answer
|
||||
* \li dns_ncache_addoptout produces a negative cache entry which will have
|
||||
* a trust of secure if all the records that make up the entry are secure.
|
||||
* \li if 'secure' is true and all the records that make up the entry
|
||||
* are secure, then dns_ncache_add produces a negative cache entry
|
||||
* with trust level secure.
|
||||
*
|
||||
* The 'covers' argument is the RR type whose nonexistence we are caching,
|
||||
* or dns_rdatatype_any when caching a NXDOMAIN response.
|
||||
|
||||
@@ -399,7 +399,7 @@ dns_opcodestats_increment(dns_stats_t *stats, dns_opcode_t code);
|
||||
*/
|
||||
|
||||
void
|
||||
dns_rcodestats_increment(dns_stats_t *stats, dns_rcode_t code);
|
||||
dns_rcodestats_increment(dns_stats_t *stats, dns_opcode_t code);
|
||||
/*%<
|
||||
* Increment the statistics counter for 'code'.
|
||||
*
|
||||
|
||||
@@ -124,7 +124,7 @@ typedef struct dns_nametree dns_nametree_t;
|
||||
typedef ISC_LIST(dns_name_t) dns_namelist_t;
|
||||
typedef struct dns_ntatable dns_ntatable_t;
|
||||
typedef struct dns_ntnode dns_ntnode_t;
|
||||
typedef enum dns_opcode dns_opcode_t;
|
||||
typedef uint16_t dns_opcode_t;
|
||||
typedef struct dns_order dns_order_t;
|
||||
typedef struct dns_peer dns_peer_t;
|
||||
typedef struct dns_peerlist dns_peerlist_t;
|
||||
@@ -308,18 +308,20 @@ enum {
|
||||
/*%
|
||||
* Opcodes.
|
||||
*/
|
||||
enum dns_opcode {
|
||||
enum {
|
||||
dns_opcode_query = 0,
|
||||
#define dns_opcode_query ((dns_opcode_t)dns_opcode_query)
|
||||
dns_opcode_iquery = 1,
|
||||
#define dns_opcode_iquery ((dns_opcode_t)dns_opcode_iquery)
|
||||
dns_opcode_status = 2,
|
||||
#define dns_opcode_status ((dns_opcode_t)dns_opcode_status)
|
||||
dns_opcode_notify = 4,
|
||||
#define dns_opcode_notify ((dns_opcode_t)dns_opcode_notify)
|
||||
dns_opcode_update = 5, /* dynamic update */
|
||||
#define dns_opcode_update ((dns_opcode_t)dns_opcode_update)
|
||||
dns_opcode_max = 6,
|
||||
dns__opcode_expand = UINT16_MAX,
|
||||
} __attribute__((__packed__));
|
||||
/* Absent attribute packed, the enum will be sized as an int */
|
||||
STATIC_ASSERT(sizeof(uint16_t) == sizeof(dns_opcode_t),
|
||||
"sizeof(dns_opecode)t) is not 16-bit");
|
||||
#define dns_opcode_max ((dns_opcode_t)dns_opcode_max)
|
||||
};
|
||||
|
||||
/*%
|
||||
* Trust levels. Must be kept in sync with trustnames[] in masterdump.c.
|
||||
|
||||
@@ -1539,19 +1539,14 @@ dns_zone_getsourceaddr(dns_zone_t *zone);
|
||||
* \li 'zone' has a non-empty primaries list.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
dns_zone_getprimaryaddr(dns_zone_t *zone, isc_sockaddr_t *dest);
|
||||
isc_sockaddr_t
|
||||
dns_zone_getprimaryaddr(dns_zone_t *zone);
|
||||
/*%<
|
||||
* Get the zone's current primary server into '*dest'.
|
||||
* Get the zone's current primary server.
|
||||
*
|
||||
* Requires:
|
||||
* \li 'zone' to be a valid zone.
|
||||
* \li 'zone' has a non-empty primaries list.
|
||||
* \li 'dest' != NULL.
|
||||
*
|
||||
* Returns:
|
||||
*\li #ISC_R_SUCCESS if the current primary server was found
|
||||
*\li #ISC_R_NOMORE if all the primaries were already iterated over
|
||||
*/
|
||||
|
||||
isc_time_t
|
||||
|
||||
+40
-71
@@ -189,19 +189,13 @@ dns_keymgr_settime_syncpublish(dst_key_t *key, dns_kasp_t *kasp, bool first) {
|
||||
isc_stdtime_t zrrsig_present;
|
||||
dns_ttl_t ttlsig = dns_kasp_zonemaxttl(kasp, true);
|
||||
zrrsig_present = published + ttlsig +
|
||||
dns_kasp_zonepropagationdelay(kasp);
|
||||
dns_kasp_zonepropagationdelay(kasp) +
|
||||
dns_kasp_publishsafety(kasp);
|
||||
if (zrrsig_present > syncpublish) {
|
||||
syncpublish = zrrsig_present;
|
||||
}
|
||||
}
|
||||
dst_key_settime(key, DST_TIME_SYNCPUBLISH, syncpublish);
|
||||
|
||||
uint32_t lifetime = 0;
|
||||
ret = dst_key_getnum(key, DST_NUM_LIFETIME, &lifetime);
|
||||
if (ret == ISC_R_SUCCESS && lifetime > 0) {
|
||||
dst_key_settime(key, DST_TIME_SYNCDELETE,
|
||||
(syncpublish + lifetime));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -249,17 +243,6 @@ keymgr_prepublication_time(dns_dnsseckey_t *key, dns_kasp_t *kasp,
|
||||
pub = now;
|
||||
}
|
||||
|
||||
/*
|
||||
* To calculate phase out times ("Retired", "Removed", ...),
|
||||
* the key lifetime is required.
|
||||
*/
|
||||
uint32_t klifetime = 0;
|
||||
ret = dst_key_getnum(key->key, DST_NUM_LIFETIME, &klifetime);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
dst_key_setnum(key->key, DST_NUM_LIFETIME, lifetime);
|
||||
klifetime = lifetime;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate prepublication time.
|
||||
*/
|
||||
@@ -289,16 +272,13 @@ keymgr_prepublication_time(dns_dnsseckey_t *key, dns_kasp_t *kasp,
|
||||
dns_ttl_t ttlsig = dns_kasp_zonemaxttl(kasp,
|
||||
true);
|
||||
syncpub2 = pub + ttlsig +
|
||||
dns_kasp_publishsafety(kasp) +
|
||||
dns_kasp_zonepropagationdelay(kasp);
|
||||
}
|
||||
|
||||
syncpub = ISC_MAX(syncpub1, syncpub2);
|
||||
dst_key_settime(key->key, DST_TIME_SYNCPUBLISH,
|
||||
syncpub);
|
||||
if (klifetime > 0) {
|
||||
dst_key_settime(key->key, DST_TIME_SYNCDELETE,
|
||||
(syncpub + klifetime));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,6 +291,13 @@ keymgr_prepublication_time(dns_dnsseckey_t *key, dns_kasp_t *kasp,
|
||||
|
||||
ret = dst_key_gettime(key->key, DST_TIME_INACTIVE, &retire);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
uint32_t klifetime = 0;
|
||||
|
||||
ret = dst_key_getnum(key->key, DST_NUM_LIFETIME, &klifetime);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
dst_key_setnum(key->key, DST_NUM_LIFETIME, lifetime);
|
||||
klifetime = lifetime;
|
||||
}
|
||||
if (klifetime == 0) {
|
||||
/*
|
||||
* No inactive time and no lifetime,
|
||||
@@ -411,7 +398,7 @@ keymgr_key_update_lifetime(dns_dnsseckey_t *key, dns_kasp_t *kasp,
|
||||
/* Initialize lifetime. */
|
||||
if (r != ISC_R_SUCCESS) {
|
||||
dst_key_setnum(key->key, DST_NUM_LIFETIME, lifetime);
|
||||
l = lifetime - 1;
|
||||
return;
|
||||
}
|
||||
/* Skip keys that are still hidden or already retiring. */
|
||||
if (g != OMNIPRESENT) {
|
||||
@@ -433,7 +420,6 @@ keymgr_key_update_lifetime(dns_dnsseckey_t *key, dns_kasp_t *kasp,
|
||||
} else {
|
||||
dst_key_unsettime(key->key, DST_TIME_INACTIVE);
|
||||
dst_key_unsettime(key->key, DST_TIME_DELETE);
|
||||
dst_key_unsettime(key->key, DST_TIME_SYNCDELETE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1300,7 +1286,6 @@ keymgr_transition_time(dns_dnsseckey_t *key, int type,
|
||||
isc_result_t ret;
|
||||
isc_stdtime_t lastchange, dstime, nexttime = now;
|
||||
dns_ttl_t ttlsig = dns_kasp_zonemaxttl(kasp, true);
|
||||
uint32_t dsstate;
|
||||
|
||||
/*
|
||||
* No need to wait if we move things into an uncertain state.
|
||||
@@ -1370,12 +1355,15 @@ keymgr_transition_time(dns_dnsseckey_t *key, int type,
|
||||
* records. This translates to:
|
||||
*
|
||||
* Dsgn + zone-propagation-delay + max-zone-ttl.
|
||||
*
|
||||
* We will also add the retire-safety interval.
|
||||
*/
|
||||
nexttime = lastchange + ttlsig +
|
||||
dns_kasp_zonepropagationdelay(kasp);
|
||||
dns_kasp_zonepropagationdelay(kasp) +
|
||||
dns_kasp_retiresafety(kasp);
|
||||
/*
|
||||
* Only add the sign delay Dsgn and retire-safety if
|
||||
* there is an actual predecessor or successor key.
|
||||
* Only add the sign delay Dsgn if there is an actual
|
||||
* predecessor or successor key.
|
||||
*/
|
||||
uint32_t tag;
|
||||
ret = dst_key_getnum(key->key, DST_NUM_PREDECESSOR,
|
||||
@@ -1385,8 +1373,7 @@ keymgr_transition_time(dns_dnsseckey_t *key, int type,
|
||||
DST_NUM_SUCCESSOR, &tag);
|
||||
}
|
||||
if (ret == ISC_R_SUCCESS) {
|
||||
nexttime += dns_kasp_signdelay(kasp) +
|
||||
dns_kasp_retiresafety(kasp);
|
||||
nexttime += dns_kasp_signdelay(kasp);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -1412,36 +1399,35 @@ keymgr_transition_time(dns_dnsseckey_t *key, int type,
|
||||
* This translates to:
|
||||
*
|
||||
* parent-propagation-delay + parent-ds-ttl.
|
||||
*
|
||||
* We will also add the retire-safety interval.
|
||||
*/
|
||||
case OMNIPRESENT:
|
||||
case HIDDEN:
|
||||
/* Make sure DS has been seen in/withdrawn from the
|
||||
* parent. */
|
||||
dsstate = next_state == HIDDEN ? DST_TIME_DSDELETE
|
||||
: DST_TIME_DSPUBLISH;
|
||||
ret = dst_key_gettime(key->key, dsstate, &dstime);
|
||||
/* Make sure DS has been seen in the parent. */
|
||||
ret = dst_key_gettime(key->key, DST_TIME_DSPUBLISH,
|
||||
&dstime);
|
||||
if (ret != ISC_R_SUCCESS || dstime > now) {
|
||||
/* Not yet, try again in an hour. */
|
||||
nexttime = now + 3600;
|
||||
} else {
|
||||
nexttime =
|
||||
dstime + dns_kasp_dsttl(kasp) +
|
||||
dns_kasp_parentpropagationdelay(kasp);
|
||||
/*
|
||||
* Only add the retire-safety if there is an
|
||||
* actual predecessor or successor key.
|
||||
*/
|
||||
uint32_t tag;
|
||||
ret = dst_key_getnum(key->key,
|
||||
DST_NUM_PREDECESSOR, &tag);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
ret = dst_key_getnum(key->key,
|
||||
DST_NUM_SUCCESSOR,
|
||||
&tag);
|
||||
}
|
||||
if (ret == ISC_R_SUCCESS) {
|
||||
nexttime += dns_kasp_retiresafety(kasp);
|
||||
}
|
||||
dns_kasp_parentpropagationdelay(kasp) +
|
||||
dns_kasp_retiresafety(kasp);
|
||||
}
|
||||
break;
|
||||
case HIDDEN:
|
||||
/* Make sure DS has been withdrawn from the parent. */
|
||||
ret = dst_key_gettime(key->key, DST_TIME_DSDELETE,
|
||||
&dstime);
|
||||
if (ret != ISC_R_SUCCESS || dstime > now) {
|
||||
/* Not yet, try again in an hour. */
|
||||
nexttime = now + 3600;
|
||||
} else {
|
||||
nexttime =
|
||||
dstime + dns_kasp_dsttl(kasp) +
|
||||
dns_kasp_parentpropagationdelay(kasp) +
|
||||
dns_kasp_retiresafety(kasp);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -1777,9 +1763,7 @@ keymgr_key_rollover(dns_kasp_key_t *kaspkey, dns_dnsseckey_t *active_key,
|
||||
if (prepub == 0 || prepub > now) {
|
||||
/* No need to start rollover now. */
|
||||
if (*nexttime == 0 || prepub < *nexttime) {
|
||||
if (prepub > 0) {
|
||||
*nexttime = prepub;
|
||||
}
|
||||
*nexttime = prepub;
|
||||
}
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
@@ -2038,20 +2022,6 @@ keymgr_purge_keyfile(dst_key_t *key, int type) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
dst_key_doublematch(dns_dnsseckey_t *key, dns_kasp_t *kasp) {
|
||||
int matches = 0;
|
||||
|
||||
for (dns_kasp_key_t *kkey = ISC_LIST_HEAD(dns_kasp_keys(kasp));
|
||||
kkey != NULL; kkey = ISC_LIST_NEXT(kkey, link))
|
||||
{
|
||||
if (dns_kasp_key_match(kkey, key)) {
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
return matches > 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Examine 'keys' and match 'kasp' policy.
|
||||
*
|
||||
@@ -2191,7 +2161,6 @@ dns_keymgr_run(const dns_name_t *origin, dns_rdataclass_t rdclass,
|
||||
* matches the kasp policy.
|
||||
*/
|
||||
if (!dst_key_is_unused(dkey->key) &&
|
||||
!dst_key_doublematch(dkey, kasp) &&
|
||||
(dst_key_goal(dkey->key) ==
|
||||
OMNIPRESENT) &&
|
||||
!keymgr_dep(dkey->key, keyring,
|
||||
|
||||
+2
-25
@@ -50,12 +50,6 @@ atomic_getuint8(isc_buffer_t *b) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
addoptout(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
|
||||
dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t minttl,
|
||||
dns_ttl_t maxttl, bool optout, bool secure,
|
||||
dns_rdataset_t *addedrdataset);
|
||||
|
||||
static isc_result_t
|
||||
copy_rdataset(dns_rdataset_t *rdataset, isc_buffer_t *buffer) {
|
||||
isc_result_t result;
|
||||
@@ -107,25 +101,8 @@ copy_rdataset(dns_rdataset_t *rdataset, isc_buffer_t *buffer) {
|
||||
isc_result_t
|
||||
dns_ncache_add(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
|
||||
dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t minttl,
|
||||
dns_ttl_t maxttl, dns_rdataset_t *addedrdataset) {
|
||||
return addoptout(message, cache, node, covers, now, minttl, maxttl,
|
||||
false, false, addedrdataset);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_ncache_addoptout(dns_message_t *message, dns_db_t *cache,
|
||||
dns_dbnode_t *node, dns_rdatatype_t covers,
|
||||
isc_stdtime_t now, dns_ttl_t minttl, dns_ttl_t maxttl,
|
||||
bool optout, dns_rdataset_t *addedrdataset) {
|
||||
return addoptout(message, cache, node, covers, now, minttl, maxttl,
|
||||
optout, true, addedrdataset);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
addoptout(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
|
||||
dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t minttl,
|
||||
dns_ttl_t maxttl, bool optout, bool secure,
|
||||
dns_rdataset_t *addedrdataset) {
|
||||
dns_ttl_t maxttl, bool optout, bool secure,
|
||||
dns_rdataset_t *addedrdataset) {
|
||||
isc_result_t result;
|
||||
isc_buffer_t buffer;
|
||||
isc_region_t r;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <isc/log.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/mutex.h>
|
||||
#include <isc/mutexblock.h>
|
||||
#include <isc/result.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/thread.h>
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <openssl/param_build.h>
|
||||
#endif
|
||||
|
||||
#include <isc/fips.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/result.h>
|
||||
#include <isc/safe.h>
|
||||
@@ -706,7 +707,7 @@ opensslecdsa_createctx(dst_key_t *key, dst_context_t *dctx) {
|
||||
}
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30200000L
|
||||
if (!isc_crypto_fips_mode()) {
|
||||
if (!isc_fips_mode()) {
|
||||
ret = opensslecdsa_set_deterministic(
|
||||
pctx, dctx->key->key_alg);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
|
||||
+83
-106
@@ -202,10 +202,9 @@ struct qpcnode {
|
||||
uint8_t : 0;
|
||||
|
||||
/*%
|
||||
* Used for dead nodes cleaning. This linked list is used to mark nodes
|
||||
* which have no data any longer, but we cannot unlink at that exact
|
||||
* moment because we did not or could not obtain a write lock on the
|
||||
* tree.
|
||||
* Used for dead node cleaning. The deadnodes queue is used
|
||||
* for nodes that have no data any longer, but we can't unlink
|
||||
* yet because we don't have a tree lock.
|
||||
*/
|
||||
isc_queue_node_t deadlink;
|
||||
};
|
||||
@@ -216,9 +215,8 @@ struct qpcnode {
|
||||
* to reduce contention between threads.
|
||||
*/
|
||||
typedef struct qpcache_bucket {
|
||||
/*%
|
||||
* Temporary storage for stale cache nodes and dynamically
|
||||
* deleted nodes that await being cleaned up.
|
||||
/*
|
||||
* Temporary storage for cache nodes that need to be deleted.
|
||||
*/
|
||||
isc_queue_t deadnodes;
|
||||
|
||||
@@ -1999,23 +1997,78 @@ tree_exit:
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
seek_ns_headers(qpc_search_t *search, qpcnode_t *node, dns_dbnode_t **nodep,
|
||||
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset,
|
||||
dns_name_t *foundname, dns_name_t *dcname,
|
||||
isc_rwlocktype_t *tlocktype) {
|
||||
qpcache_findzonecut(dns_db_t *db, const dns_name_t *name, unsigned int options,
|
||||
isc_stdtime_t __now, dns_dbnode_t **nodep,
|
||||
dns_name_t *foundname, dns_name_t *dcname,
|
||||
dns_rdataset_t *rdataset,
|
||||
dns_rdataset_t *sigrdataset DNS__DB_FLARG) {
|
||||
qpcnode_t *node = NULL;
|
||||
isc_rwlock_t *nlock = NULL;
|
||||
isc_result_t result;
|
||||
dns_slabheader_t *header = NULL;
|
||||
dns_slabheader_t *header_prev = NULL, *header_next = NULL;
|
||||
isc_rwlocktype_t nlocktype = isc_rwlocktype_none;
|
||||
isc_rwlock_t *nlock = &search->qpdb->buckets[node->locknum].lock;
|
||||
dns_slabheader_t *found = NULL, *foundsig = NULL;
|
||||
isc_rwlocktype_t tlocktype = isc_rwlocktype_none;
|
||||
isc_rwlocktype_t nlocktype = isc_rwlocktype_none;
|
||||
bool dcnull = (dcname == NULL);
|
||||
qpc_search_t search = (qpc_search_t){
|
||||
.qpdb = (qpcache_t *)db,
|
||||
.options = options,
|
||||
.now = __now ? __now : isc_stdtime_now(),
|
||||
};
|
||||
|
||||
REQUIRE(VALID_QPDB((qpcache_t *)db));
|
||||
|
||||
if (dcnull) {
|
||||
dcname = foundname;
|
||||
}
|
||||
|
||||
TREE_RDLOCK(&search.qpdb->tree_lock, &tlocktype);
|
||||
|
||||
/*
|
||||
* Search down from the root of the tree.
|
||||
*/
|
||||
result = dns_qp_lookup(search.qpdb->tree, name, NULL, NULL,
|
||||
&search.chain, (void **)&node, NULL);
|
||||
if (result != ISC_R_NOTFOUND) {
|
||||
dns_name_copy(&node->name, dcname);
|
||||
}
|
||||
if ((options & DNS_DBFIND_NOEXACT) != 0 && result == ISC_R_SUCCESS) {
|
||||
int len = dns_qpchain_length(&search.chain);
|
||||
if (len >= 2) {
|
||||
node = NULL;
|
||||
dns_qpchain_node(&search.chain, len - 2, NULL,
|
||||
(void **)&node, NULL);
|
||||
search.chain.len = len - 1;
|
||||
result = DNS_R_PARTIALMATCH;
|
||||
} else {
|
||||
result = ISC_R_NOTFOUND;
|
||||
}
|
||||
}
|
||||
|
||||
if (result == DNS_R_PARTIALMATCH) {
|
||||
result = find_deepest_zonecut(&search, node, nodep, foundname,
|
||||
rdataset,
|
||||
sigrdataset DNS__DB_FLARG_PASS);
|
||||
goto tree_exit;
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
goto tree_exit;
|
||||
} else if (!dcnull) {
|
||||
dns_name_copy(dcname, foundname);
|
||||
}
|
||||
|
||||
/*
|
||||
* We now go looking for an NS rdataset at the node.
|
||||
*/
|
||||
|
||||
nlock = &search.qpdb->buckets[node->locknum].lock;
|
||||
NODE_RDLOCK(nlock, &nlocktype);
|
||||
|
||||
for (header = node->data; header != NULL; header = header_next) {
|
||||
header_next = header->next;
|
||||
bool ns = (header->type == dns_rdatatype_ns ||
|
||||
header->type == DNS_SIGTYPE(dns_rdatatype_ns));
|
||||
if (check_stale_header(node, header, &nlocktype, nlock, search,
|
||||
if (check_stale_header(node, header, &nlocktype, nlock, &search,
|
||||
&header_prev))
|
||||
{
|
||||
if (ns) {
|
||||
@@ -2038,108 +2091,32 @@ seek_ns_headers(qpc_search_t *search, qpcnode_t *node, dns_dbnode_t **nodep,
|
||||
}
|
||||
|
||||
if (found == NULL) {
|
||||
isc_result_t result;
|
||||
|
||||
/*
|
||||
* No active NS records found. Call find_deepest_zonecut()
|
||||
* to look for them in nodes above this one.
|
||||
*/
|
||||
NODE_UNLOCK(nlock, &nlocktype);
|
||||
result = find_deepest_zonecut(search, node, nodep, foundname,
|
||||
rdataset,
|
||||
sigrdataset DNS__DB_FLARG_PASS);
|
||||
if (dcname != NULL) {
|
||||
dns_name_copy(foundname, dcname);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
if (nodep != NULL) {
|
||||
qpcnode_acquire(search->qpdb, node, nlocktype,
|
||||
*tlocktype DNS__DB_FLARG_PASS);
|
||||
*nodep = (dns_dbnode_t *)node;
|
||||
}
|
||||
|
||||
bindrdatasets(search->qpdb, node, found, foundsig, search->now,
|
||||
nlocktype, *tlocktype, rdataset,
|
||||
sigrdataset DNS__DB_FLARG_PASS);
|
||||
maybe_update_headers(search->qpdb, found, foundsig, nlock, &nlocktype,
|
||||
search->now);
|
||||
|
||||
NODE_UNLOCK(nlock, &nlocktype);
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
qpcache_findzonecut(dns_db_t *db, const dns_name_t *name, unsigned int options,
|
||||
isc_stdtime_t __now, dns_dbnode_t **nodep,
|
||||
dns_name_t *foundname, dns_name_t *dcname,
|
||||
dns_rdataset_t *rdataset,
|
||||
dns_rdataset_t *sigrdataset DNS__DB_FLARG) {
|
||||
qpcnode_t *node = NULL;
|
||||
isc_result_t result;
|
||||
isc_rwlocktype_t tlocktype = isc_rwlocktype_none;
|
||||
qpc_search_t search = (qpc_search_t){
|
||||
.qpdb = (qpcache_t *)db,
|
||||
.options = options,
|
||||
.now = __now ? __now : isc_stdtime_now(),
|
||||
};
|
||||
unsigned int len = 0;
|
||||
|
||||
REQUIRE(VALID_QPDB((qpcache_t *)db));
|
||||
|
||||
TREE_RDLOCK(&search.qpdb->tree_lock, &tlocktype);
|
||||
|
||||
/*
|
||||
* Search down from the root of the tree.
|
||||
*/
|
||||
result = dns_qp_lookup(search.qpdb->tree, name, NULL, NULL,
|
||||
&search.chain, (void **)&node, NULL);
|
||||
|
||||
switch (result) {
|
||||
case ISC_R_SUCCESS:
|
||||
if ((options & DNS_DBFIND_NOEXACT) == 0) {
|
||||
if (dcname != NULL) {
|
||||
dns_name_copy(&node->name, dcname);
|
||||
}
|
||||
dns_name_copy(&node->name, foundname);
|
||||
result = seek_ns_headers(&search, node, nodep, rdataset,
|
||||
sigrdataset, foundname, dcname,
|
||||
&tlocktype);
|
||||
break;
|
||||
}
|
||||
|
||||
len = dns_qpchain_length(&search.chain);
|
||||
if (len < 2) {
|
||||
result = ISC_R_NOTFOUND;
|
||||
break;
|
||||
}
|
||||
|
||||
FALLTHROUGH;
|
||||
case DNS_R_PARTIALMATCH:
|
||||
if (dcname != NULL) {
|
||||
dns_name_copy(&node->name, dcname);
|
||||
}
|
||||
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
/* Fell through from the previous case */
|
||||
INSIST(len >= 2);
|
||||
|
||||
node = NULL;
|
||||
dns_qpchain_node(&search.chain, len - 2, NULL,
|
||||
(void **)&node, NULL);
|
||||
search.chain.len = len - 1;
|
||||
}
|
||||
|
||||
result = find_deepest_zonecut(&search, node, nodep, foundname,
|
||||
rdataset,
|
||||
sigrdataset DNS__DB_FLARG_PASS);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
dns_name_copy(foundname, dcname);
|
||||
goto tree_exit;
|
||||
}
|
||||
|
||||
if (nodep != NULL) {
|
||||
qpcnode_acquire(search.qpdb, node, nlocktype,
|
||||
tlocktype DNS__DB_FLARG_PASS);
|
||||
*nodep = (dns_dbnode_t *)node;
|
||||
}
|
||||
|
||||
bindrdatasets(search.qpdb, node, found, foundsig, search.now, nlocktype,
|
||||
tlocktype, rdataset, sigrdataset DNS__DB_FLARG_PASS);
|
||||
maybe_update_headers(search.qpdb, found, foundsig, nlock, &nlocktype,
|
||||
search.now);
|
||||
|
||||
NODE_UNLOCK(nlock, &nlocktype);
|
||||
|
||||
tree_exit:
|
||||
TREE_UNLOCK(&search.qpdb->tree_lock, &tlocktype);
|
||||
|
||||
INSIST(!search.need_cleanup);
|
||||
|
||||
+112
-30
@@ -544,7 +544,7 @@ qpzone_destroy(qpzonedb_t *qpdb) {
|
||||
isc_refcount_decrementz(&qpdb->current_version->references);
|
||||
|
||||
isc_refcount_destroy(&qpdb->current_version->references);
|
||||
ISC_LIST_UNLINK(qpdb->open_versions, qpdb->current_version, link);
|
||||
UNLINK(qpdb->open_versions, qpdb->current_version, link);
|
||||
cds_wfs_destroy(&qpdb->current_version->glue_stack);
|
||||
isc_rwlock_destroy(&qpdb->current_version->rwlock);
|
||||
isc_mem_put(qpdb->common.mctx, qpdb->current_version,
|
||||
@@ -723,7 +723,7 @@ dns__qpzone_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
|
||||
* Keep the current version in the open list so that list operation
|
||||
* won't happen in normal lookup operations.
|
||||
*/
|
||||
ISC_LIST_PREPEND(qpdb->open_versions, qpdb->current_version, link);
|
||||
PREPEND(qpdb->open_versions, qpdb->current_version, link);
|
||||
|
||||
qpdb->common.magic = DNS_DB_MAGIC;
|
||||
qpdb->common.impmagic = QPZONE_DB_MAGIC;
|
||||
@@ -875,6 +875,7 @@ clean_zone_node(qpznode_t *node, uint32_t least_serial) {
|
||||
}
|
||||
top_prev = current;
|
||||
}
|
||||
|
||||
if (!still_dirty) {
|
||||
node->dirty = false;
|
||||
}
|
||||
@@ -1124,13 +1125,13 @@ cleanup_nondirty(qpz_version_t *version, qpz_changedlist_t *cleanup_list) {
|
||||
*
|
||||
* The caller must be holding the database lock.
|
||||
*/
|
||||
for (changed = ISC_LIST_HEAD(version->changed_list); changed != NULL;
|
||||
for (changed = HEAD(version->changed_list); changed != NULL;
|
||||
changed = next_changed)
|
||||
{
|
||||
next_changed = ISC_LIST_NEXT(changed, link);
|
||||
next_changed = NEXT(changed, link);
|
||||
if (!changed->dirty) {
|
||||
ISC_LIST_UNLINK(version->changed_list, changed, link);
|
||||
ISC_LIST_APPEND(*cleanup_list, changed, link);
|
||||
UNLINK(version->changed_list, changed, link);
|
||||
APPEND(*cleanup_list, changed, link);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1377,13 +1378,12 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp,
|
||||
(void)isc_refcount_current(
|
||||
&cur_version->references);
|
||||
if (cur_version->serial == qpdb->least_serial) {
|
||||
INSIST(ISC_LIST_EMPTY(
|
||||
INSIST(EMPTY(
|
||||
cur_version->changed_list));
|
||||
}
|
||||
ISC_LIST_UNLINK(qpdb->open_versions,
|
||||
cur_version, link);
|
||||
UNLINK(qpdb->open_versions, cur_version, link);
|
||||
}
|
||||
if (ISC_LIST_EMPTY(qpdb->open_versions)) {
|
||||
if (EMPTY(qpdb->open_versions)) {
|
||||
/*
|
||||
* We're going to become the least open
|
||||
* version.
|
||||
@@ -1413,9 +1413,8 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp,
|
||||
*/
|
||||
if (cur_ref == 1) {
|
||||
cleanup_version = cur_version;
|
||||
ISC_LIST_APPENDLIST(
|
||||
version->changed_list,
|
||||
cleanup_version->changed_list, link);
|
||||
APPENDLIST(version->changed_list,
|
||||
cleanup_version->changed_list, link);
|
||||
}
|
||||
/*
|
||||
* Become the current version.
|
||||
@@ -1434,8 +1433,8 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp,
|
||||
*/
|
||||
INSIST(isc_refcount_increment0(&version->references) ==
|
||||
0);
|
||||
ISC_LIST_PREPEND(qpdb->open_versions,
|
||||
qpdb->current_version, link);
|
||||
PREPEND(qpdb->open_versions, qpdb->current_version,
|
||||
link);
|
||||
resigned_list = version->resigned_list;
|
||||
ISC_LIST_INIT(version->resigned_list);
|
||||
} else {
|
||||
@@ -1462,7 +1461,7 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp,
|
||||
* Find the version with the least serial
|
||||
* number greater than ours.
|
||||
*/
|
||||
least_greater = ISC_LIST_PREV(version, link);
|
||||
least_greater = PREV(version, link);
|
||||
if (least_greater == NULL) {
|
||||
least_greater = qpdb->current_version;
|
||||
}
|
||||
@@ -1483,21 +1482,20 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp,
|
||||
* Add any unexecuted cleanups to
|
||||
* those of the least greater version.
|
||||
*/
|
||||
ISC_LIST_APPENDLIST(least_greater->changed_list,
|
||||
version->changed_list,
|
||||
link);
|
||||
APPENDLIST(least_greater->changed_list,
|
||||
version->changed_list, link);
|
||||
}
|
||||
} else if (version->serial == qpdb->least_serial) {
|
||||
INSIST(ISC_LIST_EMPTY(version->changed_list));
|
||||
INSIST(EMPTY(version->changed_list));
|
||||
}
|
||||
ISC_LIST_UNLINK(qpdb->open_versions, version, link);
|
||||
UNLINK(qpdb->open_versions, version, link);
|
||||
}
|
||||
least_serial = qpdb->least_serial;
|
||||
RWUNLOCK(&qpdb->lock, isc_rwlocktype_write);
|
||||
|
||||
if (cleanup_version != NULL) {
|
||||
isc_refcount_destroy(&cleanup_version->references);
|
||||
INSIST(ISC_LIST_EMPTY(cleanup_version->changed_list));
|
||||
INSIST(EMPTY(cleanup_version->changed_list));
|
||||
cleanup_gluelists(&cleanup_version->glue_stack);
|
||||
cds_wfs_destroy(&cleanup_version->glue_stack);
|
||||
isc_rwlock_destroy(&cleanup_version->rwlock);
|
||||
@@ -1508,8 +1506,8 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp,
|
||||
/*
|
||||
* Commit/rollback re-signed headers.
|
||||
*/
|
||||
for (header = ISC_LIST_HEAD(resigned_list); header != NULL;
|
||||
header = ISC_LIST_HEAD(resigned_list))
|
||||
for (header = HEAD(resigned_list); header != NULL;
|
||||
header = HEAD(resigned_list))
|
||||
{
|
||||
isc_rwlock_t *nlock = NULL;
|
||||
isc_rwlocktype_t nlocktype = isc_rwlocktype_none;
|
||||
@@ -1526,18 +1524,16 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp,
|
||||
NODE_UNLOCK(nlock, &nlocktype);
|
||||
}
|
||||
|
||||
if (ISC_LIST_EMPTY(cleanup_list)) {
|
||||
*versionp = NULL;
|
||||
return;
|
||||
}
|
||||
dns_qp_t *tree = NULL, *nsec = NULL, *nsec3 = NULL;
|
||||
bool need_tree = false, need_nsec = false, need_nsec3 = false;
|
||||
|
||||
for (changed = ISC_LIST_HEAD(cleanup_list); changed != NULL;
|
||||
for (changed = HEAD(cleanup_list); changed != NULL;
|
||||
changed = next_changed)
|
||||
{
|
||||
isc_rwlock_t *nlock = NULL;
|
||||
isc_rwlocktype_t nlocktype = isc_rwlocktype_none;
|
||||
|
||||
next_changed = ISC_LIST_NEXT(changed, link);
|
||||
next_changed = NEXT(changed, link);
|
||||
node = changed->node;
|
||||
nlock = &qpdb->buckets[node->locknum].lock;
|
||||
|
||||
@@ -1545,14 +1541,100 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp,
|
||||
if (rollback) {
|
||||
rollback_node(node, serial);
|
||||
}
|
||||
|
||||
qpznode_ref(node);
|
||||
qpznode_release(qpdb, node, least_serial,
|
||||
&nlocktype DNS__DB_FILELINE);
|
||||
|
||||
/* If the node is now empty, we can delete it. */
|
||||
if (commit && node->data == NULL) {
|
||||
switch ((int)node->nsec) {
|
||||
case DNS_DB_NSEC_HAS_NSEC:
|
||||
/*
|
||||
* Delete the matching node from the NSEC tree
|
||||
* first, then fall through to the main tree.
|
||||
*/
|
||||
if (nsec == NULL) {
|
||||
need_nsec = true;
|
||||
next_changed = changed;
|
||||
} else {
|
||||
dns_qp_deletename(nsec, &node->name,
|
||||
NULL, NULL);
|
||||
}
|
||||
FALLTHROUGH;
|
||||
case DNS_DB_NSEC_NORMAL:
|
||||
if (tree == NULL) {
|
||||
need_tree = true;
|
||||
next_changed = changed;
|
||||
} else {
|
||||
dns_qp_deletename(tree, &node->name,
|
||||
NULL, NULL);
|
||||
}
|
||||
break;
|
||||
case DNS_DB_NSEC_NSEC:
|
||||
if (nsec == NULL) {
|
||||
need_nsec = true;
|
||||
next_changed = changed;
|
||||
} else {
|
||||
dns_qp_deletename(nsec, &node->name,
|
||||
NULL, NULL);
|
||||
}
|
||||
break;
|
||||
case DNS_DB_NSEC_NSEC3:
|
||||
if (nsec3 == NULL) {
|
||||
need_nsec3 = true;
|
||||
next_changed = changed;
|
||||
} else {
|
||||
dns_qp_deletename(nsec3, &node->name,
|
||||
NULL, NULL);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
qpznode_detach(&node);
|
||||
|
||||
NODE_UNLOCK(nlock, &nlocktype);
|
||||
|
||||
if (next_changed == changed) {
|
||||
/*
|
||||
* We found a node to delete but didn't have a
|
||||
* QP writer open, so we open one now, then go
|
||||
* back to delete the node. If there's a next
|
||||
* time, we'll already have the writer open,
|
||||
* so we won't need this extra step.
|
||||
*/
|
||||
if (need_tree && tree == NULL) {
|
||||
dns_qpmulti_write(qpdb->tree, &tree);
|
||||
}
|
||||
if (need_nsec && nsec == NULL) {
|
||||
dns_qpmulti_write(qpdb->nsec, &nsec);
|
||||
}
|
||||
if (need_nsec3 && nsec3 == NULL) {
|
||||
dns_qpmulti_write(qpdb->nsec3, &nsec3);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
isc_mem_put(qpdb->common.mctx, changed, sizeof(*changed));
|
||||
}
|
||||
|
||||
if (tree != NULL) {
|
||||
dns_qp_compact(tree, DNS_QPGC_MAYBE);
|
||||
dns_qpmulti_commit(qpdb->tree, &tree);
|
||||
}
|
||||
if (nsec != NULL) {
|
||||
dns_qp_compact(nsec, DNS_QPGC_MAYBE);
|
||||
dns_qpmulti_commit(qpdb->nsec, &nsec);
|
||||
}
|
||||
if (nsec3 != NULL) {
|
||||
dns_qp_compact(nsec3, DNS_QPGC_MAYBE);
|
||||
dns_qpmulti_commit(qpdb->nsec3, &nsec3);
|
||||
}
|
||||
|
||||
*versionp = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -387,9 +387,6 @@ static int
|
||||
compare_rrsig(ARGS_COMPARE) {
|
||||
isc_region_t r1;
|
||||
isc_region_t r2;
|
||||
dns_name_t name1;
|
||||
dns_name_t name2;
|
||||
int order;
|
||||
|
||||
REQUIRE(rdata1->type == rdata2->type);
|
||||
REQUIRE(rdata1->rdclass == rdata2->rdclass);
|
||||
@@ -399,32 +396,6 @@ compare_rrsig(ARGS_COMPARE) {
|
||||
|
||||
dns_rdata_toregion(rdata1, &r1);
|
||||
dns_rdata_toregion(rdata2, &r2);
|
||||
|
||||
INSIST(r1.length > 18);
|
||||
INSIST(r2.length > 18);
|
||||
r1.length = 18;
|
||||
r2.length = 18;
|
||||
order = isc_region_compare(&r1, &r2);
|
||||
if (order != 0) {
|
||||
return order;
|
||||
}
|
||||
|
||||
dns_name_init(&name1);
|
||||
dns_name_init(&name2);
|
||||
dns_rdata_toregion(rdata1, &r1);
|
||||
dns_rdata_toregion(rdata2, &r2);
|
||||
isc_region_consume(&r1, 18);
|
||||
isc_region_consume(&r2, 18);
|
||||
dns_name_fromregion(&name1, &r1);
|
||||
dns_name_fromregion(&name2, &r2);
|
||||
order = dns_name_rdatacompare(&name1, &name2);
|
||||
if (order != 0) {
|
||||
return order;
|
||||
}
|
||||
|
||||
isc_region_consume(&r1, name_length(&name1));
|
||||
isc_region_consume(&r2, name_length(&name2));
|
||||
|
||||
return isc_region_compare(&r1, &r2);
|
||||
}
|
||||
|
||||
@@ -592,32 +563,13 @@ additionaldata_rrsig(ARGS_ADDLDATA) {
|
||||
|
||||
static isc_result_t
|
||||
digest_rrsig(ARGS_DIGEST) {
|
||||
isc_region_t r1, r2;
|
||||
dns_name_t name;
|
||||
|
||||
REQUIRE(rdata->type == dns_rdatatype_rrsig);
|
||||
|
||||
dns_rdata_toregion(rdata, &r1);
|
||||
r2 = r1;
|
||||
UNUSED(rdata);
|
||||
UNUSED(digest);
|
||||
UNUSED(arg);
|
||||
|
||||
/*
|
||||
* Type covered (2) + Algorithm (1) +
|
||||
* Labels (1) + Original TTL (4) +
|
||||
* Expire time (4) + Time signed (4) +
|
||||
* Key ID (2).
|
||||
*/
|
||||
isc_region_consume(&r2, 18);
|
||||
r1.length = 18;
|
||||
RETERR((digest)(arg, &r1));
|
||||
|
||||
/* Signer */
|
||||
dns_name_init(&name);
|
||||
dns_name_fromregion(&name, &r2);
|
||||
RETERR(dns_name_digest(&name, digest, arg));
|
||||
isc_region_consume(&r2, name_length(&name));
|
||||
|
||||
/* Signature */
|
||||
return (digest)(arg, &r2);
|
||||
return ISC_R_NOTIMPLEMENTED;
|
||||
}
|
||||
|
||||
static dns_rdatatype_t
|
||||
@@ -658,7 +610,47 @@ checknames_rrsig(ARGS_CHECKNAMES) {
|
||||
|
||||
static int
|
||||
casecompare_rrsig(ARGS_COMPARE) {
|
||||
return compare_rrsig(rdata1, rdata2);
|
||||
isc_region_t r1;
|
||||
isc_region_t r2;
|
||||
dns_name_t name1;
|
||||
dns_name_t name2;
|
||||
int order;
|
||||
|
||||
REQUIRE(rdata1->type == rdata2->type);
|
||||
REQUIRE(rdata1->rdclass == rdata2->rdclass);
|
||||
REQUIRE(rdata1->type == dns_rdatatype_rrsig);
|
||||
REQUIRE(rdata1->length != 0);
|
||||
REQUIRE(rdata2->length != 0);
|
||||
|
||||
dns_rdata_toregion(rdata1, &r1);
|
||||
dns_rdata_toregion(rdata2, &r2);
|
||||
|
||||
INSIST(r1.length > 18);
|
||||
INSIST(r2.length > 18);
|
||||
r1.length = 18;
|
||||
r2.length = 18;
|
||||
order = isc_region_compare(&r1, &r2);
|
||||
if (order != 0) {
|
||||
return order;
|
||||
}
|
||||
|
||||
dns_name_init(&name1);
|
||||
dns_name_init(&name2);
|
||||
dns_rdata_toregion(rdata1, &r1);
|
||||
dns_rdata_toregion(rdata2, &r2);
|
||||
isc_region_consume(&r1, 18);
|
||||
isc_region_consume(&r2, 18);
|
||||
dns_name_fromregion(&name1, &r1);
|
||||
dns_name_fromregion(&name2, &r2);
|
||||
order = dns_name_rdatacompare(&name1, &name2);
|
||||
if (order != 0) {
|
||||
return order;
|
||||
}
|
||||
|
||||
isc_region_consume(&r1, name_length(&name1));
|
||||
isc_region_consume(&r2, name_length(&name2));
|
||||
|
||||
return isc_region_compare(&r1, &r2);
|
||||
}
|
||||
|
||||
#endif /* RDATA_GENERIC_RRSIG_46_C */
|
||||
|
||||
@@ -556,32 +556,13 @@ additionaldata_sig(ARGS_ADDLDATA) {
|
||||
|
||||
static isc_result_t
|
||||
digest_sig(ARGS_DIGEST) {
|
||||
isc_region_t r1, r2;
|
||||
dns_name_t name;
|
||||
|
||||
REQUIRE(rdata->type == dns_rdatatype_sig);
|
||||
|
||||
dns_rdata_toregion(rdata, &r1);
|
||||
r2 = r1;
|
||||
UNUSED(rdata);
|
||||
UNUSED(digest);
|
||||
UNUSED(arg);
|
||||
|
||||
/*
|
||||
* Type covered (2) + Algorithm (1) +
|
||||
* Labels (1) + Original TTL (4) +
|
||||
* Expire time (4) + Time signed (4) +
|
||||
* Key ID (2).
|
||||
*/
|
||||
isc_region_consume(&r2, 18);
|
||||
r1.length = 18;
|
||||
RETERR((digest)(arg, &r1));
|
||||
|
||||
/* Signer */
|
||||
dns_name_init(&name);
|
||||
dns_name_fromregion(&name, &r2);
|
||||
RETERR(dns_name_digest(&name, digest, arg));
|
||||
isc_region_consume(&r2, name_length(&name));
|
||||
|
||||
/* Signature */
|
||||
return (digest)(arg, &r2);
|
||||
return ISC_R_NOTIMPLEMENTED;
|
||||
}
|
||||
|
||||
static dns_rdatatype_t
|
||||
|
||||
+9
-24
@@ -5263,7 +5263,7 @@ validated(void *arg) {
|
||||
* is returned, and that the rdatasets are bound.
|
||||
*/
|
||||
if (val->result == ISC_R_SUCCESS && !negative &&
|
||||
val->rdataset != NULL && CHAINING(val->rdataset))
|
||||
CHAINING(val->rdataset))
|
||||
{
|
||||
if (val->rdataset->type == dns_rdatatype_cname) {
|
||||
eresult = DNS_R_CNAME;
|
||||
@@ -5357,18 +5357,14 @@ validated(void *arg) {
|
||||
nextval = ISC_LIST_HEAD(fctx->validators);
|
||||
if (nextval != NULL) {
|
||||
dns_validator_send(nextval);
|
||||
goto cleanup_fetchctx;
|
||||
} else if (sentresponse) {
|
||||
done = true;
|
||||
goto cleanup_fetchctx;
|
||||
} else if (result == DNS_R_BROKENCHAIN) {
|
||||
done = true;
|
||||
goto cleanup_fetchctx;
|
||||
} else {
|
||||
fctx_try(fctx, true);
|
||||
goto cleanup_fetchctx;
|
||||
}
|
||||
UNREACHABLE();
|
||||
goto cleanup_fetchctx;
|
||||
}
|
||||
|
||||
if (negative) {
|
||||
@@ -5663,9 +5659,7 @@ answer_response:
|
||||
if (NEGATIVE(hresp->rdataset)) {
|
||||
INSIST(eresult == DNS_R_NCACHENXDOMAIN ||
|
||||
eresult == DNS_R_NCACHENXRRSET);
|
||||
} else if (eresult == ISC_R_SUCCESS &&
|
||||
hresp->rdataset->type != fctx->type)
|
||||
{
|
||||
} else if (eresult == ISC_R_SUCCESS) {
|
||||
switch (hresp->rdataset->type) {
|
||||
case dns_rdatatype_cname:
|
||||
eresult = DNS_R_CNAME;
|
||||
@@ -6328,12 +6322,9 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_message_t *message,
|
||||
*/
|
||||
if (dns_rdataset_isassociated(resp->rdataset)) {
|
||||
if (NEGATIVE(resp->rdataset)) {
|
||||
INSIST(eresult ==
|
||||
DNS_R_NCACHENXDOMAIN ||
|
||||
INSIST(eresult == DNS_R_NCACHENXDOMAIN ||
|
||||
eresult == DNS_R_NCACHENXRRSET);
|
||||
} else if (eresult == ISC_R_SUCCESS &&
|
||||
resp->rdataset->type != fctx->type)
|
||||
{
|
||||
} else if (eresult == ISC_R_SUCCESS) {
|
||||
switch (resp->rdataset->type) {
|
||||
case dns_rdatatype_cname:
|
||||
eresult = DNS_R_CNAME;
|
||||
@@ -6409,8 +6400,7 @@ cache_message(fetchctx_t *fctx, dns_message_t *message,
|
||||
}
|
||||
|
||||
/*
|
||||
* Do what dns_ncache_addoptout() does, and then compute an appropriate
|
||||
* eresult.
|
||||
* Call dns_ncache_add() and then compute an appropriate eresult.
|
||||
*/
|
||||
static isc_result_t
|
||||
ncache_adderesult(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
|
||||
@@ -6424,14 +6414,9 @@ ncache_adderesult(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
|
||||
dns_rdataset_init(&rdataset);
|
||||
ardataset = &rdataset;
|
||||
}
|
||||
if (secure) {
|
||||
result = dns_ncache_addoptout(message, cache, node, covers, now,
|
||||
minttl, maxttl, optout,
|
||||
ardataset);
|
||||
} else {
|
||||
result = dns_ncache_add(message, cache, node, covers, now,
|
||||
minttl, maxttl, ardataset);
|
||||
}
|
||||
|
||||
result = dns_ncache_add(message, cache, node, covers, now, optout,
|
||||
secure, minttl, maxttl, ardataset);
|
||||
if (result == DNS_R_UNCHANGED || result == ISC_R_SUCCESS) {
|
||||
/*
|
||||
* If the cache now contains a negative entry and we
|
||||
|
||||
+6
-12
@@ -18385,22 +18385,18 @@ dns_zone_getsourceaddr(dns_zone_t *zone) {
|
||||
return sourceaddr;
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_zone_getprimaryaddr(dns_zone_t *zone, isc_sockaddr_t *dest) {
|
||||
isc_result_t result = ISC_R_NOMORE;
|
||||
isc_sockaddr_t
|
||||
dns_zone_getprimaryaddr(dns_zone_t *zone) {
|
||||
isc_sockaddr_t curraddr;
|
||||
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
REQUIRE(dest != NULL);
|
||||
|
||||
LOCK_ZONE(zone);
|
||||
INSIST(dns_remote_count(&zone->primaries) > 0);
|
||||
if (!dns_remote_done(&zone->primaries)) {
|
||||
*dest = dns_remote_curraddr(&zone->primaries);
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
curraddr = dns_remote_curraddr(&zone->primaries);
|
||||
UNLOCK_ZONE(zone);
|
||||
|
||||
return result;
|
||||
return curraddr;
|
||||
}
|
||||
|
||||
isc_time_t
|
||||
@@ -18461,9 +18457,7 @@ get_request_transport_type(dns_zone_t *zone) {
|
||||
: DNS_TRANSPORT_UDP;
|
||||
|
||||
/* Check if the peer is forced to always use TCP. */
|
||||
if (transport_type != DNS_TRANSPORT_TCP &&
|
||||
!dns_remote_done(&zone->primaries))
|
||||
{
|
||||
if (transport_type != DNS_TRANSPORT_TCP) {
|
||||
isc_result_t result;
|
||||
isc_sockaddr_t primaryaddr;
|
||||
isc_netaddr_t primaryip;
|
||||
|
||||
@@ -15,6 +15,7 @@ libisc_la_HEADERS = \
|
||||
include/isc/base64.h \
|
||||
include/isc/buffer.h \
|
||||
include/isc/commandline.h \
|
||||
include/isc/condition.h \
|
||||
include/isc/counter.h \
|
||||
include/isc/crypto.h \
|
||||
include/isc/dir.h \
|
||||
@@ -24,6 +25,7 @@ libisc_la_HEADERS = \
|
||||
include/isc/errno.h \
|
||||
include/isc/error.h \
|
||||
include/isc/file.h \
|
||||
include/isc/fips.h \
|
||||
include/isc/formatcheck.h \
|
||||
include/isc/fuzz.h \
|
||||
include/isc/getaddresses.h \
|
||||
@@ -50,6 +52,7 @@ libisc_la_HEADERS = \
|
||||
include/isc/mem.h \
|
||||
include/isc/meminfo.h \
|
||||
include/isc/mutex.h \
|
||||
include/isc/mutexblock.h \
|
||||
include/isc/net.h \
|
||||
include/isc/netaddr.h \
|
||||
include/isc/netmgr.h \
|
||||
@@ -120,6 +123,7 @@ libisc_la_SOURCES = \
|
||||
base32.c \
|
||||
base64.c \
|
||||
commandline.c \
|
||||
condition.c \
|
||||
counter.c \
|
||||
crypto.c \
|
||||
dir.c \
|
||||
@@ -129,6 +133,7 @@ libisc_la_SOURCES = \
|
||||
errno2result.h \
|
||||
error.c \
|
||||
file.c \
|
||||
fips.c \
|
||||
getaddresses.c \
|
||||
hash.c \
|
||||
hashmap.c \
|
||||
@@ -156,6 +161,7 @@ libisc_la_SOURCES = \
|
||||
meminfo.c \
|
||||
mutex.c \
|
||||
mutex_p.h \
|
||||
mutexblock.c \
|
||||
net.c \
|
||||
netaddr.c \
|
||||
netscope.c \
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <isc/async.h>
|
||||
#include <isc/atomic.h>
|
||||
#include <isc/barrier.h>
|
||||
#include <isc/condition.h>
|
||||
#include <isc/job.h>
|
||||
#include <isc/loop.h>
|
||||
#include <isc/magic.h>
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <isc/condition.h>
|
||||
#include <isc/strerr.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/time.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
isc_result_t
|
||||
isc__condition_waituntil(pthread_cond_t *c, pthread_mutex_t *m, isc_time_t *t) {
|
||||
int presult;
|
||||
isc_result_t result;
|
||||
struct timespec ts;
|
||||
|
||||
REQUIRE(c != NULL && m != NULL && t != NULL);
|
||||
|
||||
/*
|
||||
* POSIX defines a timespec's tv_sec as time_t.
|
||||
*/
|
||||
result = isc_time_secondsastimet(t, &ts.tv_sec);
|
||||
|
||||
/*
|
||||
* If we have a range error ts.tv_sec is most probably a signed
|
||||
* 32 bit value. Set ts.tv_sec to INT_MAX. This is a kludge.
|
||||
*/
|
||||
if (result == ISC_R_RANGE) {
|
||||
ts.tv_sec = INT_MAX;
|
||||
} else if (result != ISC_R_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
/*!
|
||||
* POSIX defines a timespec's tv_nsec as long. isc_time_nanoseconds
|
||||
* ensures its return value is < 1 billion, which will fit in a long.
|
||||
*/
|
||||
ts.tv_nsec = (long)isc_time_nanoseconds(t);
|
||||
|
||||
do {
|
||||
presult = pthread_cond_timedwait(c, m, &ts);
|
||||
if (presult == 0) {
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
if (presult == ETIMEDOUT) {
|
||||
return ISC_R_TIMEDOUT;
|
||||
}
|
||||
} while (presult == EINTR);
|
||||
|
||||
UNEXPECTED_SYSERROR(presult, "pthread_cond_timedwait()");
|
||||
return ISC_R_UNEXPECTED;
|
||||
}
|
||||
+34
-139
@@ -11,17 +11,13 @@
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
#include <openssl/provider.h>
|
||||
#endif /* OPENSSL_VERSION_NUMBER >= 0x30000000L */
|
||||
|
||||
#include <isc/crypto.h>
|
||||
#include <isc/fips.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/tls.h>
|
||||
@@ -29,10 +25,6 @@
|
||||
|
||||
static isc_mem_t *isc__crypto_mctx = NULL;
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
static OSSL_PROVIDER *base = NULL, *fips = NULL;
|
||||
#endif /* OPENSSL_VERSION_NUMBER >= 0x30000000L */
|
||||
|
||||
const EVP_MD *isc__crypto_md5 = NULL;
|
||||
const EVP_MD *isc__crypto_sha1 = NULL;
|
||||
const EVP_MD *isc__crypto_sha224 = NULL;
|
||||
@@ -57,6 +49,7 @@ const EVP_MD *isc__crypto_sha512 = NULL;
|
||||
isc__crypto_##alg = NULL; \
|
||||
} \
|
||||
}
|
||||
|
||||
#else /* OPENSSL_VERSION_NUMBER >= 0x30000000L */
|
||||
#define md_register_algorithm(alg, algname) \
|
||||
{ \
|
||||
@@ -68,34 +61,6 @@ const EVP_MD *isc__crypto_sha512 = NULL;
|
||||
#define md_unregister_algorithm(alg)
|
||||
#endif /* OPENSSL_VERSION_NUMBER >= 0x30000000L */
|
||||
|
||||
static isc_result_t
|
||||
register_algorithms(void) {
|
||||
if (!isc_crypto_fips_mode()) {
|
||||
md_register_algorithm(md5, "MD5");
|
||||
}
|
||||
|
||||
md_register_algorithm(sha1, "SHA1");
|
||||
md_register_algorithm(sha224, "SHA224");
|
||||
md_register_algorithm(sha256, "SHA256");
|
||||
md_register_algorithm(sha384, "SHA384");
|
||||
md_register_algorithm(sha512, "SHA512");
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
unregister_algorithms(void) {
|
||||
md_unregister_algorithm(sha512);
|
||||
md_unregister_algorithm(sha384);
|
||||
md_unregister_algorithm(sha256);
|
||||
md_unregister_algorithm(sha224);
|
||||
md_unregister_algorithm(sha1);
|
||||
md_unregister_algorithm(md5);
|
||||
}
|
||||
|
||||
#undef md_unregister_algorithm
|
||||
#undef md_register_algorithm
|
||||
|
||||
#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
/*
|
||||
* This was crippled with LibreSSL, so just skip it:
|
||||
@@ -114,14 +79,14 @@ unregister_algorithms(void) {
|
||||
|
||||
static void *
|
||||
isc__crypto_malloc_ex(size_t size, const char *file, int line) {
|
||||
return isc__mem_allocate(isc__crypto_mctx, size, 0, __func__, file,
|
||||
return isc__mem_allocate(isc__crypto_mctx, size, 0, file,
|
||||
(unsigned int)line);
|
||||
}
|
||||
|
||||
static void *
|
||||
isc__crypto_realloc_ex(void *ptr, size_t size, const char *file, int line) {
|
||||
return isc__mem_reallocate(isc__crypto_mctx, ptr, size, 0, __func__,
|
||||
file, (unsigned int)line);
|
||||
return isc__mem_reallocate(isc__crypto_mctx, ptr, size, 0, file,
|
||||
(unsigned int)line);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -130,7 +95,7 @@ isc__crypto_free_ex(void *ptr, const char *file, int line) {
|
||||
return;
|
||||
}
|
||||
if (isc__crypto_mctx != NULL) {
|
||||
isc__mem_free(isc__crypto_mctx, ptr, 0, __func__, file,
|
||||
isc__mem_free(isc__crypto_mctx, ptr, 0, file,
|
||||
(unsigned int)line);
|
||||
}
|
||||
}
|
||||
@@ -167,82 +132,6 @@ isc__crypto_free_ex(void *ptr, const char *file, int line) {
|
||||
|
||||
#endif /* !defined(LIBRESSL_VERSION_NUMBER) */
|
||||
|
||||
#if defined(HAVE_EVP_DEFAULT_PROPERTIES_ENABLE_FIPS)
|
||||
bool
|
||||
isc_crypto_fips_mode(void) {
|
||||
return EVP_default_properties_is_fips_enabled(NULL) != 0;
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_crypto_fips_enable(void) {
|
||||
if (isc_crypto_fips_mode()) {
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
INSIST(fips == NULL);
|
||||
fips = OSSL_PROVIDER_load(NULL, "fips");
|
||||
if (fips == NULL) {
|
||||
return isc_tlserr2result(
|
||||
ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_CRYPTO,
|
||||
"OSSL_PROVIDER_load", ISC_R_CRYPTOFAILURE);
|
||||
}
|
||||
|
||||
INSIST(base == NULL);
|
||||
base = OSSL_PROVIDER_load(NULL, "base");
|
||||
if (base == NULL) {
|
||||
OSSL_PROVIDER_unload(fips);
|
||||
return isc_tlserr2result(
|
||||
ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_CRYPTO,
|
||||
"OSS_PROVIDER_load", ISC_R_CRYPTOFAILURE);
|
||||
}
|
||||
|
||||
if (EVP_default_properties_enable_fips(NULL, 1) == 0) {
|
||||
return isc_tlserr2result(ISC_LOGCATEGORY_GENERAL,
|
||||
ISC_LOGMODULE_CRYPTO,
|
||||
"EVP_default_properties_enable_fips",
|
||||
ISC_R_CRYPTOFAILURE);
|
||||
}
|
||||
|
||||
unregister_algorithms();
|
||||
register_algorithms();
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
#elif defined(HAVE_FIPS_MODE)
|
||||
bool
|
||||
isc_crypto_fips_mode(void) {
|
||||
return FIPS_mode() != 0;
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_crypto_fips_enable(void) {
|
||||
if (isc_crypto_fips_mode()) {
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
if (FIPS_mode_set(1) == 0) {
|
||||
return isc_tlserr2result(ISC_LOGCATEGORY_GENERAL,
|
||||
ISC_LOGMODULE_CRYPTO, "FIPS_mode_set",
|
||||
ISC_R_CRYPTOFAILURE);
|
||||
}
|
||||
|
||||
unregister_algorithms();
|
||||
register_algorithms();
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
#else
|
||||
bool
|
||||
isc_crypto_fips_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_crypto_fips_enable(void) {
|
||||
return ISC_R_NOTIMPLEMENTED;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
isc__crypto_setdestroycheck(bool check) {
|
||||
isc_mem_setdestroycheck(isc__crypto_mctx, check);
|
||||
@@ -278,16 +167,6 @@ isc__crypto_initialize(void) {
|
||||
|
||||
RUNTIME_CHECK(OPENSSL_init_ssl(opts, NULL) == 1);
|
||||
|
||||
register_algorithms();
|
||||
|
||||
#if defined(ENABLE_FIPS_MODE)
|
||||
if (isc_crypto_fips_enable() != ISC_R_SUCCESS) {
|
||||
ERR_clear_error();
|
||||
FATAL_ERROR("Failed to toggle FIPS mode but is "
|
||||
"required for this build");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Protect ourselves against unseeded PRNG */
|
||||
if (RAND_status() != 1) {
|
||||
isc_tlserr2result(ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_CRYPTO,
|
||||
@@ -296,23 +175,39 @@ isc__crypto_initialize(void) {
|
||||
"cannot be initialized (see the `PRNG not "
|
||||
"seeded' message in the OpenSSL FAQ)");
|
||||
}
|
||||
|
||||
#if defined(ENABLE_FIPS_MODE)
|
||||
if (!isc_fips_mode()) {
|
||||
if (isc_fips_set_mode(1) != ISC_R_SUCCESS) {
|
||||
isc_tlserr2result(ISC_LOGCATEGORY_GENERAL,
|
||||
ISC_LOGMODULE_CRYPTO, "FIPS_mode_set",
|
||||
ISC_R_CRYPTOFAILURE);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
md_register_algorithm(md5, "MD5");
|
||||
md_register_algorithm(sha1, "SHA1");
|
||||
md_register_algorithm(sha224, "SHA224");
|
||||
md_register_algorithm(sha256, "SHA256");
|
||||
md_register_algorithm(sha384, "SHA384");
|
||||
md_register_algorithm(sha512, "SHA512");
|
||||
}
|
||||
|
||||
void
|
||||
isc__crypto_shutdown(void) {
|
||||
unregister_algorithms();
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
if (base != NULL) {
|
||||
OSSL_PROVIDER_unload(base);
|
||||
}
|
||||
|
||||
if (fips != NULL) {
|
||||
OSSL_PROVIDER_unload(fips);
|
||||
}
|
||||
#endif /* OPENSSL_VERSION_NUMBER >= 0x30000000L */
|
||||
md_unregister_algorithm(sha512);
|
||||
md_unregister_algorithm(sha384);
|
||||
md_unregister_algorithm(sha256);
|
||||
md_unregister_algorithm(sha224);
|
||||
md_unregister_algorithm(sha1);
|
||||
md_unregister_algorithm(md5);
|
||||
|
||||
OPENSSL_cleanup();
|
||||
|
||||
isc_mem_detach(&isc__crypto_mctx);
|
||||
isc_mem_destroy(&isc__crypto_mctx);
|
||||
}
|
||||
|
||||
#undef md_unregister_algorithm
|
||||
#undef md_register_algorithm
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <isc/fips.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#if defined(HAVE_EVP_DEFAULT_PROPERTIES_ENABLE_FIPS)
|
||||
#include <openssl/evp.h>
|
||||
bool
|
||||
isc_fips_mode(void) {
|
||||
return EVP_default_properties_is_fips_enabled(NULL) != 0;
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_fips_set_mode(int mode) {
|
||||
return EVP_default_properties_enable_fips(NULL, mode) != 0
|
||||
? ISC_R_SUCCESS
|
||||
: ISC_R_FAILURE;
|
||||
}
|
||||
#elif defined(HAVE_FIPS_MODE)
|
||||
#include <openssl/crypto.h>
|
||||
|
||||
bool
|
||||
isc_fips_mode(void) {
|
||||
return FIPS_mode() != 0;
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_fips_set_mode(int mode) {
|
||||
return FIPS_mode_set(mode) != 0 ? ISC_R_SUCCESS : ISC_R_FAILURE;
|
||||
}
|
||||
#else
|
||||
bool
|
||||
isc_fips_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_fips_set_mode(int mode) {
|
||||
UNUSED(mode);
|
||||
return ISC_R_NOTIMPLEMENTED;
|
||||
}
|
||||
#endif
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <isc/atomic.h>
|
||||
#include <isc/barrier.h>
|
||||
#include <isc/condition.h>
|
||||
#include <isc/helper.h>
|
||||
#include <isc/job.h>
|
||||
#include <isc/loop.h>
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/*! \file */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <isc/error.h>
|
||||
#include <isc/mutex.h>
|
||||
#include <isc/result.h>
|
||||
#include <isc/string.h>
|
||||
#include <isc/types.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
/*
|
||||
* We use macros instead of static inline functions so that the exact code
|
||||
* location can be reported when PTHREADS_RUNTIME_CHECK() fails or when mutrace
|
||||
* reports lock contention.
|
||||
*/
|
||||
|
||||
#ifdef ISC_TRACK_PTHREADS_OBJECTS
|
||||
|
||||
typedef pthread_cond_t *isc_condition_t;
|
||||
|
||||
#define isc_condition_init(cp) \
|
||||
{ \
|
||||
*cp = malloc(sizeof(**cp)); \
|
||||
isc__condition_init(*cp); \
|
||||
}
|
||||
#define isc_condition_wait(cp, mp) isc__condition_wait(*cp, *mp)
|
||||
#define isc_condition_waituntil(cp, mp, t) isc__condition_waituntil(*cp, *mp, t)
|
||||
#define isc_condition_signal(cp) isc__condition_signal(*cp)
|
||||
#define isc_condition_broadcast(cp) isc__condition_broadcast(*cp)
|
||||
#define isc_condition_destroy(cp) \
|
||||
{ \
|
||||
isc__condition_destroy(*cp); \
|
||||
free(*cp); \
|
||||
}
|
||||
|
||||
#else /* ISC_TRACK_PTHREADS_OBJECTS */
|
||||
|
||||
typedef pthread_cond_t isc_condition_t;
|
||||
|
||||
#define isc_condition_init(cond) isc__condition_init(cond)
|
||||
#define isc_condition_wait(cp, mp) isc__condition_wait(cp, mp)
|
||||
#define isc_condition_waituntil(cp, mp, t) isc__condition_waituntil(cp, mp, t)
|
||||
#define isc_condition_signal(cp) isc__condition_signal(cp)
|
||||
#define isc_condition_broadcast(cp) isc__condition_broadcast(cp)
|
||||
#define isc_condition_destroy(cp) isc__condition_destroy(cp)
|
||||
|
||||
#endif /* ISC_TRACK_PTHREADS_OBJECTS */
|
||||
|
||||
#define isc__condition_init(cond) \
|
||||
{ \
|
||||
int _ret = pthread_cond_init(cond, NULL); \
|
||||
PTHREADS_RUNTIME_CHECK(pthread_cond_init, _ret); \
|
||||
}
|
||||
|
||||
#define isc__condition_wait(cp, mp) \
|
||||
{ \
|
||||
int _ret = pthread_cond_wait(cp, mp); \
|
||||
PTHREADS_RUNTIME_CHECK(pthread_cond_wait, _ret); \
|
||||
}
|
||||
|
||||
#define isc__condition_signal(cp) \
|
||||
{ \
|
||||
int _ret = pthread_cond_signal(cp); \
|
||||
PTHREADS_RUNTIME_CHECK(pthread_cond_signal, _ret); \
|
||||
}
|
||||
|
||||
#define isc__condition_broadcast(cp) \
|
||||
{ \
|
||||
int _ret = pthread_cond_broadcast(cp); \
|
||||
PTHREADS_RUNTIME_CHECK(pthread_cond_broadcast, _ret); \
|
||||
}
|
||||
|
||||
#define isc__condition_destroy(cp) \
|
||||
{ \
|
||||
int _ret = pthread_cond_destroy(cp); \
|
||||
PTHREADS_RUNTIME_CHECK(pthread_cond_destroy, _ret); \
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc__condition_waituntil(pthread_cond_t *, pthread_mutex_t *, isc_time_t *);
|
||||
@@ -24,20 +24,6 @@ extern const EVP_MD *isc__crypto_sha256;
|
||||
extern const EVP_MD *isc__crypto_sha384;
|
||||
extern const EVP_MD *isc__crypto_sha512;
|
||||
|
||||
bool
|
||||
isc_crypto_fips_mode(void);
|
||||
/*
|
||||
* Return if FIPS mode is currently enabled or not.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
isc_crypto_fips_enable(void);
|
||||
/*
|
||||
* Enable FIPS mode. It cannot be disabled afterwards.
|
||||
*
|
||||
* This function is NOT thread safe.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Private
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/*****
|
||||
***** Module Info
|
||||
*****/
|
||||
|
||||
/***
|
||||
*** Imports
|
||||
***/
|
||||
|
||||
#include <isc/types.h>
|
||||
|
||||
/***
|
||||
*** Functions
|
||||
***/
|
||||
|
||||
bool
|
||||
isc_fips_mode(void);
|
||||
/*
|
||||
* Return if FIPS mode is currently enabled or not
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
isc_fips_set_mode(int mode);
|
||||
/*
|
||||
* Enable FIPS mode.
|
||||
*/
|
||||
+31
-15
@@ -21,12 +21,9 @@
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/mutex.h>
|
||||
#include <isc/overflow.h>
|
||||
#include <isc/refcount.h>
|
||||
#include <isc/types.h>
|
||||
#include <isc/urcu.h>
|
||||
|
||||
/* Add -DISC_MEM_TRACE=1 to CFLAGS for detailed reference tracing */
|
||||
|
||||
/*%
|
||||
* Define ISC_MEM_TRACKLINES=1 to turn on detailed tracing of memory
|
||||
* allocation and freeing by file and line number.
|
||||
@@ -65,8 +62,8 @@ extern unsigned int isc_mem_defaultflags;
|
||||
/*@}*/
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
#define _ISC_MEM_FILELINE , __func__, __FILE__, __LINE__
|
||||
#define _ISC_MEM_FLARG , const char *, const char *, unsigned int
|
||||
#define _ISC_MEM_FILELINE , __FILE__, __LINE__
|
||||
#define _ISC_MEM_FLARG , const char *, unsigned int
|
||||
#else /* if ISC_MEM_TRACKLINES */
|
||||
#define _ISC_MEM_FILELINE
|
||||
#define _ISC_MEM_FLARG
|
||||
@@ -252,16 +249,35 @@ isc_mem_arena_set_dirty_decay_ms(isc_mem_t *mctx, const ssize_t decay_ms);
|
||||
*/
|
||||
/*@}*/
|
||||
|
||||
#if ISC_MEM_TRACE
|
||||
#define isc_mem_ref(ptr) isc_mem__ref(ptr, __func__, __FILE__, __LINE__)
|
||||
#define isc_mem_unref(ptr) isc_mem__unref(ptr, __func__, __FILE__, __LINE__)
|
||||
#define isc_mem_attach(ptr, ptrp) \
|
||||
isc_mem__attach(ptr, ptrp, __func__, __FILE__, __LINE__)
|
||||
#define isc_mem_detach(ptrp) isc_mem__detach(ptrp, __func__, __FILE__, __LINE__)
|
||||
ISC_REFCOUNT_TRACE_DECL(isc_mem);
|
||||
#else
|
||||
ISC_REFCOUNT_DECL(isc_mem);
|
||||
#endif
|
||||
void
|
||||
isc_mem_attach(isc_mem_t *, isc_mem_t **);
|
||||
|
||||
/*@{*/
|
||||
void
|
||||
isc_mem_attach(isc_mem_t *, isc_mem_t **);
|
||||
#define isc_mem_detach(cp) isc__mem_detach((cp)_ISC_MEM_FILELINE)
|
||||
void
|
||||
isc__mem_detach(isc_mem_t **_ISC_MEM_FLARG);
|
||||
/*!<
|
||||
* \brief Attach to / detach from a memory context.
|
||||
*
|
||||
* This is intended for applications that use multiple memory contexts
|
||||
* in such a way that it is not obvious when the last allocations from
|
||||
* a given context has been freed and destroying the context is safe.
|
||||
*
|
||||
* Most applications do not need to call these functions as they can
|
||||
* simply create a single memory context at the beginning of main()
|
||||
* and destroy it at the end of main(), thereby guaranteeing that it
|
||||
* is not destroyed while there are outstanding allocations.
|
||||
*/
|
||||
/*@}*/
|
||||
|
||||
#define isc_mem_destroy(cp) isc__mem_destroy((cp)_ISC_MEM_FILELINE)
|
||||
void
|
||||
isc__mem_destroy(isc_mem_t **_ISC_MEM_FLARG);
|
||||
/*%<
|
||||
* Destroy a memory context.
|
||||
*/
|
||||
|
||||
void
|
||||
isc_mem_stats(isc_mem_t *mctx, FILE *out);
|
||||
|
||||
@@ -22,21 +22,6 @@
|
||||
#include <isc/result.h> /* for ISC_R_ codes */
|
||||
#include <isc/util.h>
|
||||
|
||||
#define LOCK(lp) \
|
||||
{ \
|
||||
ISC_UTIL_TRACE(fprintf(stderr, "LOCKING %p %s %d\n", (lp), \
|
||||
__FILE__, __LINE__)); \
|
||||
isc_mutex_lock((lp)); \
|
||||
ISC_UTIL_TRACE(fprintf(stderr, "LOCKED %p %s %d\n", (lp), \
|
||||
__FILE__, __LINE__)); \
|
||||
}
|
||||
#define UNLOCK(lp) \
|
||||
{ \
|
||||
isc_mutex_unlock((lp)); \
|
||||
ISC_UTIL_TRACE(fprintf(stderr, "UNLOCKED %p %s %d\n", (lp), \
|
||||
__FILE__, __LINE__)); \
|
||||
}
|
||||
|
||||
/*
|
||||
* We use macros instead of static inline functions so that the exact code
|
||||
* location can be reported when PTHREADS_RUNTIME_CHECK() fails or when mutrace
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* See the COPYRIGHT file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/*! \file isc/mutexblock.h */
|
||||
|
||||
#include <isc/mutex.h>
|
||||
#include <isc/types.h>
|
||||
|
||||
void
|
||||
isc_mutexblock_init(isc_mutex_t *block, unsigned int count);
|
||||
/*%<
|
||||
* Initialize a block of locks. If an error occurs all initialized locks
|
||||
* will be destroyed, if possible.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li block != NULL
|
||||
*
|
||||
*\li count > 0
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
isc_mutexblock_destroy(isc_mutex_t *block, unsigned int count);
|
||||
/*%<
|
||||
* Destroy a block of locks.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li block != NULL
|
||||
*
|
||||
*\li count > 0
|
||||
*
|
||||
*\li Each lock in the block be initialized via isc_mutex_init() or
|
||||
* the whole block was initialized via isc_mutex_initblock().
|
||||
*
|
||||
*/
|
||||
@@ -14,6 +14,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*! \file isc/rwlock.h */
|
||||
|
||||
@@ -26,42 +27,7 @@ typedef enum {
|
||||
isc_rwlocktype_write
|
||||
} isc_rwlocktype_t;
|
||||
|
||||
#define RWLOCK(lp, t) \
|
||||
{ \
|
||||
ISC_UTIL_TRACE(fprintf(stderr, "RWLOCK %p, %d %s %d\n", (lp), \
|
||||
(t), __FILE__, __LINE__)); \
|
||||
isc_rwlock_lock((lp), (t)); \
|
||||
ISC_UTIL_TRACE(fprintf(stderr, "RWLOCKED %p, %d %s %d\n", \
|
||||
(lp), (t), __FILE__, __LINE__)); \
|
||||
}
|
||||
#define RWUNLOCK(lp, t) \
|
||||
{ \
|
||||
ISC_UTIL_TRACE(fprintf(stderr, "RWUNLOCK %p, %d %s %d\n", \
|
||||
(lp), (t), __FILE__, __LINE__)); \
|
||||
isc_rwlock_unlock((lp), (t)); \
|
||||
}
|
||||
|
||||
#define RDLOCK(lp) RWLOCK(lp, isc_rwlocktype_read)
|
||||
#define RDUNLOCK(lp) RWUNLOCK(lp, isc_rwlocktype_read)
|
||||
#define WRLOCK(lp) RWLOCK(lp, isc_rwlocktype_write)
|
||||
#define WRUNLOCK(lp) RWUNLOCK(lp, isc_rwlocktype_write)
|
||||
|
||||
#define UPGRADELOCK(lock, locktype) \
|
||||
{ \
|
||||
if (locktype == isc_rwlocktype_read) { \
|
||||
if (isc_rwlock_tryupgrade(lock) == ISC_R_SUCCESS) { \
|
||||
locktype = isc_rwlocktype_write; \
|
||||
} else { \
|
||||
RWUNLOCK(lock, locktype); \
|
||||
locktype = isc_rwlocktype_write; \
|
||||
RWLOCK(lock, locktype); \
|
||||
} \
|
||||
} \
|
||||
INSIST(locktype == isc_rwlocktype_write); \
|
||||
}
|
||||
|
||||
#if USE_PTHREAD_RWLOCK
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
||||
/*
|
||||
@@ -72,8 +38,6 @@ typedef enum {
|
||||
|
||||
#if ISC_TRACK_PTHREADS_OBJECTS
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef pthread_rwlock_t *isc_rwlock_t;
|
||||
typedef pthread_rwlock_t isc__rwlock_t;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user