get_desc() { cat <&1 | tee log exit // ~CSPLIT // /etc/bind named.conf.new -ci "-vbDm 644" -- // This is the primary configuration file for the BIND DNS server named. // // This is for a "caching mostly" server configuration // using Debian's file structure // assuming "/etc/bind/rndc.key" exists // assuming "/etc/bind/rndc.conf", if it exists, uses same key acl "private_nets" { 10.0.0.0/8; 172.16.0.0/12; 192.168.0.0/16; localnets; }; options { // for secondary zone info use simple file names to be stored here directory "/var/cache/bind"; // default is a random unpriviledged udp port query-source address * port 53; // include file generated by /etc/bond/isp_dns.sh // for dynamically assigned dns // forwarders { . . . }; include "/var/lib/misc/named.forwarders"; // restrict query access allow-query { private_nets; }; // restrict transfer access allow-transfer { none; }; dialup refresh; # minimize refresh auth-nxdomain no; # conform to RFC1035 }; // act as lightweight resolver lwres { }; // prime the server with knowledge of the root servers zone "." { type hint; file "/etc/bind/db.root"; }; // be authoritative for the localhost forward and reverse zones, and for // broadcast zones as per RFC 1912 zone "localhost" { type master; file "/etc/bind/db.local"; forwarders { }; }; zone "127.in-addr.arpa" { type master; file "/etc/bind/db.127"; forwarders { }; }; zone "0.in-addr.arpa" { type master; file "/etc/bind/db.0"; forwarders { }; }; zone "255.in-addr.arpa" { type master; file "/etc/bind/db.255"; forwarders { }; }; // add entries for other zones below here # ~CSPLIT # /var/local/lib/misc resolv.conf.local -ci "-vDm 644" -s resolv.conf -- nameserver 127.0.0.1 nameserver 127.0.0.1 nameserver 127.0.0.1 // ~CSPLIT // /var/local/lib/misc named.forwarders -ci "-vDm 644" -- forwarders { }; #!/bin/sh -u # /usr/local/sbin isp-dns-conf -ci "-vD" -- \ # This configures resolv.conf or bind for Internet dns RCS='$Revision: 1.42 $';version(){ cat < # This is free software; see the GNU General Public License version 2 # or later for copying conditions. There is NO warranty. VRS exit; } error() { warn ERROR: "$@"; exit 1;} evalu() { eval "$@";} help(){ cat <value(s) keys: $VALID_KEY | $KEY_DNS HLP exit; } push_nameservers() { local dns; for dns in $*; do echo " $IN_nameservers "| grep -q -F " $dns "|| IN_nameservers="$IN_nameservers $dns"; done } do_options() { for opt in "$@"; do case "$opt" in local-dns) mk_lnk $RES_LOCAL;; no-local-dns) mk_lnk $RES_NOLOCAL;; *) warn "unknown option $1 ";; esac; done; } do_read() { while read key value; do [ "$key" ]&& evalu "case '$key' in $VALID_KEY) IN_$key='$value';; $KEY_DNS) push_nameservers $value;; *) warn unknown key: $key;; esac" done update=y; } do_sig() { slu_unlock_file -p $$ $RES_LOCK; exit; } mk_lnk() { cd $IDC_VAR_DIR||return; trap do_sig $IDC_SIGNALS; if slu_lock_file -r $IDC_RETRY -p $$ $RES_LOCK; then ln -sf $1 $RES_CONF||:; slu_unlock_file -p $$ $RES_LOCK; fi } warn() { echo "$@" >&2;} #exec 3<>/dev/null export IN_device= IN_nameservers= IN_domain= IN_interface=; export IDC_ETC= IDC_SIGNALS= IDC_VAR_DIR= IDC_RETRY=; export RES_CONF= RES_LOCAL= RES_LOCK= RES_NOLOCAL=; case "$0" in */local/*) PREFIX=/local;; *) PREFIX=;; esac IDC_PROG="isp-dns-conf"; IDC_ETC=/etc$PREFIX/isp-dns-conf IDC_RETRY=10; IDC_SIGNALS='HUP INT TERM'; IDC_VAR_DIR=/var$PREFIX/lib/misc; RP_OPTIONS=; RES_LOCK=/var/lock/etc..resolv.conf; RES_CONF=resolv.conf; RES_LOCAL=${RES_CONF}.local; RES_NOLOCAL=${RES_CONF}.nolocal; update=; VALID_KEY="device | domain | interface" KEY_DNS="nameservers" # check dependencies hash cat echo grep ln rm run-parts|| exit; . sh-lock-utils|| exit; [ $# -gt 0 ]|| help; while getopts "C:HVo:uX" LR;do case $LR in C) . "$OPTARG"; break;; V) version $RCS; break;; H) help;; o) do_options $OPTARG;; u) do_read;; \?) break;; X) set -x;RP_OPTIONS="$RP_OPTIONS --arg=-X";; esac;done; shift $(($OPTIND-1)); [ "$update" ]|| exit 0; [ "$IN_nameservers" ]|| { error "no dns info on $IN_domain";} cd $IDC_VAR_DIR||exit; ( #give kernel time to setup routes sleep 1; run-parts $RP_OPTIONS --arg -u $IDC_ETC/updaters; ) & #!/bin/sh -u # /usr/local/bin sh-lock-utils -ci "-vD" -s "sh-lock-file sh-unlock-file" -- \ # sh-lock-utils -- provides functions for locking files slu_version(){ cat < This is free software; see the GNU General Public License version 2 or later for copying conditions. There is NO warranty. VRS false; slu_chk; } SLU_VERSION='$Revision: 1.43 $'; # AVAILABLE at: http://www.dma.org/~rhawes/programs/sh-lock-file #sh-lock-utils -- source file for shell scripts to use functions # The two other commands are symbolic links to sh-lock-utils slu_help() { cat <&2; slu_err_get; } slu_error_usage() { slu_error $SLU_E_USAGE "$PGM: USAGE: $*, use -H for help"; } slu_lock_all() { local lock lockfile locklist= lock_next next recurse=0 ret=0; while [ $# -gt 0 ]&& { lock="$1"; shift;}; do if [ "$lock" ]; then slu_lock_it "$lock" 0|| slu_chk; if slu_err_get; then locklist="$locklist $lock"; else [ "$locklist" ]&& echo "$locklist"| slu_unlock_file $vb -p $pid -; break; fi fi done slu_err_get } slu_lock_dir() { local dir lock; while [ $# -gt 0 ]&& { lock="$1"; shift;}; do if [ "$lock" ]&& dir=$(dirname "$lock"); then if [ -d "$dir" ]; then [ -r "$dir" ]|| slu_abort "$dir is unreadable"; [ -w "$dir" ]|| slu_abort "$dir is unwriteable"; else slu_abort "$dir is not a directory"; fi fi done slu_err_get; } slu_lock_file() { # make symbolic link to it's own process id in /proc local cum=0 errno=0 inc=1 link lock option pid= PGM=sh-lock-file ret=0\ retry=0 retry_max=-1 timer=8 vb= OPTARG OPTIND=1; while getopts ":HVXi:p:r:t:v" option;do case "$option" in H) slu_help_lock;; V) slu_version $SLU_VERSION;; X) set -x;; i) slu_chk_min inc 0 $OPTARG;; p) slu_chk_min pid 1 $OPTARG;; r) slu_chk_min retry_max -1 $OPTARG;; t) slu_chk_min timer 1 $OPTARG;; v) vb=-v;; \?) slu_error_usage "Opton: '$OPTARG' is invalid";; :) slu_error_usage "Opton: '$OPTARG' is missing an argument";; *) ;; esac|| break; done shift $(($OPTIND-1)); if [ $# -gt 0 ]&& [ "$1" = "-" ]; then shift; while read -r lock; do [ "$lock" ]&& set -- "$@" "$lock"; done fi ! slu_err_get|| { [ $(echo "$@" | wc -w) -gt 0 ]|| slu_error_usage "no lockfiles specified"; [ $(echo "$@" | wc -l) -eq 1 ]|| slu_error_usage "lockfile name has a new line character"; slu_lock_dir "$@"; link=/proc/$pid/status; [ -f "$link" ]|| slu_abort "$link does not exist"; } ! slu_err_get|| until slu_lock_ok_all "$@"&& slu_lock_all "$@" do retry=$(($retry + 1)); [ $retry_max -gt 0 ]&& { [ $retry -le $retry_max ]|| slu_abort "retry lock exceeded count"; } slu_err_get|| break; [ -z "$vb" ]|| { cum=$(($cum + $timer)); echo "retry $retry sleep $timer cum $cum pid $pid"; } sleep $timer|| slu_chk|| break; timer=$(($timer + $inc)); done slu_err_get; } slu_lock_fix() { # remove an invalid lock local lockfile lock_next next recurse=$1; slu_lock_init; # make certain only a single process tries this # this prevents possible accidental removal of valid locks if slu_lock_it "$lock" $next; then if slu_lock_invalid $recurse; then rm $vb -f "$lockfile"|| slu_abort "cannot remove invalid lockfile: $lockfile"; fi rm $vb -f "$lock_next" fi slu_err_get; } slu_lock_init() { next=$(($recurse + 1)); lockfile="${lock}.$recurse"; lock_next="${lock}.$next"; } slu_lock_invalid() { # true if invalid local lockfile recurse=$1 w; lockfile="${lock}.$recurse"; if [ -L "$lockfile" ]; then [ ! -f "$lockfile" ]|| ! w=$(slu_which_locked "$lockfile")|| [ -z "$w" ]|| [ "$w" -eq $pid ]|| [ "$( ps --no-headers -o state $w )" = Z ]; else [ -e "$lockfile" ]; fi } slu_lock_it() { # level# lockname local lock="$1" lockfile lock_next next recurse=$2; slu_lock_init; slu_lock_ok&& ln -s $vb $link "$lockfile" 2>&3|| false; # or another process beat us } slu_lock_ok() { # true if ok to lock level recurse local ret=1; if slu_lock_invalid $next; then slu_lock_fix $next; fi if [ ! -L "$lock_next" ]; then if slu_lock_invalid $recurse; then slu_lock_fix $recurse; fi [ -L "$lockfile" ]|| ret=0; fi slu_err_get|| ret=$?; return $ret; } slu_lock_ok_all() { local lock lockfile lock_next next recurse=0 ret=0; while [ $# -gt 0 ]&& { lock="$1"; shift;}; do if [ "$lock" ]; then slu_lock_init; slu_lock_ok; ret=$?; [ $ret -eq 0 ]|| break; fi done return $ret; } slu_pid_locked() { [ -L "$2" ]&& ls -l "$2" 2>&3| grep -q " /proc/$1/status$";} slu_unlock_file() { # safely remove lock files in signal handlers set by trap local errno=0 pid=0 lock option PGM=sh-unlock-file vb= OPTARG OPTIND=1; while getopts ":HVXp:v" option;do case "$option" in H) slu_help_unlock;; V) slu_version $SLU_VERSION;; X) set -x;; p) slu_chk_min pid 1 $OPTARG;; v) vb=-v;; \?) slu_error_usage "Opton: '$OPTARG' is invalid";; :) slu_error_usage "Opton: '$OPTARG' is missing an argument";; *) ;; esac|| break; done shift $(($OPTIND-1)); if [ $# -gt 0 ]&& [ "$1" = "-" ]; then shift; while read -r lock; do [ "$lock" ]&& set -- "$@" "$lock"; done fi # search for all recursive locks ! slu_err_get|| slu_unlock_it "$@" slu_err_get; } slu_unlock_it() { local file lock; while [ $# -gt 0 ]&& { lock="$1"; shift;}; do [ "$lock" ]&& ls "${lock}."[0-9]* 2>&3| grep "^.*\.[0-9]\+$"| { while read -r file; do [ "$file" ]&& slu_pid_locked $pid "$file"&& rm -f $vb "$file"; done } done slu_err_get; } slu_which_locked() { # get pid in symbolic link [ -L "$1" ]&& ls -l "$1" 2>&3| sed -n 's%.* /proc/\([0-9]\+\)/status$%\1%p' } #efficiency exec 3<>/dev/null #check PATH hash cat dirname echo grep ln ls ps rm sed sleep wc&& case "$0" in */sh-lock-file) slu_lock_file "$@";; */sh-unlock-file) slu_unlock_file "$@";; *) ;; esac #!/bin/sh # /etc/ppp/ip-down.d zzz90_diald -ci "-vD" -- \ # optionally flush cache. # Copyright (C) 2003 by Richard Hawes # This is free software; see the GNU General Public License version 2 # or later for copying conditions. There is NO warranty. # usage: set ppp option in /etc/ppp/peers/ . . . # ipparam "earthlink --bind_flush" exec 3<>/dev/null # check if diald is installed hash diald 2>&3||exit 0; # check dependencies hash logger ps||exit; FLUSH_CACHE=; set -- ${PPP_IPPARAM}; while [ $# -gt 0 ]; do [ "$1" != --bind_flush ]|| { FLUSH_CACHE=y;break;} shift; done if [ "$FLUSH_CACHE" ]&& hash rndc 2>&3&& ps -C named>&3; then # flush is needed for dynamically assigned ip addresses # to trigger diald to dial out on a name service lookup ( rndc flush&& logger -t "$0" flushed bind\'s domain name cache; ) 2>&3 >&3 & fi #!/bin/sh # /etc/dhcp3 dhclient-enter-hooks -ci "-vbD" -- \ # This script sets up forwarding dns # Copyright (C) 2003 by Richard Hawes # This is free software; see the GNU General Public License version 2 # or later for copying conditions. There is NO warranty. # $Revision: 1.8 $ PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin; exec 3<>/dev/null; if hash isp-dns-conf; then make_resolv_conf() { if [ "x$new_domain_name_servers" != x ]||[ x$new_domain_name != x ];then isp-dns-conf -u <<-INFO domain $new_domain_name interface $interface nameservers $new_domain_name_servers $old_domain_name_servers INFO fi } fi #!/bin/sh # /etc/diald/initializer.d bind -ci "-vD" -- \ # This script flushes bind when diald starts up # configure diald: initializer /etc/diald/initialzer.d/bind exec 3<>/dev/null; hash named 2>&3|| exit 0; hash ps rndc|| exit; if ps -C named >&3; then . /etc/diald/diald.provider if grep '^[^#]*--bind_flush' /etc/ppp/peers/$PROVIDER >&3 2>&3; then rndc flush&& echo flush bind\'s cache; fi fi #!/bin/sh # /etc/ppp/ip-up.d 007_isp-dns-conf -ci "-vD" -- \ # configure dns. # Copyright (C) 2003 by Richard Hawes # This is free software; see the GNU General Public License version 2 # or later for copying conditions. There is NO warranty. exec 3<>/dev/null # usage: in /etc/ppp/peers/PROVIDER # ipparam "--domain my_isp.com 1.1.1.1 2.2.2.2" # check if isp-dns-conf is installed hash isp-dns-conf 2>&3|| exit 0; # check dependencies hash logger||exit; OPTIONS=; DNAME_SERV=; set -- ${PPP_IPPARAM}; while [ $# -gt 0 ]; do case $1 in --domain) [ $# -lt 2 ]|| { OPTIONS="${OPTIONS}domain $2 "; shift; } ;; [0-9]*.[0-9]*.[0-9]*.[0-9]*) DNAME_SERV="$DNAME_SERV $1";; *) ;; esac shift; done ( isp-dns-conf -u <&1 | logger -t "$0" interface $IFNAME device $DEVICE nameservers $DNS1 $DNS2 $DNAME_SERV $OPTIONS INFO ) 2>&3 >&3 & #!/bin/sh -u # /usr/local/etc/isp-dns-conf/updaters bind -ci "-vD" -- \ # This configures bind forwarders RCS='$Revision: 1.31 $'; version(){ cat < # This is free software; see the GNU General Public License version 2 # or later for copying conditions. There is NO warranty. VRS exit; } evalu() { eval "$@";} help() { warn "usage: called from $IDC_PROG" exit; } do_bind() { FORWARD=$IDC_VAR_DIR/named.forwarders; BIND_LOCK=/var/lock/etc..bind; LOCK_PID=$$; if [ $# -gt 0 ]; then TEMP="$(mk_fwd $*)" else warn "don't have info on bind forwarder statement"; return; fi trap do_sig $IDC_SIGNALS; if if_diff TEMP $FORWARD&& slu_lock_file -r $IDC_RETRY -p $LOCK_PID $BIND_LOCK; then trap '' $IDC_SIGNALS; echo "$TEMP" > $FORWARD; if ps -C named >&3; then trap do_sig $IDC_SIGNALS; rndc reconfig; fi slu_unlock_file -p $LOCK_PID $BIND_LOCK; fi } do_sig() { slu_unlock_file -p $LOCK_PID $BIND_LOCK; exit 0; } if_diff() { [ ! -e $2 ] || ! evalu echo \"\$$1\" | diff -Bbq - $2 >&3; } mk_fwd() { echo "# auto-generated by $IDC_PROG" echo "# $IN_interface" echo "# $IN_device" echo "# $IN_domain" echo forwarders \{; for N in $*; do echo " $N;"; done echo "};" } warn() { echo "$@" >&2;} # exec 3<>/dev/null; IDC_PROG=isp-dns-conf; P0="$IDC_PROG--bind"; update=; . sh-lock-utils|| exit; [ $# -gt 0 ]||help; # check if bind is installed hash named 2>&3|| exit 0; # check dependencies hash cat diff echo grep ln ls ps rm rndc sleep||exit; while getopts "HVXu" LR;do case $LR in H) help; break;; V) version $RCS; break;; u) update=y;; X) set -x;; \?) break;; esac;done; shift $(($OPTIND-1)); [ -z "$update" ]|| do_bind $IN_nameservers #!/bin/sh -u # /usr/local/etc/isp-dns-conf/updaters libc -ci "-vD" -- \ # This configures resolv.conf RCS='Revision: 1.25 $'; version(){ cat < # This is free software; see the GNU General Public License version 2 # or later for copying conditions. There is NO warranty. VRS exit; } help(){ warn "usage: called from $IDC_PROG" exit; } evalu() { eval "$@";} do_resolv() { LOCK_PID=$$; if [ $# -gt 0 ]; then TEMP_LOCAL="$(mk_res 127.0.0.1 $1 ${2:-})"; TEMP_NOLOCAL="$(mk_res $1 ${2:-} ${3:-})"; else warn "don't have info on resolv.conf"; return; fi trap do_sig $IDC_SIGNALS; if if_diff LOCAL || if_diff NOLOCAL && slu_lock_file -r $IDC_RETRY -p $LOCK_PID $RES_LOCK; then trap '' $IDC_SIGNALS; echo "$TEMP_LOCAL" > $RES_LOCAL; echo "$TEMP_NOLOCAL" > $RES_NOLOCAL; slu_unlock_file -p $LOCK_PID $RES_LOCK; fi } do_sig() { slu_unlock_file -p $LOCK_PID $RES_LOCK; exit 0; } if_diff() { evalu "[ ! -e \$RES_$1 ]" || ! evalu echo \"\$TEMP_$1\" | evalu diff -Bbq - \$RES_$1 >&3; } mk_res() { echo "# auto-generated by $IDC_PROG" echo "# $IN_interface" echo "# $IN_device" if [ "$IN_domain" ];then echo search $IN_domain; fi for N in "$@"; do echo nameserver $N done } warn() { echo "$@" >&2;} #exec 3<>/dev/null IDC_PROG=isp-dns-conf; P0="$IDC_PROG--libc"; update=; . sh-lock-utils|| exit; [ $# -gt 0 ]||help; # check dependencies hash cat diff echo grep ln ls rm sleep||exit; while getopts "HVXu" LR;do case $LR in H) help; break;; V) version $RCS; break;; X) set -x;; u) update=y;; \?) break;; esac;done; shift $(($OPTIND-1)); [ -z "$update" ]|| do_resolv $IN_nameservers; #!/bin/sh -u # /usr/local/sbin install-split -i "-vDb" -- \ # install split text files RCS='$Revision: 1.46 $'; version(){ cat < This is free software; see the GNU General Public License version 2 or later for copying conditions. There is NO warranty. VRS err_set; } _install(){ if check; then XLS=$( ls xx* )|| err_set&& { rbr_nxt echo "$DG :"| tee $CHG| arkiv $OLD|| err_set;}&& rbr_nxt : "$DG"&& $DG touch -t 200101010000 $NEW&& { [ -z "$DG" ]|| mv $CHG ${CHG}.debug; } fi } _reinstall(){ restor "$NEW" "$OLD";} _uninstall(){ restor "$OLD" "$NEW";} arkiv(){ xargs -r ls 2>&3| $DG cpio -ovF $1 -H newc;} check(){ if [ ! -e $CHG ]; then if [ "$MD5" ]&& [ -e "$MD5" ]; then if [ $MWC -eq `wc -c <$MD5` ]; then md5sum -vc $MD5|| err_set; else error $MD5 size is not $MWC; fi fi else error ${Oi}ed previously\?; fi } evalu(){ eval "$@"|| err_set;} error(){ warn ERROR: "$@"; err_set;} err_get(){ return $errno;} err_set(){ errno=1; return 1;} help(){ echo "USAGE: $P0-[$ONE] [ -C config_file | -o eval_options . . . ] dir" for LR in $ONE; do evalu echo \"\ -$LR\ --\ \$O$LR\";done echo "second line of each file contains: $LN2" err_set; } restor(){ if [ -e $CHG ]; then if [ $2 -ot $1 ]; then arkiv $2 <$CHG|| err_set; err_get&& $DG xargs -r rm -f <$CHG&& $DG cpio -ivmuF $1|| err_set; else error $2 is newer than $1; fi else error not ${Oi}ed; fi } rbr_nxt(){ RBR=$1; NXT="$2"; for XXN in $XLS; do if { read LN1&& read $LN2;}<$XXN&& [ "$DIR" ]&&[ "$BAS" ]&&[ "$PRM" ];then evalu xxprm $PRM; fi; done; err_get&& evalu $ERN; } warn(){ echo "$@" >&2;} opt_c(){ $RBR "$FIL";} opt_i(){ $NXT $Oi "$@" $XXN "$FIL"&& $NXT rm $XXN|| err_set;} opt_s(){ local SYM; $NXT cd "$DIR"|| return 0; for SYM in "$@"; do $RBR "$DIR/$SYM"; $NXT ln -fvs "$BAS" "$SYM"|| err_set; done $NXT cd - >&3; } xxprm(){ FIL="$DIR/$BAS"; OPTIND=1; while getopts "ci:s:$EOP" LR; do [ "$LR" = '?' ]&& break|| opt_$LR ${OPTARG:-}; done; } OH=help; OV=version; Oi=install; Or=re$Oi; Ou=un$Oi; P0="$Oi-split "; CHG=change.list; EOP=; ERN=; LN2="COM DIR BAS PRM"; MD5=; MWC=; NEW=new.cpio; OLD=old.cpio; ONE="H V i r u"; DG=; [ -z "${INSTALL_SPLIT_DEBUG:-}" ]|| DG=warn; errno=0; exec 3<>/dev/null; SN=; hash cat cpio echo install ln md5sum mv rm tee touch wc xargs|| err_set; err_get&& while getopts "C:o:X$ONE" LR; do case $LR in C) . "$OPTARG";; H) $OH;; X) set -x;; V) $OV $RCS;; [iru]) SN=O$LR;; o) evalu $OPTARG;; \?) err_set;; esac|| break; done; shift $(($OPTIND-1)); [ $# -lt 2 ]|| set_err; if err_get; then [ $# -eq 0 ]|| cd "$1"&& evalu echo $P0 \$$SN&& evalu _\$$SN; fi err_get; 8e65120046e8f2dcc08b422aa55d17e2 xx00 291147cad6be8a142dc1ae0cfd55e2f8 xx01 c098f06265e4ff41e92326029327f3b8 xx02 d3d4bbf132f1de37f7a79091b1f22a25 xx03 01d389087414791f93b75b13d61185a5 xx04 20547e9b90f7e19da510de9eda321e59 xx05 b4e51e8bf05e5edf4e5e717b482f1a58 xx06 a9f9dca7d39bc5733355325146776bf3 xx07 e3107e029ba87dff99e8b1bb2bb30de8 xx08 2583b90b83eeaf1344328ef654718b21 xx09 46fb93b43f87b653172b651b8f05867c xx10 443c4504d03992aebdb935f8b21356e4 xx11 b752af987d6a8146ae065015e3677b3b xx12