Merge branch '2408-dnssec-policy-purge-keys-v9_16' into 'v9_16'
Resolve "kasp: Purge deleted keys" See merge request isc-projects/bind9!4726
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
5588. [func] Add "purge-keys" option to "dnssec-policy". This sets
|
||||
the time how long key files should be retained after
|
||||
they have become obsolete. [GL #2408]
|
||||
|
||||
5586. [bug] An invalid direction field in a LOC record resulted in
|
||||
an INSIST failure. [GL #2499]
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ DNSSEC-POLICY
|
||||
parent-ds-ttl duration;
|
||||
parent-propagation-delay duration;
|
||||
publish-safety duration;
|
||||
purge-keys duration;
|
||||
retire-safety duration;
|
||||
signatures-refresh duration;
|
||||
signatures-validity duration;
|
||||
|
||||
@@ -26,6 +26,7 @@ dnssec-policy "test" {
|
||||
parent-ds-ttl 7200;
|
||||
parent-propagation-delay PT1H;
|
||||
publish-safety PT3600S;
|
||||
purge-keys P90D;
|
||||
retire-safety PT3600S;
|
||||
signatures-refresh P3D;
|
||||
signatures-validity P2W;
|
||||
|
||||
@@ -315,6 +315,11 @@ zone "step5.zsk-prepub.autosign" {
|
||||
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.
|
||||
@@ -344,6 +349,11 @@ zone "step5.ksk-doubleksk.autosign" {
|
||||
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.
|
||||
@@ -383,6 +393,11 @@ zone "step7.csk-roll.autosign" {
|
||||
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;
|
||||
@@ -414,3 +429,8 @@ zone "step6.csk-roll2.autosign" {
|
||||
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";
|
||||
};
|
||||
|
||||
@@ -52,6 +52,7 @@ dnssec-policy "zsk-prepub" {
|
||||
dnskey-ttl 3600;
|
||||
publish-safety P1D;
|
||||
retire-safety P2D;
|
||||
purge-keys PT1H;
|
||||
|
||||
keys {
|
||||
ksk key-directory lifetime P2Y algorithm @DEFAULT_ALGORITHM@;
|
||||
@@ -71,6 +72,7 @@ dnssec-policy "ksk-doubleksk" {
|
||||
dnskey-ttl 2h;
|
||||
publish-safety P1D;
|
||||
retire-safety P2D;
|
||||
purge-keys PT1H;
|
||||
|
||||
keys {
|
||||
ksk key-directory lifetime P60D algorithm @DEFAULT_ALGORITHM@;
|
||||
@@ -93,6 +95,7 @@ dnssec-policy "csk-roll" {
|
||||
dnskey-ttl 1h;
|
||||
publish-safety PT1H;
|
||||
retire-safety 2h;
|
||||
purge-keys PT1H;
|
||||
|
||||
keys {
|
||||
csk key-directory lifetime P6M algorithm @DEFAULT_ALGORITHM@;
|
||||
@@ -114,6 +117,7 @@ dnssec-policy "csk-roll2" {
|
||||
dnskey-ttl 1h;
|
||||
publish-safety PT1H;
|
||||
retire-safety 1h;
|
||||
purge-keys 0;
|
||||
|
||||
keys {
|
||||
csk key-directory lifetime P6M algorithm @DEFAULT_ALGORITHM@;
|
||||
|
||||
@@ -504,6 +504,44 @@ private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK1" >> "$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK2" >> "$infile"
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O full -f $zonefile $infile > signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 6:
|
||||
# The predecessor DNSKEY can be purged.
|
||||
setup step6.zsk-prepub.autosign
|
||||
# Subtract purge-keys interval from all the times (1h).
|
||||
# Tact(N) = now - 962h - 1h = now - 963h
|
||||
# Tret(N) = now - 242h - 1h = now - 243h
|
||||
# Tdea(N) = now - 49h - 1h = now - 50h
|
||||
# Trem(N) = now - 1h - 1h = now - 2h
|
||||
# Tpub(N+1) = now - 268h - 1h = now - 269h
|
||||
# Tact(N+1) = Tret(N)
|
||||
# Tret(N+1) = now + 478h - 1h = now + 477h
|
||||
# Trem(N+1) = now + 719h - 1h = now + 718h
|
||||
TactN="now-963h"
|
||||
TretN="now-243h"
|
||||
TremN="now-2h"
|
||||
TdeaN="now-50h"
|
||||
TpubN1="now-269h"
|
||||
TactN1="${TretN}"
|
||||
TretN1="now+477h"
|
||||
TremN1="now+718h"
|
||||
ksktimes="-P ${TactN} -A ${TactN} -P sync ${TactN}"
|
||||
zsktimes="-P ${TactN} -A ${TactN} -I ${TretN} -D ${TremN}"
|
||||
newtimes="-P ${TpubN1} -A ${TactN1} -I ${TretN1} -D ${TremN1}"
|
||||
KSK=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 -f KSK $ksktimes $zone 2> keygen.out.$zone.1)
|
||||
ZSK1=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 $zsktimes $zone 2> keygen.out.$zone.2)
|
||||
ZSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 $newtimes $zone 2> keygen.out.$zone.3)
|
||||
$SETTIME -s -g $O -k $O $TactN -r $O $TactN -d $O $TactN "$KSK" > settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $H -k $H $TdeaN -z $H $TdeaN "$ZSK1" > settime.out.$zone.2 2>&1
|
||||
$SETTIME -s -g $O -k $O $TactN1 -z $O $TdeaN "$ZSK2" > settime.out.$zone.3 2>&1
|
||||
# Set key rollover relationship.
|
||||
key_successor $ZSK1 $ZSK2
|
||||
# Sign zone.
|
||||
cat template.db.in "${KSK}.key" "${ZSK1}.key" "${ZSK2}.key" > "$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK" >> "$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK1" >> "$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK2" >> "$infile"
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O full -f $zonefile $infile > signer.out.$zone.1 2>&1
|
||||
|
||||
#
|
||||
# The zones at ksk-doubleksk.autosign represent the various steps of a KSK
|
||||
# Double-KSK rollover.
|
||||
@@ -710,7 +748,7 @@ setup step5.ksk-doubleksk.autosign
|
||||
# Tsbm(N+1) = now - 50h - 2h = now - 52h
|
||||
# Tact(N+1) = Tret(N)
|
||||
# Tret(N+1) = now + 1390h - 2h = now + 1388h
|
||||
# Trem(N+1) = now + 60d + 2h = now + 1442h
|
||||
# Trem(N+1) = now + 60d - 2h = now + 1442h
|
||||
TactN="now-1492h"
|
||||
TretN="now-52h"
|
||||
TremN="now-2h"
|
||||
@@ -737,6 +775,44 @@ private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK2" >> "$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK" >> "$infile"
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O full -f $zonefile $infile > signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 6:
|
||||
# The predecessor DNSKEY can be purged.
|
||||
setup step6.ksk-doubleksk.autosign
|
||||
# Subtract purge-keys interval from all the times (1h).
|
||||
# Tact(N) = now - 1492h - 1h = now - 1493h
|
||||
# Tret(N) = now - 52h - 1h = now - 53h
|
||||
# Trem(N) = now - 2h - 1h = now - 3h
|
||||
# Tpub(N+1) = now - 79h - 1h = now - 80h
|
||||
# Tsbm(N+1) = now - 52h - 1h = now - 53h
|
||||
# Tact(N+1) = Tret(N)
|
||||
# Tret(N+1) = now + 1388h - 1h = now + 1387h
|
||||
# Trem(N+1) = now + 1442h - 1h = now + 1441h
|
||||
TactN="now-1493h"
|
||||
TretN="now-53h"
|
||||
TremN="now-3h"
|
||||
TpubN1="now-80h"
|
||||
TsbmN1="now-53h"
|
||||
TactN1="${TretN}"
|
||||
TretN1="now+1387h"
|
||||
TremN1="now+1441h"
|
||||
ksktimes="-P ${TactN} -A ${TactN} -P sync ${TactN} -I ${TretN} -D ${TremN}"
|
||||
newtimes="-P ${TpubN1} -A ${TretN} -P sync ${TsbmN1} -I ${TretN1} -D ${TremN1}"
|
||||
zsktimes="-P ${TactN} -A ${TactN}"
|
||||
KSK1=$($KEYGEN -a $DEFAULT_ALGORITHM -L 7200 -f KSK $ksktimes $zone 2> keygen.out.$zone.1)
|
||||
KSK2=$($KEYGEN -a $DEFAULT_ALGORITHM -L 7200 -f KSK $newtimes $zone 2> keygen.out.$zone.2)
|
||||
ZSK=$($KEYGEN -a $DEFAULT_ALGORITHM -L 7200 $zsktimes $zone 2> keygen.out.$zone.3)
|
||||
$SETTIME -s -g $H -k $H $TretN -r $H $TretN -d $H $TretN "$KSK1" > settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $O -k $O $TactN1 -r $O $TactN1 -d $O $TactN1 "$KSK2" > settime.out.$zone.2 2>&1
|
||||
$SETTIME -s -g $O -k $O $TactN -z $O $TactN "$ZSK" > settime.out.$zone.3 2>&1
|
||||
# Set key rollover relationship.
|
||||
key_successor $KSK1 $KSK2
|
||||
# Sign zone.
|
||||
cat template.db.in "${KSK1}.key" "${KSK2}.key" "${ZSK}.key" > "$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK1" >> "$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$KSK2" >> "$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK" >> "$infile"
|
||||
$SIGNER -S -x -s now-1h -e now+2w -o $zone -O full -f $zonefile $infile > signer.out.$zone.1 2>&1
|
||||
|
||||
#
|
||||
# The zones at csk-roll.autosign represent the various steps of a CSK rollover
|
||||
# (which is essentially a ZSK Pre-Publication / KSK Double-KSK rollover).
|
||||
@@ -992,6 +1068,40 @@ private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK1" >> "$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK2" >> "$infile"
|
||||
$SIGNER -S -z -x -s now-1h -e now+30d -o $zone -O full -f $zonefile $infile > signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 8:
|
||||
# The predecessor DNSKEY can be purged.
|
||||
setup step8.csk-roll.autosign
|
||||
# Subtract purge-keys interval from all the times (1h).
|
||||
# Tact(N) = now - 5093h - 1h = now - 5094h
|
||||
# Tret(N) = now - 629h - 1h = now - 630h
|
||||
# Trem(N) = now - 2h - 1h = now - 3h
|
||||
# Tpub(N+1) = now - 632h - 1h = now - 633h
|
||||
# Tsbm(N+1) = Tret(N)
|
||||
# Tact(N+1) = Tret(N)
|
||||
# Tret(N+1) = now + 3835h - 1h = now + 3834h
|
||||
# Trem(N+1) = now + 4462h - 1h = now + 4461h
|
||||
TactN="now-5094h"
|
||||
TretN="now-630h"
|
||||
TremN="now-3h"
|
||||
TpubN1="now-633h"
|
||||
TsbmN1="${TretN}"
|
||||
TactN1="${TretN}"
|
||||
TretN1="now+3834h"
|
||||
TremN1="now+4461h"
|
||||
csktimes="-P ${TactN} -P sync ${TactN} -A ${TactN} -I ${TretN} -D ${TremN}"
|
||||
newtimes="-P ${TpubN1} -P sync ${TsbmN1} -A ${TactN1} -I ${TretN1} -D ${TremN1}"
|
||||
CSK1=$($KEYGEN -k csk-roll -l policies/autosign.conf $csktimes $zone 2> keygen.out.$zone.1)
|
||||
CSK2=$($KEYGEN -k csk-roll -l policies/autosign.conf $newtimes $zone 2> keygen.out.$zone.2)
|
||||
$SETTIME -s -g $H -k $H $TremN -r $H $TremN -d $H $TremN -z $H $TactN1 "$CSK1" > settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $O -k $O $TsbmN1 -r $O $TsbmN1 -d $O $TactN1 -z $O $TactN1 "$CSK2" > settime.out.$zone.2 2>&1
|
||||
# Set key rollover relationship.
|
||||
key_successor $CSK1 $CSK2
|
||||
# Sign zone.
|
||||
cat template.db.in "${CSK1}.key" "${CSK2}.key" > "$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK1" >> "$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK2" >> "$infile"
|
||||
$SIGNER -S -z -x -s now-1h -e now+30d -o $zone -O full -f $zonefile $infile > signer.out.$zone.1 2>&1
|
||||
|
||||
#
|
||||
# The zones at csk-roll2.autosign represent the various steps of a CSK rollover
|
||||
# (which is essentially a ZSK Pre-Publication / KSK Double-KSK rollover).
|
||||
@@ -1208,3 +1318,37 @@ cat template.db.in "${CSK1}.key" "${CSK2}.key" > "$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK1" >> "$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK2" >> "$infile"
|
||||
$SIGNER -S -z -x -s now-1h -e now+30d -o $zone -O full -f $zonefile $infile > signer.out.$zone.1 2>&1
|
||||
|
||||
# Step 7:
|
||||
# The predecessor DNSKEY can be purged, but purge-keys is disabled.
|
||||
setup step7.csk-roll2.autosign
|
||||
# Subtract 90 days (default, 2160h) from all the times.
|
||||
# Tact(N) = now - 4636h - 2160h = now - 6796h
|
||||
# Tret(N) = now - 172h - 2160h = now - 2332h
|
||||
# Trem(N) = now - 2h - 2160h = now - 2162h
|
||||
# Tpub(N+1) = now - 175h - 2160h = now - 2335h
|
||||
# Tsbm(N+1) = Tret(N)
|
||||
# Tact(N+1) = Tret(N)
|
||||
# Tret(N+1) = now + 4294h - 2160h = now + 2134h
|
||||
# Trem(N+1) = now + 4360h - 2160h = now + 2200h
|
||||
TactN="now-6796h"
|
||||
TretN="now-2332h"
|
||||
TremN="now-2162h"
|
||||
TpubN1="now-2335h"
|
||||
TsbmN1="${TretN}"
|
||||
TactN1="${TretN}"
|
||||
TretN1="now+2134h"
|
||||
TremN1="now+2200h"
|
||||
csktimes="-P ${TactN} -P sync ${TactN} -A ${TactN} -I ${TretN} -D ${TremN}"
|
||||
newtimes="-P ${TpubN1} -P sync ${TsbmN1} -A ${TactN1} -I ${TretN1} -D ${TremN1}"
|
||||
CSK1=$($KEYGEN -k csk-roll2 -l policies/autosign.conf $csktimes $zone 2> keygen.out.$zone.1)
|
||||
CSK2=$($KEYGEN -k csk-roll2 -l policies/autosign.conf $newtimes $zone 2> keygen.out.$zone.2)
|
||||
$SETTIME -s -g $H -k $U $TremN -r $U $TremN -d $H $TremN -z $H now-135h "$CSK1" > settime.out.$zone.1 2>&1
|
||||
$SETTIME -s -g $O -k $O $TsbmN1 -r $O $TsbmN1 -d $O $TremN -z $O now-135h "$CSK2" > settime.out.$zone.2 2>&1
|
||||
# Set key rollover relationship.
|
||||
key_successor $CSK1 $CSK2
|
||||
# Sign zone.
|
||||
cat template.db.in "${CSK1}.key" "${CSK2}.key" > "$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK1" >> "$infile"
|
||||
private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK2" >> "$infile"
|
||||
$SIGNER -S -z -x -s now-1h -e now+30d -o $zone -O full -f $zonefile $infile > signer.out.$zone.1 2>&1
|
||||
|
||||
@@ -856,7 +856,7 @@ status=$((status+ret))
|
||||
next_key_event_threshold=$((next_key_event_threshold+i))
|
||||
|
||||
check_numkeys() {
|
||||
_numkeys=$(get_keyids "$1" "$2" | wc -l)
|
||||
_numkeys=$(get_keyids "$DIR" "$ZONE" | wc -l)
|
||||
test "$_numkeys" -eq "$NUM_KEYS" || return 1
|
||||
return 0
|
||||
}
|
||||
@@ -873,9 +873,9 @@ check_keys() {
|
||||
ret=0
|
||||
|
||||
echo_i "check number of keys for zone ${ZONE} in dir ${DIR} ($n)"
|
||||
retry_quiet 10 check_numkeys "$DIR" "$ZONE" "$NUM_KEYS" || ret=1
|
||||
retry_quiet 10 check_numkeys || ret=1
|
||||
if [ $ret -ne 0 ]; then
|
||||
_numkeys=$(get_keyids "$1" "$2" | wc -l)
|
||||
_numkeys=$(get_keyids "$DIR" "$ZONE" | wc -l)
|
||||
log_error "bad number of key files ($_numkeys) for zone $ZONE (expected $NUM_KEYS)"
|
||||
status=$((status+ret))
|
||||
fi
|
||||
@@ -3434,6 +3434,22 @@ dnssec_verify
|
||||
# policy this is: 30d - 867600s - 93600s - 3600s = 1627200 seconds.
|
||||
check_next_key_event 1627200
|
||||
|
||||
#
|
||||
# Zone: step6.zsk-prepub.autosign.
|
||||
#
|
||||
set_zone "step6.zsk-prepub.autosign"
|
||||
set_policy "zsk-prepub" "2" "3600"
|
||||
set_server "ns3" "10.53.0.3"
|
||||
# ZSK (KEY2) DNSKEY is purged.
|
||||
key_clear "KEY2"
|
||||
|
||||
# Various signing policy checks.
|
||||
check_keys
|
||||
check_dnssecstatus "$SERVER" "$POLICY" "$ZONE"
|
||||
check_apex
|
||||
check_subdomain
|
||||
dnssec_verify
|
||||
|
||||
#
|
||||
# Testing KSK Double-KSK rollover.
|
||||
#
|
||||
@@ -3679,6 +3695,22 @@ dnssec_verify
|
||||
# 5184000 - 97200 - 180000 - 7200 = 4813200 seconds.
|
||||
check_next_key_event 4899600
|
||||
|
||||
#
|
||||
# Zone: step6.ksk-doubleksk.autosign.
|
||||
#
|
||||
set_zone "step6.ksk-doubleksk.autosign"
|
||||
set_policy "ksk-doubleksk" "2" "7200"
|
||||
set_server "ns3" "10.53.0.3"
|
||||
# KSK (KEY1) DNSKEY is purged.
|
||||
key_clear "KEY1"
|
||||
|
||||
# Various signing policy checks.
|
||||
check_keys
|
||||
check_dnssecstatus "$SERVER" "$POLICY" "$ZONE"
|
||||
check_apex
|
||||
check_subdomain
|
||||
dnssec_verify
|
||||
|
||||
#
|
||||
# Testing CSK key rollover (1).
|
||||
#
|
||||
@@ -4009,6 +4041,22 @@ dnssec_verify
|
||||
# Ipub: 3h (10800 seconds)
|
||||
check_next_key_event 13795200
|
||||
|
||||
#
|
||||
# Zone: step8.csk-roll.autosign.
|
||||
#
|
||||
set_zone "step8.csk-roll.autosign"
|
||||
set_policy "csk-roll" "1" "3600"
|
||||
set_server "ns3" "10.53.0.3"
|
||||
# The old CSK (KEY1) is purged.
|
||||
key_clear "KEY1"
|
||||
|
||||
# Various signing policy checks.
|
||||
check_keys
|
||||
check_dnssecstatus "$SERVER" "$POLICY" "$ZONE"
|
||||
check_apex
|
||||
check_subdomain
|
||||
dnssec_verify
|
||||
|
||||
#
|
||||
# Testing CSK key rollover (2).
|
||||
#
|
||||
@@ -4298,6 +4346,21 @@ dnssec_verify
|
||||
# Time passed: 175h (630000 seconds)
|
||||
check_next_key_event 15440400
|
||||
|
||||
#
|
||||
# Zone: step7.csk-roll2.autosign.
|
||||
#
|
||||
set_zone "step7.csk-roll2.autosign"
|
||||
set_policy "csk-roll2" "2" "3600"
|
||||
set_server "ns3" "10.53.0.3"
|
||||
# The old CSK (KEY1) could have been purged, but purge-keys is disabled.
|
||||
|
||||
# Various signing policy checks.
|
||||
check_keys
|
||||
check_dnssecstatus "$SERVER" "$POLICY" "$ZONE"
|
||||
check_apex
|
||||
check_subdomain
|
||||
dnssec_verify
|
||||
|
||||
#
|
||||
# Test #2375: Scheduled rollovers are happening faster than they can finish
|
||||
#
|
||||
|
||||
@@ -4881,6 +4881,15 @@ The following options can be specified in a ``dnssec-policy`` statement:
|
||||
bits. If it is omitted, as shown in the example for the second and
|
||||
third keys, an appropriate default size for the algorithm is used.
|
||||
|
||||
``purge-keys``
|
||||
This is the time after when DNSSEC keys that have been deleted from
|
||||
the zone can be removed from disk. If a key still determined to have
|
||||
presence (for example in some resolver cache), ``named`` will not
|
||||
remove the key files.
|
||||
|
||||
The default is ``P90D`` (90 days). Set this option to ``0`` to never
|
||||
purge deleted keys.
|
||||
|
||||
``publish-safety``
|
||||
This is a margin that is added to the pre-publication interval in
|
||||
rollover timing calculations, to give some extra time to cover
|
||||
|
||||
@@ -135,7 +135,7 @@ dnssec-policy "nsec3" {
|
||||
publish-safety PT3600S;
|
||||
retire-safety PT3600S;
|
||||
share-keys no;
|
||||
purge-keys-after P14D;
|
||||
purge-keys P90D;
|
||||
|
||||
keys {
|
||||
ksk key-directory P5Y ECDSAP256SHA256;
|
||||
|
||||
@@ -753,9 +753,10 @@ keys. The following is an example of such a clause:
|
||||
|
||||
The policy has multiple parts:
|
||||
|
||||
- The name must be specified. As each zone can use a different policy, ``named`` needs to
|
||||
be able to distinguish between policies. This is done by giving each
|
||||
policy a name, such as ``standard`` in the above example.
|
||||
- The name must be specified. As each zone can use a different policy,
|
||||
``named`` needs to be able to distinguish between policies. This is
|
||||
done by giving each policy a name, such as ``standard`` in the above
|
||||
example.
|
||||
|
||||
- The ``keys`` clause lists all keys that should be in the zone, along
|
||||
with their associated parameters. In this example, we are using the
|
||||
@@ -782,7 +783,7 @@ The policy has multiple parts:
|
||||
long the signatures on the DNSKEY and non-DNSKEY records are valid,
|
||||
and how often BIND should re-sign the zone.
|
||||
|
||||
- Finally, the parameters ending in ``-safety`` are there to give
|
||||
- The parameters ending in ``-safety`` are there to give
|
||||
you a bit of leeway in case a key roll doesn't go to plan. When
|
||||
introduced into the zone, the ``publish-safety`` time is the amount
|
||||
of additional time, over and above that calculated from the other
|
||||
@@ -792,6 +793,11 @@ The policy has multiple parts:
|
||||
other parameters, during which the old key is retained in the zone before
|
||||
being removed.
|
||||
|
||||
- Finally, the ``purge-keys`` option allows you to clean up key files
|
||||
automatically after a period of time. If a key has been removed from the
|
||||
zone, this option will determine how long its key files will be retained
|
||||
on disk.
|
||||
|
||||
(You do not have to specify all the items listed above in your policy
|
||||
definition. Any that are not set simply take the default value.)
|
||||
|
||||
|
||||
@@ -110,6 +110,7 @@ dnssec\-policy string {
|
||||
parent\-ds\-ttl duration;
|
||||
parent\-propagation\-delay duration;
|
||||
publish\-safety duration;
|
||||
purge\-keys duration;
|
||||
retire\-safety duration;
|
||||
signatures\-refresh duration;
|
||||
signatures\-validity duration;
|
||||
|
||||
@@ -8,6 +8,7 @@ dnssec-policy "default" {
|
||||
dnskey-ttl 3600;
|
||||
publish-safety 1h;
|
||||
retire-safety 1h;
|
||||
purge-keys P90D;
|
||||
|
||||
// Signature timings
|
||||
signatures-refresh 5d;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
parent-ds-ttl <duration>;
|
||||
parent-propagation-delay <duration>;
|
||||
publish-safety <duration>;
|
||||
purge-keys <duration>;
|
||||
retire-safety <duration>;
|
||||
signatures-refresh <duration>;
|
||||
signatures-validity <duration>;
|
||||
|
||||
@@ -32,6 +32,7 @@ dnssec-policy <string> {
|
||||
parent-propagation-delay <duration>;
|
||||
parent-registration-delay <duration>; // obsolete
|
||||
publish-safety <duration>;
|
||||
purge-keys <duration>;
|
||||
retire-safety <duration>;
|
||||
signatures-refresh <duration>;
|
||||
signatures-validity <duration>;
|
||||
|
||||
@@ -31,6 +31,7 @@ dnssec-policy <string> {
|
||||
parent-ds-ttl <duration>;
|
||||
parent-propagation-delay <duration>;
|
||||
publish-safety <duration>;
|
||||
purge-keys <duration>;
|
||||
retire-safety <duration>;
|
||||
signatures-refresh <duration>;
|
||||
signatures-validity <duration>;
|
||||
|
||||
@@ -31,6 +31,11 @@ New Features
|
||||
this case, ``named`` attempts to answer DNS requests with stale data,
|
||||
but does not start the ``stale-refresh-time`` window. [GL #2434]
|
||||
|
||||
- A new option, ``purge-keys``, has been added to ``dnssec-policy``. It sets
|
||||
the time how long key files should be retained after they have become
|
||||
obsolete (due to a key rollover). Default is 90 days, and the feature can
|
||||
be disabled by setting it to 0. [GL #2408]
|
||||
|
||||
Removed Features
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
@@ -1290,6 +1290,7 @@ dns_dnsseckey_create(isc_mem_t *mctx, dst_key_t **dstkey,
|
||||
dk->hint_remove = false;
|
||||
dk->first_sign = false;
|
||||
dk->is_active = false;
|
||||
dk->purge = false;
|
||||
dk->prepublish = 0;
|
||||
dk->source = dns_keysource_unknown;
|
||||
dk->index = 0;
|
||||
|
||||
@@ -59,6 +59,7 @@ struct dns_dnsseckey {
|
||||
bool hint_remove; /*% metadata says *don't* publish */
|
||||
bool is_active; /*% key is already active */
|
||||
bool first_sign; /*% key is newly becoming active */
|
||||
bool purge; /*% remove key files */
|
||||
unsigned int prepublish; /*% how long until active? */
|
||||
dns_keysource_t source; /*% how the key was found */
|
||||
bool ksk; /*% this is a key-signing key */
|
||||
|
||||
@@ -89,6 +89,7 @@ struct dns_kasp {
|
||||
/* Configuration: Timings */
|
||||
uint32_t publish_safety;
|
||||
uint32_t retire_safety;
|
||||
uint32_t purge_keys;
|
||||
|
||||
/* Zone settings */
|
||||
dns_ttl_t zone_max_ttl;
|
||||
@@ -109,6 +110,7 @@ struct dns_kasp {
|
||||
#define DNS_KASP_KEY_TTL (3600)
|
||||
#define DNS_KASP_DS_TTL (86400)
|
||||
#define DNS_KASP_PUBLISH_SAFETY (3600)
|
||||
#define DNS_KASP_PURGE_KEYS (86400 * 90)
|
||||
#define DNS_KASP_RETIRE_SAFETY (3600)
|
||||
#define DNS_KASP_ZONE_MAXTTL (86400)
|
||||
#define DNS_KASP_ZONE_PROPDELAY (300)
|
||||
@@ -306,6 +308,30 @@ dns_kasp_setdnskeyttl(dns_kasp_t *kasp, dns_ttl_t ttl);
|
||||
*\li 'kasp' is a valid, thawed kasp.
|
||||
*/
|
||||
|
||||
uint32_t
|
||||
dns_kasp_purgekeys(dns_kasp_t *kasp);
|
||||
/*%<
|
||||
* Get purge keys interval.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li 'kasp' is a valid, frozen kasp.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
*\li Purge keys interval.
|
||||
*/
|
||||
|
||||
void
|
||||
dns_kasp_setpurgekeys(dns_kasp_t *kasp, uint32_t value);
|
||||
/*%<
|
||||
* Set purge keys interval.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
*\li 'kasp' is a valid, thawed kasp.
|
||||
*/
|
||||
|
||||
uint32_t
|
||||
dns_kasp_publishsafety(dns_kasp_t *kasp);
|
||||
/*%<
|
||||
|
||||
@@ -53,6 +53,7 @@ dns_kasp_create(isc_mem_t *mctx, const char *name, dns_kasp_t **kaspp) {
|
||||
kasp->dnskey_ttl = DNS_KASP_KEY_TTL;
|
||||
kasp->publish_safety = DNS_KASP_PUBLISH_SAFETY;
|
||||
kasp->retire_safety = DNS_KASP_RETIRE_SAFETY;
|
||||
kasp->purge_keys = DNS_KASP_PURGE_KEYS;
|
||||
|
||||
kasp->zone_max_ttl = DNS_KASP_ZONE_MAXTTL;
|
||||
kasp->zone_propagation_delay = DNS_KASP_ZONE_PROPDELAY;
|
||||
@@ -203,6 +204,22 @@ dns_kasp_setdnskeyttl(dns_kasp_t *kasp, dns_ttl_t ttl) {
|
||||
kasp->dnskey_ttl = ttl;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
dns_kasp_purgekeys(dns_kasp_t *kasp) {
|
||||
REQUIRE(DNS_KASP_VALID(kasp));
|
||||
REQUIRE(kasp->frozen);
|
||||
|
||||
return (kasp->purge_keys);
|
||||
}
|
||||
|
||||
void
|
||||
dns_kasp_setpurgekeys(dns_kasp_t *kasp, uint32_t value) {
|
||||
REQUIRE(DNS_KASP_VALID(kasp));
|
||||
REQUIRE(!kasp->frozen);
|
||||
|
||||
kasp->purge_keys = value;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
dns_kasp_publishsafety(dns_kasp_t *kasp) {
|
||||
REQUIRE(DNS_KASP_VALID(kasp));
|
||||
|
||||
+114
-2
@@ -14,6 +14,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/dir.h>
|
||||
@@ -1823,6 +1824,94 @@ keymgr_key_rollover(dns_kasp_key_t *kaspkey, dns_dnsseckey_t *active_key,
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static bool
|
||||
keymgr_key_may_be_purged(dst_key_t *key, uint32_t after, isc_stdtime_t now) {
|
||||
bool ksk = false;
|
||||
bool zsk = false;
|
||||
dst_key_state_t hidden[NUM_KEYSTATES] = { HIDDEN, NA, NA, NA };
|
||||
isc_stdtime_t lastchange = 0;
|
||||
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
dst_key_format(key, keystr, sizeof(keystr));
|
||||
|
||||
/* If 'purge-keys' is disabled, always retain keys. */
|
||||
if (after == 0) {
|
||||
return (false);
|
||||
}
|
||||
|
||||
/* Don't purge keys with goal OMNIPRESENT */
|
||||
if (dst_key_goal(key) == OMNIPRESENT) {
|
||||
return (false);
|
||||
}
|
||||
|
||||
/* Don't purge unused keys. */
|
||||
if (dst_key_is_unused(key)) {
|
||||
return (false);
|
||||
}
|
||||
|
||||
/* If this key is completely HIDDEN it may be purged. */
|
||||
(void)dst_key_getbool(key, DST_BOOL_KSK, &ksk);
|
||||
(void)dst_key_getbool(key, DST_BOOL_ZSK, &zsk);
|
||||
if (ksk) {
|
||||
hidden[DST_KEY_KRRSIG] = HIDDEN;
|
||||
hidden[DST_KEY_DS] = HIDDEN;
|
||||
}
|
||||
if (zsk) {
|
||||
hidden[DST_KEY_ZRRSIG] = HIDDEN;
|
||||
}
|
||||
if (!keymgr_key_match_state(key, key, 0, NA, hidden)) {
|
||||
return (false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check 'purge-keys' interval. If the interval has passed since
|
||||
* the last key change, it may be purged.
|
||||
*/
|
||||
for (int i = 0; i < NUM_KEYSTATES; i++) {
|
||||
isc_stdtime_t change = 0;
|
||||
(void)dst_key_gettime(key, keystatetimes[i], &change);
|
||||
if (change > lastchange) {
|
||||
lastchange = change;
|
||||
}
|
||||
}
|
||||
|
||||
return ((lastchange + after) < now);
|
||||
}
|
||||
|
||||
static void
|
||||
keymgr_purge_keyfile(dst_key_t *key, const char *dir, int type) {
|
||||
isc_result_t ret;
|
||||
isc_buffer_t fileb;
|
||||
char filename[NAME_MAX];
|
||||
|
||||
/*
|
||||
* Make the filename.
|
||||
*/
|
||||
isc_buffer_init(&fileb, filename, sizeof(filename));
|
||||
ret = dst_key_buildfilename(key, type, dir, &fileb);
|
||||
if (ret != ISC_R_SUCCESS) {
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
dst_key_format(key, keystr, sizeof(keystr));
|
||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DNSSEC,
|
||||
DNS_LOGMODULE_DNSSEC, ISC_LOG_WARNING,
|
||||
"keymgr: failed to purge DNSKEY %s (%s): cannot "
|
||||
"build filename (%s)",
|
||||
keystr, keymgr_keyrole(key),
|
||||
isc_result_totext(ret));
|
||||
return;
|
||||
}
|
||||
|
||||
if (unlink(filename) < 0) {
|
||||
char keystr[DST_KEY_FORMATSIZE];
|
||||
dst_key_format(key, keystr, sizeof(keystr));
|
||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DNSSEC,
|
||||
DNS_LOGMODULE_DNSSEC, ISC_LOG_WARNING,
|
||||
"keymgr: failed to purge DNSKEY %s (%s): unlink "
|
||||
"'%s' failed",
|
||||
keystr, keymgr_keyrole(key), filename);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Examine 'keys' and match 'kasp' policy.
|
||||
*
|
||||
@@ -1901,6 +1990,27 @@ dns_keymgr_run(const dns_name_t *origin, dns_rdataclass_t rdclass,
|
||||
if (!found_match) {
|
||||
keymgr_key_retire(dkey, kasp, now);
|
||||
}
|
||||
|
||||
/* Check purge-keys interval. */
|
||||
if (keymgr_key_may_be_purged(dkey->key,
|
||||
dns_kasp_purgekeys(kasp), now)) {
|
||||
dst_key_format(dkey->key, keystr, sizeof(keystr));
|
||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DNSSEC,
|
||||
DNS_LOGMODULE_DNSSEC, ISC_LOG_INFO,
|
||||
"keymgr: purge DNSKEY %s (%s) according "
|
||||
"to policy %s",
|
||||
keystr, keymgr_keyrole(dkey->key),
|
||||
dns_kasp_getname(kasp));
|
||||
|
||||
keymgr_purge_keyfile(dkey->key, directory,
|
||||
DST_TYPE_PUBLIC);
|
||||
keymgr_purge_keyfile(dkey->key, directory,
|
||||
DST_TYPE_PRIVATE);
|
||||
keymgr_purge_keyfile(dkey->key, directory,
|
||||
DST_TYPE_STATE);
|
||||
|
||||
dkey->purge = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Create keys according to the policy, if come in short. */
|
||||
@@ -1993,8 +2103,10 @@ dns_keymgr_run(const dns_name_t *origin, dns_rdataclass_t rdclass,
|
||||
for (dns_dnsseckey_t *dkey = ISC_LIST_HEAD(*keyring); dkey != NULL;
|
||||
dkey = ISC_LIST_NEXT(dkey, link))
|
||||
{
|
||||
dns_dnssec_get_hints(dkey, now);
|
||||
RETERR(dst_key_tofile(dkey->key, options, directory));
|
||||
if (!dkey->purge) {
|
||||
dns_dnssec_get_hints(dkey, now);
|
||||
RETERR(dst_key_tofile(dkey->key, options, directory));
|
||||
}
|
||||
}
|
||||
|
||||
result = ISC_R_SUCCESS;
|
||||
|
||||
@@ -456,6 +456,7 @@ dns_kasp_nsec3iter
|
||||
dns_kasp_nsec3saltlen
|
||||
dns_kasp_parentpropagationdelay
|
||||
dns_kasp_publishsafety
|
||||
dns_kasp_purgekeys
|
||||
dns_kasp_retiresafety
|
||||
dns_kasp_setdnskeyttl
|
||||
dns_kasp_setdsttl
|
||||
@@ -463,6 +464,7 @@ dns_kasp_setnsec3
|
||||
dns_kasp_setnsec3param
|
||||
dns_kasp_setparentpropagationdelay
|
||||
dns_kasp_setpublishsafety
|
||||
dns_kasp_setpurgekeys
|
||||
dns_kasp_setretiresafety
|
||||
dns_kasp_setsigrefresh
|
||||
dns_kasp_setsigvalidity
|
||||
|
||||
@@ -315,6 +315,8 @@ cfg_kasp_fromconfig(const cfg_obj_t *config, const char *name, isc_mem_t *mctx,
|
||||
DNS_KASP_PUBLISH_SAFETY));
|
||||
dns_kasp_setretiresafety(kasp, get_duration(maps, "retire-safety",
|
||||
DNS_KASP_RETIRE_SAFETY));
|
||||
dns_kasp_setpurgekeys(
|
||||
kasp, get_duration(maps, "purge-keys", DNS_KASP_PURGE_KEYS));
|
||||
|
||||
(void)confget(maps, "keys", &keys);
|
||||
if (keys != NULL) {
|
||||
|
||||
@@ -2154,6 +2154,7 @@ static cfg_clausedef_t dnssecpolicy_clauses[] = {
|
||||
{ "parent-registration-delay", &cfg_type_duration,
|
||||
CFG_CLAUSEFLAG_OBSOLETE },
|
||||
{ "publish-safety", &cfg_type_duration, 0 },
|
||||
{ "purge-keys", &cfg_type_duration, 0 },
|
||||
{ "retire-safety", &cfg_type_duration, 0 },
|
||||
{ "signatures-refresh", &cfg_type_duration, 0 },
|
||||
{ "signatures-validity", &cfg_type_duration, 0 },
|
||||
|
||||
Reference in New Issue
Block a user