mkeys_refresh_on 2
mkeys_status_on 2 > rndc.out.$n 2>&1
# there should be two keys listed now
-count=`grep -c "keyid: " rndc.out.$n`
+count=`grep -c "keyid: " rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
# two lines indicating trust status
-count=`grep -c "trust" rndc.out.$n`
+count=`grep -c "trust" rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
# one indicates current trust
-count=`grep -c "trusted since" rndc.out.$n`
+count=`grep -c "trusted since" rndc.out.$n`
[ "$count" -eq 1 ] || ret=1
# one indicates pending trust
count=`grep -c "trust pending" rndc.out.$n`
mkeys_refresh_on 3
mkeys_status_on 3 > rndc.out.$n 2>&1
# there should be one key listed now
-count=`grep -c "keyid: " rndc.out.$n`
+count=`grep -c "keyid: " rndc.out.$n`
[ "$count" -eq 1 ] || ret=1
# one line indicating trust status
-count=`grep -c "trust" rndc.out.$n`
+count=`grep -c "trust" rndc.out.$n`
[ "$count" -eq 1 ] || ret=1
# ... and the key is not trusted
count=`grep -c "no trust" rndc.out.$n`
mkeys_sync_on 2
mkeys_status_on 2 > rndc.out.$n 2>&1
# two keys listed
-count=`grep -c "keyid: " rndc.out.$n`
+count=`grep -c "keyid: " rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
# two lines indicating trust status
-count=`grep -c "trust" rndc.out.$n`
+count=`grep -c "trust" rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
# trust is revoked
count=`grep -c "trust revoked" rndc.out.$n`
mkeys_sync_on 2
mkeys_status_on 2 > rndc.out.$n 2>&1
# two keys listed
-count=`grep -c "keyid: " rndc.out.$n`
+count=`grep -c "keyid: " rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
# two lines indicating trust status
-count=`grep -c "trust" rndc.out.$n`
+count=`grep -c "trust" rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
# trust is revoked
count=`grep -c "trust revoked" rndc.out.$n`
mkeys_sync_on 2
mkeys_status_on 2 > rndc.out.$n 2>&1
# two keys listed
-count=`grep -c "keyid: " rndc.out.$n`
+count=`grep -c "keyid: " rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
# two lines indicating trust status
-count=`grep -c "trust" rndc.out.$n`
+count=`grep -c "trust" rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
# trust is revoked
count=`grep -c "trust revoked" rndc.out.$n`
rm -f ns2/managed-keys.bind*
keyfile_to_managed_keys ns1/$original ns1/$standby1 > ns2/managed.conf
nextpart ns2/named.run > /dev/null
-$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns2
+$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mkeys ns2
n=`expr $n + 1`
echo_i "check that no key from bind.keys is marked as an initializing key ($n)"
rm -f ns2/managed-keys.bind*
mv ns2/managed1.conf ns2/managed.conf
nextpart ns2/named.run > /dev/null
-$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns2
+$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mkeys ns2
n=`expr $n + 1`
echo_i "check that standby key is now trusted ($n)"
wait_for_log "Returned from key fetch in keyfetch_done()" ns2/named.run
mkeys_status_on 2 > rndc.out.$n 2>&1
# two keys listed
-count=`grep -c "keyid: " rndc.out.$n`
+count=`grep -c "keyid: " rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
# two lines indicating trust status
-count=`grep -c "trust" rndc.out.$n`
+count=`grep -c "trust" rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
# both indicate current trust
-count=`grep -c "trusted since" rndc.out.$n`
+count=`grep -c "trusted since" rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
mkeys_refresh_on 2
mkeys_status_on 2 > rndc.out.$n 2>&1
# three keys listed
-count=`grep -c "keyid: " rndc.out.$n`
+count=`grep -c "keyid: " rndc.out.$n`
[ "$count" -eq 3 ] || ret=1
# one is revoked
-count=`grep -c "REVOKE" rndc.out.$n`
+count=`grep -c "REVOKE" rndc.out.$n`
[ "$count" -eq 1 ] || ret=1
# three lines indicating trust status
-count=`grep -c "trust" rndc.out.$n`
+count=`grep -c "trust" rndc.out.$n`
[ "$count" -eq 3 ] || ret=1
# one indicates current trust
-count=`grep -c "trusted since" rndc.out.$n`
+count=`grep -c "trusted since" rndc.out.$n`
[ "$count" -eq 1 ] || ret=1
# one indicates revoked trust
-count=`grep -c "trust revoked" rndc.out.$n`
+count=`grep -c "trust revoked" rndc.out.$n`
[ "$count" -eq 1 ] || ret=1
# one indicates trust pending
-count=`grep -c "trust pending" rndc.out.$n`
+count=`grep -c "trust pending" rndc.out.$n`
[ "$count" -eq 1 ] || ret=1
# removal scheduled
count=`grep -c "remove at" rndc.out.$n`
mkeys_refresh_on 2
mkeys_status_on 2 > rndc.out.a.$n 2>&1
# four keys listed
-count=`grep -c "keyid: " rndc.out.a.$n`
+count=`grep -c "keyid: " rndc.out.a.$n`
[ "$count" -eq 4 ] || { echo "keyid: count ($count) != 4"; ret=1; }
# one revoked
-count=`grep -c "trust revoked" rndc.out.a.$n`
+count=`grep -c "trust revoked" rndc.out.a.$n`
[ "$count" -eq 1 ] || { echo "trust revoked count ($count) != 1"; ret=1; }
# two pending
-count=`grep -c "trust pending" rndc.out.a.$n`
+count=`grep -c "trust pending" rndc.out.a.$n`
[ "$count" -eq 2 ] || { echo "trust pending count ($count) != 2"; ret=1; }
$SETTIME -R now -K ns1 $standby3 > /dev/null
mkeys_loadkeys_on 1
mkeys_refresh_on 2
mkeys_status_on 2 > rndc.out.b.$n 2>&1
# now three keys listed
-count=`grep -c "keyid: " rndc.out.b.$n`
+count=`grep -c "keyid: " rndc.out.b.$n`
[ "$count" -eq 3 ] || { echo "keyid: count ($count) != 3"; ret=1; }
# one revoked
-count=`grep -c "trust revoked" rndc.out.b.$n`
+count=`grep -c "trust revoked" rndc.out.b.$n`
[ "$count" -eq 1 ] || { echo "trust revoked count ($count) != 1"; ret=1; }
# one pending
-count=`grep -c "trust pending" rndc.out.b.$n`
+count=`grep -c "trust pending" rndc.out.b.$n`
[ "$count" -eq 1 ] || { echo "trust pending count ($count) != 1"; ret=1; }
$SETTIME -D now -K ns1 $standby3 > /dev/null
mkeys_loadkeys_on 1
mkeys_refresh_on 2
mkeys_status_on 2 > rndc.out.$n 2>&1
# two keys listed
-count=`grep -c "keyid: " rndc.out.$n`
+count=`grep -c "keyid: " rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
# none revoked
-count=`grep -c "REVOKE" rndc.out.$n`
+count=`grep -c "REVOKE" rndc.out.$n`
[ "$count" -eq 0 ] || ret=1
# two lines indicating trust status
-count=`grep -c "trust" rndc.out.$n`
+count=`grep -c "trust" rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
# both indicate current trust
-count=`grep -c "trusted since" rndc.out.$n`
+count=`grep -c "trusted since" rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
mkeys_refresh_on 2
mkeys_status_on 2 > rndc.out.$n 2>&1
# two keys listed
-count=`grep -c "keyid: " rndc.out.$n`
+count=`grep -c "keyid: " rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
# both revoked
-count=`grep -c "REVOKE" rndc.out.$n`
+count=`grep -c "REVOKE" rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
# two lines indicating trust status
-count=`grep -c "trust" rndc.out.$n`
+count=`grep -c "trust" rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
# both indicate trust revoked
-count=`grep -c "trust revoked" rndc.out.$n`
+count=`grep -c "trust revoked" rndc.out.$n`
[ "$count" -eq 2 ] || ret=1
# both have removal scheduled
count=`grep -c "remove at" rndc.out.$n`
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} . ns2
rm -f ns2/managed-keys.bind*
nextpart ns2/named.run > /dev/null
-$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns2
+$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mkeys ns2
n=`expr $n + 1`
echo_i "check positive validation ($n)"
mkeys_refresh_on 2
mkeys_status_on 2 > rndc.out.$n 2>&1
# one key listed
-count=`grep -c "keyid: " rndc.out.$n`
+count=`grep -c "keyid: " rndc.out.$n`
[ "$count" -eq 1 ] || { echo "'keyid:' count ($count) != 1"; ret=1; }
# it's the original key id
-count=`grep -c "keyid: $originalid" rndc.out.$n`
+count=`grep -c "keyid: $originalid" rndc.out.$n`
[ "$count" -eq 1 ] || { echo "'keyid: $originalid' count ($count) != 1"; ret=1; }
# not revoked
-count=`grep -c "REVOKE" rndc.out.$n`
+count=`grep -c "REVOKE" rndc.out.$n`
[ "$count" -eq 0 ] || { echo "'REVOKE' count ($count) != 0"; ret=1; }
# trust is still current
-count=`grep -c "trust" rndc.out.$n`
+count=`grep -c "trust" rndc.out.$n`
[ "$count" -eq 1 ] || { echo "'trust' count != 1"; ret=1; }
-count=`grep -c "trusted since" rndc.out.$n`
+count=`grep -c "trusted since" rndc.out.$n`
[ "$count" -eq 1 ] || { echo "'trusted since' count != 1"; ret=1; }
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
rm -f ns1/root.db.signed.jnl
cp ns1/root.db ns1/root.db.signed
nextpart ns1/named.run > /dev/null
-$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns1
+$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mkeys ns1
wait_for_log "loaded serial" ns1/named.run
mkeys_refresh_on 2
mkeys_status_on 2 > rndc.out.$n 2>&1
# one key listed
-count=`grep -c "keyid: " rndc.out.$n`
+count=`grep -c "keyid: " rndc.out.$n`
[ "$count" -eq 1 ] || ret=1
# it's the original key id
-count=`grep -c "keyid: $originalid" rndc.out.$n`
+count=`grep -c "keyid: $originalid" rndc.out.$n`
[ "$count" -eq 1 ] || ret=1
# not revoked
-count=`grep -c "REVOKE" rndc.out.$n`
+count=`grep -c "REVOKE" rndc.out.$n`
[ "$count" -eq 0 ] || ret=1
# trust is still current
-count=`grep -c "trust" rndc.out.$n`
+count=`grep -c "trust" rndc.out.$n`
[ "$count" -eq 1 ] || ret=1
-count=`grep -c "trusted since" rndc.out.$n`
+count=`grep -c "trusted since" rndc.out.$n`
[ "$count" -eq 1 ] || ret=1
t2=`grep 'next refresh:' rndc.out.$n`
[ "$t1" = "$t2" ] && ret=1
rm -f ns1/root.db.signed.jnl
cat ns1/K*.key >> ns1/root.db.signed
nextpart ns1/named.run > /dev/null
-$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns1
+$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mkeys ns1
wait_for_log "loaded serial" ns1/named.run
# Less than a second may have passed since the last time ns2 received a
# ./DNSKEY response from ns1. Ensure keys are refreshed at a different
mkeys_refresh_on 2
mkeys_status_on 2 > rndc.out.$n 2>&1
# one key listed
-count=`grep -c "keyid: " rndc.out.$n`
+count=`grep -c "keyid: " rndc.out.$n`
[ "$count" -eq 1 ] || ret=1
# it's the original key id
-count=`grep -c "keyid: $originalid" rndc.out.$n`
+count=`grep -c "keyid: $originalid" rndc.out.$n`
[ "$count" -eq 1 ] || ret=1
# not revoked
-count=`grep -c "REVOKE" rndc.out.$n`
+count=`grep -c "REVOKE" rndc.out.$n`
[ "$count" -eq 0 ] || ret=1
# trust is still current
-count=`grep -c "trust" rndc.out.$n`
+count=`grep -c "trust" rndc.out.$n`
[ "$count" -eq 1 ] || ret=1
-count=`grep -c "trusted since" rndc.out.$n`
+count=`grep -c "trusted since" rndc.out.$n`
[ "$count" -eq 1 ] || ret=1
t2=`grep 'next refresh:' rndc.out.$n`
[ "$t1" = "$t2" ] && ret=1
# between the next scheduled key refresh time and startup time of restarted ns5.
$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} . ns5
nextpart ns5/named.run > /dev/null
-$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns5
+$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mkeys ns5
wait_for_log "Returned from key fetch in keyfetch_done()" ns5/named.run
# ns5/named.run will contain logs from both the old instance and the new
# instance. In order for the test to pass, both must attempt a fetch.
# an "hour" until keys are refreshed again after initial failure
cp ns5/named2.args ns5/named.args
nextpart ns5/named.run > /dev/null
-$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns5
+$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mkeys ns5
wait_for_log "Returned from key fetch in keyfetch_done() for '.': failure" ns5/named.run
mkeys_secroots_on 5
grep '; initializing managed' ns5/named.secroots > /dev/null 2>&1 || ret=1