- various fixes to configure.pl and lib/BackupPC/Lib.pm
[BackupPC.git] / conf / config.pl
index d8b6ac9..e02fe27 100644 (file)
@@ -270,14 +270,27 @@ $Conf{TrashCleanSleepSec} = 300;
 $Conf{DHCPAddressRanges} = [];
 
 #
-# These configuration settings aren't used by BackupPC, but simply
-# remember a few settings used by configure.pl during installation.
-# These are used by configure.pl when upgrading to new versions of
-# BackupPC.
+# The BackupPC user.
 #
 $Conf{BackupPCUser} = '';
-$Conf{CgiDir}       = '';
-$Conf{InstallDir}   = '';
+
+#
+# Important installation directories:
+#
+#   TopDir     - where all the backup data is stored
+#   ConfDir    - where the main config and hosts files resides
+#   LogDir     - where log files and other transient information
+#   InstallDir - where the bin, lib and doc installation dirs reside.
+#                Note: you cannot change this value since all the
+#                perl scripts include this path.  You must reinstall
+#                with configure.pl to change InstallDir.
+#   CgiDir     - Apache CGI directory for BackupPC_Admin
+#
+$Conf{TopDir}      = '';
+$Conf{ConfDir}     = '';
+$Conf{LogDir}      = '';
+$Conf{InstallDir}  = '';
+$Conf{CgiDir}      = '';
 
 #
 # Whether BackupPC and the CGI script BackupPC_Admin verify that they
@@ -547,6 +560,9 @@ $Conf{ArchiveInfoKeepCnt} = 10;
 # array, and $Conf{SmbShareName} contains multiple share names, then
 # the setting is assumed to apply all shares.
 #
+# If a hash is used, a special key "*" means it applies to all
+# shares.
+#
 # Examples:
 #    $Conf{BackupFilesOnly} = '/myFiles';
 #    $Conf{BackupFilesOnly} = ['/myFiles'];     # same as first example
@@ -555,6 +571,10 @@ $Conf{ArchiveInfoKeepCnt} = 10;
 #       'c' => ['/myFiles', '/important'],      # these are for 'c' share
 #       'd' => ['/moreFiles', '/archive'],      # these are for 'd' share
 #    };
+#    $Conf{BackupFilesOnly} = {
+#       'c' => ['/myFiles', '/important'],      # these are for 'c' share
+#       '*' => ['/myFiles', '/important'],      # these are other shares
+#    };
 #
 $Conf{BackupFilesOnly} = undef;
 
@@ -590,6 +610,9 @@ $Conf{BackupFilesOnly} = undef;
 # Users report that for smbclient you should specify a directory
 # followed by "/*", eg: "/proc/*", instead of just "/proc".
 #
+# If a hash is used, a special key "*" means it applies to all
+# shares.
+#
 # Examples:
 #    $Conf{BackupFilesExclude} = '/temp';
 #    $Conf{BackupFilesExclude} = ['/temp'];     # same as first example
@@ -598,6 +621,10 @@ $Conf{BackupFilesOnly} = undef;
 #       'c' => ['/temp', '/winnt/tmp'],         # these are for 'c' share
 #       'd' => ['/junk', '/dont_back_this_up'], # these are for 'd' share
 #    };
+#    $Conf{BackupFilesExclude} = {
+#       'c' => ['/temp', '/winnt/tmp'],         # these are for 'c' share
+#       '*' => ['/junk', '/dont_back_this_up'], # these are for other shares
+#    };
 #
 $Conf{BackupFilesExclude} = undef;
 
@@ -705,7 +732,7 @@ $Conf{BackupZeroFilesIsFatal} = 1;
 #   - 'rsync':   backup and restore via rsync (via rsh or ssh).
 #                Best choice for linux/unix.  Good choice also for WinXX.
 #
-#   - 'rsyncd':  backup and restre via rsync daemon on the client.
+#   - 'rsyncd':  backup and restore via rsync daemon on the client.
 #                Best choice for linux/unix if you have rsyncd running on
 #                the client.  Good choice also for WinXX.
 #
