PageRenderTime 59ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/src/netbsd/src/external/bsd/bind/dist/bin/tests/system/tsiggss/tests.sh

https://bitbucket.org/killerpenguinassassins/open_distrib_devel
Shell | 79 lines | 61 code | 15 blank | 3 comment | 17 complexity | 22cd8fe5bb2846bf874a2d4a2befac2f MD5 | raw file
Possible License(s): CC0-1.0, MIT, LGPL-2.0, LGPL-3.0, WTFPL, GPL-2.0, BSD-2-Clause, AGPL-3.0, CC-BY-SA-3.0, MPL-2.0, JSON, BSD-3-Clause-No-Nuclear-License-2014, LGPL-2.1, CPL-1.0, AGPL-1.0, 0BSD, ISC, Apache-2.0, GPL-3.0, IPL-1.0, MPL-2.0-no-copyleft-exception, BSD-3-Clause
  1. #!/bin/sh
  2. # tests for TSIG-GSS updates
  3. SYSTEMTESTTOP=..
  4. . $SYSTEMTESTTOP/conf.sh
  5. status=0
  6. DIGOPTS="@10.53.0.1 -p 5300"
  7. # we don't want a KRB5_CONFIG setting breaking the tests
  8. KRB5_CONFIG=/dev/null
  9. export KRB5_CONFIG
  10. test_update() {
  11. host="$1"
  12. type="$2"
  13. cmd="$3"
  14. digout="$4"
  15. cat <<EOF > ns1/update.txt
  16. server 10.53.0.1 5300
  17. update add $host $cmd
  18. send
  19. EOF
  20. echo "I:testing update for $host $type $cmd"
  21. $NSUPDATE -g ns1/update.txt > /dev/null 2>&1 || {
  22. echo "I:update failed for $host $type $cmd"
  23. return 1
  24. }
  25. out=`$DIG $DIGOPTS -t $type -q $host | egrep "^${host}"`
  26. lines=`echo "$out" | grep "$digout" | wc -l`
  27. [ $lines -eq 1 ] || {
  28. echo "I:dig output incorrect for $host $type $cmd: $out"
  29. return 1
  30. }
  31. return 0
  32. }
  33. echo "I:testing updates as administrator"
  34. KRB5CCNAME="FILE:"`pwd`/ns1/administrator.ccache
  35. export KRB5CCNAME
  36. test_update testdc1.example.nil. A "86400 A 10.53.0.10" "10.53.0.10" || status=1
  37. test_update testdc2.example.nil. A "86400 A 10.53.0.11" "10.53.0.11" || status=1
  38. test_update denied.example.nil. TXT "86400 TXT helloworld" "helloworld" && status=1
  39. echo "I:testing updates as a user"
  40. KRB5CCNAME="FILE:"`pwd`/ns1/testdenied.ccache
  41. export KRB5CCNAME
  42. test_update testdenied.example.nil. A "86400 A 10.53.0.12" "10.53.0.12" && status=1
  43. test_update testdenied.example.nil. TXT "86400 TXT helloworld" "helloworld" || status=1
  44. echo "I:testing external update policy"
  45. test_update testcname.example.nil. TXT "86400 CNAME testdenied.example.nil" "testdenied" && status=1
  46. perl ./authsock.pl --type=CNAME --path=ns1/auth.sock --pidfile=authsock.pid --timeout=120 > /dev/null 2>&1 &
  47. sleep 1
  48. test_update testcname.example.nil. TXT "86400 CNAME testdenied.example.nil" "testdenied" || status=1
  49. test_update testcname.example.nil. TXT "86400 A 10.53.0.13" "10.53.0.13" && status=1
  50. echo "I:testing external policy with SIG(0) key"
  51. ret=0
  52. $NSUPDATE -R random.data -k ns1/Kkey.example.nil.*.private <<END > /dev/null 2>&1 || ret=1
  53. server 10.53.0.1 5300
  54. zone example.nil
  55. update add fred.example.nil 120 cname foo.bar.
  56. send
  57. END
  58. output=`$DIG $DIGOPTS +short cname fred.example.nil.`
  59. [ -n "$output" ] || ret=1
  60. [ $ret -eq 0 ] || echo "I:failed"
  61. status=`expr $status + $ret`
  62. [ $status -eq 0 ] && echo "I:tsiggss tests all OK"
  63. kill `cat authsock.pid`
  64. exit $status