Adding test

This commit is contained in:
Petr Sklenar 2022-01-04 19:55:24 +01:00
commit 1d4563e817
6 changed files with 231 additions and 0 deletions

View file

@ -0,0 +1,65 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/bind/Regression/bz1769876-BIND-stops-DNSKEY-lookup-in-get-dst-key
# Description: Test for BZ#1769876 (BIND stops DNSKEY lookup in get_dst_key() when a)
# Author: Petr Mensik <pemensik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/bind/Regression/bz1769876-BIND-stops-DNSKEY-lookup-in-get-dst-key
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE fakeroot.db bad.db
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Petr Mensik <pemensik@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for BZ#1769876 (BIND stops DNSKEY lookup in get_dst_key() when a)" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: bind" >> $(METADATA)
@echo "Requires: bind bind-utils" >> $(METADATA)
@echo "RhtsRequires: library(bind/bind-utils)" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 1769876" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,5 @@
PURPOSE of /CoreOS/bind/Regression/bz1769876-BIND-stops-DNSKEY-lookup-in-get-dst-key
Description: Test for BZ#1769876 (BIND stops DNSKEY lookup in get_dst_key() when a)
Author: Petr Mensik <pemensik@redhat.com>
Bug summary: BIND stops DNSKEY lookup in get_dst_key() when a key with unsupported algorithm is found first
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1769876

View file

@ -0,0 +1,12 @@
$TTL 600
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS ns.fakeroot.
h1 A 127.0.0.1
h2 A 127.0.0.2

View file

@ -0,0 +1,13 @@
$TTL 600
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS ns.fakeroot
bad NS ns.fakeroot
bad3 NS ns.fakeroot
localhost. A 127.0.0.1
AAAA ::1
ns.fakeroot A 127.0.0.1

View file

@ -0,0 +1,19 @@
summary: Test for BZ#1769876 (BIND stops DNSKEY lookup in get_dst_key() when a)
description: |
Bug summary: BIND stops DNSKEY lookup in get_dst_key() when a key with unsupported algorithm is found first
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1769876
contact: Petr Mensik <pemensik@redhat.com>
component:
- bind
test: ./runtest.sh
framework: beakerlib
require:
- library(bind/bind-utils)
recommend:
- bind
- bind-utils
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1769876
extra-summary: /CoreOS/bind/Regression/bz1769876-BIND-stops-DNSKEY-lookup-in-get-dst-key
extra-task: /CoreOS/bind/Regression/bz1769876-BIND-stops-DNSKEY-lookup-in-get-dst-key

View file

@ -0,0 +1,117 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/bind/Regression/bz1769876-BIND-stops-DNSKEY-lookup-in-get-dst-key
# Description: Test for BZ#1769876 (BIND stops DNSKEY lookup in get_dst_key() when a)
# Author: Petr Mensik <pemensik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="bind"
PHASE=${PHASE:-Test}
rlJournalStart
rlPhaseStartSetup "Configuring common part"
rlImport "bind/bind-utils"
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "rlServiceStart rngd"
rlFileBackup /etc/named.conf /var/named
rlRun "cp fakeroot.db bad.db /var/named"
rlRun "pushd $TmpDir"
rlPhaseEnd
if [[ "$PHASE" =~ "Test" ]]; then
rlPhaseStartSetup "Creating local server"
rlRun "sed -e 's/\(listen-on.*\){.*}/\1{ any; }/' -e 's/\(allow-query *\){ localhost; }/\1{ any; }/' -i /etc/named.conf"
cat >> /etc/named.conf << CONF
zone "." IN {
type master;
file "fakeroot.db.signed";
};
zone "bad" IN {
type master;
file "bad.db.signed";
};
zone "bad3" IN {
type master;
file "bad3.db.signed";
};
# Include generated trust anchor
include "root.conf";
CONF
rlPhaseEnd
rlPhaseStartTest "Testing local server"
rlRun "pushd /var/named"
rlRun "cp bad.db bad3.db"
rlRun "bad_KSK=$(dnssec-keygen -f KSK -a RSASHA512 -b 2048 bad)"
rlRun "bad_ZSK=$(dnssec-keygen -a ECDSAP256SHA256 -n ZONE -b 2048 bad)"
rlRun "echo '\$INCLUDE $bad_KSK.key' >> bad.db"
rlRun "echo '\$INCLUDE $bad_ZSK.key' >> bad.db"
rlRun "dnssec-signzone -A -k $bad_KSK -z -N INCREMENT -o bad -t bad.db"
rlRun "bad3_KSK=$(dnssec-keygen -f KSK -a RSASHA512 -b 2048 bad3)"
rlRun "bad3_ZSK=$(dnssec-keygen -a ECDSAP256SHA256 -n ZONE -b 2048 bad3)"
rlRun "echo '\$INCLUDE $bad3_KSK.key' >> bad3.db"
rlRun "echo '\$INCLUDE $bad3_ZSK.key' >> bad3.db"
rlRun "dnssec-signzone -A -k $bad3_KSK -z -3 9911c319070e83f8 -N INCREMENT -o bad3 -t bad3.db"
rlRun "buZoneGenerateSign -o . -f fakeroot.db -A root" 0 "Generate signed root"
rlRun "rlServiceStart named"
rlRun -s "dig +dnssec +multi @localhost h1.bad."
rlAssertGrep 'status: NOERROR' "$rlRun_LOG"
if [ -x /usr/bin/delv ]; then
rlRun -s "delv @::1 -a root.conf h1.bad."
rlAssertGrep 'fully validated' "$rlRun_LOG"
rlRun -s "delv @::1 -a root.conf h1.bad3."
rlAssertGrep 'fully validated' "$rlRun_LOG"
fi
rlPhaseEnd
fi
if [[ "$PHASE" =~ "Client" ]]; then
rlPhaseStartSetup "Creating local server"
rlRun "test -n \"$MASTER\""
rlRun "buFetchManagedKeys . $MASTER > /etc/named/root.conf"
rlRun "echo 'include \"/etc/named/root.conf\";' >> /etc/named.conf"
# FIXME: create forwarding somehow!
rlPhaseEnd
fi
rlPhaseStartCleanup
[ "$DEBUGTEST" = y ] && PS1="Interrupted test $PS1" bash -i
rm -f $rlRun_LOG
rlRun "rm -f {Kbad.,Kbad3.,K.}+* {bad,bad3}.db"
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlFileRestore
rlRun "rlServiceRestore named"
rlRun "rlServiceRestore rngd"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd