evobackup/docs/bkctld.8

286 lines
5.7 KiB
Groff

.\" Manpage for bkctld.
.\" Contact vlaborie@evolix.fr to correct errors or typos.
.TH man 8 "11 Janvier 2017" "1.0" "bkctld man page"
.SH NAME
bkctld - tool to manage evobackup jail
.SH SYNOPSIS
bkctld <command> [<args>]
.SH DESCRIPTION
bkctld is a shell script used to set up and manage a backup server able to receive data from many servers (clients).
.PP
The aim is to run a SSH chroot environment (called "jails" in the FreeBSD world) for every single client. The client will then be able to send data over SSH using rsync in his own chroot environment (using root account).
.PP
Incrementals are stored outside the chroot using hard links or btrfs snapshots (thus incrementals are not accessible by clients). This method has the advantage to keep incrementals securely isolated using low space on device.
.PP
A suitable volume size must be mounted on /backup (usage of **btrfs** is preferable, providing subvolume and snapshot fonctionnality). For security reason, you can use an encrypted volume (e.g. **luks**)
.PP
.SH BKCTLD COMMANDS
bkctld init <jailname>
.RS 4
Create an evobackup jail.
.RE
.PP
bkctld update <jailname>|all
.RS 4
Update an evobackup jail or all.
.RE
.PP
bkctld remove <jailname>|all
.RS 4
Remove an evobackup jail or all.
.RE
.PP
bkctld start <jailname>|all
.RS 4
Start an evobackup jail or all.
.RE
.PP
bkctld stop <jailname>|all
.RS 4
Stop an evobackup jail or all.
.RE
.PP
bkctld reload <jailname>|all
.RS 4
Reload an evobackup jail or all.
.RE
.PP
bkctld restart <jailname>|all
.RS 4
Restart an evobackup jail or all.
.RE
.PP
bkctld sync <jailname>|all
.RS 4
Sync an evobackup jail or all.
.RE
.RS 4
Second server is defined by $NODE var in /etc/default/bkctld.
.RE
.PP
bkctld status [<jailname>]
.RS 4
Print status of all evobackup jail or one jail.
.RE
.PP
bkctld key <jailname> [<keyfile>]
.RS 4
Print or set the SSH public key of an evobackup jail.
.RE
.PP
bkctld port <jailname> [<ssh_port>|auto]
.RS 4
Print or set the SSH port of an evobackup jail.
.RE
.RS 4
Auto to set next available port (last + 1).
.RE
.PP
bkctld ip <jailname> [<ip>|all]
.RS 4
Print or set allowed IP of an evobackup jail.
.RE
.RS 4
All for unrestricted access (default).
.RE
.PP
bkctld inc
.RS 4
Generate inc of an evobackup jail.
.RE
.PP
bkctld rm
.RS 4
Remove old inc of an evobackup jail.
.RE
.PP
.SH CONFIGURATION VARS
bkctld configuration has to be set in /etc/default/bkctld file.
.SH REQUIREDS VARS
Default required vars are defined in bkctld script. Alter them to override default values.
.RE
.PP
CONFDIR
.RS 4
Dir where incremental backup is configured. See INCS CONFIGURATION section for details.
.RE
.RS 4
default : /etc/evobackup
.RE
.PP
JAILDIR
.RS 4
Dir for jail's root dir. BTRFS recommended.
.RE
.RS 4
default : /backup/jails
.RE
.PP
INCDIR
.RS 4
Dir where incremental backup is stored. BTRFS recommended.
default : /backups/incs
.RE
.PP
TPLDIR
.RS 4
Dir where jail template file is stored.
.RE
.RS 4
default : /usr/share/bkctld
.RE
.PP
LOG_DIR
.RS 4
Emplacement of log directory.
.RE
.RS 4
default : /var/log
.RE
.PP
.SH OPTIONALS VARS
Optionnals vars are no default value. No set them desactivate correspondant fonctionnality.
.RE
.PP
NOTIF_MAIL
.RS 4
Mail address were notification mail will be set.
.RE
.RS 4
Default : no mail notification
.RE
.PP
FIREWALL_RULES
.RS 4
Configuration file were firewall was configured to allow jail access. This file must be sourced by your firewall configuration tool.
.RE
.RS 4
Default : no firewall auto configuration
.SH INCS CONFIGURATION
Incremental backups was configured in $CONFDIR/<jailname>. Some example of syntax.
.RE
.PP
Keep the incrememtal backup of today
.RS 4
+%Y-%m-%d.-0day
.RE
.PP
Keep the incremental backup of yesterday
.RS 4
+%Y-%m-%d.-1day
.RE
.PP
Keep the incremental backup of the first day of this month
.RS 4
+%Y-%m-01.-0month
.RE
.PP
Keep the incremental backup of the first day of last month
.RS 4
+%Y-%m-01.-1month
.RE
.PP
Keep the incremental backup of every 15 days
.RS 4
+%Y-%m-01.-1month
.RE
.RS 4
+%Y-%m-15.-1month
.RE
.PP
Keep the incremental backup of the first january
.RS 4
+%Y-01-01.-1month
.RE
.PP
.PP
Default value : keep incremental of last 4 days and last 2 months. Change default in $TPLDIR/inc.tpl.
+%Y-%m-%d.-0day
+%Y-%m-%d.-1day
+%Y-%m-%d.-2day
+%Y-%m-%d.-3day
+%Y-%m-01.-0month
+%Y-%m-01.-1month
.SH CLIENT CONFIGURATION
You can save various systems on evobackup jail : Linux, BSD, Windows, MacOSX. Only prequisites is rsync command.
.PP
.RS 4
rsync -av -e "ssh -p SSH_PORT" /home/ root@SERVER_NAME:/var/backup/home/
.PP
.RE
You can simply create a shell script which use rsync for backup your's servers. An example script is available in docs/zzz_evobackup for quickstart.
.RE
.PP
This documentation explain how to use this example script.
.PP
Install example script in crontab :
.PP
.RS 4
# For Linux
.RE
.RS 4
install -v -m700 zzz_evobackup /etc/cron.daily/
.PP
# For FreeBSD
.RE
.RS 4
install -v -m700 zzz_evobackup /etc/periodic/daily/
.PP
.RE
Generate an SSH key for root account with no passphrase :
.PP
.RS 4
ssh-keygen
.RE
.PP
Sent /root/.ssh/id_rsa.pub to backup server administrator or read BKCTLD COMMANDS section.
.PP
Edit zzz_evobackup script and update this variables :
.PP
.RS 4
SSH_PORT
.RS 4
Port of corespondant evobackup jail.
.RE
.PP
SYSTEME
.RS 4
Linux or BSD.
.RE
.PP
MAIL
.RS 4
Email address for notification.
.RE
.PP
NODE
.RS 4
Use for alternate between mutiple backup servers.
.RE
.RS 4
Default value permit to save on node0 on pair day and on node1 on impair day.
.RE
.PP
SRV
.RS 4
Adress of your backup serveur.
.RE
.RE
.PP
Uncomment service dump, ex Mysql / LDAP / PostgreQL / ...
.PP
Itiniate SSH connection and validate fingerprint :
.PP
.RS 4
ssh -p SSH_PORT SERVER_NAME
.RE
.PP
Your daily evobackup is in place !
.PP
.SH SEE ALSO
rsync(1), sshd(8), chroot(8)
.SH AUTHOR
Victor Laborie (vlaborie@evolix.fr)