tests.sh revision 32148399a2d4476e8246cea601d882b578ad1c82
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews#!/bin/sh
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews#
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews#
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# Permission to use, copy, modify, and/or distribute this software for any
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# purpose with or without fee is hereby granted, provided that the above
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# copyright notice and this permission notice appear in all copies.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews#
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# PERFORMANCE OF THIS SOFTWARE.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# $Id: tests.sh,v 1.4.154.1 2012/01/04 20:05:03 smann Exp $
e4653123ecc6cdbfc0b9eda6e98e44af3b1f9a08Mark Andrews
0c310d16b05ee94743d33f6920907edee6084fc8Michael GraffSYSTEMTESTTOP=..
0c310d16b05ee94743d33f6920907edee6084fc8Michael Graff. $SYSTEMTESTTOP/conf.sh
0c310d16b05ee94743d33f6920907edee6084fc8Michael Graff
0c310d16b05ee94743d33f6920907edee6084fc8Michael GraffDIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd"
2bc0da0cd874b15593d65338ba96e90ceed13072Mark AndrewsDIGCMD="$DIG $DIGOPTS @10.53.0.2 -p 5300"
3761c433912beabe43abeed2c3513b6201c59f64Mark AndrewsRNDCCMD="$RNDC -s 10.53.0.2 -p 9953 -c ../common/rndc.conf"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsstatus=0
0c310d16b05ee94743d33f6920907edee6084fc8Michael Graffn=0
0c310d16b05ee94743d33f6920907edee6084fc8Michael Graff
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsn=`expr $n + 1`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:preparing ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsret=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsserver 10.53.0.2
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewszone nil.
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsupdate add text1.nil. 600 IN TXT "addition 1"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewssend
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewszone other.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsupdate add text1.other. 600 IN TXT "addition 1"
eb6bd543c7d072efdca509eb17f8f301c1467b53Mark Andrewssend
deaaf94332abbfdb3aff53675546acfed16e5eb6Mark AndrewsEND
deaaf94332abbfdb3aff53675546acfed16e5eb6Mark Andrews[ -s ns2/nil.db.jnl ] || ret=1
deaaf94332abbfdb3aff53675546acfed16e5eb6Mark Andrews[ -s ns2/other.db.jnl ] || ret=1
eb6bd543c7d072efdca509eb17f8f301c1467b53Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
deaaf94332abbfdb3aff53675546acfed16e5eb6Mark Andrewsstatus=`expr $status + $ret`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:rndc freeze"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDCCMD freeze | sed 's/^/I:ns2 /'
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsn=`expr $n + 1`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:checking zone was dumped ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsret=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsgrep "addition 1" ns2/nil.db > /dev/null 2>&1 || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsstatus=`expr $status + $ret`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsn=`expr $n + 1`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:checking journal file is still present ($n)"
15330e4fa27c82ac04cc2ce234ec930e4b6b42d3Mark Andrewsret=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews[ -s ns2/nil.db.jnl ] || ret=1
15330e4fa27c82ac04cc2ce234ec930e4b6b42d3Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsstatus=`expr $status + $ret`
15330e4fa27c82ac04cc2ce234ec930e4b6b42d3Mark Andrews
15330e4fa27c82ac04cc2ce234ec930e4b6b42d3Mark Andrewsn=`expr $n + 1`
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrewsecho "I:checking zone not writable ($n)"
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrewsret=0
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END && ret=1
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrewsserver 10.53.0.2
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrewszone nil.
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrewsupdate add text2.nil. 600 IN TXT "addition 2"
8a17d1e7cdba9fdcf71fb2f821a954a251204105Mark Andrewssend
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark AndrewsEND
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrews
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrews$DIGCMD text2.nil. TXT | grep 'addition 2' >/dev/null && ret=1
904294c0c952227f7778fd0ba2ccea08c097b872Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
904294c0c952227f7778fd0ba2ccea08c097b872Mark Andrewsstatus=`expr $status + $ret`
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrews
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrewsecho "I:rndc thaw"
2bc0da0cd874b15593d65338ba96e90ceed13072Mark Andrews$RNDCCMD thaw | sed 's/^/I:ns2 /'
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrews
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrewsn=`expr $n + 1`
3a4ec3da9fa14511cbc3660f75817cfacb3f4d1eMark Andrewsecho "I:checking zone now writable ($n)"
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrewsret=0
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrewsserver 10.53.0.2
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrewszone nil.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsupdate add text3.nil. 600 IN TXT "addition 3"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewssend
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark AndrewsEND
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews$DIGCMD text3.nil. TXT | grep 'addition 3' >/dev/null || ret=1
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsstatus=`expr $status + $ret`
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsecho "I:rndc sync"
fcf8db89e6c5740822838380c3a4ffcfb7754992Mark Andrewsret=0
fcf8db89e6c5740822838380c3a4ffcfb7754992Mark Andrews$RNDCCMD sync nil | sed 's/^/I:ns2 /'
06a49674418e8a74e879b63ea4ce4cb2261bbc70Mark Andrews
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsn=`expr $n + 1`
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsecho "I:checking zone was dumped ($n)"
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsret=0
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsgrep "addition 3" ns2/nil.db > /dev/null 2>&1 || ret=1
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsstatus=`expr $status + $ret`
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsn=`expr $n + 1`
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsecho "I:checking journal file is still present ($n)"
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsret=0
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews[ -s ns2/nil.db.jnl ] || ret=1
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsstatus=`expr $status + $ret`
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsn=`expr $n + 1`
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsecho "I:checking zone is still writable ($n)"
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsret=0
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsserver 10.53.0.2
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewszone nil.
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsupdate add text4.nil. 600 IN TXT "addition 4"
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewssend
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark AndrewsEND
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews$DIGCMD text4.nil. TXT | grep 'addition 4' >/dev/null || ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsstatus=`expr $status + $ret`
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsecho "I:rndc sync -clean"
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsret=0
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews$RNDCCMD sync -clean nil | sed 's/^/I:ns2 /'
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsn=`expr $n + 1`
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsecho "I:checking zone was dumped ($n)"
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsret=0
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsgrep "addition 4" ns2/nil.db > /dev/null 2>&1 || ret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsstatus=`expr $status + $ret`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsn=`expr $n + 1`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho "I:checking journal file is deleted ($n)"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsret=0
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews[ -s ns2/nil.db.jnl ] && ret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsstatus=`expr $status + $ret`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsn=`expr $n + 1`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho "I:checking zone is still writable ($n)"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsret=0
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsserver 10.53.0.2
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewszone nil.
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsupdate add text5.nil. 600 IN TXT "addition 5"
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewssend
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark AndrewsEND
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews$DIGCMD text4.nil. TXT | grep 'addition 4' >/dev/null || ret=1
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsstatus=`expr $status + $ret`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsn=`expr $n + 1`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho "I:checking other journal files not removed ($n)"
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsret=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews[ -s ns2/other.db.jnl ] || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsstatus=`expr $status + $ret`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:cleaning all zones ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDCCMD sync -clean | sed 's/^/I:ns2 /'
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsn=`expr $n + 1`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:checking all journals removed ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsret=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews[ -s ns2/nil.db.jnl ] && ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews[ -s ns2/other.db.jnl ] && ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsstatus=`expr $status + $ret`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsn=`expr $n + 1`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:checking that freezing static zones is not allowed ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsret=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDCCMD freeze static 2>&1 | grep 'not dynamic' > /dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsstatus=`expr $status + $ret`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsn=`expr $n + 1`
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsecho "I:checking that journal is removed when serial is changed before thaw ($n)"
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsret=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewssleep 1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsserver 10.53.0.2
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewszone other.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsupdate add text6.other. 600 IN TXT "addition 6"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewssend
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark AndrewsEND
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews[ -s ns2/other.db.jnl ] || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDCCMD freeze other 2>&1 | sed 's/^/I:ns2 /'
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsserial=`awk '$3 == "serial" {print $1}' ns2/other.db`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsnewserial=`expr $serial + 1`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewssed s/$serial/$newserial/ ns2/other.db > ns2/other.db.new
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho 'frozen TXT "frozen addition"' >> ns2/other.db.new
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsmv -f ns2/other.db.new ns2/other.db
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews$RNDCCMD thaw 2>&1 | sed 's/^/I:ns2 /'
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrewssleep 1
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews[ -f ns2/other.db.jnl ] && ret=1
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrewsserver 10.53.0.2
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrewszone other.
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrewsupdate add text7.other. 600 IN TXT "addition 7"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewssend
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark AndrewsEND
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$DIGCMD text6.other. TXT | grep 'addition 6' >/dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$DIGCMD text7.other. TXT | grep 'addition 7' >/dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$DIGCMD frozen.other. TXT | grep 'frozen addition' >/dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsstatus=`expr $status + $ret`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsn=`expr $n + 1`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:checking that journal is kept when ixfr-from-differences is in use ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsret=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsserver 10.53.0.2
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewszone nil.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsupdate add text6.nil. 600 IN TXT "addition 6"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewssend
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark AndrewsEND
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews[ -s ns2/nil.db.jnl ] || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDCCMD freeze nil 2>&1 | sed 's/^/I:ns2 /'
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsserial=`awk '$3 == "serial" {print $1}' ns2/nil.db`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsnewserial=`expr $serial + 1`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewssed s/$serial/$newserial/ ns2/nil.db > ns2/nil.db.new
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho 'frozen TXT "frozen addition"' >> ns2/nil.db.new
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsmv -f ns2/nil.db.new ns2/nil.db
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDCCMD thaw 2>&1 | sed 's/^/I:ns2 /'
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewssleep 1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews[ -s ns2/nil.db.jnl ] || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsserver 10.53.0.2
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewszone nil.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsupdate add text7.nil. 600 IN TXT "addition 7"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewssend
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark AndrewsEND
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews$DIGCMD text6.nil. TXT | grep 'addition 6' >/dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$DIGCMD text7.nil. TXT | grep 'addition 7' >/dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$DIGCMD frozen.nil. TXT | grep 'frozen addition' >/dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsstatus=`expr $status + $ret`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews# temp test
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:dumping stats ($n)"
0c310d16b05ee94743d33f6920907edee6084fc8Michael Graff$RNDCCMD stats
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsn=`expr $n + 1`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I: verifying adb records in named.stats ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsgrep "ADB stats" ns2/named.stats > /dev/null || ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsstatus=`expr $status + $ret`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsn=`expr $n + 1`
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsecho "I:test using second key ($n)"
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsret=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.2 -p 9953 -c ns2/secondkey.conf status > /dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsstatus=`expr $status + $ret`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsn=`expr $n + 1`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:test 'rndc dumpdb' on a empty cache ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsret=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.3 -p 9953 -c ../common/rndc.conf dumpdb > /dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsfor i in 1 2 3 4 5 6 7 8 9
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdo
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews tmp=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews grep "Dump complete" ns3/named_dump.db > /dev/null || tmp=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews [ $tmp -eq 0 ] && break
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews sleep 1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdone
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews[ $tmp -eq 1 ] && ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsstatus=`expr $status + $ret`
f0a5bb8f86631ce638cb2b6c65bbb9bcf9b0cdc0Bob Halley
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsn=`expr $n + 1`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:test 'rndc reload' on a zone with include files ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsret=0
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsgrep "incl/IN: skipping load" ns2/named.run > /dev/null && ret=1
f0a5bb8f86631ce638cb2b6c65bbb9bcf9b0cdc0Bob Halleyloads=`grep "incl/IN: starting load" ns2/named.run | wc -l`
f0a5bb8f86631ce638cb2b6c65bbb9bcf9b0cdc0Bob Halley[ "$loads" -eq 1 ] || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.2 -p 9953 -c ../common/rndc.conf reload > /dev/null || ret=1
f0a5bb8f86631ce638cb2b6c65bbb9bcf9b0cdc0Bob Halleyfor i in 1 2 3 4 5 6 7 8 9
f0a5bb8f86631ce638cb2b6c65bbb9bcf9b0cdc0Bob Halleydo
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews tmp=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews grep "incl/IN: skipping load" ns2/named.run > /dev/null || tmp=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews [ $tmp -eq 0 ] && break
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews sleep 1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdone
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews[ $tmp -eq 1 ] && ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewstouch ns2/static.db
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.2 -p 9953 -c ../common/rndc.conf reload > /dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsfor i in 1 2 3 4 5 6 7 8 9
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdo
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews tmp=0
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews loads=`grep "incl/IN: starting load" ns2/named.run | wc -l`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews [ "$loads" -eq 2 ] || tmp=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews [ $tmp -eq 0 ] && break
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews sleep 1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsdone
f305d86668bfd4d4727c3e0f70e7e97a2fa1b772Bob Halley[ $tmp -eq 1 ] && ret=1
2bc0da0cd874b15593d65338ba96e90ceed13072Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsstatus=`expr $status + $ret`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
0c310d16b05ee94743d33f6920907edee6084fc8Michael Graffn=`expr $n + 1`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:testing rndc with hmac-md5 ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsret=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.4 -p 9951 -c ns4/key1.conf status > /dev/null 2>&1 || ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsfor i in 2 3 4 5 6
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsdo
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews $RNDC -s 10.53.0.4 -p 9951 -c ns4/key${i}.conf status > /dev/null 2>&1 && ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsdone
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsstatus=`expr $status + $ret`
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsn=`expr $n + 1`
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsecho "I:testing rndc with hmac-sha1 ($n)"
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsret=0
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews$RNDC -s 10.53.0.4 -p 9952 -c ns4/key2.conf status > /dev/null 2>&1 || ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsfor i in 1 3 4 5 6
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsdo
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews $RNDC -s 10.53.0.4 -p 9952 -c ns4/key${i}.conf status > /dev/null 2>&1 && ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsdone
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsstatus=`expr $status + $ret`
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsn=`expr $n + 1`
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsecho "I:testing rndc with hmac-sha224 ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsret=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.4 -p 9953 -c ns4/key3.conf status > /dev/null 2>&1 || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsfor i in 1 2 4 5 6
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdo
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews $RNDC -s 10.53.0.4 -p 9953 -c ns4/key${i}.conf status > /dev/null 2>&1 && ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdone
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsstatus=`expr $status + $ret`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsn=`expr $n + 1`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:testing rndc with hmac-sha256 ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsret=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.4 -p 9954 -c ns4/key4.conf status > /dev/null 2>&1 || ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsfor i in 1 2 3 5 6
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdo
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews $RNDC -s 10.53.0.4 -p 9954 -c ns4/key${i}.conf status > /dev/null 2>&1 && ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdone
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsstatus=`expr $status + $ret`
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsn=`expr $n + 1`
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsecho "I:testing rndc with hmac-sha384 ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsret=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.4 -p 9955 -c ns4/key5.conf status > /dev/null 2>&1 || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsfor i in 1 2 3 4 6
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdo
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews $RNDC -s 10.53.0.4 -p 9955 -c ns4/key${i}.conf status > /dev/null 2>&1 && ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdone
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsstatus=`expr $status + $ret`
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsn=`expr $n + 1`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:testing rndc with hmac-sha512 ($n)"
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsret=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf status > /dev/null 2>&1 || ret=1
0c310d16b05ee94743d33f6920907edee6084fc8Michael Grafffor i in 1 2 3 4 5
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdo
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews $RNDC -s 10.53.0.4 -p 9956 -c ns4/key${i}.conf status > /dev/null 2>&1 2>&1 && ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdone
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsstatus=`expr $status + $ret`
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsn=`expr $n + 1`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:testing automatic zones are reported ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsret=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf status > rndc.output.test$n || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsgrep "number of zones: 198 (196 automatic)" rndc.output.test$n > /dev/null || ret=1
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsstatus=`expr $status + $ret`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsn=`expr $n + 1`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:testing rndc with null command ($n)"
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsret=0
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf null || ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsstatus=`expr $status + $ret`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsn=`expr $n + 1`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsecho "I:testing rndc with unknown control channel command ($n)"
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrewsret=0
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf obviouslynotacommand >/dev/null 2>&1 && ret=1
3d5cad69ec20157912e95cf3b79316dfb0a314f3Mark Andrews# rndc: 'obviouslynotacommand' failed: unknown command
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsstatus=`expr $status + $ret`
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsn=`expr $n + 1`
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsecho "I:testing rndc with querylog command ($n)"
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsret=0
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews# first enable it with querylog on option
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf querylog on >/dev/null 2>&1 || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews# query for builtin and check if query was logged
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$DIG @10.53.0.4 -p 5300 -c ch -t txt foo12345.bind > /dev/null || ret 1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsgrep "query logging is now on" ns4/named.run > /dev/null || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsgrep "query: foo12345.bind CH TXT" ns4/named.run > /dev/null || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews# toggle query logging and check again
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf querylog > /dev/null 2>&1 || ret=1
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews# query for another builtin zone and check if query was logged
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews$DIG @10.53.0.4 -p 5300 -c ch -t txt foo9876.bind > /dev/null || ret 1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsgrep "query logging is now off" ns4/named.run > /dev/null || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsgrep "query: foo9876.bind CH TXT" ns4/named.run > /dev/null && ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsstatus=`expr $status + $ret`
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsn=`expr $n + 1`
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsecho "I:testing rndc nta time limits ($n)"
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsret=0
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf nta -l 2h nta1.example 2>&1 | grep "Negative trust anchor added" > /dev/null || ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf nta -l 1d nta2.example 2>&1 | grep "Negative trust anchor added" > /dev/null || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf nta -l 1w nta3.example 2>&1 | grep "Negative trust anchor added" > /dev/null || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf nta -l 8d nta4.example 2>&1 | grep "NTA lifetime cannot exceed one week" > /dev/null || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsstatus=`expr $status + $ret`
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsfor i in 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsdo
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews n=`expr $n + 1`
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews echo "I:testing rndc buffer size limits (size=${i}) ($n)"
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews ret=0
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews $RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf testgen ${i} 2>&1 > rndc.output.test$n || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews actual_size=`./gencheck rndc.output.test$n`
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews if [ "$?" = "0" ]; then
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews expected_size=`expr $i + 1`
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews if [ $actual_size != $expected_size ]; then ret=1; fi
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews else
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews fi
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews if [ $ret != 0 ]; then echo "I:failed"; fi
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews status=`expr $status + $ret`
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsdone
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsn=`expr $n + 1`
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsecho "I:testing rndc -r (show result) ($n)"
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsret=0
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf -r testgen 0 2>&1 > rndc.output.test$n || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsgrep "ISC_R_SUCCESS 0" rndc.output.test$n > /dev/null || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsstatus=`expr $status + $ret`
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsn=`expr $n + 1`
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsecho "I:testing rndc with a token containing a space ($n)"
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsret=0
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf -r flush '"view with a space"' 2>&1 > rndc.output.test$n || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsgrep "not found" rndc.output.test$n > /dev/null && ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsstatus=`expr $status + $ret`
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsn=`expr $n + 1`
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsecho "I:test 'rndc reconfig' with a broken config ($n)"
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsret=0
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf reconfig > /dev/null || ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewssleep 1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsmv ns4/named.conf ns4/named.conf.save
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsecho "error error error" >> ns4/named.conf
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf reconfig > rndc.output.test$n 2>&1 && ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsgrep "rndc: 'reconfig' failed: unexpected token" rndc.output.test$n > /dev/null || ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsmv ns4/named.conf.save ns4/named.conf
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewssleep 1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf reconfig > /dev/null || ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewssleep 1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsstatus=`expr $status + $ret`
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrewsn=`expr $n + 1`
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsecho "I:test read-only control channel access ($n)"
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsret=0
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.5 -p 9953 -c ../common/rndc.conf status > /dev/null 2>&1 || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.5 -p 9953 -c ../common/rndc.conf nta -dump > /dev/null 2>&1 || ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews$RNDC -s 10.53.0.5 -p 9953 -c ../common/rndc.conf reconfig > /dev/null 2>&1 && ret=1
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsstatus=`expr $status + $ret`
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsn=`expr $n + 1`
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsecho "I:test rndc status shows running on ($n)"
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsret=0
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews$RNDC -s 10.53.0.5 -p 9953 -c ../common/rndc.conf status > rndc.output.test$n /dev/null 2>&1 || ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsgrep "^running on " rndc.output.test$n > /dev/null || ret=1
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsstatus=`expr $status + $ret`
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsn=`expr $n + 1`
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsecho "I:test 'rndc reconfig' with loading of a large zone ($n)"
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewsret=0
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewscur=`awk 'BEGIN {l=0} /^/ {l++} END { print l }' ns6/named.run`
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrewscp ns6/named.conf ns6/named.conf.save
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho "zone \"huge.zone\" { type master; file \"huge.zone.db\"; };" >> ns6/named.conf
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho " I:reloading config"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews$RNDC -s 10.53.0.6 -p 9953 -c ../common/rndc.conf reconfig > rndc.output.test$n 2>&1 || ret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsif [ $ret != 0 ]; then echo " I:failed"; fi
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsstatus=`expr $status + $ret`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewssleep 1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsn=`expr $n + 1`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho " I:check if zone load was scheduled ($n)"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsgrep "scheduled loading new zones" ns6/named.run > /dev/null || ret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsif [ $ret != 0 ]; then echo " I:failed"; fi
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsstatus=`expr $status + $ret`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsn=`expr $n + 1`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho " I:check if query for the zone returns SERVFAIL ($n)"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews$DIG @10.53.0.6 -p 5300 -t soa huge.zone > dig.out.test$n
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsgrep "SERVFAIL" dig.out.test$n > /dev/null || ret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsif [ $ret != 0 ]; then echo " I:failed (ignored)"; ret=0; fi
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsstatus=`expr $status + $ret`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsn=`expr $n + 1`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho " I:wait for the zones to be loaded ($n)"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewstry=0
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewswhile test $try -lt 45
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsdo
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews sleep 1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews sed -n "$cur,"'$p' < ns6/named.run | grep "any newly configured zones are now loaded" > /dev/null && {
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews ret=0
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews break
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews }
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews try=`expr $try + 1`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsdone
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsif [ $ret != 0 ]; then echo " I:failed"; fi
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsstatus=`expr $status + $ret`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsn=`expr $n + 1`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsecho " I:check if query for the zone returns NOERROR ($n)"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews$DIG @10.53.0.6 -p 5300 -t soa huge.zone > dig.out.test$n
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsgrep "NOERROR" dig.out.test$n > /dev/null || ret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsif [ $ret != 0 ]; then echo " I:failed"; fi
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsstatus=`expr $status + $ret`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsmv ns6/named.conf.save ns6/named.conf
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewssleep 1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews$RNDC -s 10.53.0.6 -p 9953 -c ../common/rndc.conf reconfig > /dev/null || ret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewssleep 1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsstatus=`expr $status + $ret`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsif [ -x "$PYTHON" ]; then
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews n=`expr $n + 1`
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews echo "I:test rndc python bindings ($n)"
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews ret=0
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews $PYTHON > rndc.output.test$n << EOF
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsimport sys
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewssys.path.insert(0, '../../../../bin/python')
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsfrom isc import *
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsr = rndc(('10.53.0.5', 9953), 'hmac-sha256', '1234abcd8765')
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsresult = r.call('status')
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrewsprint(result['text'])
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark AndrewsEOF
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews grep 'server is up and running' rndc.output.test$n > /dev/null 2>&1 || ret=1
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews if [ $ret != 0 ]; then echo "I:failed"; fi
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews status=`expr $status + $ret`
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrewsfi
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsexit $status
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews