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

Check synth-from-dnssec XML counters

This commit is contained in:
Mark Andrews
2021-10-29 09:41:31 +11:00
committed by Petr Špaček
parent 98cab76295
commit 6dcea1531d
8 changed files with 90 additions and 0 deletions

View File

@@ -39,3 +39,4 @@ rm -f ./wild.out ./insecure.wild.out
rm -f ./wildcname.out ./insecure.wildcname.out
rm -f ./minimal.nxdomain.out
rm -f ./black.out
rm -f ./xml.out*

View File

@@ -33,6 +33,10 @@ controls {
inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
};
statistics-channels {
inet 10.53.0.1 port @EXTRAPORT1@ allow { any; };
};
zone "." {
type primary;
file "root.db.signed";

View File

@@ -33,6 +33,10 @@ controls {
inet 10.53.0.2 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
};
statistics-channels {
inet 10.53.0.2 port @EXTRAPORT1@ allow { any; };
};
zone "." {
type hint;
file "root.hints";

View File

@@ -33,6 +33,10 @@ controls {
inet 10.53.0.3 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
};
statistics-channels {
inet 10.53.0.3 port @EXTRAPORT1@ allow { any; };
};
zone "." {
type hint;
file "root.hints";

View File

@@ -34,6 +34,10 @@ controls {
inet 10.53.0.4 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
};
statistics-channels {
inet 10.53.0.4 port @EXTRAPORT1@ allow { any; };
};
zone "." {
type hint;
file "root.hints";

View File

@@ -34,6 +34,10 @@ controls {
inet 10.53.0.5 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
};
statistics-channels {
inet 10.53.0.5 port @EXTRAPORT1@ allow { any; };
};
zone "." {
type hint;
file "root.hints";

View File

@@ -34,6 +34,10 @@ controls {
inet 10.53.0.6 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
};
statistics-channels {
inet 10.53.0.6 port @EXTRAPORT1@ allow { any; };
};
zone "." {
type hint;
file "root.hints";

View File

@@ -424,6 +424,71 @@ do
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status+ret))
done
if ${FEATURETEST} --have-libxml2 && [ -x "${CURL}" ] ; then
echo_i "getting XML statisistcs for (synth-from-dnssec ${description};) ($n)"
ret=0
xml=xml.out$n
${CURL} http://10.53.0.${ns}:${EXTRAPORT1}/xml/v3/server > $xml 2>/dev/null || ret=1
n=$((n+1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status+ret))
echo_i "check XML for 'CoveringNSEC' with (synth-from-dnssec ${description};) ($n)"
ret=0
counter=$(sed -n 's;.*<view name="_default">.*\(<counter name="CoveringNSEC">[0-9]*</counter>\).*</view><view.*;\1;gp' $xml)
count=$(echo "$counter" | grep CoveringNSEC | wc -l)
test $count = 1 || ret=1
zero=$(echo "$counter" | grep ">0<" | wc -l)
if [ ${synth} = yes ]
then
test $zero = 0 || ret=1
else
test $zero = 1 || ret=1
fi
n=$((n+1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status+ret))
echo_i "check XML for 'CacheNSECNodes' with (synth-from-dnssec ${description};) ($n)"
ret=0
counter=$(sed -n 's;.*<view name="_default">.*\(<counter name="CacheNSECNodes">[0-9]*</counter>\).*</view><view.*;\1;gp' $xml)
count=$(echo "$counter" | grep CacheNSECNodes | wc -l)
test $count = 1 || ret=1
zero=$(echo "$counter" | grep ">0<" | wc -l)
if [ ${ad} = yes ]
then
test $zero = 0 || ret=1
else
test $zero = 1 || ret=1
fi
n=$((n+1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status+ret))
for synthesized in SynthNXDOMAIN SynthNODATA SynthWILDCARD
do
case $synthesized in
SynthNXDOMAIN) count=1;;
SynthNODATA) count=2;;
SynthWILDCARD) count=2;;
esac
echo_i "check XML for '$synthesized}' with (synth-from-dnssec ${description};) ($n)"
ret=0
if [ ${synth} = yes ]
then
grep '<counter name="'$synthesized'">'$count'</counter>' $xml > /dev/null || ret=1
else
grep '<counter name="'$synthesized'">'0'</counter>' $xml > /dev/null || ret=1
fi
n=$((n+1))
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status+ret))
done
else
echo_i "Skipping XML statistics checks"
fi
done
echo_i "check redirect response (+dnssec) (synth-from-dnssec <default>;) ($n)"