@@ -726,6 +753,17 @@ $Conf{XferMethod} = 'smb';
 #
 $Conf{XferLogLevel} = 1;
 
+#
+# Filename charset encoding on the client.  BackupPC uses utf8
+# on the server for filename encoding.  If this is empty, then
+# utf8 is assumed and client filenames will not be modified.  If set
+# to a different encoding then filenames will be re-encoded in utf8.
+# A typical WinXX encoding for latin1/western europe is 'cp1252'.
+# Do "perldoc Encode::Supported" to see the list of possible charset
+# values, and also see http://czyborra.com/charsets/iso8859.html.
+#   
+$Conf{ClientCharset} = '';
+
 #
 # Name of the host share that is backed up when using SMB.  This can be a
 # string or an array of strings if there are multiple shares per host.
@@ -880,7 +918,7 @@ $Conf{TarShareName} = '/';
 # This setting only matters if $Conf{XferMethod} = 'tar'.
 #
 $Conf{TarClientCmd} = '$sshPath -q -x -n -l root $host'
-                    . ' $tarPath -c -v -f - -C $shareName+'
+                    . ' env LC_ALL=C $tarPath -c -v -f - -C $shareName+'
                     . ' --totals';
 
 #
@@ -937,7 +975,7 @@ $Conf{TarIncrArgs} = '--newer=$incrDate+ $fileList+';
 # restore option will be removed.
 #
 $Conf{TarClientRestoreCmd} = '$sshPath -q -x -l root $host'
-                  . ' $tarPath -x -p --numeric-owner --same-owner'
+                  . ' env LC_ALL=C $tarPath -x -p --numeric-owner --same-owner'
                   . ' -v -f - -C $shareName+';
 
 #
@@ -1132,6 +1170,63 @@ $Conf{RsyncRestoreArgs} = [
            #
 ];
 
+#
+# Share name to backup.  For $Conf{XferMethod} = "backuppcd" this should
+# be a file system path, eg '/' or '/home'.
+#
+# This can also be a list of multiple file system paths or modules.
+# (Can it??)
+#
+#     $Conf{BackupPCdShareName} = ['/', '/var', '/data', '/boot'];
+#
+$Conf{BackupPCdShareName} = '/';
+
+#
+# Path to backuppcd executable on the server
+#
+$Conf{BackupPCdPath} = '/usr/bin/backuppcd';
+
+#
+# Full command to run backuppcd on the server to backup a given
+# client machine.  The following variables are substituted at
+# run-time (TODO: update this list)
+#
+#        $host           host name being backed up
+#        $hostIP         host's IP address
+#        $shareName      share name to backup (ie: top-level directory path)
+#        $backuppcdPath  same as $Conf{BackupPCdPath}
+#        $sshPath        same as $Conf{SshPath}
+#
+# This setting only matters if $Conf{XferMethod} = 'backuppcd'.
+#
+# Arguments to backupcpd are:
+#
+#   - the host name to backup
+#   - the share name to backup
+#   - the directory where the pool is
+#   - the directory where the last run was (NOT DONE YET)
+#   - a boolean value indicating whether or not the pool is
+#      compressed or not
+#   - the directory where the new run should occur (currently it assumes ".")
+#
+$Conf{BackupPCdCmd} = '$bpcdPath $host $shareName $poolDir XXXX $poolCompress $topDir/pc/$client/new';
+
+#
+# Full command to run backuppcd on the server for restore to a
+# client machine.  The following variables are substituted at
+# run-time (TODO: update this list)
+#
+#        $host           host name being backed up
+#        $hostIP         host's IP address
+#        $shareName      share name to backup (ie: top-level directory path)
+#        $backuppcdPath  same as $Conf{BackupPCdPath}
+#        $sshPath        same as $Conf{SshPath}
+#
+# This setting only matters if $Conf{XferMethod} = 'backuppcd'.
+#
+$Conf{BackupPCdRestoreCmd} = '$bpcdPath TODO';
+
+
 #
 # Archive Destination
 #
@@ -1344,7 +1439,7 @@ $Conf{CompressLevel} = 0;
 # Despite the name, this parameter sets the timeout for all transport
 # methods (tar, smb etc).
 #
