Managing SSH chroots to backup a lot of machines
Go to file
2020-04-11 08:54:01 +02:00
docs Don't instruct to use a specific branch when installing manually 2020-04-11 08:41:36 +02:00
lib bkctld-rm: log incs to be deleted 2020-04-11 08:41:04 +02:00
test Bad firewall now returns a simple Warning 2020-04-11 08:53:41 +02:00
tpl Use lastlog in sshrc 2019-01-28 17:51:41 -05:00
.gitignore Add a Vagrantfile for test with Vagrant 2018-03-05 14:15:23 +01:00
bash_completion Subcommand list are now dynamic in bash completion 2019-01-28 17:51:41 -05:00
bkctld bkctld: auto-detect lib directory 2020-04-08 17:53:28 +02:00
bkctld.8 Fix default bkctld.conf path in docs 2019-01-29 10:48:52 -05:00
bkctld.conf bkctld.conf: Add NODE by default 2019-03-18 16:50:06 +01:00
bkctld.conf.5 Fix default bkctld.conf path in docs 2019-01-29 10:48:52 -05:00
bkctld.service Transform bkctld SysVinit script into systemd oneshot service 2019-01-28 17:51:41 -05:00
CHANGELOG.md Add tests for Buster (ext4/btrfs) 2020-04-11 08:54:01 +02:00
check-incs.sh check-incs.sh : whitespaces and braces 2019-12-15 18:52:09 +01:00
check-last-incs.sh check-last-incs.sh : new script to quickly check last inc for jails 2019-12-15 18:54:57 +01:00
evobackup-incl.5 Switch documentation to mdoc(7) 2019-01-02 13:45:21 -05:00
LICENSE fix file name 2017-08-05 17:33:00 -04:00
README.md shellcheck improvements for bats tests 2020-04-08 16:49:27 +02:00
Vagrantfile Add tests for Buster (ext4/btrfs) 2020-04-11 08:54:01 +02:00
zzz_evobackup revert zzz_evobackup commit mistake 2020-04-01 09:24:58 +02:00

Bkctld (aka evobackup)

Bkctld is a shell script that creates and manages a backup server which can handle the backups of many other servers (clients). It is licensed under the AGPLv3.

It uses SSH chroots (called "jails" in the FreeBSD world) to sandbox every clients backups. Each client will upload it's data every day using rsync in it's chroot (using the root account). Prior backups are stored incrementally outside of the chroot using hard links or BTRFS snapshots. (So they can not be affected by the client).

Using this method, we can keep a large quantity of backups of each client securely and efficiently.

                                    Backup server
                                    ************
Server 1 ------ SSH/rsync ------->  * tcp/2222 *
                                    *          *
Server 2 ------ SSH/rsync ------->  * tcp/2223 *
                                    ************

This method uses standard tools (ssh, rsync, cp -al, btrfs subvolume) and has been used for many years by Evolix to backup hundreds of servers, totaling many terabytes of data, each day. bkctld has been tested on Debian Jessie and should be compatible with other Debian versions or derived distributions like Ubuntu.

A large enough volume must be mounted on /backup, we recommend the usage of BTRFS so you can use sub-volumes and snapshots. This volume can also be encrypted with LUKS.

Install

See the installation guide for instructions.

Testing

You can deploy test environments with Vagrant :

vagrant up

Deployment

Launch rsync-auto in a terminal for automatic synchronization of your local code with Vagrant VM :

vagrant rsync-auto

Bats

You can run bats tests with the test provision :

vagrant provision --provision-with test

You can also run the tests from inside the VM

localhost $ vagrant ssh test
vagrant@test $ sudo -i
root@test # bats /vagrant/test/*.bats

You should shellcheck your bats files, but with shellcheck > 0.4.6, because the 0.4.0 version doesn't support bats syntax.

Usage

See docs/usage.md.

The man(1) page, in troff(7) language, can be generated with pandoc:

pandoc -f markdown \
	-t man usage.md \
	--template default.man \
	-V title=bkctld \
	-V section=8 \
	-V date="$(date '+%d %b %Y')" \
	-V footer="$(git describe --tags)" \
	-V header="bkctld man page"

Client configuration

You can save various systems in the evobackup jails : Linux, BSD, Windows, MacOSX. The only prerequisite is the rsync command.

rsync -av -e "ssh -p SSH_PORT" /home/ root@SERVER_NAME:/var/backup/home/

An example synchronization script is present in zzz_evobackup, clone the evobackup repository and read the CLIENT CONFIGURATION section of the manual.

git clone https://forge.evolix.org/evobackup.git
cd evobackup
man ./docs/bkctld.8