What is it?
iBackup simplifies backing up the system configuration files (/etc) for UNIX systems (Solaris, *BSD, Linux). You can run the program from any directory, it will by default save the (maybe compressed) tarball to /root. It is possible to encrypt the tarball, to upload the tarball to some other host and run this backup automated in a cronjob. You could also send the backup by mail, using nail.
You might want to check the man pages of tar(1), scp(1), gzip(1), compress(1), ncftp(1), openssl(1) and kimmo.suominen.com/ssh/ for an introduction to ssh/scp with public/private keys. You can also generate reports about the running system, which look like this.
Installation and configuration
gzip -dc ibackup-2.27.tar.gz | tar -xvf -
make install install-config
$EDITOR /etc/ibackup.conf
Dependencies
GNU Bash (recommended)
OpenSSH (recommended)
Usage
Run ibackup with one or more of the following parameters:
linux save system configuration of Linux (Debian, Slackware)
solaris save system configuration of Solaris
bsd save system configuration of FreeBSD, NetBSD and OpenBSD
sysconf generate and save a HTML system configuration report, example
mysql-fs save MySQL configuration and db (filesystem) mysql-dump save MySQL configuration and db (dump)
postgresql-fs save PostgreSQL configuration and db (filesystem)
postgresql-dump save PostgreSQL configuration and db (dump)
apache save Apache configuration
squid save Squid configuration
bind save Bind configuration
pks save OpenPGP Public Key Server configuration and data
mailman save Mailman configuration and data
aide save AIDE configuration
raptor save Raptor/Symantec Firewall configuration
viruswall save Trend Micro Interscan Viruswall configuration checkpoint save Checkpoint Firewall configuration
ipso save Checkpoint and system configuration of Nokia IPSO citrix save Citrix ICA Client configuration sb_fullcluster save Stonebeat Fullcluster configuration sb_servercluster save Stonebeat Servercluster configuration finjan save Finjan Surfingate configuration
rainfinity save Rainfinity configuration --compress compress the tarball
--dont-compress don't compress the tarball
--encrypt | -e encrypt the tarball
--upload | -u upload the tarball (scp/ftp)
--dont-upload don't upload the tarball
Running iBackup without parameter gives you a list of available configurations. You should check the source to add your own parameters (things to backup or exclude). When restoring make sure you are in /, unpacking in /pub would restore your backups in there.
Output
iBackup will produce a tarball named like this hostname_date_time.tar[.gz|.Z] including all the configuration files you specify as parameters.
Example
root@silverhorse:~ ibackup linux sysconf
root@silverhorse:~ ls -la
-rw------- 1 root root 158269 Jan 15 14:59 silverhorse_15011963_1459.tar.gz
root@silverhorse:~# _
Setting up a cronjob
This will set up a cronjob for a quarter past 6 am daily.
root@silverhorse:~ export EDITOR=mcedit
root@silverhorse:~ crontab -e
15 6 * * * /usr/bin/ibackup linux apache postgresql-dump > /dev/null 2>&1
15 6 * * * (/usr/bin/sysconf 2>/dev/null | mail -a "Content-type: text/html" -s "System Report" jolly@jumper.net)
root@silverhorse:~# crontab -l
15 6 * * * /usr/bin/ibackup linux apache postgresql-dump > /dev/null 2>&1
15 6 * * * (/usr/bin/sysconf 2>/dev/null | mail -a "Content-type: text/html" -s "System Report" jolly@jumper.net)
root@silverhorse:~# _
Can I add support for other configurations? Of course you can, just edit /usr/bin/ibackup to fit your needs, if you think your changes might be useful for others, don't hesitate to send them to me. Let us have a look at the mysql-fs example case $@ in mysql-fs)
pre="/etc/init.d/mysql stop"
post="/etc/init.d/mysql start"
dir="$dir var/lib/mysql etc/mysql";;
esac
We define the variable pre which is executed before we create the tarball (here we stop the database). The post variable says what to do after we have created our backup (in this example start the database). In the dir variable we define what paths or files we want to backup, it is important to not have a / at the beginning (for example etc, not /etc). You can exclude files by writing them to /tmp/excludes (for example "echo etc/shadow >> /tmp/excludes").
Restore from a backup
Following command restores the complete etc directory to /
cd /
gzip -dc silverhorse_15011963_1459.tar.gz | tar -xvf - etc
I Thank
mcduke on fn (#macdev) for making the logo (even when he was dead tired)
ORBman from #windowmaker for giving me security related tips and telling me about openssl
mentor (my hero) from #debian for fixing the upload bug