-$Conf{ClientTimeout} = 7200;
+$Conf{ClientTimeout} = 72000;
 
 #
 # Maximum number of log files we keep around in each PC's directory
@@ -1583,6 +1678,14 @@ $Conf{EMailNotifyOldOutlookDays} = 5.0;
 $Conf{EMailOutlookBackupSubj} = undef;
 $Conf{EMailOutlookBackupMesg} = undef;
 
+#
+# Additional email headers
+#
+$Conf{EMailHeaders} = <<EOF;
+MIME-Version: 1.0
+Content-Type: text/plain; charset="iso-8859-1"
+EOF
+
 ###########################################################################
 # CGI user interface configuration settings
 # (can be overridden in the per-PC config.pl)
@@ -1751,9 +1854,21 @@ $Conf{CgiImageDirURL} = '';
 #
 $Conf{CgiCSSFile} = 'BackupPC_stnd.css';
 
+#
+# Whether the user is allowed to edit their per-PC config.
+#
+$Conf{CgiUserConfigEditEnable} = 1;
+
 #
 # Which per-host config variables a non-admin user is allowed
-# to edit.
+# to edit.  Admin users can edit all per-host config variables,
+# even if disabled in this list.
+#
+# SECURITY WARNING: Do not let users edit any of the Cmd
+# config variables!  That's because a user could set a
+# Cmd to a shell script of their choice and it will be
+# run as the BackupPC user.  That script could do all
+# sorts of bad things.
 #
 $Conf{CgiUserConfigEdit} = {
         FullPeriod                => 1,
@@ -1774,14 +1889,20 @@ $Conf{CgiUserConfigEdit} = {
         BlackoutGoodCnt           => 1,
         BlackoutPeriods           => 1,
         BackupZeroFilesIsFatal    => 1,
+        ClientCharset             => 1,
         XferMethod                => 1,
         XferLogLevel              => 1,
         SmbShareName              => 1,
         SmbShareUserName          => 1,
         SmbSharePasswd            => 1,
+        SmbClientFullCmd          => 0,
+        SmbClientIncrCmd          => 0,
+        SmbClientRestoreCmd       => 0,
         TarShareName              => 1,
         TarFullArgs               => 1,
         TarIncrArgs               => 1,
+        TarClientCmd              => 0,
+        TarClientRestoreCmd       => 0,
         RsyncShareName            => 1,
         RsyncdClientPort          => 1,
         RsyncdPasswd              => 1,
@@ -1789,16 +1910,30 @@ $Conf{CgiUserConfigEdit} = {
         RsyncCsumCacheVerifyProb  => 1,
         RsyncArgs                 => 1,
         RsyncRestoreArgs          => 1,
+        RsyncClientCmd            => 0,
+        RsyncClientRestoreCmd     => 0,
         ArchiveDest               => 1,
         ArchiveComp               => 1,
         ArchivePar                => 1,
         ArchiveSplit              => 1,
+        ArchiveClientCmd          => 0,
         FixedIPNetBiosNameCheck   => 1,
+        NmbLookupCmd              => 0,
+        NmbLookupFindHostCmd      => 0,
         PingMaxMsec               => 1,
+        PingCmd                   => 0,
         ClientTimeout             => 1,
         MaxOldPerPCLogFiles       => 1,
         CompressLevel             => 1,
         ClientNameAlias           => 1,
+        DumpPreUserCmd            => 0,
+        DumpPostUserCmd           => 0,
+        RestorePreUserCmd         => 0,
+        RestorePostUserCmd        => 0,
+        ArchivePreUserCmd         => 0,
+        ArchivePostUserCmd        => 0,
+        DumpPostShareCmd          => 0,
+        DumpPreShareCmd           => 0,
         EMailNotifyMinDays        => 1,
         EMailFromUserName         => 1,
         EMailAdminUserName        => 1,
@@ -1811,4 +1946,5 @@ $Conf{CgiUserConfigEdit} = {
         EMailNotifyOldOutlookDays => 1,
         EMailOutlookBackupSubj    => 1,
         EMailOutlookBackupMesg    => 1,
+        EMailHeaders              => 1,
 };