Commits

Anonymous committed 549d8f7

[svn r29] Add passwd as well as IP authentication, add tests to makefile

Comments (0)

Files changed (4)

 Allow from 172.16.0.0/12
 Allow from 10.0.0.0/8
 
+AuthType Basic
+AuthName "Recovery Console"
+#you may need to change this in a production env depending on the apache setup
+AuthUserFile /var/www/backups/.htpasswd
+Require valid-user
+
+
+
 DirectoryIndex recovery.php
+sreiner:0J6RNyEjbfJ7w
+mszabo:2htxpH4uO.EWo
+tdavies:Ua8UVdlxtX7Mw
+sgr:Xl83lFWTdKE2c
+
 	sudo chown root:root backup-controller
 	sudo chmod a+x backup-controller
 	sudo chmod ug+s backup-controller
+
+test : backup-controller
+	./backup-controller -b isenguard2 -b jasper -s florey2 -s chain -s edoras -s onyx -p onyx:222 check
 CONFDIR=~/.rsync-backup-config
 
 #what date is it? (to name any backups created now)
-NOW="$(date "+%Y-%m-%d" )"
+#use pre-defined value because this may be a recursive call made at 00:00:01 AM
+NOW="${BACKUP_CONTROLLER_NOW:-$(date "+%Y-%m-%d" )}"
 
 #Declare associative arrays
 declare -A HOST_FILES
 	done
     fi
     read -p "Make a copy of ${RLOC/%\/}/${tree/#\/} before replacing? [suffix, leave blank for no copy] " -ei "~" KEEP_COPY
-    "$0" -t "$date" -b "$bHost" -s "$host:$tree" -r "$RLOC" -v "$KEEP_COPY" "${X[@]}" restore 
+    BACKUP_CONTROLLER_NOW="$NOW" "$0" -t "$date" -b "$bHost" -s "$host:$tree" -r "$RLOC" -v "$KEEP_COPY" "${X[@]}" restore 
     echo
     echo "Copy any files you need from ${RLOC/%\/}/${tree/#\/}"
     [ "$KEEP_COPY" ] && \
 
 #Handle Options
 
-while getopts ":s:b:d:r:t:x:l:v:eihwnz" OPT ; do
+while getopts ":s:b:d:r:t:x:l:v:p:eihwnz" OPT ; do
 
     case "$OPT" in
 	h) # HELP!
 		ACTIONS+=(backup)
 	    fi
 	    for action in "${ACTIONS[@]}" ; do 
-		"$0" plan "$file" "$action"
+		 BACKUP_CONTROLLER_NOW="$NOW" "$0" plan "$file" "$action"
 	    done
 	else 
 	    # if a secondary action is specified (e.g. $0 plan /path/to/planfile clean),
 		EXTRA+=(-t "- $keepFor")
 	    fi
 	    #echo executing: "$0" -l "$file" "${EXTRA[@]}" "${P[@]}" "${S[@]}" "${B[@]}" "${X[@]}" "$action"
-	    "$0" -l "$file" "${EXTRA[@]}" "${P[@]}" "${S[@]}" "${B[@]}" "${X[@]}" "${action[@]}"
+	     BACKUP_CONTROLLER_NOW="$NOW" "$0" -l "$file" "${EXTRA[@]}" "${P[@]}" "${S[@]}" "${B[@]}" "${X[@]}" "${action[@]}"
 	fi
 	;;
     batch) # handle multiple plans seqentially 
 	#this is the safest way to handle multiple plans as each plan requires exclusive access to the BAKDIRs of the backup hosts
 	for file in "$@" ; do
-	    "$0" plan "$file" all
+	     BACKUP_CONTROLLER_NOW="$NOW" "$0" plan "$file" all
 	done
 	;;
     interactive)
 	    EXTRA=("-x" "$OTHER_BAKDIRS")
 	fi
 
-	"$0" -s "$HOSTS:$1" -b "$DSTS" -t "$RTIME" -r "$localhost:$tmp" "${EXTRA[@]}" restore >&2
+	 BACKUP_CONTROLLER_NOW="$NOW" "$0" -s "$HOSTS:$1" -b "$DSTS" -t "$RTIME" -r "$localhost:$tmp" "${EXTRA[@]}" restore >&2
 	cd "$tmp/$(dirname "$1")"
 	if [ -z "$ZIP" ] ; then
 	    tar -cf - "$(basename "$1")" | gzip