wok-next rev 1357

Add: BoxBackup automatic on-line backup system
author Dominique Corbex <domcox@users.sourceforge.net>
date Tue Sep 09 22:18:22 2008 +0200 (2008-09-09)
parents d5be027602dd
children 30037287225e
files boxbackup-client/description.txt boxbackup-client/receipt boxbackup-client/stuff/bbackupd boxbackup-server/description.txt boxbackup-server/receipt boxbackup-server/stuff/bbstored
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/boxbackup-client/description.txt	Tue Sep 09 22:18:22 2008 +0200
     1.3 @@ -0,0 +1,22 @@
     1.4 +BoxBackup Client (bbackupd)
     1.5 +
     1.6 +BoxBackup is designed to be easy to set up and run, and cheap to use. 
     1.7 +Once set up, there should be no need for user or administrative 
     1.8 +intervention, apart from usual system maintenance.
     1.9 +
    1.10 +bbackupd is configured with a list of directories to back up. It has a 
    1.11 +lazy approach to backing up data. Every so often, the directories are 
    1.12 +scanned, and new data is uploaded to the server. 
    1.13 +
    1.14 +The daemon is always running, although sleeping most of the time. In 
    1.15 +lazy mode, it is completely self contained - scripts running under cron 
    1.16 +jobs are not used.
    1.17 +
    1.18 +If an old version of the file is present on the server, a modified 
    1.19 +version of the rsync algorithm is used to upload only the changed 
    1.20 +portions of the file.
    1.21 +
    1.22 +After a new version is uploaded, the old version is still available 
    1.23 +(subject to disc space on the server). Similarly, a deleted file is 
    1.24 +still available. The only limit to their availability is space allocated 
    1.25 +to this account on the server.
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/boxbackup-client/receipt	Tue Sep 09 22:18:22 2008 +0200
     2.3 @@ -0,0 +1,80 @@
     2.4 +# SliTaz package receipt.
     2.5 +
     2.6 +PACKAGE="boxbackup-client"
     2.7 +VERSION="0.10"
     2.8 +CATEGORY="network"
     2.9 +SHORT_DESC="Client for the BoxBackup on-line backup system"
    2.10 +MAINTAINER="domcox@users.sourceforge.net"
    2.11 +DEPENDS="db libedit openssl perl zlib"
    2.12 +SOURCE="boxbackup"
    2.13 +WANTED="boxbackup-server"
    2.14 +WEB_SITE="http://www.boxbackup.org/"
    2.15 +
    2.16 +# Configuration variables                                                                                                    
    2.17 +CONF_DIR="/etc/box"
    2.18 +DATA_DIR="/var/lib/bbackupd"
    2.19 +RUN_DMON=0
    2.20 +
    2.21 +# Rules to gen a SliTaz package suitable for Tazpkg
    2.22 +genpkg_rules()
    2.23 +{
    2.24 + 	_pkg=$WOK/$WANTED/${SOURCE}-$VERSION/parcels/boxbackup-${VERSION}-backup-client-linux-gnu
    2.25 +	mkdir -p $fs/usr/bin
    2.26 +	cp -a $_pkg/bb* $fs/usr/bin
    2.27 +	mkdir -p $fs/etc/init.d
    2.28 +	cp -a stuff/bbackupd $fs/etc/init.d
    2.29 +}
    2.30 +
    2.31 +# Pre and post install commands for Tazpkg
    2.32 +
    2.33 +pre_install()
    2.34 +{
    2.35 +	# Stop daemon
    2.36 +	if [ -e /var/run/bbackupd.pid ]; then
    2.37 +		/etc/init.d/bbackupd stop
    2.38 +		RUN_DMON=1
    2.39 +	fi
    2.40 +}
    2.41 +
    2.42 +post_install()
    2.43 +{
    2.44 +	# Creating conf dir
    2.45 +	if [ ! -e $CONF_DIR ]; then
    2.46 +	    mkdir -p $CONF_DIR && chmod 755 $CONF_DIR
    2.47 +	fi
    2.48 +	if [ ! -e $DATA_DIR ]; then
    2.49 +	    mkdir -p $DATA_DIR && chmod 700 $DATA_DIR
    2.50 +	fi
    2.51 +	# Start daemon (if stopped by install)
    2.52 +	if [ $RUN_DMON -eq 1 ]; then
    2.53 +		/etc/init.d/bbackupd start
    2.54 +	fi
    2.55 +}
    2.56 +
    2.57 +# Pre and post remove commands for Tazpkg
    2.58 +
    2.59 +pre_remove()
    2.60 +{
    2.61 +    # Stop daemon
    2.62 +	if [ -e /var/run/bbackupd.pid ]; then
    2.63 +		/etc/init.d/bbackupd stop
    2.64 +	fi
    2.65 +}
    2.66 +
    2.67 +post_remove()
    2.68 +{
    2.69 +	# Delete DATA directory
    2.70 +	rm -rf $DATA_DIR
    2.71 +
    2.72 +	# Delete Client config files
    2.73 +	rm -rf $CONF_DIR/bbackupd*
    2.74 +
    2.75 +	# Delete CONF dir (if empty)
    2.76 +	if [ `ls $CONF_DIR | wc -l` -eq 0 ]; then
    2.77 +		echo -n "Removing $CONF_DIR..."
    2.78 +		rm -rf $CONF_DIR
    2.79 +		status
    2.80 +	fi
    2.81 +	# Delete PID, sock files
    2.82 +	rm -f /var/run/bbackupd.*
    2.83 +}
    2.84 \ No newline at end of file
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/boxbackup-client/stuff/bbackupd	Tue Sep 09 22:18:22 2008 +0200
     3.3 @@ -0,0 +1,55 @@
     3.4 +#!/bin/sh
     3.5 +# /etc/init.d/bbackupd: Start, stop and restart bbackupd deamon on SliTaz, at boot
     3.6 +# time or with the command line.
     3.7 +#
     3.8 +# To start daemon at boot time, just put the right name in the $RUN_DAEMONS
     3.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
    3.10 +#
    3.11 +. /etc/init.d/rc.functions
    3.12 +. /etc/daemons.conf
    3.13 +
    3.14 +NAME=BBackupd
    3.15 +DESC="BoxBackup deamon"
    3.16 +DAEMON=/usr/bin/bbackupd
    3.17 +OPTIONS=$BBSTORED_OPTIONS
    3.18 +PIDFILE=/var/run/bbackupd.pid
    3.19 +
    3.20 +case "$1" in
    3.21 +  start)
    3.22 +    if [ -f $PIDFILE ] ; then
    3.23 +      echo "$NAME already running."
    3.24 +      exit 1
    3.25 +    fi
    3.26 +    echo -n "Starting $DESC: $NAME... "
    3.27 +    $DAEMON $OPTIONS > /dev/null
    3.28 +    status
    3.29 +    ;;
    3.30 +  stop)
    3.31 +    if [ ! -f $PIDFILE ] ; then
    3.32 +      echo "$NAME is not running."
    3.33 +      exit 1
    3.34 +    fi
    3.35 +    echo -n "Stopping $DESC: $NAME... "
    3.36 +    kill `cat $PIDFILE`
    3.37 +    status
    3.38 +    ;;
    3.39 +  restart)
    3.40 +    if [ ! -f $PIDFILE ] ; then
    3.41 +      echo "$NAME is not running."
    3.42 +      exit 1
    3.43 +    fi
    3.44 +    echo -n "Restarting $DESC: $NAME... "
    3.45 +    kill `cat $PIDFILE`
    3.46 +    sleep 2
    3.47 +    $DAEMON $OPTIONS > /dev/null
    3.48 +    status
    3.49 +    ;;
    3.50 +  *)
    3.51 +    echo ""
    3.52 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    3.53 +    echo ""
    3.54 +    exit 1
    3.55 +    ;;
    3.56 +esac
    3.57 +
    3.58 +exit 0
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/boxbackup-server/description.txt	Tue Sep 09 22:18:22 2008 +0200
     4.3 @@ -0,0 +1,37 @@
     4.4 +Server for the BoxBackup on-line backup system.
     4.5 +
     4.6 +Box Backup is an open source, completely automatic, on-line backup system. 
     4.7 +It has the following key features:
     4.8 +
     4.9 +    * All backed up data is stored on the server in files on a filesystem - 
    4.10 +      no tape, archive or other special devices are required. 
    4.11 +
    4.12 +    * The server is trusted only to make files available when they are 
    4.13 +      required - all data is encrypted and can be decoded only by the 
    4.14 +      original client. This makes it ideal for backing up over an untrusted 
    4.15 +      network (such as the Internet), or where the server is in an 
    4.16 +      uncontrolled environment. 
    4.17 +
    4.18 +    * A backup daemon runs on systems to be backed up, and copies encrypted 
    4.19 +      data to the server when it notices changes - so backups are continuous 
    4.20 +      and up-to-date (although traditional snapshot backups are possible too). 
    4.21 +
    4.22 +    * Only changes within files are sent to the server, just like rsync, 
    4.23 +      minimising the bandwidth used between clients and server. This makes it 
    4.24 +      particularly suitable for backing up between distant locations, or over 
    4.25 +      the Internet. 
    4.26 +
    4.27 +    * It behaves like tape - old file versions and deleted files are available. 
    4.28 +
    4.29 +    * Old versions of files on the server are stored as changes from the 
    4.30 +      current version, minimising the storage space required on the server. 
    4.31 +      Files are the server are also compressed to minimise their size. 
    4.32 +
    4.33 +    * Choice of backup behaviour - it can be optimised for document or server 
    4.34 +      backup. 
    4.35 +
    4.36 +    * It is designed to be easy and cheap to run a server. It has a portable 
    4.37 +      implementation, and optional RAID implemented in userland for reliability 
    4.38 +      without complex server setup or expensive hardware. 
    4.39 +
    4.40 +Box Backup is distributed under a BSD license. 
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/boxbackup-server/receipt	Tue Sep 09 22:18:22 2008 +0200
     5.3 @@ -0,0 +1,180 @@
     5.4 +# SliTaz package receipt.
     5.5 +
     5.6 +PACKAGE="boxbackup-server"
     5.7 +VERSION="0.10"
     5.8 +CATEGORY="network"
     5.9 +SHORT_DESC="Server for the BoxBackup on-line backup system"
    5.10 +MAINTAINER="domcox@users.sourceforge.net"
    5.11 +DEPENDS="db libedit openssl perl zlib"
    5.12 +BUILD_DEPENDS="db-dev libedit-dev openssl-dev zlib-dev"
    5.13 +SOURCE="boxbackup"
    5.14 +TARBALL="$SOURCE-$VERSION.tgz"
    5.15 +WEB_SITE="http://www.boxbackup.org/"
    5.16 +WGET_URL="$SF_MIRROR/$SOURCE/$TARBALL"
    5.17 +
    5.18 +# Configuration variables
    5.19 +HOSTNAME=`ifconfig | awk -F ":" '/cast/ {print substr($2,0, index($2," ")-1) }'`
    5.20 +CONF_DIR="/etc/box"
    5.21 +DATA_DIR="/var/lib/bbstored"
    5.22 +CA_DIR="${CONF_DIR}/ca"
    5.23 +BBUSER="bbstored"
    5.24 +
    5.25 +# Rules to configure and make the package.
    5.26 +compile_rules()
    5.27 +{
    5.28 +	cd $src
    5.29 +	./configure --prefix=/usr $CONFIGURE_ARGS
    5.30 +	make
    5.31 +}
    5.32 +
    5.33 +# Rules to gen a SliTaz package suitable for Tazpkg.
    5.34 +genpkg_rules()
    5.35 +{
    5.36 +	_pkg=$WOK/$PACKAGE/${SOURCE}-${VERSION}/parcels/boxbackup-${VERSION}-backup-server-linux-gnu
    5.37 +	mkdir -p $fs/usr/bin
    5.38 +	cp -a $_pkg/bb* $fs/usr/bin
    5.39 +	cp -a $_pkg/ra* $fs/usr/bin
    5.40 +	mkdir -p $fs/etc/init.d
    5.41 +	cp -a stuff/bbstored $fs/etc/init.d
    5.42 +}
    5.43 +
    5.44 +
    5.45 +# Pre and post install commands for Tazpkg.
    5.46 +
    5.47 +pre_install()
    5.48 +{
    5.49 +	# Stop daemon
    5.50 +	if [ -e /var/run/bbstored.pid ]; then
    5.51 +		/etc/init.d/bbstored stop
    5.52 +	fi
    5.53 +}
    5.54 +
    5.55 +post_install()
    5.56 +{
    5.57 +	# adduser BBUSER if needed
    5.58 +	if  ! grep -q $BBUSER $1/etc/passwd; then
    5.59 +		echo -n "Adding user '$BBUSER'..."
    5.60 +		echo $BBUSER':x:505:505:BoxBackup Network Backup:/dev/null:/bin/false' >> $1/etc/passwd
    5.61 +		echo $BBUSER':!:14013:0:99999:7:::' >> $1/etc/shadow
    5.62 +		echo $BBUSER':x:505:' >> $1/etc/group
    5.63 +		echo $BBUSER':!::' >> $1/etc/gshadow
    5.64 +		status
    5.65 +	fi
    5.66 +
    5.67 +	# Create config is needed
    5.68 +	if [ ! -e $CONF_DIR ]; then
    5.69 +		mkdir -p $CONF_DIR && chown $BBUSER $CONF_DIR && chmod 700 $CONF_DIR
    5.70 +	fi
    5.71 +
    5.72 +	if [ ! -e $DATA_DIR/backup ]; then
    5.73 +		# Creating backup dir
    5.74 +		echo -n "Creating backup directory..."
    5.75 +		mkdir -p $DATA_DIR/backup && chown -R $BBUSER $DATA_DIR && chmod -R 700 $DATA_DIR
    5.76 +		status
    5.77 +	fi
    5.78 +
    5.79 +	if [ ! -e $CONF_DIR/raidfile.conf ]; then
    5.80 +		# RAID Setup
    5.81 +		echo -n "Disabling deprecated userland RAID..."
    5.82 +		/usr/bin/raidfile-config $CONF_DIR 2048 $DATA_DIR 2>1 > /dev/null
    5.83 +		status
    5.84 +		chown -R $BBUSER $CONF_DIR/raidfile.conf && chmod 700 -R $CONF_DIR/raidfile.conf
    5.85 +	fi
    5.86 +
    5.87 +	if [ ! -e $CONF_DIR/bbstored.conf ]; then
    5.88 +		# Setting hostname
    5.89 +		echo -n "Setting hostname... "
    5.90 +		if [ `hostname -f 2>1 > /dev/null;echo $?` -eq 0 ]; then
    5.91 +		HOSTNAME=`hostname -f`
    5.92 +		fi
    5.93 +		if [ -z $HOSTNAME ]; then
    5.94 +			HOSTNAME="127.0.0.1"
    5.95 +		fi
    5.96 +		echo $HOSTNAME
    5.97 +
    5.98 +		# Setting up the CA environment
    5.99 +		echo -n "Creating certificates..."
   5.100 +		/usr/bin/bbstored-certs $CA_DIR init 2>1 > /dev/null
   5.101 +		status
   5.102 +
   5.103 +		# Generate server certificate request
   5.104 +		echo -n "Generate server certificate request..."
   5.105 +		bbstored-config $CONF_DIR $HOSTNAME $BBUSER 2>1 > /dev/null
   5.106 +		status
   5.107 +
   5.108 +		# Sign the server certificate
   5.109 +		echo -n "Sign the server certificate..."
   5.110 +		openssl x509 -req -sha1 -extensions usr_crt \
   5.111 +			-in $CONF_DIR/$BBUSER/${HOSTNAME}-csr.pem \
   5.112 +			-CA $CA_DIR/roots/serverCA.pem \
   5.113 +			-CAkey $CA_DIR/keys/serverRootKey.pem \
   5.114 +			-out $CA_DIR/servers/${HOSTNAME}-cert.pem \
   5.115 +			-days 5000 2>1 > /dev/null
   5.116 +		status
   5.117 +
   5.118 +		# Preparing the server certificates
   5.119 +		echo -n "Installing server certificate..."
   5.120 +	    cp -a $CA_DIR/servers/${HOSTNAME}-cert.pem $CONF_DIR/$BBUSER
   5.121 +		status
   5.122 +		echo -n "Installing client certificate..."
   5.123 +		cp -a $CA_DIR/roots/clientCA.pem $CONF_DIR/$BBUSER
   5.124 +		status
   5.125 +
   5.126 +		# Securing $CONF_DIR
   5.127 +		chown -R $BBUSER $CONF_DIR/bbstored* && chmod 700 -R $CONF_DIR/bbstored*
   5.128 +	fi
   5.129 +
   5.130 +	if [ -e $CA_DIR ]; then
   5.131 +		# Warning
   5.132 +		echo
   5.133 +		echo "IMPORTANT NOTE:"
   5.134 +		echo "--------------"
   5.135 +		echo "The certificate authority directory $CA_DIR is intended to be"
   5.136 +		echo "moved to another system. It should not be kept on the backup server"
   5.137 +		echo "to limit the impact of a server compromise."
   5.138 +	fi
   5.139 +}
   5.140 +
   5.141 +# Pre and post remove commands for Tazpkg
   5.142 +
   5.143 +pre_remove()
   5.144 +{
   5.145 +	/etc/init.d/bbstored stop
   5.146 +}
   5.147 +
   5.148 +post_remove()
   5.149 +{
   5.150 +	if  grep -q $BBUSER $1/etc/passwd; then
   5.151 +		echo -n "Removing $BBUSER user..."
   5.152 +		deluser bbstored
   5.153 +		status
   5.154 +	fi
   5.155 +	# Delete data
   5.156 +	if [ -e $DATA_DIR ]; then
   5.157 +		echo -n "Removing all backup data..."
   5.158 +		rm -r $DATA_DIR
   5.159 +		status
   5.160 +	fi
   5.161 +	# Delete bbstored conf files
   5.162 +	if [ -e $CONF_DIR/bbstored.conf ]; then
   5.163 +		echo -n "Removing config files..."
   5.164 +		rm -rf $CONF_DIR/bbstored
   5.165 +		rm -f $CONF_DIR/raidfile.conf
   5.166 +		rm -f $CONF_DIR/bbstored.conf
   5.167 +		status
   5.168 +	fi
   5.169 +	# Delete certificates
   5.170 +	if [ -e $CA_DIR ]; then
   5.171 +		echo -n "Removing certificates..."
   5.172 +        rm -r $CA_DIR
   5.173 +		status
   5.174 +    fi
   5.175 +	# Delete $CONF_DIR (if empty)
   5.176 +	if [ `ls $CONF_DIR | wc -l` -eq 0 ]; then
   5.177 +		echo -n "Removing $CONF_DIR..."
   5.178 +		rm -r $CONF_DIR
   5.179 +		status
   5.180 +	fi
   5.181 +	# Delete PID, sock files
   5.182 +	rm -f /var/run/bbstored.*
   5.183 +}
   5.184 \ No newline at end of file
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/boxbackup-server/stuff/bbstored	Tue Sep 09 22:18:22 2008 +0200
     6.3 @@ -0,0 +1,55 @@
     6.4 +#!/bin/sh
     6.5 +# /etc/init.d/bbstored: Start, stop and restart bbstored deamon on SliTaz, at boot
     6.6 +# time or with the command line.
     6.7 +#
     6.8 +# To start daemon at boot time, just put the right name in the $RUN_DAEMONS
     6.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
    6.10 +#
    6.11 +. /etc/init.d/rc.functions
    6.12 +. /etc/daemons.conf
    6.13 +
    6.14 +NAME=BBstored
    6.15 +DESC="BoxBackup server deamon"
    6.16 +DAEMON=/usr/bin/bbstored
    6.17 +OPTIONS=$BBSTORED_OPTIONS
    6.18 +PIDFILE=/var/run/bbstored.pid
    6.19 +
    6.20 +case "$1" in
    6.21 +  start)
    6.22 +    if [ -f $PIDFILE ] ; then
    6.23 +      echo "$NAME already running."
    6.24 +      exit 1
    6.25 +    fi
    6.26 +    echo -n "Starting $DESC: $NAME... "
    6.27 +    $DAEMON $OPTIONS > /dev/null
    6.28 +    status
    6.29 +    ;;
    6.30 +  stop)
    6.31 +    if [ ! -f $PIDFILE ] ; then
    6.32 +      echo "$NAME is not running."
    6.33 +      exit 1
    6.34 +    fi
    6.35 +    echo -n "Stopping $DESC: $NAME... "
    6.36 +    kill `cat $PIDFILE`
    6.37 +    status
    6.38 +    ;;
    6.39 +  restart)
    6.40 +    if [ ! -f $PIDFILE ] ; then
    6.41 +      echo "$NAME is not running."
    6.42 +      exit 1
    6.43 +    fi
    6.44 +    echo -n "Restarting $DESC: $NAME... "
    6.45 +    kill `cat $PIDFILE`
    6.46 +    sleep 2
    6.47 +    $DAEMON $OPTIONS > /dev/null
    6.48 +    status
    6.49 +    ;;
    6.50 +  *)
    6.51 +    echo ""
    6.52 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    6.53 +    echo ""
    6.54 +    exit 1
    6.55 +    ;;
    6.56 +esac
    6.57 +
    6.58 +exit 0