1################################################################# 2# 3# @(#) distribute.sh -- distribute and reload command for dnssec-signer 4# 5# (c) Jul 2008 Holger Zuleger hznet.de 6# 7# Feb 2010 action "distkeys" added but currently not used 8# 9# This shell script will be run by zkt-signer as a distribution 10# and reload command if: 11# 12# a) the dnssec.conf file parameter Distribute_Cmd: points 13# to this file 14# and 15# b) the user running the zkt-signer command is not 16# root (uid==0) 17# and 18# c) the owner of this shell script is the same as the 19# running user and the access rights don't allow writing 20# for anyone except the owner 21# or 22# d) the group of this shell script is the same as the 23# running user and the access rights don't allow writing 24# for anyone except the group 25# 26################################################################# 27 28# set path to rndc and scp 29PATH="/bin:/usr/bin:/usr/local/sbin" 30 31# remote server and directory 32server=localhost # fqdn of remote name server 33dir=/var/named # zone directory on remote name server 34 35progname=$0 36usage() 37{ 38 echo "usage: $progname distkeys|distribute|reload <zone> <path_to_zonefile> [<viewname>]" 1>&2 39 test $# -gt 0 && echo $* 1>&2 40 exit 1 41} 42 43if test $# -lt 3 44then 45 usage 46fi 47action="$1" 48zone="$2" 49zonefile="$3" 50view="" 51test $# -gt 3 && view="$4" 52 53case $action in 54distkeys) 55 if test -n "$view" 56 then 57 : echo "scp K$zone+* $server:$dir/$view/$zone/" 58 scp K$zone+* $server:$dir/$view/$zone/ 59 else 60 : echo "scp K$zone+* $server:$dir/$zone/" 61 scp K$zone+* $server:$dir/$zone/ 62 fi 63 ;; 64distribute) 65 if test -n "$view" 66 then 67 : echo "scp $zonefile $server:$dir/$view/$zone/" 68 scp $zonefile $server:$dir/$view/$zone/ 69 else 70 : echo "scp $zonefile $server:$dir/$zone/" 71 scp $zonefile $server:$dir/$zone/ 72 fi 73 ;; 74reload) 75 : echo "rndc $action $zone $view" 76 rndc $action $zone $view 77 ;; 78*) 79 usage "illegal action $action" 80 ;; 81esac 82 83