8affddc52d
Fixes the following things: 1. Sanitizes log output to prevent an attacker from using a specially crafted POST to add extra lines to the log 2. Simplify a regular expression since "..file" cannot be used to escape the current directory 3. Makes sure directories are consistent 4. Correct logic issues in misc/cronjobs/backup.sh Thanks to Frere Sebastien Marie for catching these issues. Signed-off-by: Robin Sheat <robin@catalyst.net.nz> Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
23 lines
870 B
Bash
Executable file
23 lines
870 B
Bash
Executable file
#!/bin/sh
|
|
# Script to create daily backups of the Koha database.
|
|
# Based on a script by John Pennington
|
|
BACKUPDIR=`xmlstarlet sel -t -v 'yazgfs/config/backupdir' $KOHA_CONF`
|
|
KOHA_DATE=`date '+%y%m%d'`
|
|
KOHA_BACKUP=$BACKUPDIR/koha-$KOHA_DATE.sql.gz
|
|
|
|
mysqldump --single-transaction -u koha -ppassword koha | gzip -9 > $KOHA_BACKUP
|
|
|
|
#mv $KOHA_BACKUP /home/kohaadmin &&
|
|
#chown kohaadmin.users /home/kohaadmin/koha-$KOHA_DATE.dump.gz &&
|
|
#chmod 600 /home/kohaadmin/koha-$KOHA_DATE.dump.gz &&
|
|
# Makes the compressed dump file property of the kohaadmin user.
|
|
# Make sure that you replace kohaadmin with a real user.
|
|
|
|
if [ -f $KOHA_BACKUP ] ; then
|
|
echo "$KOHA_BACKUP was successfully created." | mail kohaadmin -s $KOHA_BACKUP
|
|
else
|
|
echo "$KOHA_BACKUP was NOT successfully created." | mail kohaadmin -s $KOHA_BACKUP
|
|
fi
|
|
|
|
# Notifies kohaadmin of (un)successful backup creation
|
|
# EOF
|