Forum archive
TKLPatch for Bacula [Updated]
Ok, we needed a backup appliance, and after looking at the two best offerings, I went with bacula. As always, my work is based on a one or two days research of the software, so experienced bacula users are invited to step in and comment about best practices, test the patch and give constructive feedback.
Features:
Bacula backup installed from ubuntu's repository.
Webacula web frontend for easy management. (convenience)
securewebacula script to set admin password and allowed network access to webacula. (convenience)
http and https access enabled.
Webmin module for Bacula installed. (convenience)
What it does:
1. Set Hostname to bacula
HOSTNAME=bacula echo "$HOSTNAME" > /etc/hostname sed -i "s|127.0.1.1 \(.*\)|127.0.1.1 $HOSTNAME|" /etc/hosts hostname bacula
2. Update package information
apt-get update
3. Install required packages. Note that bacula-server is installed after to prevent an error if mysql-server is still not running.
install mysql-server zendframework php5-gd bacula-console php5-mysql webmin-bacula-backup install bacula-server
4. Download webacula web interface. I extracted the file to /var/www and renamed the directory to /var/www/webacula
cd /usr/src wget -O webacula.tar.gz http://sourceforge.net/projects/webacula/files/webacula/5.0.2/webacula-5.0.2.tar.gz/download tar xzf webacula.tar.gz -C /var/www/ mv /var/www/webacula-5.0.2/ /var/www/webacula
5. Install webacula: Run database scripts, link Zend framework and set some application and php settings.
/var/www/webacula/install/webacula_mysql_create_database.sh /var/www/webacula/install/webacula_mysql_make_tables.sh ln -s /usr/share/php/Zend/ /var/www/webacula/library/ usermod -aG bacula www-data sed -i "s/max_execution_time = 30/max_execution_time = 600/" /etc/php5/apache2/php.ini sed -i "s|/usr/bin/sudo||" /var/www/webacula/application/config.ini sed -i "s|/sbin/bconsole|/usr/bin/bconsole|" /var/www/webacula/application/config.ini
6. Enable apache modules. For ssl access and rewrite module required by webacula
a2enmod rewrite ssl a2ensite default-ssl
7. Create user admin and set password for /webacula. We are using apache's basic authentication here.
htpasswd -c -b /etc/apache2/webacula.users admin turnkey
8. Stop mysql and apache2, to prevent conflicts.
service mysql stop service apache2 stop
9. Clean apt cache and sources.
rm -f /usr/src/webacula.tar.gz cleanup_apt
securewebacula script:
The following is the content of this script, which overlays to /usr/local/bin, and basically ask a password and allowed networks to access the webacula application and issues a htpasswd command to change the password and replaces the Allow from entry of webacula's apache conf located in /etc/apache2/conf.d/webacula.conf. Comments are welcome.
#!/bin/bash
# Script to secure access to webacula application
# by Adrian Moya
echo "This script will secure access to /webacula con this server"
echo
while [[ $PASSWD = "" ]]; do
stty -echo
read -p "Password for admin: " PASSWD; echo
stty echo
if [[ $PASSWD = "" ]]; then
echo "This password can't be blank"
fi
done
echo
echo "Please set allowed network access to webacula"
echo "You can use Apache Allow Directive values here"
echo "Examples: if your network ip range is 192.168.1.x"
echo "Allow access from your current network (recommended): 192.168.1.0/24"
echo "More info at http://httpd.apache.org/docs/2.0/mod/mod_access.html#allow"
echo
while [[ $ALLOWFROM = "" ]]; do
read -p "Which ip's or domains can access webacula: " ALLOWFROM
if [[ $ALLOWFROM = "" ]]; then
echo "This field can't be blank"
fi
done
echo
htpasswd -b /etc/apache2/webacula.users admin $PASSWD
echo "Updating Allow directive for /webacula"
sed -r -i "s|Allow from .*|Allow from $ALLOWFROM|" /etc/apache2/conf.d/webacula.conf
service apache2 reloadEnjoy!
I forgot in the first published version to add the webmin module. So I've added it to give support to this frontend. It looks real nice.
Note: I didn't re-run tests after adding the module, so if you have any issue please post asap. :)