initial commit of file from CVS for smeserver-BackupPC on Sat Sep 7 20:10:07 AEST 2024
This commit is contained in:
parent
2bf47720f7
commit
26a891845f
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
*.rpm
|
||||||
|
*.log
|
||||||
|
*spec-20*
|
||||||
|
*.tar.xz
|
21
Makefile
Normal file
21
Makefile
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Makefile for source rpm: smeserver-BackupPC
|
||||||
|
# $Id: Makefile,v 1.1 2020/10/26 14:35:58 brianr Exp $
|
||||||
|
NAME := smeserver-BackupPC
|
||||||
|
SPECFILE = $(firstword $(wildcard *.spec))
|
||||||
|
|
||||||
|
define find-makefile-common
|
||||||
|
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||||
|
endef
|
||||||
|
|
||||||
|
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||||
|
|
||||||
|
ifeq ($(MAKEFILE_COMMON),)
|
||||||
|
# attept a checkout
|
||||||
|
define checkout-makefile-common
|
||||||
|
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||||
|
endef
|
||||||
|
|
||||||
|
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
||||||
|
endif
|
||||||
|
|
||||||
|
include $(MAKEFILE_COMMON)
|
17
README.md
17
README.md
@ -1,3 +1,18 @@
|
|||||||
# smeserver-BackupPC
|
# <img src="https://www.koozali.org/images/koozali/Logo/Png/Koozali_logo_2016.png" width="25%" vertical="auto" style="vertical-align:bottom"> smeserver-BackupPC
|
||||||
|
|
||||||
SMEServer Koozali developed git repo for smeserver-BackupPC smecontribs
|
SMEServer Koozali developed git repo for smeserver-BackupPC smecontribs
|
||||||
|
|
||||||
|
## Wiki
|
||||||
|
<br />https://wiki.koozali.org/BackupPC
|
||||||
|
<br />https://wiki.koozali.org/BackupPC/fr
|
||||||
|
<br />https://wiki.koozali.org/BackupPC-4.2
|
||||||
|
<br />https://wiki.koozali.org/SME-101.09:_Supplément:_SME_&_BackupPC-4.2
|
||||||
|
|
||||||
|
## Bugzilla
|
||||||
|
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-BackupPC&product=SME%20Contribs&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
<br />*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
|
||||||
|
*Once it has been checked, then this comment will be deleted*
|
||||||
|
<br />
|
||||||
|
48
additional/createlinks.sav
Normal file
48
additional/createlinks.sav
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use esmith::Build::CreateLinks qw(:all);
|
||||||
|
|
||||||
|
# Start and stop links
|
||||||
|
|
||||||
|
service_link_enhanced("backuppc", "S98", "7");
|
||||||
|
service_link_enhanced("backuppc", "K10", "6");
|
||||||
|
service_link_enhanced("backuppc", "K10", "0");
|
||||||
|
service_link_enhanced("backuppc", "K10", "1");
|
||||||
|
|
||||||
|
service_link_enhanced("httpd-bkpc", "S86", "7");
|
||||||
|
service_link_enhanced("httpd-bkpc", "K15", "6");
|
||||||
|
service_link_enhanced("httpd-bkpc", "K15", "0");
|
||||||
|
service_link_enhanced("httpd-bkpc", "K15", "1");
|
||||||
|
|
||||||
|
safe_symlink("../daemontools" , 'root/etc/rc.d/init.d/supervise/httpd-bkpc');
|
||||||
|
safe_symlink("/var/service/httpd-bkpc" , 'root/service/httpd-bkpc');
|
||||||
|
|
||||||
|
# Panel links
|
||||||
|
|
||||||
|
panel_link("backuppc", 'manager');
|
||||||
|
|
||||||
|
# Various symlinks
|
||||||
|
|
||||||
|
|
||||||
|
# Event symlinks
|
||||||
|
|
||||||
|
my $event = 'backuppc-update';
|
||||||
|
templates2events("/etc/httpd/conf/httpd.conf", $event);
|
||||||
|
templates2events("/etc/sudoers", $event);
|
||||||
|
templates2events("/etc/httpd/bkpc-conf/httpd.conf", qw(backuppc-update bootstrap-console-save));
|
||||||
|
|
||||||
|
event_link("backuppc-checkupgrade", $event, "20");
|
||||||
|
event_link("backuppc-genkey", $event, "10");
|
||||||
|
event_link("backuppc-checkupgrade", "post-upgrade", "91");
|
||||||
|
event_link("backuppc-genkey", "post-upgrade", "90");
|
||||||
|
|
||||||
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/backuppc");
|
||||||
|
safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
|
||||||
|
safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-bkpc");
|
||||||
|
safe_symlink("sigusr1", "root/etc/e-smith/events/logrotate/services2adjust/httpd-bkpc");
|
||||||
|
|
||||||
|
# Create needed empty files
|
||||||
|
safe_touch("root/etc/e-smith/events/logrotate/logfiles2timestamp/var/log/httpd/bkpc_access_log");
|
||||||
|
safe_touch("root/etc/e-smith/events/logrotate/logfiles2timestamp/var/log/httpd/bkpc_error_log");
|
||||||
|
safe_touch("root/var/service/httpd-bkpc/down");
|
||||||
|
|
1
contriborbase
Normal file
1
contriborbase
Normal file
@ -0,0 +1 @@
|
|||||||
|
contribs10
|
66
createlinks
Normal file
66
createlinks
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use esmith::Build::CreateLinks qw(:all);
|
||||||
|
|
||||||
|
# Start and stop links - SME9
|
||||||
|
|
||||||
|
#service_link_enhanced("backuppc", "S98", "7");
|
||||||
|
#service_link_enhanced("backuppc", "K10", "6");
|
||||||
|
#service_link_enhanced("backuppc", "K10", "0");
|
||||||
|
#service_link_enhanced("backuppc", "K10", "1");
|
||||||
|
|
||||||
|
#service_link_enhanced("httpd-bkpc", "S86", "7");
|
||||||
|
#service_link_enhanced("httpd-bkpc", "K15", "6");
|
||||||
|
#service_link_enhanced("httpd-bkpc", "K15", "0");
|
||||||
|
#service_link_enhanced("httpd-bkpc", "K15", "1");
|
||||||
|
|
||||||
|
#safe_symlink("../daemontools" , 'root/etc/rc.d/init.d/supervise/httpd-bkpc');
|
||||||
|
#safe_symlink("/var/service/httpd-bkpc" , 'root/service/httpd-bkpc');
|
||||||
|
|
||||||
|
# Panel links
|
||||||
|
|
||||||
|
panel_link("backuppc", 'manager');
|
||||||
|
|
||||||
|
# Various symlinks
|
||||||
|
|
||||||
|
|
||||||
|
# Event symlinks
|
||||||
|
|
||||||
|
# our event specific for updating with yum without reboot
|
||||||
|
$event = 'smeserver-BackupPC-update'; #Must match rpm name
|
||||||
|
foreach my $file (qw(/etc/systemd/system-preset/49-koozali.preset
|
||||||
|
/etc/httpd/conf/httpd.conf
|
||||||
|
/etc/sudoers
|
||||||
|
/etc/httpd/bkpc-conf/httpd.conf
|
||||||
|
/etc/updatedb.conf
|
||||||
|
))
|
||||||
|
{
|
||||||
|
templates2events( $file, $event );
|
||||||
|
}
|
||||||
|
#action needed in case we have a systemd unit
|
||||||
|
event_link("systemd-default", $event, "10");
|
||||||
|
event_link("systemd-reload", $event, "50");
|
||||||
|
#action specific to this package
|
||||||
|
event_link("backuppc-checkupgrade", $event, "20");
|
||||||
|
event_link("backuppc-genkey", $event, "10");
|
||||||
|
event_link("backuppc-checkupgrade", "post-upgrade", "91");
|
||||||
|
event_link("backuppc-genkey", "post-upgrade", "90");
|
||||||
|
#services we need to restart
|
||||||
|
#safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/backuppc");
|
||||||
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
|
||||||
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/httpd-bkpc");
|
||||||
|
safe_symlink("restart", "root/etc/e-smith/events/logrotate/services2adjust/httpd-bkpc");
|
||||||
|
|
||||||
|
# Create needed empty files
|
||||||
|
safe_touch("root/etc/e-smith/events/logrotate/logfiles2timestamp/var/log/httpd/bkpc_access_log");
|
||||||
|
safe_touch("root/etc/e-smith/events/logrotate/logfiles2timestamp/var/log/httpd/bkpc_error_log");
|
||||||
|
safe_touch("root/var/service/httpd-bkpc/down");
|
||||||
|
|
||||||
|
|
||||||
|
use esmith::Build::Backup qw(:all);
|
||||||
|
backup_includes("smeserver-BackupPC", qw(
|
||||||
|
/etc/BackupPC
|
||||||
|
));
|
||||||
|
# warning this could be a symlink to an external drive
|
||||||
|
# also this will not backup the whole backups, but who would do that by default ?
|
||||||
|
# /var/lib/BackupPC
|
40
root/etc/BackupPC/localArchive.conf
Normal file
40
root/etc/BackupPC/localArchive.conf
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# Destination directory, where the archive will be created
|
||||||
|
destination = /tmp/
|
||||||
|
|
||||||
|
# Split size in MBytes. If different from 0, the archive will be cut at this size
|
||||||
|
split = 0
|
||||||
|
|
||||||
|
# Compression. Can be gzip, bzip2 or none
|
||||||
|
compress = gzip
|
||||||
|
|
||||||
|
# Encryption of the archives, using OpenSSL
|
||||||
|
# You can put here the name of the cipher you want to use
|
||||||
|
# To obtain a list of available cipher, run the command
|
||||||
|
# man enc
|
||||||
|
# eg: cipher = aes-256-cbc
|
||||||
|
# If encryption is turned on, .enc will be appended
|
||||||
|
# At the end of the archive's name.
|
||||||
|
# To be able tu use this archive talter, you'll have to
|
||||||
|
# decrypt it using the same key
|
||||||
|
# cat archive.tar.gz.enc | openssl enc aes-256-cbc -d -pass file:/etc/BackupPC/archive.key > archive.tar.gz
|
||||||
|
cipher = off
|
||||||
|
|
||||||
|
# The key file to use to encrypt the archive
|
||||||
|
# You should backup this key somewhere. If you lost it
|
||||||
|
# your archives will be unusuable
|
||||||
|
key = /etc/BackupPC/archive.key
|
||||||
|
|
||||||
|
# The backup number to archive, -1 means the last one
|
||||||
|
backupNum = -1
|
||||||
|
|
||||||
|
# The share to archive
|
||||||
|
share = '*'
|
||||||
|
|
||||||
|
# The amount of parity (using par2)
|
||||||
|
parity = 0
|
||||||
|
|
||||||
|
# The hosts to archive, separate them with a space eg: localhost server1 server2
|
||||||
|
hosts = localhost
|
||||||
|
|
||||||
|
# The user who will receive the log of the archive, you can set a email address out of the server if you want
|
||||||
|
sendMailTo = admin
|
17
root/etc/BackupPC/localCopyPool.conf
Normal file
17
root/etc/BackupPC/localCopyPool.conf
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Destination directory, where the pool will be copied
|
||||||
|
destination = /tmp/
|
||||||
|
|
||||||
|
# The source directory, the topdir of the data
|
||||||
|
source = /var/lib/BackupPC
|
||||||
|
|
||||||
|
# Compression used for the "pc" archive. Can be gzip, bzip2 or none
|
||||||
|
compress = gzip
|
||||||
|
|
||||||
|
# If you want to extract the "pc" archive on the destination, can be set to 'yes' or 'no'
|
||||||
|
extract = yes
|
||||||
|
|
||||||
|
# Stop BackupPC daemon. You should let this to 'yes' unless you use something like LVM snapshots
|
||||||
|
stop = yes
|
||||||
|
|
||||||
|
# The user who will receive the log of the archive, you can set a email address out of the server if you want
|
||||||
|
sendMailTo = admin
|
32
root/etc/BackupPC/pc/localserver-template.pl
Normal file
32
root/etc/BackupPC/pc/localserver-template.pl
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
$Conf{RsyncShareName} = [
|
||||||
|
'/'
|
||||||
|
];
|
||||||
|
$Conf{BackupFilesExclude} = {
|
||||||
|
'/' => [
|
||||||
|
'/var/lib/BackupPC',
|
||||||
|
'/proc',
|
||||||
|
'/tmp',
|
||||||
|
'/sys',
|
||||||
|
'/dev',
|
||||||
|
'/boot',
|
||||||
|
'/mnt',
|
||||||
|
'/media',
|
||||||
|
'/selinux',
|
||||||
|
'/aquota.*',
|
||||||
|
'/lost+found',
|
||||||
|
'/initrd',
|
||||||
|
'/var/tmp',
|
||||||
|
'/var/lib/mysql'
|
||||||
|
]
|
||||||
|
};
|
||||||
|
$Conf{DumpPreUserCmd} = '/usr/bin/sudo /usr/share/BackupPC/bin/BackupPC_SME_pre-backup';
|
||||||
|
$Conf{XferMethod} = 'rsync';
|
||||||
|
$Conf{RsyncClientCmd} = '/usr/bin/sudo $rsyncPath $argList+';
|
||||||
|
$Conf{RsyncClientRestoreCmd} = '/usr/bin/sudo $rsyncPath $argList+';
|
||||||
|
$Conf{ClientNameAlias} = '127.0.0.1';
|
||||||
|
$Conf{BackupsDisable} = 1;
|
||||||
|
$Conf{RsyncSshArgs} = [
|
||||||
|
'-e',
|
||||||
|
'/usr/bin/sudo -p'
|
||||||
|
];
|
||||||
|
|
26
root/etc/BackupPC/pc/smeserver-template.pl
Normal file
26
root/etc/BackupPC/pc/smeserver-template.pl
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
$Conf{RsyncShareName} = [
|
||||||
|
'/'
|
||||||
|
];
|
||||||
|
$Conf{BackupFilesExclude} = {
|
||||||
|
'/' => [
|
||||||
|
'/var/lib/BackupPC/',
|
||||||
|
'/proc',
|
||||||
|
'/tmp',
|
||||||
|
'/sys',
|
||||||
|
'/dev',
|
||||||
|
'/boot',
|
||||||
|
'/mnt',
|
||||||
|
'/media',
|
||||||
|
'/selinux',
|
||||||
|
'/aquota.*',
|
||||||
|
'/lost+found',
|
||||||
|
'/initrd',
|
||||||
|
'/var/tmp',
|
||||||
|
'/var/lib/mysql',
|
||||||
|
'/var/spool/squid'
|
||||||
|
]
|
||||||
|
};
|
||||||
|
$Conf{DumpPreUserCmd} = '$sshPath -l root $host /sbin/e-smith/signal-event pre-backup';
|
||||||
|
$Conf{XferMethod} = 'rsync';
|
||||||
|
$Conf{BackupsDisable} = 1;
|
||||||
|
|
38
root/etc/BackupPC/pc/windows-template.pl
Normal file
38
root/etc/BackupPC/pc/windows-template.pl
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
$Conf{ClientCharset} = 'cp1252';
|
||||||
|
$Conf{RsyncShareName} = [
|
||||||
|
'cDrive'
|
||||||
|
];
|
||||||
|
$Conf{RsyncdPasswd} = 'secret';
|
||||||
|
$Conf{RsyncdUserName} = 'backuppc';
|
||||||
|
$Conf{XferMethod} = 'rsyncd';
|
||||||
|
$Conf{BackupFilesExclude} = {
|
||||||
|
'*' => [
|
||||||
|
'*/hiberfil.sys',
|
||||||
|
'*/pagefile.sys',
|
||||||
|
'*/WUTemp',
|
||||||
|
'*/RECYCLER',
|
||||||
|
'*/UsrClass.dat',
|
||||||
|
'*/UsrClass.dat.LOG',
|
||||||
|
'*/NTUSER.DAT',
|
||||||
|
'*/NTUSER.DAT.LOG',
|
||||||
|
'*/Temporary?Internet?Files/*',
|
||||||
|
'*/Documents?and?Settings/*/Recent',
|
||||||
|
'*/Cache',
|
||||||
|
'*/parent.lock',
|
||||||
|
'*/Thumbs.db',
|
||||||
|
'*/IconCache.db',
|
||||||
|
'*/System?Volume?Information',
|
||||||
|
'*/Temp/*',
|
||||||
|
'*.tmp',
|
||||||
|
'*.bak',
|
||||||
|
'*/WINDOWS/system32/config/SYSTEM',
|
||||||
|
'*/WINDOWS/system32/config/SOFTWARE',
|
||||||
|
'*/WINDOWS/system32/config/SECURITY',
|
||||||
|
'*/WINDOWS/system32/config/SECURITY.LOG',
|
||||||
|
'*/WINDOWS/system32/config/SAM',
|
||||||
|
'*/WINDOWS/system32/config/SAM.LOG',
|
||||||
|
'*/WINDOWS/system32/config/DEFAULT',
|
||||||
|
]
|
||||||
|
};
|
||||||
|
$Conf{BackupsDisable} = 1;
|
||||||
|
|
41
root/etc/BackupPC/remoteArchive.conf
Normal file
41
root/etc/BackupPC/remoteArchive.conf
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# The host you to send archives to
|
||||||
|
remoteHost = remote.host.com
|
||||||
|
|
||||||
|
# The remote user to use for the ssh connection
|
||||||
|
remoteUser = root
|
||||||
|
|
||||||
|
# Destination directory, where the archive will be created
|
||||||
|
remoteDir = /tmp/
|
||||||
|
|
||||||
|
# Compression. Can be gzip, bzip2 or none
|
||||||
|
compress = gzip
|
||||||
|
|
||||||
|
# Encryption of the archives, using OpenSSL
|
||||||
|
# You can put here the name of the cipher you want to use
|
||||||
|
# To obtain a list of available cipher, run the command
|
||||||
|
# man enc
|
||||||
|
# eg: cipher = aes-256-cbc
|
||||||
|
# If encryption is turned on, .enc will be appended
|
||||||
|
# At the end of the archive's name.
|
||||||
|
# To be able tu use this archive talter, you'll have to
|
||||||
|
# decrypt it using the same key
|
||||||
|
# cat archive.tar.gz.enc | openssl enc aes-256-cbc -d -pass file:/etc/BackupPC/archive.key > archive.tar.gz
|
||||||
|
cipher = off
|
||||||
|
|
||||||
|
# The key file to use to encrypt the archive
|
||||||
|
# You should backup this key somewhere. If you lost it
|
||||||
|
# your archives will be unusuable
|
||||||
|
key = /etc/BackupPC/archive.key
|
||||||
|
|
||||||
|
# The backup number to archive, -1 means the last one
|
||||||
|
backupNum = -1
|
||||||
|
|
||||||
|
# The share to archive
|
||||||
|
share = '*'
|
||||||
|
|
||||||
|
# The hoststo archive, separate them with a space eg: localhost server1 server2
|
||||||
|
hosts = localhost
|
||||||
|
|
||||||
|
# The user who will receive the log of the archive, you can set a email address out of the server if you want
|
||||||
|
sendMailTo = admin
|
||||||
|
|
23
root/etc/BackupPC/remoteCopyPool.conf
Normal file
23
root/etc/BackupPC/remoteCopyPool.conf
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# The host you to send the pool to
|
||||||
|
remoteHost = remote.host.com
|
||||||
|
|
||||||
|
# The remote user to use for the ssh connection
|
||||||
|
remoteUser = root
|
||||||
|
|
||||||
|
# Destination directory, where the archive will be created
|
||||||
|
remoteDir = /tmp/
|
||||||
|
|
||||||
|
# The source directory, the topdir of the data
|
||||||
|
source = /var/lib/BackupPC
|
||||||
|
|
||||||
|
# Compression used for the "pc" archive. Can be gzip, bzip2 or none
|
||||||
|
compress = gzip
|
||||||
|
|
||||||
|
# If you want to extract the "pc" archive on the destination, can be set to 'yes' or 'no'
|
||||||
|
extract = yes
|
||||||
|
|
||||||
|
# Stop BackupPC daemon. You should let this to 'yes' unless you use something like LVM snapshots
|
||||||
|
stop = yes
|
||||||
|
|
||||||
|
# The user who will receive the log of the archive, you can set a email address out of the server if you want
|
||||||
|
sendMailTo = admin
|
40
root/etc/BackupPC/usbArchive.conf
Normal file
40
root/etc/BackupPC/usbArchive.conf
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# The device you want to use, where the archive will be created
|
||||||
|
device = /dev/sdc1
|
||||||
|
|
||||||
|
# Split size in MBytes. If different from 0, the archive will be cut at this size
|
||||||
|
split = 0
|
||||||
|
|
||||||
|
# Compression. Can be gzip, bzip2 or none
|
||||||
|
compress = gzip
|
||||||
|
|
||||||
|
# Encryption of the archives, using OpenSSL
|
||||||
|
# You can put here the name of the cipher you want to use
|
||||||
|
# To obtain a list of available cipher, run the command
|
||||||
|
# man enc
|
||||||
|
# eg: cipher = aes-256-cbc
|
||||||
|
# If encryption is turned on, .enc will be appended
|
||||||
|
# At the end of the archive's name.
|
||||||
|
# To be able tu use this archive talter, you'll have to
|
||||||
|
# decrypt it using the same key
|
||||||
|
# cat archive.tar.gz.enc | openssl enc aes-256-cbc -d -pass file:/etc/BackupPC/archive.key > archive.tar.gz
|
||||||
|
cipher = off
|
||||||
|
|
||||||
|
# The key file to use to encrypt the archive
|
||||||
|
# You should backup this key somewhere. If you lost it
|
||||||
|
# your archives will be unusuable
|
||||||
|
key = /etc/BackupPC/archive.key
|
||||||
|
|
||||||
|
# The backup number to archive, -1 means the last one
|
||||||
|
backupNum = -1
|
||||||
|
|
||||||
|
# The share to archive
|
||||||
|
share = '*'
|
||||||
|
|
||||||
|
# The amount of parity (using par2)
|
||||||
|
parity = 0
|
||||||
|
|
||||||
|
# The hoststo archive, separate them with a space eg: localhost server1 server2
|
||||||
|
hosts = localhost
|
||||||
|
|
||||||
|
# The user who will receive the log of the archive, you can set a email address out of the server if you want
|
||||||
|
sendMailTo = admin
|
18
root/etc/BackupPC/usbCopyPool.conf
Normal file
18
root/etc/BackupPC/usbCopyPool.conf
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# The device you want to use, where the archive will be created
|
||||||
|
device = /dev/sdc1
|
||||||
|
|
||||||
|
# Compression to use for the "pc" archive. Can be gzip, bzip2 or none
|
||||||
|
compress = gzip
|
||||||
|
|
||||||
|
# The source directory, the topdir of the data
|
||||||
|
source = /var/lib/BackupPC
|
||||||
|
|
||||||
|
# If you want to extract the "pc" archive on the destination, can be set to 'yes' or 'no'
|
||||||
|
extract = yes
|
||||||
|
|
||||||
|
# Stop BackupPC daemon. You should let this to 'yes' unless you use something like LVM snapshots
|
||||||
|
stop = yes
|
||||||
|
|
||||||
|
# The user who will receive the log of the archive, you can set a email address out of the server if you want
|
||||||
|
sendMailTo = admin
|
||||||
|
|
1
root/etc/e-smith/db/accounts/defaults/backuppc/type
Normal file
1
root/etc/e-smith/db/accounts/defaults/backuppc/type
Normal file
@ -0,0 +1 @@
|
|||||||
|
system
|
@ -0,0 +1 @@
|
|||||||
|
enabled
|
@ -0,0 +1 @@
|
|||||||
|
enabled
|
1
root/etc/e-smith/db/configuration/defaults/backuppc/sudo
Normal file
1
root/etc/e-smith/db/configuration/defaults/backuppc/sudo
Normal file
@ -0,0 +1 @@
|
|||||||
|
/usr/bin/rsync,/bin/gtar
|
1
root/etc/e-smith/db/configuration/defaults/backuppc/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/backuppc/type
Normal file
@ -0,0 +1 @@
|
|||||||
|
service
|
@ -0,0 +1 @@
|
|||||||
|
950
|
@ -0,0 +1 @@
|
|||||||
|
enabled
|
@ -0,0 +1 @@
|
|||||||
|
service
|
55
root/etc/e-smith/events/actions/backuppc-checkupgrade
Normal file
55
root/etc/e-smith/events/actions/backuppc-checkupgrade
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# We may need to update some configuration if we have upgraded from smeserver-backuppc.fws
|
||||||
|
if [ -e /etc/BackupPC/config.pl ]; then
|
||||||
|
|
||||||
|
# The new URL for backuppc images is /BackupPC/images
|
||||||
|
sed -i 's|^\$Conf{CgiImageDirURL} .*|$Conf{CgiImageDirURL} = "/BackupPC/images";|' /etc/BackupPC/config.pl
|
||||||
|
|
||||||
|
# Update paths
|
||||||
|
sed -i 's|/opt/backuppc/files|/var/lib/BackupPC|' /etc/BackupPC/config.pl
|
||||||
|
sed -i 's|/usr/local/BackupPC|/usr/share/BackupPC|' /etc/BackupPC/config.pl
|
||||||
|
sed -i 's|/opt/backuppc/cgi-bin|/usr/share/BackupPC/sbin|' /etc/BackupPC/config.pl
|
||||||
|
sed -i 's|/opt/backuppc/images|/usr/share/BackupPC/html|' /etc/BackupPC/config.pl
|
||||||
|
|
||||||
|
# Update the admin user and the user whi receives the alerts
|
||||||
|
sed -i "s|$Conf{CgiAdminUsers} = '';|$Conf{CgiAdminUsers} = 'admin';|" /etc/BackupPC/config.pl
|
||||||
|
sed -i "s|$Conf{EMailAdminUserName} = 'backuppc';|$Conf{EMailAdminUserName} = 'admin';|" /etc/BackupPC/config.pl
|
||||||
|
|
||||||
|
# Update the CgiURL
|
||||||
|
SystemName=$(/sbin/e-smith/db configuration get SystemName)
|
||||||
|
DomainName=$(/sbin/e-smith/db configuration get DomainName)
|
||||||
|
sed -i "s|$Conf{CgiURL} = 'http://localhost/.*|$Conf{CgiURL} = 'https://$SystemName.$DomainName/BackupPC';|" /etc/BackupPC/config.pl
|
||||||
|
|
||||||
|
# If par2 is not present, then put /bin/true in the config file to prevent an error
|
||||||
|
if [ ! -x /usr/local/bin/par2 ]; then
|
||||||
|
sed -i 's|^$Conf{ParPath} .*|$Conf{ParPath} = "/bin/true";|' /etc/BackupPC/config.pl
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Same for localhost.pl, the default config in previous release
|
||||||
|
if [ -e /etc/BackupPC/pc/localhost.pl ]; then
|
||||||
|
sed -i "s|$Conf{DumpPreUserCmd} = '/usr/bin/sudo /usr/local/BackupPC/bin/BackupPC_SME_pre-backup';|$Conf{DumpPreUserCmd} = '/usr/bin/sudo /usr/share/BackupPC/bin/BackupPC_SME_pre-backup';|" /etc/BackupPC/pc/localhost.pl
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add the example configs
|
||||||
|
EX=$(/sbin/e-smith/db configuration getprop backuppc examples)
|
||||||
|
if [ $EX == 'enabled' ]; then
|
||||||
|
if [ $(grep -c windows-template /etc/BackupPC/hosts) -lt 1 ]; then
|
||||||
|
echo "windows-template 0 admin" >> /etc/BackupPC/hosts
|
||||||
|
fi
|
||||||
|
if [ $(grep -c localserver-template /etc/BackupPC/hosts) -lt 1 ]; then
|
||||||
|
echo "localserver-template 0 admin" >> /etc/BackupPC/hosts
|
||||||
|
fi
|
||||||
|
if [ $(grep -c smeserver-template /etc/BackupPC/hosts) -lt 1 ]; then
|
||||||
|
echo "smeserver-template 0 admin" >> /etc/BackupPC/hosts
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure permissions are ok
|
||||||
|
chown -R backuppc:backuppc /etc/BackupPC/
|
||||||
|
chown -R backuppc:backuppc /var/log/BackupPC/
|
||||||
|
find /etc/BackupPC/ -type f -exec chmod 640 {} \;
|
||||||
|
|
33
root/etc/e-smith/events/actions/backuppc-genkey
Normal file
33
root/etc/e-smith/events/actions/backuppc-genkey
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
# Generate a keyfile for archives encryption
|
||||||
|
|
||||||
|
my $keyfile = '/etc/BackupPC/archive.key';
|
||||||
|
|
||||||
|
if (! -e $keyfile){
|
||||||
|
use MIME::Base64 qw(encode_base64);
|
||||||
|
|
||||||
|
my $key = "not set due to error";
|
||||||
|
if ( open( RANDOM, "/dev/urandom" ) ){
|
||||||
|
my $buf;
|
||||||
|
# 57 bytes is a full line of Base64 coding, and contains
|
||||||
|
# 456 bits of randomness - given a perfectly random /dev/random
|
||||||
|
if ( read( RANDOM, $buf, 57 ) != 57 )
|
||||||
|
{
|
||||||
|
warn("Short read from /dev/random: $!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$key = encode_base64($buf);
|
||||||
|
chomp $key;
|
||||||
|
}
|
||||||
|
close RANDOM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
warn "Could not open /dev/urandom: $!";
|
||||||
|
}
|
||||||
|
open( KEYFILE, ">$keyfile") || warn "Could not open $keyfile: $!";
|
||||||
|
print KEYFILE $key;
|
||||||
|
close KEYFILE;
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
# Grab ValidFrom access list property of httpd-admin
|
||||||
|
# SSL enabled virtual hosts should only allow access from IP's in
|
||||||
|
# this list, as well as local networks.
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
use esmith::NetworksDB;
|
||||||
|
|
||||||
|
my $ndb = esmith::NetworksDB->open_ro();
|
||||||
|
|
||||||
|
my @localAccess = $ndb->local_access_spec();
|
||||||
|
my $validFrom = ${'httpd-admin'}{'ValidFrom'};
|
||||||
|
if ($validFrom)
|
||||||
|
{
|
||||||
|
push @localAccess, split /,/, $validFrom;
|
||||||
|
}
|
||||||
|
$localAccess .= join ' ',
|
||||||
|
map { s:/255.255.255.255::; $_ }
|
||||||
|
@localAccess;
|
||||||
|
|
||||||
|
"";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
$OUT .= "LoadModule auth_tkt_module modules/mod_auth_tkt.so\n";
|
||||||
|
|
||||||
|
my $secret = ${'httpd-admin'}{TKTAuthSecret} || "34322500-7330-4400-423A-3A00434F5245";
|
||||||
|
$OUT .= "TKTAuthSecret \"$secret\"\n";
|
||||||
|
$OUT .= "TKTAuthDigestType SHA256\n";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,153 @@
|
|||||||
|
{
|
||||||
|
my $port = ${'httpd-bkpc'}{TCPPort} || '950';
|
||||||
|
$OUT .= "Listen 127.0.0.1:$port\n";
|
||||||
|
|
||||||
|
$OUT .= <<HERE;
|
||||||
|
|
||||||
|
HostnameLookups off
|
||||||
|
|
||||||
|
ServerAdmin admin@$DomainName
|
||||||
|
ServerRoot /etc/httpd
|
||||||
|
ServerTokens ProductOnly
|
||||||
|
|
||||||
|
User backuppc
|
||||||
|
Group backuppc
|
||||||
|
|
||||||
|
ErrorLog /var/log/httpd/bkpc_error_log
|
||||||
|
LogLevel warn
|
||||||
|
HERE
|
||||||
|
|
||||||
|
foreach (qw(
|
||||||
|
env
|
||||||
|
log_config
|
||||||
|
mime
|
||||||
|
negotiation
|
||||||
|
status
|
||||||
|
info
|
||||||
|
include
|
||||||
|
autoindex
|
||||||
|
dir
|
||||||
|
asis
|
||||||
|
imap
|
||||||
|
imagemap
|
||||||
|
actions
|
||||||
|
userdir
|
||||||
|
proxy
|
||||||
|
proxy_http
|
||||||
|
alias
|
||||||
|
rewrite
|
||||||
|
access
|
||||||
|
authz_host
|
||||||
|
authz_user
|
||||||
|
auth
|
||||||
|
auth_anon
|
||||||
|
auth_digest
|
||||||
|
expires
|
||||||
|
headers
|
||||||
|
usertrack
|
||||||
|
setenvif
|
||||||
|
ssl
|
||||||
|
cgi
|
||||||
|
mpm_prefork
|
||||||
|
unixd
|
||||||
|
access_compat
|
||||||
|
authn_core
|
||||||
|
authz_core
|
||||||
|
))
|
||||||
|
{
|
||||||
|
next unless -f "/usr/lib/httpd/modules/mod_${_}.so" ||
|
||||||
|
-f "/usr/lib64/httpd/modules/mod_${_}.so";
|
||||||
|
$OUT .= "LoadModule ${_}_module modules/mod_${_}.so\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$OUT .=<<"HERE";
|
||||||
|
|
||||||
|
PidFile /var/run/httpd-bkpc.pid
|
||||||
|
ScoreBoardFile /var/run/httpd-bkpc.scoreboard
|
||||||
|
UseCanonicalName off
|
||||||
|
LogFormat "%h %l %u %t \\"%r\\" %>s %b" common
|
||||||
|
LogFormat "%{User-agent}i" agent
|
||||||
|
|
||||||
|
CustomLog /var/log/httpd/bkpc_access_log common
|
||||||
|
|
||||||
|
KeepAlive On
|
||||||
|
MaxKeepAliveRequests 100
|
||||||
|
KeepAliveTimeout 15
|
||||||
|
|
||||||
|
MaxClients 150
|
||||||
|
MaxRequestsPerChild 100
|
||||||
|
|
||||||
|
ServerName www.$DomainName
|
||||||
|
|
||||||
|
MinSpareServers 1
|
||||||
|
MaxSpareServers 5
|
||||||
|
StartServers 1
|
||||||
|
Timeout 300
|
||||||
|
|
||||||
|
DefaultIcon /icons/unknown.gif
|
||||||
|
DirectoryIndex index.htm index.html index.php index.cgi
|
||||||
|
IndexOptions FancyIndexing VersionSort NameWidth=*
|
||||||
|
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
|
||||||
|
AccessFileName .htaccess
|
||||||
|
|
||||||
|
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
|
||||||
|
AddIconByType (TXT,/icons/text.gif) text/*
|
||||||
|
AddIconByType (IMG,/icons/image2.gif) image/*
|
||||||
|
AddIconByType (SND,/icons/sound2.gif) audio/*
|
||||||
|
AddIconByType (VID,/icons/movie.gif) video/*
|
||||||
|
TypesConfig /etc/mime.types
|
||||||
|
|
||||||
|
AddEncoding x-compress Z
|
||||||
|
AddEncoding x-gzip gz
|
||||||
|
|
||||||
|
AddIcon /icons/binary.gif .bin .exe
|
||||||
|
AddIcon /icons/binhex.gif .hqx
|
||||||
|
AddIcon /icons/tar.gif .tar
|
||||||
|
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
|
||||||
|
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
|
||||||
|
AddIcon /icons/a.gif .ps .ai .eps
|
||||||
|
AddIcon /icons/layout.gif .html .shtml .htm .pdf
|
||||||
|
AddIcon /icons/text.gif .txt
|
||||||
|
AddIcon /icons/c.gif .c
|
||||||
|
AddIcon /icons/p.gif .pl .py
|
||||||
|
AddIcon /icons/f.gif .for
|
||||||
|
AddIcon /icons/dvi.gif .dvi
|
||||||
|
AddIcon /icons/uuencoded.gif .uu
|
||||||
|
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
|
||||||
|
AddIcon /icons/tex.gif .tex
|
||||||
|
AddIcon /icons/bomb.gif core
|
||||||
|
|
||||||
|
AddIcon /icons/back.gif ..
|
||||||
|
AddIcon /icons/hand.right.gif README
|
||||||
|
AddIcon /icons/folder.gif ^^DIRECTORY^^
|
||||||
|
AddIcon /icons/blank.gif ^^BLANKICON^^
|
||||||
|
|
||||||
|
AddLanguage en .en
|
||||||
|
AddLanguage fr .fr
|
||||||
|
AddLanguage de .de
|
||||||
|
AddLanguage da .da
|
||||||
|
AddLanguage el .el
|
||||||
|
AddLanguage it .it
|
||||||
|
|
||||||
|
LanguagePriority en fr de
|
||||||
|
|
||||||
|
AddType text/html .shtml
|
||||||
|
AddType application/x-pkcs7-crl .crl
|
||||||
|
|
||||||
|
AddType application/x-x509-ca-cert .crt
|
||||||
|
|
||||||
|
BrowserMatch "Mozilla/2" nokeepalive
|
||||||
|
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
|
||||||
|
BrowserMatch "RealPlayer 4\.0" force-response-1.0
|
||||||
|
BrowserMatch "Java/1\.0" force-response-1.0
|
||||||
|
BrowserMatch "JDK/1\.0" force-response-1.0
|
||||||
|
|
||||||
|
AddHandler cgi-script .cgi
|
||||||
|
AddHandler server-parsed .shtml
|
||||||
|
AddHandler imap-file map
|
||||||
|
|
||||||
|
DocumentRoot /usr/share/BackupPC/html
|
||||||
|
|
||||||
|
HERE
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
# First, we configure the "default" to be a very restrictive set of
|
||||||
|
# permissions.
|
||||||
|
|
||||||
|
<Directory />
|
||||||
|
Options None
|
||||||
|
AllowOverride None
|
||||||
|
Require all denied
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
Alias /BackupPC/images /usr/share/BackupPC/html/
|
||||||
|
ScriptAlias /BackupPC /usr/share/BackupPC/sbin/BackupPC_Admin
|
||||||
|
|
||||||
|
<Directory /usr/share/BackupPC/html/>
|
||||||
|
Options None
|
||||||
|
AllowOverride None
|
||||||
|
Require ip 127.0.0.1
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory /usr/share/BackupPC/sbin/>
|
||||||
|
Options ExecCGI
|
||||||
|
AllowOverride None
|
||||||
|
AuthName "BackupPC"
|
||||||
|
AuthType Basic
|
||||||
|
TKTAuthLoginURL /server-common/cgi-bin/login
|
||||||
|
{
|
||||||
|
my $ManagerTimeout = ${'httpd-admin'}{ManagerTimeout} || "30m";
|
||||||
|
$OUT = " TKTAuthTimeout $ManagerTimeout\n";
|
||||||
|
my $Cookie = ${'httpd-admin'}{Cookie} || "disabled";
|
||||||
|
$OUT .= " TKTAuthCookieExpires $ManagerTimeout\n" if "$Cookie" eq "enabled";
|
||||||
|
my $ManagerTimeoutReset = ${'httpd-admin'}{ManagerTimeoutReset} || "0.66";
|
||||||
|
$OUT .= " TKTAuthTimeoutRefresh $ManagerTimeoutReset\n";
|
||||||
|
}
|
||||||
|
<RequireAll>
|
||||||
|
Require valid-user
|
||||||
|
Require ip 127.0.0.1
|
||||||
|
</RequireAll>
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
# vim: ft=perl:
|
||||||
|
|
||||||
|
$haveSSL = (exists ${modSSL}{status} and ${modSSL}{status} eq "enabled") ? 'yes' : 'no';
|
||||||
|
|
||||||
|
$OUT = '';
|
||||||
|
if ((${'backuppc'}{'status'} || 'disabled') eq 'enabled' &&
|
||||||
|
(${'httpd-bkpc'}{'status'} || 'disabled') eq 'enabled'){
|
||||||
|
|
||||||
|
$OUT .= " RewriteRule ^/backuppc(/.*|\$) https://%{HTTP_HOST}/BackupPC\$1 [L,R]\n";
|
||||||
|
|
||||||
|
if (($port eq "80") && ($haveSSL eq 'yes')){
|
||||||
|
$OUT .= " RewriteRule ^/BackupPC(/.*|\$) https://%{HTTP_HOST}/BackupPC\$1 [L,R]\n";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$OUT .= " ProxyPass /BackupPC http://127.0.0.1:${'httpd-bkpc'}{TCPPort}/BackupPC\n";
|
||||||
|
$OUT .= " ProxyPassReverse /BackupPC http://127.0.0.1:${'httpd-bkpc'}{TCPPort}/BackupPC\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$OUT .=<<"HERE";
|
||||||
|
|
||||||
|
<Location /BackupPC>
|
||||||
|
SSLRequireSSL on
|
||||||
|
Require ip $localAccess $externalSSLAccess
|
||||||
|
</Location>
|
||||||
|
|
||||||
|
HERE
|
||||||
|
}
|
||||||
|
}
|
7
root/etc/e-smith/templates/etc/sudoers/00BackupPCAlias
Normal file
7
root/etc/e-smith/templates/etc/sudoers/00BackupPCAlias
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
$OUT .= "Cmnd_Alias BACKUPPC_CMD = /usr/share/BackupPC/bin/BackupPC_SME_pre-backup, /etc/rc.d/init.d/backuppc *";
|
||||||
|
foreach( split( /[;,]/,( $backuppc{'sudo'} || '' ) ) ){
|
||||||
|
$OUT .= ", $_";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
1
root/etc/e-smith/templates/etc/sudoers/20BackupPC
Normal file
1
root/etc/e-smith/templates/etc/sudoers/20BackupPC
Normal file
@ -0,0 +1 @@
|
|||||||
|
backuppc ALL=(root) NOPASSWD: BACKUPPC_CMD
|
4
root/etc/e-smith/templates/etc/updatedb.conf/05BackupPC
Normal file
4
root/etc/e-smith/templates/etc/updatedb.conf/05BackupPC
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
$PRUNEPATHS .= " /var/lib/BackupPC ";
|
||||||
|
$OUT ="";
|
||||||
|
}
|
32
root/etc/e-smith/web/functions/backuppc
Normal file
32
root/etc/e-smith/web/functions/backuppc
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Administration
|
||||||
|
# description : BackupPC
|
||||||
|
# navigation : 4000 4200
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use CGI':all';
|
||||||
|
use CGI::Carp qw(fatalsToBrowser);
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN
|
||||||
|
{
|
||||||
|
$ENV {'PATH'} = '/bin:/usr/bin:/sbin';
|
||||||
|
$ENV {'SHELL'} = '/bin/bash';
|
||||||
|
delete $ENV {'ENV'};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
my $q = new CGI;
|
||||||
|
my $content="0; url=https://".$ENV {'HTTP_X_FORWARDED_HOST'}."/BackupPC";
|
||||||
|
$q->default_dtd('-//W3C//DTD XHTML 1.0 Transitional//EN');
|
||||||
|
|
||||||
|
print $q->header ('text/html');
|
||||||
|
print $q->start_html (-head=>meta({-http_equiv=>'refresh', -content=>$content}));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print $q->end_html;
|
||||||
|
|
||||||
|
|
187
root/etc/httpd/bkpc-conf/httpd.conf
Normal file
187
root/etc/httpd/bkpc-conf/httpd.conf
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
#------------------------------------------------------------
|
||||||
|
# !!DO NOT MODIFY THIS FILE!!
|
||||||
|
#
|
||||||
|
# Manual changes will be lost when this file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read the developer's guide, which is available
|
||||||
|
# at http://www.contribs.org/development/
|
||||||
|
#
|
||||||
|
# Copyright (C) 1999-2006 Mitel Networks Corporation
|
||||||
|
#------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
LoadModule auth_tkt_module modules/mod_auth_tkt.so
|
||||||
|
TKTAuthSecret "1234"
|
||||||
|
|
||||||
|
|
||||||
|
Listen 127.0.0.1:950
|
||||||
|
|
||||||
|
HostnameLookups off
|
||||||
|
|
||||||
|
ServerAdmin admin
|
||||||
|
ServerRoot /etc/httpd
|
||||||
|
ServerTokens ProductOnly
|
||||||
|
|
||||||
|
User backuppc
|
||||||
|
Group backuppc
|
||||||
|
|
||||||
|
ErrorLog /var/log/httpd/bkpc_error_log
|
||||||
|
LogLevel warn
|
||||||
|
LoadModule env_module modules/mod_env.so
|
||||||
|
LoadModule log_config_module modules/mod_log_config.so
|
||||||
|
LoadModule mime_module modules/mod_mime.so
|
||||||
|
LoadModule negotiation_module modules/mod_negotiation.so
|
||||||
|
LoadModule status_module modules/mod_status.so
|
||||||
|
LoadModule info_module modules/mod_info.so
|
||||||
|
LoadModule include_module modules/mod_include.so
|
||||||
|
LoadModule autoindex_module modules/mod_autoindex.so
|
||||||
|
LoadModule dir_module modules/mod_dir.so
|
||||||
|
LoadModule asis_module modules/mod_asis.so
|
||||||
|
LoadModule imap_module modules/mod_imap.so
|
||||||
|
LoadModule actions_module modules/mod_actions.so
|
||||||
|
LoadModule userdir_module modules/mod_userdir.so
|
||||||
|
LoadModule proxy_module modules/mod_proxy.so
|
||||||
|
LoadModule proxy_http_module modules/mod_proxy_http.so
|
||||||
|
LoadModule alias_module modules/mod_alias.so
|
||||||
|
LoadModule rewrite_module modules/mod_rewrite.so
|
||||||
|
LoadModule access_module modules/mod_access.so
|
||||||
|
LoadModule auth_module modules/mod_auth.so
|
||||||
|
LoadModule auth_anon_module modules/mod_auth_anon.so
|
||||||
|
LoadModule auth_digest_module modules/mod_auth_digest.so
|
||||||
|
LoadModule expires_module modules/mod_expires.so
|
||||||
|
LoadModule headers_module modules/mod_headers.so
|
||||||
|
LoadModule usertrack_module modules/mod_usertrack.so
|
||||||
|
LoadModule setenvif_module modules/mod_setenvif.so
|
||||||
|
LoadModule ssl_module modules/mod_ssl.so
|
||||||
|
LoadModule cgi_module modules/mod_cgi.so
|
||||||
|
|
||||||
|
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
|
||||||
|
LoadModule unixd_module modules/mod_unixd.so
|
||||||
|
LoadModule authn_core_module modules/mod_authn_core.so
|
||||||
|
LoadModule : modules/mod_authz_core.so
|
||||||
|
|
||||||
|
|
||||||
|
PidFile /var/run/httpd-bkpc.pid
|
||||||
|
ScoreBoardFile /var/run/httpd-bkpc.scoreboard
|
||||||
|
UseCanonicalName off
|
||||||
|
LogFormat "%h %l %u %t \"%r\" %>s %b" common
|
||||||
|
LogFormat "%{User-agent}i" agent
|
||||||
|
|
||||||
|
CustomLog /var/log/httpd/bkpc_access_log common
|
||||||
|
|
||||||
|
KeepAlive On
|
||||||
|
MaxKeepAliveRequests 100
|
||||||
|
KeepAliveTimeout 15
|
||||||
|
|
||||||
|
MaxClients 150
|
||||||
|
MaxRequestsPerChild 100
|
||||||
|
|
||||||
|
ServerName www.domain.tld
|
||||||
|
|
||||||
|
MinSpareServers 1
|
||||||
|
MaxSpareServers 5
|
||||||
|
StartServers 1
|
||||||
|
Timeout 300
|
||||||
|
|
||||||
|
DefaultIcon /icons/unknown.gif
|
||||||
|
DirectoryIndex index.htm index.html index.php index.cgi
|
||||||
|
IndexOptions FancyIndexing VersionSort NameWidth=*
|
||||||
|
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
|
||||||
|
AccessFileName .htaccess
|
||||||
|
|
||||||
|
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
|
||||||
|
AddIconByType (TXT,/icons/text.gif) text/*
|
||||||
|
AddIconByType (IMG,/icons/image2.gif) image/*
|
||||||
|
AddIconByType (SND,/icons/sound2.gif) audio/*
|
||||||
|
AddIconByType (VID,/icons/movie.gif) video/*
|
||||||
|
DefaultType text/plain
|
||||||
|
TypesConfig /etc/mime.types
|
||||||
|
|
||||||
|
AddEncoding x-compress Z
|
||||||
|
AddEncoding x-gzip gz
|
||||||
|
|
||||||
|
AddIcon /icons/binary.gif .bin .exe
|
||||||
|
AddIcon /icons/binhex.gif .hqx
|
||||||
|
AddIcon /icons/tar.gif .tar
|
||||||
|
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
|
||||||
|
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
|
||||||
|
AddIcon /icons/a.gif .ps .ai .eps
|
||||||
|
AddIcon /icons/layout.gif .html .shtml .htm .pdf
|
||||||
|
AddIcon /icons/text.gif .txt
|
||||||
|
AddIcon /icons/c.gif .c
|
||||||
|
AddIcon /icons/p.gif .pl .py
|
||||||
|
AddIcon /icons/f.gif .for
|
||||||
|
AddIcon /icons/dvi.gif .dvi
|
||||||
|
AddIcon /icons/uuencoded.gif .uu
|
||||||
|
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
|
||||||
|
AddIcon /icons/tex.gif .tex
|
||||||
|
AddIcon /icons/bomb.gif core
|
||||||
|
|
||||||
|
AddIcon /icons/back.gif ..
|
||||||
|
AddIcon /icons/hand.right.gif README
|
||||||
|
AddIcon /icons/folder.gif ^^DIRECTORY^^
|
||||||
|
AddIcon /icons/blank.gif ^^BLANKICON^^
|
||||||
|
|
||||||
|
AddLanguage en .en
|
||||||
|
AddLanguage fr .fr
|
||||||
|
AddLanguage de .de
|
||||||
|
AddLanguage da .da
|
||||||
|
AddLanguage el .el
|
||||||
|
AddLanguage it .it
|
||||||
|
|
||||||
|
LanguagePriority en fr de
|
||||||
|
|
||||||
|
AddType text/html .shtml
|
||||||
|
AddType application/x-pkcs7-crl .crl
|
||||||
|
|
||||||
|
AddType application/x-x509-ca-cert .crt
|
||||||
|
|
||||||
|
BrowserMatch "Mozilla/2" nokeepalive
|
||||||
|
BrowserMatch "MSIE 4.0b2;" nokeepalive downgrade-1.0 force-response-1.0
|
||||||
|
BrowserMatch "RealPlayer 4.0" force-response-1.0
|
||||||
|
BrowserMatch "Java/1.0" force-response-1.0
|
||||||
|
BrowserMatch "JDK/1.0" force-response-1.0
|
||||||
|
|
||||||
|
AddHandler cgi-script .cgi
|
||||||
|
AddHandler server-parsed .shtml
|
||||||
|
AddHandler imap-file map
|
||||||
|
|
||||||
|
DocumentRoot /usr/share/BackupPC/html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# First, we configure the "default" to be a very restrictive set of
|
||||||
|
# permissions.
|
||||||
|
|
||||||
|
<Directory />
|
||||||
|
Options None
|
||||||
|
AllowOverride None
|
||||||
|
Require all denied
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Alias /BackupPC/images /usr/share/BackupPC/html/
|
||||||
|
ScriptAlias /BackupPC /usr/share/BackupPC/sbin/BackupPC_Admin
|
||||||
|
|
||||||
|
<Directory /usr/share/BackupPC/html/>
|
||||||
|
Options None
|
||||||
|
AllowOverride None
|
||||||
|
Require ip 127.0.0.1
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory /usr/share/BackupPC/sbin/>
|
||||||
|
Options ExecCGI
|
||||||
|
AllowOverride None
|
||||||
|
AuthName "BackupPC"
|
||||||
|
AuthType Basic
|
||||||
|
TKTAuthLoginURL /server-common/cgi-bin/login
|
||||||
|
SetEnv IMGHDR_SRC "/server-common/server-manager.jpg"
|
||||||
|
<RequireAll>
|
||||||
|
Require valid-user
|
||||||
|
Require ip 127.0.0.1
|
||||||
|
</RequireAll>
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
|
12
root/usr/lib/systemd/system/httpd-bkpc.service
Normal file
12
root/usr/lib/systemd/system/httpd-bkpc.service
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=BackupPC web page
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
#PIDFile=/run/bandwidthd.pid
|
||||||
|
ExecStart=/var/service/httpd-bkpc/run
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=sme-server.target
|
||||||
|
|
67
root/usr/share/BackupPC/bin/BackupPC_SME_localArchive
Executable file
67
root/usr/share/BackupPC/bin/BackupPC_SME_localArchive
Executable file
@ -0,0 +1,67 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
# Author: Daniel Berteaud (daniel@firewall-services.com)
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
use lib "/usr/share/BackupPC/lib";
|
||||||
|
use BackupPC::SMEarchive;
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
|
||||||
|
my $logFile = '/tmp/'.genRandName ();
|
||||||
|
|
||||||
|
|
||||||
|
# Sortie erreur standard=fichier de log
|
||||||
|
open (STDERR, ">$logFile");
|
||||||
|
|
||||||
|
my $today = `$path{date} +%F-%kh%M`;
|
||||||
|
my $check = 1;
|
||||||
|
# on inscrit la date en haut du fichier log
|
||||||
|
print STDERR "Starting archive: ".`$path{date}`."\n";
|
||||||
|
|
||||||
|
my %opts=();
|
||||||
|
|
||||||
|
my %params=(
|
||||||
|
'destination'=>"/tmp/",
|
||||||
|
'split'=>"0",
|
||||||
|
'compress'=>"gzip",
|
||||||
|
'cipher'=>'off',
|
||||||
|
'key'=>'/etc/BackupPC/archive.key',
|
||||||
|
'backupNum'=>"-1",
|
||||||
|
'share'=>"*",
|
||||||
|
'parity'=>'0',
|
||||||
|
'hosts'=>'localhost',
|
||||||
|
'sendMailTo'=>'admin',
|
||||||
|
'configFile'=>'/etc/BackupPC/localArchive.conf');
|
||||||
|
|
||||||
|
# On lance la récupération des paramètre qui retourne le fichier de config à utiliser
|
||||||
|
$params{configFile} = init($params{configFile});
|
||||||
|
|
||||||
|
%params = readConf(\%params);
|
||||||
|
|
||||||
|
print STDERR "\nYou have requested to archive these hosts: $params{hosts} to this destination: $params{destination}\n\n";
|
||||||
|
|
||||||
|
localArchive($params{hosts},$params{backupNum},$params{share},$params{compress},$params{split},$params{cipher},$params{key},$params{destination});
|
||||||
|
|
||||||
|
print STDERR "\n\nArchive finished: ".`$path{date}`."\n";
|
||||||
|
|
||||||
|
my $log = `$path{cat} $logFile`;
|
||||||
|
sendMail($params{sendMailTo},'localArchive',$log);
|
||||||
|
mvLog('localArchive',$logFile,$today);
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
|
80
root/usr/share/BackupPC/bin/BackupPC_SME_localCopyPool
Executable file
80
root/usr/share/BackupPC/bin/BackupPC_SME_localCopyPool
Executable file
@ -0,0 +1,80 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
# Author: Daniel Berteaud (daniel@firewall-services.com)
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
use lib "/usr/share/BackupPC/lib";
|
||||||
|
use BackupPC::SMEarchive;
|
||||||
|
use BackupPC::SMEcopyPool;
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
|
||||||
|
my $logFile = '/tmp/'.genRandName ();
|
||||||
|
my $rsyncLog = '/tmp/'.genRandName ();
|
||||||
|
my $check = 1;
|
||||||
|
|
||||||
|
|
||||||
|
# Sortie erreur standard=fichier de log
|
||||||
|
open (STDERR, ">$logFile");
|
||||||
|
|
||||||
|
my $today = `$path{date} +%F-%kh%M`;
|
||||||
|
|
||||||
|
# on inscrit la date en haut du fichier log
|
||||||
|
print STDERR "Starting pool copy: ".`$path{date}`."\n";
|
||||||
|
|
||||||
|
my %opts=();
|
||||||
|
|
||||||
|
my %params=(
|
||||||
|
'destination'=>"/tmp/",
|
||||||
|
'source'=>'/var/lib/BackupPC/',
|
||||||
|
'compress'=>"gzip",
|
||||||
|
'extract'=>"yes",
|
||||||
|
'stop'=>"yes",
|
||||||
|
'sendMailTo'=>'admin',
|
||||||
|
'configFile'=>'/etc/BackupPC/localCopyPool.conf');
|
||||||
|
|
||||||
|
# On lance la récupération des paramètres qui retourne le fichier de config à utiliser
|
||||||
|
$params{configFile} = init($params{configFile});
|
||||||
|
|
||||||
|
%params = readConf(\%params);
|
||||||
|
|
||||||
|
|
||||||
|
print STDERR "You have requested to copy all your backups ($params{source}) to this destination: $params{destination}\n\n";
|
||||||
|
|
||||||
|
$check = verifTree($params{source});
|
||||||
|
|
||||||
|
if ($check eq 1){
|
||||||
|
if ($params{stop} eq 'yes'){
|
||||||
|
stopBackupPC();
|
||||||
|
}
|
||||||
|
copyPool($params{source},$params{destination},$logFile,$rsyncLog);
|
||||||
|
localCopyPC($params{source},$params{destination},$params{compress},$params{extract},$logFile);
|
||||||
|
if ($params{stop} eq 'yes'){
|
||||||
|
startBackupPC();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
print STDERR "\naborting, the source directory is probably not the good one\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print STDERR "\n\nCopy finished: ".`$path{date}`."\n";
|
||||||
|
|
||||||
|
my $log = `$path{cat} $logFile`;
|
||||||
|
sendMail($params{sendMailTo},'localCopyPool',$log);
|
||||||
|
mvLog('localCopyPool',$logFile,$today);
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
|
13
root/usr/share/BackupPC/bin/BackupPC_SME_pre-backup
Normal file
13
root/usr/share/BackupPC/bin/BackupPC_SME_pre-backup
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
HOME=/root
|
||||||
|
PATH=/usr/bin:$PATH
|
||||||
|
|
||||||
|
# Backup config and log on the dedicated hard drive
|
||||||
|
mkdir -p /var/lib/BackupPC/etc
|
||||||
|
rsync -ahq --del /etc/BackupPC/ /var/lib/BackupPC/etc/
|
||||||
|
mkdir -p /var/lib/BackupPC/log
|
||||||
|
rsync -ahq --del /var/log/BackupPC /var/lib/BackupPC/log/
|
||||||
|
|
||||||
|
# Run a standard signal-event pre-backup
|
||||||
|
/sbin/e-smith/signal-event pre-backup
|
||||||
|
|
67
root/usr/share/BackupPC/bin/BackupPC_SME_remoteArchive
Executable file
67
root/usr/share/BackupPC/bin/BackupPC_SME_remoteArchive
Executable file
@ -0,0 +1,67 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
# Author: Daniel Berteaud (daniel@firewall-services.com)
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
use lib "/usr/share/BackupPC/lib";
|
||||||
|
use BackupPC::SMEarchive;
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
|
||||||
|
my $logFile = '/tmp/'.genRandName ();
|
||||||
|
|
||||||
|
|
||||||
|
# Sortie erreur standard=fichier de log
|
||||||
|
open (STDERR, ">$logFile");
|
||||||
|
|
||||||
|
my $today = `$path{date} +%F-%kh%M`;
|
||||||
|
my $check = 1;
|
||||||
|
# on inscrit la date en haut du fichier log
|
||||||
|
print STDERR "Starting archive: ".`$path{date}`."\n";
|
||||||
|
|
||||||
|
my %opts=();
|
||||||
|
|
||||||
|
my %params=(
|
||||||
|
'remoteHost'=>"remote_host.com",
|
||||||
|
'remoteUser'=>"backuppc",
|
||||||
|
'remoteDir'=>"/tmp/",
|
||||||
|
'compress'=>"gzip",
|
||||||
|
'cipher'=>'off',
|
||||||
|
'key'=>'/etc/BackupPC/archive.key',
|
||||||
|
'backupNum'=>"-1",
|
||||||
|
'share'=>"*",
|
||||||
|
'hosts'=>'localhost',
|
||||||
|
'sendMailTo'=>'admin',
|
||||||
|
'configFile'=>'/etc/BackupPC/remoteArchive.conf');
|
||||||
|
|
||||||
|
# On lance la récupération des paramètre qui retourne le fichier de config à utiliser
|
||||||
|
$params{configFile} = init($params{configFile});
|
||||||
|
|
||||||
|
%params = readConf(\%params);
|
||||||
|
|
||||||
|
print STDERR "\nYou have requested to archive these hosts: $params{hosts} to this destination: $params{remoteUser}\@$params{remoteHost}:/$params{remoteDir}\n\n";
|
||||||
|
|
||||||
|
remoteArchive($params{remoteHost},$params{remoteUser},$params{remoteDir},$params{hosts},$params{backupNum},$params{share},$params{compress},$params{cipher},$params{key});
|
||||||
|
|
||||||
|
print STDERR "\n\nArchive finished: ".`$path{date}`."\n";
|
||||||
|
|
||||||
|
my $log = `$path{cat} $logFile`;
|
||||||
|
sendMail($params{sendMailTo},'remoteArchive',$log);
|
||||||
|
mvLog('remoteArchive',$logFile,$today);
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
|
84
root/usr/share/BackupPC/bin/BackupPC_SME_remoteCopyPool
Executable file
84
root/usr/share/BackupPC/bin/BackupPC_SME_remoteCopyPool
Executable file
@ -0,0 +1,84 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
# Author: Daniel Berteaud (daniel@firewall-services.com)
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
use lib "/usr/share/BackupPC/lib";
|
||||||
|
use BackupPC::SMEarchive;
|
||||||
|
use BackupPC::SMEcopyPool;
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
|
||||||
|
my $logFile = '/tmp/'.genRandName ();
|
||||||
|
my $rsyncLog = '/tmp/'.genRandName ();
|
||||||
|
my $check = 1;
|
||||||
|
|
||||||
|
|
||||||
|
# Sortie erreur standard=fichier de log
|
||||||
|
open (STDERR, ">$logFile");
|
||||||
|
|
||||||
|
my $today = `$path{date} +%F-%kh%M`;
|
||||||
|
|
||||||
|
# on inscrit la date en haut du fichier log
|
||||||
|
print STDERR "Starting pool copy: ".`$path{date}`."\n";
|
||||||
|
|
||||||
|
my %opts=();
|
||||||
|
|
||||||
|
my %params=(
|
||||||
|
'remoteHost'=>"remote_host.com",
|
||||||
|
'remoteUser'=>"backuppc",
|
||||||
|
'remoteDir'=>"/tmp/",
|
||||||
|
'source'=>'/var/lib/BackupPC/',
|
||||||
|
'compress'=>"gzip",
|
||||||
|
'extract'=>"yes",
|
||||||
|
'stop'=>"yes",
|
||||||
|
'sendMailTo'=>'admin',
|
||||||
|
'configFile'=>'/etc/BackupPC/remoteCopyPool.conf');
|
||||||
|
|
||||||
|
# On lance la récupération des paramètres qui retourne le fichier de config à utiliser
|
||||||
|
$params{configFile} = init($params{configFile});
|
||||||
|
|
||||||
|
%params = readConf(\%params);
|
||||||
|
|
||||||
|
|
||||||
|
print STDERR "You have requested to copy all your backups ($params{source}) to this destination: $params{remoteUser}\@$params{remoteHost}:$params{remoteDir}\n\n";
|
||||||
|
|
||||||
|
$check = verifTree($params{source});
|
||||||
|
|
||||||
|
if ($check eq 1){
|
||||||
|
if ($params{stop} eq 'yes'){
|
||||||
|
stopBackupPC();
|
||||||
|
}
|
||||||
|
|
||||||
|
copyPool($params{source},"$params{remoteUser}\@$params{remoteHost}:$params{remoteDir}",$logFile,$rsyncLog);
|
||||||
|
remoteCopyPC($params{source},$params{remoteHost},$params{remoteUser},$params{remoteDir},$params{compress},$params{extract},$logFile);
|
||||||
|
if ($params{stop} eq 'yes'){
|
||||||
|
startBackupPC();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
print STDERR "\naborting, the source directory is probably not the good one\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print STDERR "\n\nCopy finished: ".`$path{date}`."\n";
|
||||||
|
|
||||||
|
my $log = `$path{cat} $logFile`;
|
||||||
|
sendMail($params{sendMailTo},'remoteCopyPool',$log);
|
||||||
|
mvLog('remoteCopyPool',$logFile,$today);
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
|
85
root/usr/share/BackupPC/bin/BackupPC_SME_usbArchive
Executable file
85
root/usr/share/BackupPC/bin/BackupPC_SME_usbArchive
Executable file
@ -0,0 +1,85 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
# Author: Daniel Berteaud (daniel@firewall-services.com)
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
use lib "/usr/share/BackupPC/lib";
|
||||||
|
use BackupPC::SMEarchive;
|
||||||
|
#use Getopt::Std;
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
|
||||||
|
my $logFile = '/tmp/'.genRandName ();
|
||||||
|
|
||||||
|
|
||||||
|
# Sortie erreur standard=fichier de log
|
||||||
|
open (STDERR, ">$logFile");
|
||||||
|
|
||||||
|
my $today = `$path{date} +%F-%kh%M`;
|
||||||
|
my $check = 1;
|
||||||
|
# on inscrit la date en haut du fichier log
|
||||||
|
print STDERR "Starting archive: ".`$path{date}`."\n";
|
||||||
|
|
||||||
|
my %opts=();
|
||||||
|
|
||||||
|
my %params=(
|
||||||
|
'split'=>"0",
|
||||||
|
'compress'=>"/bin/gzip",
|
||||||
|
'cipher'=>'off',
|
||||||
|
'key'=>'/etc/BackupPC/archive.key',
|
||||||
|
'backupNum'=>"-1",
|
||||||
|
'share'=>"*",
|
||||||
|
'hosts'=>'localhost',
|
||||||
|
'sendMailTo'=>'admin',
|
||||||
|
'device'=>'/dev/sdc1',
|
||||||
|
'configFile'=>'/etc/BackupPC/usbArchive.conf');
|
||||||
|
|
||||||
|
# On définit un nom aléatoire pour le point de montage
|
||||||
|
$params{destination} = '/var/lib/BackupPC/'.genRandName();
|
||||||
|
# On lance la récupération des paramètre qui retourne le fichier de config à utiliser
|
||||||
|
$params{configFile} = init($params{configFile});
|
||||||
|
|
||||||
|
%params = readConf(\%params);
|
||||||
|
|
||||||
|
print STDERR "\nYou have requested to archive these hosts: $params{hosts} to this destination: $params{destination}\n\n";
|
||||||
|
|
||||||
|
$check = mountUsb($params{destination},$params{device});
|
||||||
|
|
||||||
|
if ($check eq 1){
|
||||||
|
localArchive($params{hosts},$params{backupNum},$params{share},$params{compress},$params{split},$params{cipher},$params{key},$params{destination});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
print STDERR "\n\nAborting, an error occured while mounting the removable device $params{device} on $params{destination}\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$check = umountUsb($params{destination},$params{device});
|
||||||
|
|
||||||
|
if ($check = 1){
|
||||||
|
print STDERR "\numounting $params{device}: [ OK ]\n";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
print STDERR "\nan error occured while unmounting the device $params{device} from $params{destination}\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print STDERR "\n\nArchive finished: ".`$path{date}`."\n";
|
||||||
|
|
||||||
|
my $log = `$path{cat} $logFile`;
|
||||||
|
sendMail($params{sendMailTo},'usbArchive',$log);
|
||||||
|
mvLog('usbArchive',$logFile,$today);
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
|
93
root/usr/share/BackupPC/bin/BackupPC_SME_usbCopyPool
Executable file
93
root/usr/share/BackupPC/bin/BackupPC_SME_usbCopyPool
Executable file
@ -0,0 +1,93 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
# Author: Daniel Berteaud (daniel@firewall-services.com)
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
use lib "/usr/share/BackupPC/lib";
|
||||||
|
use BackupPC::SMEarchive;
|
||||||
|
use BackupPC::SMEcopyPool;
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
|
||||||
|
my $logFile = '/tmp/'.genRandName ();
|
||||||
|
my $rsyncLog = '/tmp/'.genRandName ();
|
||||||
|
my $check = 1;
|
||||||
|
|
||||||
|
|
||||||
|
# Sortie erreur standard=fichier de log
|
||||||
|
open (STDERR, ">$logFile");
|
||||||
|
|
||||||
|
my $today = `$path{date} +%F-%kh%M`;
|
||||||
|
|
||||||
|
# on inscrit la date en haut du fichier log
|
||||||
|
print STDERR "Starting pool copy: ".`$path{date}`."\n";
|
||||||
|
|
||||||
|
my %opts=();
|
||||||
|
|
||||||
|
my %params=(
|
||||||
|
'device'=>'/dev/sdc1',
|
||||||
|
'source'=>'/var/lib/BackupPC',
|
||||||
|
'compress'=>"none",
|
||||||
|
'extract'=>"yes",
|
||||||
|
'stop'=>"yes",
|
||||||
|
'sendMailTo'=>'admin',
|
||||||
|
'configFile'=>'/etc/BackupPC/usbCopyPool.conf');
|
||||||
|
|
||||||
|
# On définit un nom aléatoire pour le point de montage
|
||||||
|
$params{destination} = '/var/lib/BackupPC/'.genRandName();
|
||||||
|
|
||||||
|
# On lance la récupération des paramètres qui retourne le fichier de config à utiliser
|
||||||
|
$params{configFile} = init($params{configFile});
|
||||||
|
|
||||||
|
%params = readConf(\%params);
|
||||||
|
|
||||||
|
|
||||||
|
print STDERR "You have requested to copy all your backups ($params{source}) to this destination: $params{device}\n\n";
|
||||||
|
|
||||||
|
$check = (verifTree($params{source}) && mountUsb($params{destination},$params{device}));;
|
||||||
|
|
||||||
|
|
||||||
|
if ($check eq 1){
|
||||||
|
if ($params{stop} eq 'yes'){
|
||||||
|
stopBackupPC();
|
||||||
|
}
|
||||||
|
copyPool($params{source},$params{destination},$logFile,$rsyncLog);
|
||||||
|
localCopyPC($params{source},$params{destination},$params{compress},$params{extract},$logFile);
|
||||||
|
if ($params{stop} eq 'yes'){
|
||||||
|
startBackupPC();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
print STDERR "\naborting, the source directory is probably not the good one, or an error occured while mounting $params{device} on $params{destination}\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$check = umountUsb($params{destination},$params{device});
|
||||||
|
|
||||||
|
if ($check = 1){
|
||||||
|
print STDERR "\numounting $params{device}: [ OK ]\n";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
print STDERR "\nan error occured while unmounting the device $params{device} from $params{destination}\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print STDERR "\n\nCopy finished: ".`$path{date}`."\n";
|
||||||
|
|
||||||
|
my $log = `$path{cat} $logFile`;
|
||||||
|
sendMail($params{sendMailTo},'usbCopyPool',$log);
|
||||||
|
mvLog('usblCopyPool',$logFile,$today);
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
|
301
root/usr/share/BackupPC/lib/BackupPC/SMEarchive.pm
Normal file
301
root/usr/share/BackupPC/lib/BackupPC/SMEarchive.pm
Normal file
@ -0,0 +1,301 @@
|
|||||||
|
# Author: Daniel Berteaud (daniel@firewall-services.com)
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
package BackupPC::SMEarchive;
|
||||||
|
use Exporter;
|
||||||
|
our @ISA = qw(Exporter);
|
||||||
|
our @EXPORT = qw(%path %opts &checkExec &checkDest &init &readConf &logAndPerform &sendMail &genRandName &mvLog &localArchive &mountUsb &umountUsb &remoteArchive);
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use Mail::Send;
|
||||||
|
use Getopt::Std;
|
||||||
|
|
||||||
|
|
||||||
|
our %path=();
|
||||||
|
$path{backuppcBin} = '/usr/share/BackupPC/bin/';
|
||||||
|
$path{split} = '/usr/bin/split';
|
||||||
|
$path{date} = '/bin/date';
|
||||||
|
$path{rm} = '/bin/rm';
|
||||||
|
$path{rmdir} = '/bin/rmdir';
|
||||||
|
$path{cat} = '/bin/cat';
|
||||||
|
$path{mkdir} = '/bin/mkdir';
|
||||||
|
$path{par2} = '/bin/ping';
|
||||||
|
$path{ssh} = '/usr/bin/ssh';
|
||||||
|
$path{mount} = '/bin/mount';
|
||||||
|
$path{umount} = '/bin/umount';
|
||||||
|
$path{grep} = '/bin/grep';
|
||||||
|
$path{wc} = '/usr/bin/wc';
|
||||||
|
$path{sudo} = '/usr/bin/sudo';
|
||||||
|
$path{gzip} = '/bin/gzip';
|
||||||
|
$path{bzip2} = ( -x '/usr/bin/pbzip2' ) ? '/usr/bin/pbzip2' : '/usr/bin/bzip2';
|
||||||
|
$path{rsync} = '/usr/bin/rsync';
|
||||||
|
$path{tar} = '/bin/tar';
|
||||||
|
$path{openssl} = '/usr/bin/openssl';
|
||||||
|
$path{nice} = '/bin/nice';
|
||||||
|
|
||||||
|
sub checkExec{
|
||||||
|
# On vérifie que les executables sont bien executables
|
||||||
|
my $ok = 1;
|
||||||
|
foreach (keys %path){
|
||||||
|
if (!-x $path{$_}){$ok = 0;}
|
||||||
|
}
|
||||||
|
return $ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub checkDest{
|
||||||
|
# On vérifie les droits d'écriture sur la destination
|
||||||
|
my ($destination) = @_;
|
||||||
|
my $ok = 0;
|
||||||
|
logAndPerform("$path{mkdir} $destination") if (!-d $destination);
|
||||||
|
if ((-w $destination) && (-d $destination)){$ok = 1;}
|
||||||
|
return $ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Fonciton qui récupère les arguments, et remplace le fichier de conf si spécifié
|
||||||
|
sub init{
|
||||||
|
my ($configFile) = @_;
|
||||||
|
my %opts;
|
||||||
|
getopts ("hf:", \%opts) || help();
|
||||||
|
|
||||||
|
$opts{h} = '0' if (! defined $opts{h});
|
||||||
|
if (defined $opts{f}){
|
||||||
|
if (-e $opts{f}){
|
||||||
|
print STDERR "using $opts{f} as config file instead of default\n";
|
||||||
|
$configFile = $opts{f};
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
print STDERR "\nIgnoring specified config file $opts{f} because this file doesn't exist. Using default one\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
help () if ($opts{h});
|
||||||
|
return $configFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub help(){
|
||||||
|
print <<EOF;
|
||||||
|
usage: $0 [-h] [-f config]
|
||||||
|
|
||||||
|
options:
|
||||||
|
-h print this help
|
||||||
|
-f config use config instead of default one.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Fonction qui parse le fichier de config
|
||||||
|
sub readConf($){
|
||||||
|
my $hRef = shift;
|
||||||
|
my %params;
|
||||||
|
foreach my $key ( keys %$hRef){
|
||||||
|
$params{$key} = $hRef->{$key};
|
||||||
|
}
|
||||||
|
open (PARAMS,"< $params{configFile}") || die "erreur a l'ouverture de $params{configFile}\n";
|
||||||
|
my @params_lus=<PARAMS>;
|
||||||
|
close PARAMS;
|
||||||
|
print STDERR "Parsing config file\n\n";
|
||||||
|
foreach (@params_lus){
|
||||||
|
foreach my $key (keys(%params)){
|
||||||
|
# valeur = partie droite de la ligne contenant $key dans le fichier
|
||||||
|
if ($_ =~ /\s*$key\s*=\s*(.*)/){
|
||||||
|
$params{$key} = $1;
|
||||||
|
print STDERR "key=\"$key\", value=\"$params{$key}\"\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print STDERR "\n\n";
|
||||||
|
return (%params);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Fonction qui log les commandes et qui les éxecute
|
||||||
|
sub logAndPerform($){
|
||||||
|
my ($cmd) = @_;
|
||||||
|
print STDERR "\nexecuting command\n$cmd\n\n";
|
||||||
|
system($cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Fonction qui envoie le mail contenant le log
|
||||||
|
sub sendMail($$$){
|
||||||
|
my ($sendMailTo,$about,$content) = @_;
|
||||||
|
my $mail = new Mail::Send;
|
||||||
|
$mail->to("$sendMailTo");
|
||||||
|
$mail->set("From","BackupPC");
|
||||||
|
$mail->subject("$about");
|
||||||
|
my $body = $mail->open;
|
||||||
|
print $body $content;
|
||||||
|
$body->close;
|
||||||
|
}
|
||||||
|
|
||||||
|
# fonction qui génère un nom aléatoire pour les fichiers temporaires
|
||||||
|
sub genRandName (){
|
||||||
|
my @c=("A".."Z","a".."z",0..9);
|
||||||
|
my $randomName = join("",@c[map{rand @c}(1..8)]);
|
||||||
|
return $randomName;
|
||||||
|
}
|
||||||
|
|
||||||
|
# fonction qui déplace le fichier de log au bon endroit
|
||||||
|
sub mvLog($$$){
|
||||||
|
my ($type,$file,$today) = @_;
|
||||||
|
if (! -d "/var/log/BackupPC/$type/"){
|
||||||
|
logAndPerform("$path{mkdir} -p /var/log/BackupPC/$type/");
|
||||||
|
}
|
||||||
|
my $content = `$path{cat} $file`;
|
||||||
|
open(LOGFILE, "> /var/log/BackupPC/$type/$today");
|
||||||
|
print LOGFILE $content;
|
||||||
|
close LOGFILE;
|
||||||
|
system("$path{rm} -f $file");
|
||||||
|
}
|
||||||
|
|
||||||
|
sub localArchive($$$$$$$$){
|
||||||
|
my ($hosts,$backupNum,$share,$compress,$split,$cipher,$key,$destination) = @_;
|
||||||
|
my $check = 1;
|
||||||
|
my $extension = 'tar';
|
||||||
|
# on fixe l'extension de l'archive en fonction de la compression utilisée
|
||||||
|
if ($compress eq 'gzip'){$extension = 'tar.gz';}
|
||||||
|
elsif ($compress eq 'bzip2'){$extension = 'tar.bz2';}
|
||||||
|
else{$extension = 'tar';}
|
||||||
|
|
||||||
|
if (! checkExec()){
|
||||||
|
print STDERR "\nError, one of the needed executable is not executable\n";
|
||||||
|
$check = 0;
|
||||||
|
}
|
||||||
|
if (! checkDest($destination)){
|
||||||
|
print STDERR "\nError, $destination is not writable\n";
|
||||||
|
$check = 0;
|
||||||
|
}
|
||||||
|
#if (! checkHosts($params{checkHosts}){
|
||||||
|
# print STDERR "\nError, $hosts is not a valid list of hosts\n";
|
||||||
|
# $check = 0;
|
||||||
|
#}
|
||||||
|
|
||||||
|
if ($check eq 1){
|
||||||
|
my @hosts = split(/\s/,$hosts);
|
||||||
|
|
||||||
|
# On supprime toutes les archives existantes sur la destination pour éviter la fragmentation
|
||||||
|
logAndPerform("$path{rm} -f $destination/*.$extension");
|
||||||
|
|
||||||
|
foreach my $host (@hosts){
|
||||||
|
my $cmd = "$path{backuppcBin}/BackupPC_tarCreate -t -h $host -n $backupNum -s $share . ";
|
||||||
|
if (($compress eq 'gzip') || ($compress eq 'bzip2')){
|
||||||
|
$cmd .= "| $path{nice} -n 10 $path{$compress} -c ";
|
||||||
|
}
|
||||||
|
if (($cipher ne 'off') && (-e $key)){
|
||||||
|
$cmd .= "| $path{nice} -n 10 $path{openssl} enc -$cipher -salt -pass file:$key";
|
||||||
|
$extension .= '.enc';
|
||||||
|
}
|
||||||
|
if ($split eq '0'){
|
||||||
|
$cmd .= "> $destination/$host.$backupNum.$extension";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$cmd .= "| $path{split} - -b $split"."m"."$destination/$host.$backupNum.$extension.";
|
||||||
|
}
|
||||||
|
logAndPerform($cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
print STDERR "\nFatal error, aborting\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub mountUsb($$){
|
||||||
|
my ($destination,$device) = @_;
|
||||||
|
my $ok = 0;
|
||||||
|
if (!-e $destination){
|
||||||
|
logAndPerform("$path{mkdir} -p $destination");
|
||||||
|
}
|
||||||
|
if (!-e $destination){
|
||||||
|
print STDERR "\n\n$destination doesn't exist and cannot be created\n\n";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
logAndPerform("$path{sudo} $path{mount} $device $destination");
|
||||||
|
$ok = `$path{mount} | $path{grep} $destination | $path{wc} -l`;
|
||||||
|
chomp($ok);
|
||||||
|
}
|
||||||
|
return $ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub umountUsb($$){
|
||||||
|
my ($destination,$device) = @_;
|
||||||
|
my $ok = 0;
|
||||||
|
my $isMounted = `$path{mount} | $path{grep} $destination | $path{wc} -l`;
|
||||||
|
chomp($isMounted);
|
||||||
|
if ($isMounted eq '1'){
|
||||||
|
print STDERR "\n$device seems to be mounted, lets umount it\n";
|
||||||
|
logAndPerform("$path{sudo} $path{umount} -f $destination");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
print STDERR "\n\nError: $device seems to be already unmounted\n\n";
|
||||||
|
}
|
||||||
|
$isMounted = `$path{mount} | $path{grep} $destination | $path{wc} -l`;
|
||||||
|
chomp($isMounted);
|
||||||
|
if ($isMounted eq '1'){
|
||||||
|
print STDERR "\nError: $device seems to be buzy, lets try to umount it lazily\n";
|
||||||
|
logAndPerform("$path{sudo} $path{umount} -fl $destination");
|
||||||
|
}
|
||||||
|
$isMounted = `$path{mount} | $path{grep} $destination | $path{wc} -l`;
|
||||||
|
chomp($isMounted);
|
||||||
|
if ($isMounted eq '1'){
|
||||||
|
print STDERR "\nError: $device seems to be buzy, lazy umount has failed\n";
|
||||||
|
}
|
||||||
|
if ($isMounted eq '0'){
|
||||||
|
logAndPerform("$path{rmdir} $destination");
|
||||||
|
}
|
||||||
|
$isMounted = `$path{mount} | $path{grep} $destination | $path{wc} -l`;
|
||||||
|
chomp($isMounted);
|
||||||
|
if ($isMounted eq '0'){
|
||||||
|
$ok = 1;
|
||||||
|
}
|
||||||
|
return $ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub remoteArchive($$$$$$$$$){
|
||||||
|
my ($remoteHost,$remoteUser,$remoteDir,$hosts,$backupNum,$share,$compress,$cipher,$key) = @_;
|
||||||
|
my $check = 1;
|
||||||
|
my $extension = 'tar';
|
||||||
|
# on fixe l'extension de l'archive en fonction de la compression utilisée
|
||||||
|
if ($compress eq 'gzip'){$extension = 'tar.gz';}
|
||||||
|
elsif ($compress eq 'bzip2'){$extension = 'tar.bz2';}
|
||||||
|
else{$extension = 'tar';}
|
||||||
|
|
||||||
|
if (! checkExec()){
|
||||||
|
print STDERR "\nError, one of the needed executable is not executable\n";
|
||||||
|
$check = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($check eq 1){
|
||||||
|
my @hosts = split(/\s/,$hosts);
|
||||||
|
|
||||||
|
foreach my $host (@hosts){
|
||||||
|
my $cmd = "$path{backuppcBin}/BackupPC_tarCreate -t -h $host -n $backupNum -s $share . ";
|
||||||
|
if (($compress eq 'gzip') || ($compress eq 'bzip2')){
|
||||||
|
$cmd .= "| $path{$compress} -c ";
|
||||||
|
}
|
||||||
|
if (($cipher ne 'off') && (-e $key)){
|
||||||
|
$cmd .= "| $path{openssl} enc -$cipher -salt -pass file:$key";
|
||||||
|
$extension .= '.enc';
|
||||||
|
}
|
||||||
|
$cmd .= " | $path{ssh} -l $remoteUser $remoteHost \"(cd $remoteDir && $path{cat} > $remoteDir/$host.$backupNum.$extension)\"";
|
||||||
|
|
||||||
|
logAndPerform($cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
print STDERR "\nFatal error, aborting\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
176
root/usr/share/BackupPC/lib/BackupPC/SMEcopyPool.pm
Normal file
176
root/usr/share/BackupPC/lib/BackupPC/SMEcopyPool.pm
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
# Author: Daniel Berteaud (daniel@firewall-services.com)
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
package BackupPC::SMEcopyPool;
|
||||||
|
use lib "/usr/share/BackupPC/lib";
|
||||||
|
use BackupPC::SMEarchive;
|
||||||
|
use Exporter;
|
||||||
|
our @ISA = qw(Exporter);
|
||||||
|
our @EXPORT = qw(&verifTree &stopBackupPC &startBackupPC ©Pool &localCopyPC &remoteCopyPC);
|
||||||
|
|
||||||
|
# Fonction qui vérifie (grossièrement) l'arborescence de la source pour la copie de pool
|
||||||
|
sub verifTree($){
|
||||||
|
my ($source) = @_;
|
||||||
|
print STDERR "\ntesting $source\n";
|
||||||
|
my $ok = 1;
|
||||||
|
foreach ("$source","$source/pc","$source/pool","$source/cpool"){
|
||||||
|
if (!-d "$_"){
|
||||||
|
print STDERR "$_ is not a valid directory, aborting\n";
|
||||||
|
$ok = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Fonction qui arrête le service BackupPC
|
||||||
|
sub stopBackupPC(){
|
||||||
|
if (-e '/var/log/BackupPC/BackupPC.pid'){
|
||||||
|
$pid = `$path{cat} /var/log/BackupPC/BackupPC.pid`;
|
||||||
|
print STDERR "BackupPC is running (pid=$pid), you have requested to stop it\n";
|
||||||
|
logAndPerform("$path{sudo} /etc/rc.d/init.d/backuppc stop");
|
||||||
|
}
|
||||||
|
elsif ((! -e '/var/log/BackupPC/BackupPC.pid') && ($stop eq 'yes')){
|
||||||
|
print STDERR "\nYou have requested to stop BackupPC daemon but it seems that it's not running\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Fonction qui démarre le service BackupPC
|
||||||
|
sub startBackupPC(){
|
||||||
|
if (! -e '/var/log/BackupPC/BackupPC.pid'){
|
||||||
|
print STDERR "\n\nrestarting BackupPC deamon\n\n";
|
||||||
|
logAndPerform("$path{sudo} /etc/rc.d/init.d/backuppc start");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Fonction qui copie les données de backuppc sous forme brut
|
||||||
|
# Ne copie pas le répertoire pc/ (pb de hardlinks, gérés à part)
|
||||||
|
# Peut être utilisée pour une copie local ou distante
|
||||||
|
sub copyPool($$$$){
|
||||||
|
my ($source,$destination,$logFile,$rsyncLog) = @_;
|
||||||
|
|
||||||
|
|
||||||
|
# Si /etc/BackupPC exist, on le sauvegarde dans $params{source}/etc
|
||||||
|
if(-d '/etc/BackupPC'){
|
||||||
|
logAndPerform("$path{mkdir} -p $source/etc") if (!-d "$source/etc");
|
||||||
|
logAndPerform("$path{rsync} -ah --del --stats /etc/BackupPC/ $source/etc/ > $rsyncLog");
|
||||||
|
print STDERR `$path{cat} $rsyncLog`;
|
||||||
|
}
|
||||||
|
# idem pour les logs
|
||||||
|
if(-d '/var/log/BackupPC'){
|
||||||
|
logAndPerform("$path{mkdir} -p $source/log") if (!-d "$source/log");
|
||||||
|
logAndPerform("$path{rsync} -ah --del --stats /var/log/BackupPC/ $source/log/ > $rsyncLog");
|
||||||
|
print STDERR `$path{cat} $rsyncLog`;
|
||||||
|
}
|
||||||
|
|
||||||
|
# commande qui sync en non récursif pour créer les rep nécessaires
|
||||||
|
logAndPerform("$path{rsync} -qlptgoDHhd --stats --del $source/ $destination/ > $rsyncLog");
|
||||||
|
print STDERR `$path{cat} $rsyncLog`;
|
||||||
|
|
||||||
|
# la commande suivante sync tout sauf les rep pc, pool et cpool (pour éviter de saturer la ram)
|
||||||
|
logAndPerform("$path{rsync} -ah --del --stats --exclude=cpool/ --exclude=pool/ --exclude=pc/ $source/ $destination/ > $rsyncLog");
|
||||||
|
print STDERR `$path{cat} $rsyncLog`;
|
||||||
|
|
||||||
|
# Maintenant, on sync le rep pool
|
||||||
|
logAndPerform("$path{rsync} -ah --del --stats $source/pool/ $destination/pool/ > $rsyncLog");
|
||||||
|
print STDERR `$path{cat} $rsyncLog`;
|
||||||
|
|
||||||
|
# Puis le cpool
|
||||||
|
logAndPerform("$path{rsync} -ah --del --stats $source/cpool/ $destination/cpool/ > $rsyncLog");
|
||||||
|
print STDERR `$path{cat} $rsyncLog`;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Fonction qui copie le répertoire pc/ vers un rep local (en utilisant BackupPC_tarPCCopy)
|
||||||
|
sub localCopyPC($$$$$){
|
||||||
|
my ($source,$destination,$compress,$extract,$logFile) = @_;
|
||||||
|
my $archName = 'pc.tar';
|
||||||
|
my $cmd = ();
|
||||||
|
my @pipe = ();
|
||||||
|
my $tarOpts = 'xPf';
|
||||||
|
my $main = '';
|
||||||
|
|
||||||
|
# on vide le répertoire "pc"
|
||||||
|
if ($destination ne ''){
|
||||||
|
logAndPerform("$path{rm} -Rf $destination/pc/*");
|
||||||
|
}
|
||||||
|
|
||||||
|
push(@pipe,"$path{backuppcBin}/BackupPC_tarPCCopy $source/pc/ |");
|
||||||
|
|
||||||
|
if ($compress eq 'gzip'){
|
||||||
|
push (@pipe," $path{gzip} -c |");
|
||||||
|
$archName = "pc.tar.gz";
|
||||||
|
$tarOpts = 'xPzf';
|
||||||
|
}
|
||||||
|
elsif ($compress eq 'bzip2'){
|
||||||
|
push (@pipe," $path{bzip2} -c |");
|
||||||
|
$archName = "pc.tar.bz2";
|
||||||
|
$tarOpts = 'xPjf';
|
||||||
|
}
|
||||||
|
if ($extract eq 'yes'){
|
||||||
|
push (@pipe,"(cd $destination/pc/ && $path{tar} $tarOpts -)");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
push (@pipe,"$path{cat} > $destination/pc/$archName");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (@pipe){
|
||||||
|
$main = $main.$_;
|
||||||
|
}
|
||||||
|
|
||||||
|
logAndPerform($main);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Fonciton qui copie le rep pc/ sur une machine distante (toujours en utilisant BackuPPC_tarPCCopy)
|
||||||
|
sub remoteCopyPC($$$$$$$){
|
||||||
|
my ($source,$remoteHost,$remoteUser,$remoteDir,$compress,$extract,$logFile) = @_;
|
||||||
|
my $archName = 'pc.tar';
|
||||||
|
my $cmd = ();
|
||||||
|
my @pipe = ();
|
||||||
|
my $tarOpts = 'xPf';
|
||||||
|
my $main = '';
|
||||||
|
|
||||||
|
# on vide le répertoire "pc"
|
||||||
|
if ($remoteDir ne ''){
|
||||||
|
logAndPerform("$path{ssh} -l $remoteUser $remoteHost \"$path{rm} -Rf $remoteDir/pc/*\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
push(@pipe,"$path{backuppcBin}/BackupPC_tarPCCopy $source/pc/ |");
|
||||||
|
|
||||||
|
if ($compress eq 'gzip'){
|
||||||
|
push (@pipe," $path{gzip} -c |");
|
||||||
|
$archName = "pc.tar.gz";
|
||||||
|
$tarOpts = 'xPzf';
|
||||||
|
}
|
||||||
|
elsif ($compress eq 'bzip2'){
|
||||||
|
push (@pipe," $path{bzip2} -c |");
|
||||||
|
$archName = "pc.tar.bz2";
|
||||||
|
$tarOpts = 'xPjf';
|
||||||
|
}
|
||||||
|
if ($extract eq 'yes'){
|
||||||
|
push (@pipe,"$path{ssh} -l $remoteUser $remoteHost \"(cd $remoteDir/pc/ && $path{tar} $tarOpts -)\"");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
push (@pipe,"$path{ssh} -l $remoteUser $remoteHost \"$path{cat} > $remoteDir/pc/$archName\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (@pipe){
|
||||||
|
$main = $main.$_;
|
||||||
|
}
|
||||||
|
|
||||||
|
logAndPerform($main);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
104
root/usr/share/smanager/lib/SrvMngr/Controller/Backuppc.pm
Normal file
104
root/usr/share/smanager/lib/SrvMngr/Controller/Backuppc.pm
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
package SrvMngr::Controller::Backuppc;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Administration
|
||||||
|
# description : BackupPC
|
||||||
|
# navigation : 4000 4200
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# name : backuppc, method : get, url : /backuppc, ctlact : Backuppc#main
|
||||||
|
# routes : end
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
use utf8;
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw(theme_list init_session ip_number_or_blank);
|
||||||
|
|
||||||
|
use Quota;
|
||||||
|
use esmith::ConfigDB;
|
||||||
|
use esmith::AccountsDB;
|
||||||
|
|
||||||
|
use esmith::util;
|
||||||
|
use File::Basename;
|
||||||
|
use File::Find;
|
||||||
|
use File::Path qw(make_path remove_tree);
|
||||||
|
|
||||||
|
use esmith::Backup;
|
||||||
|
use esmith::BackupHistoryDB;
|
||||||
|
use esmith::util;
|
||||||
|
use esmith::lockfile;
|
||||||
|
|
||||||
|
use constant DEBUG => $ENV{MOJO_SMANAGER_DEBUG} || 0;
|
||||||
|
|
||||||
|
our $cdb = esmith::ConfigDB->open || die "Couldn't open config db";
|
||||||
|
our $adb = esmith::AccountsDB->open || die "Couldn't open accounts db";
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
#my $modul = get_backuppc( $c );
|
||||||
|
|
||||||
|
my $url = "https://".$c->session->{'SystemName'}.".".$c->session->{"DomainName"}."/BackupPC";
|
||||||
|
#my $url = 'https://sme10.thereadclan.me.uk/BackupPC';
|
||||||
|
$c->stash(url => $url );
|
||||||
|
$c->render(template => 'backuppc');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_backuppc {
|
||||||
|
|
||||||
|
my ($c) = @_;
|
||||||
|
|
||||||
|
my $tx = $c->tx;
|
||||||
|
my $req = $tx->req;
|
||||||
|
|
||||||
|
# 3 env variables for durep.cgi
|
||||||
|
#$ENV{'SCRIPT_NAME'} = 'durep';
|
||||||
|
#$ENV{'REQUEST_METHOD'} = $req->method;
|
||||||
|
#$ENV{'QUERY_STRING'} = $req->url->query->to_string;
|
||||||
|
|
||||||
|
my $res = `https:////sme10.thereadclan.me.uk//BackupPC`;
|
||||||
|
|
||||||
|
my $res = `/usr/share/BackupPC/sbin/BackupPC_Admin`; #
|
||||||
|
my $step = 0; my $out;
|
||||||
|
my @lines = split /\n/, $res;
|
||||||
|
# remove except 'body'
|
||||||
|
foreach my $line (@lines) {
|
||||||
|
if ( $line =~ m|<body>| ) {
|
||||||
|
$step = 1;
|
||||||
|
} elsif ( $line =~ m|</body>| ) {
|
||||||
|
$step = 2;
|
||||||
|
} elsif ( $step == 1 ) {
|
||||||
|
$out .= $line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sub main {
|
||||||
|
|
||||||
|
# my $c = shift;
|
||||||
|
# $c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
# BEGIN
|
||||||
|
# {
|
||||||
|
# $ENV {'PATH'} = '/bin:/usr/bin:/sbin';
|
||||||
|
# $ENV {'SHELL'} = '/bin/bash';
|
||||||
|
# delete $ENV {'ENV'};
|
||||||
|
# }
|
||||||
|
|
||||||
|
|
||||||
|
#$c = $c->redirect_to("https://".$ENV {'HTTP_X_FORWARDED_HOST'}."/BackupPC");
|
||||||
|
# $c = $c->redirect_to("https://sme10.thereadclan.me.uk//BackupPC");
|
||||||
|
|
||||||
|
#}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
% layout 'default', title => 'Sme server 2 - BackupPC';
|
||||||
|
|
||||||
|
% content_for 'head_contrib' => begin
|
||||||
|
|
||||||
|
%end
|
||||||
|
|
||||||
|
% content_for 'module' => begin
|
||||||
|
% if ($config->{debug} == 1) {
|
||||||
|
<p>
|
||||||
|
%= dumper stash 'url'
|
||||||
|
</p>
|
||||||
|
% }
|
||||||
|
|
||||||
|
<div id="central">
|
||||||
|
% if ( stash 'error' ) {
|
||||||
|
<br><div class=sme-error>
|
||||||
|
%= $c->render_to_string(inline => stash 'error')
|
||||||
|
</div>
|
||||||
|
%}
|
||||||
|
|
||||||
|
<iframe src="<%= $url %>" title="Backup PC" width="100%" height="1000px"></iframe>
|
||||||
|
|
||||||
|
%#= $c->render_to_string(inline => $modul)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
% end
|
27
root/var/service/httpd-bkpc/log/run
Normal file
27
root/var/service/httpd-bkpc/log/run
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# copyright (C) 2005 Mitel Networks Corporation
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
# Technical support for this program is available from Mitel Networks
|
||||||
|
# Please visit our web site www.mitel.com/sme/ for details.
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
exec \
|
||||||
|
/usr/local/bin/setuidgid smelog \
|
||||||
|
/usr/local/bin/multilog t s5000000 \
|
||||||
|
/var/log/httpd-bkpc
|
||||||
|
|
12
root/var/service/httpd-bkpc/run
Normal file
12
root/var/service/httpd-bkpc/run
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# copyright (C) 1999-2004 Mitel Networks Corporation
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
config=/etc/httpd/bkpc-conf/httpd.conf
|
||||||
|
|
||||||
|
[ -e $config ] || exit 1
|
||||||
|
|
||||||
|
exec 2>&1
|
||||||
|
exec chpst -P /usr/sbin/httpd -f $config -D FOREGROUND&
|
||||||
|
|
260
smeserver-BackupPC.spec
Normal file
260
smeserver-BackupPC.spec
Normal file
@ -0,0 +1,260 @@
|
|||||||
|
# $Id: smeserver-BackupPC.spec,v 1.16 2023/02/11 09:01:47 terryfage Exp $
|
||||||
|
# Authority: vip-ire
|
||||||
|
# Name: Daniel Berteaud
|
||||||
|
|
||||||
|
Name: smeserver-BackupPC
|
||||||
|
Version: 0.2
|
||||||
|
Release: 16%{?dist}
|
||||||
|
Summary: BackupPC integration into SME server
|
||||||
|
|
||||||
|
Group: Applications/System
|
||||||
|
License: GPL
|
||||||
|
URL: http://backuppc.sourceforge.net/
|
||||||
|
Source: %{name}-%{version}.tar.xz
|
||||||
|
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{version}
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
BuildRequires: e-smith-devtools
|
||||||
|
|
||||||
|
Requires: mod_auth_tkt
|
||||||
|
Requires: BackupPC >= 4.0.0
|
||||||
|
Requires: smeserver-remoteuseraccess
|
||||||
|
Requires: openssl
|
||||||
|
#Requires: e-smith-manager >= 2.8.0
|
||||||
|
Requires: e-smith-apache >= 2.6.0-19
|
||||||
|
AutoReqProv: no
|
||||||
|
|
||||||
|
#Conflicts: smeserver-backuppc.fws
|
||||||
|
Obsoletes: smeserver-backuppc.fws
|
||||||
|
|
||||||
|
|
||||||
|
%description
|
||||||
|
BackupPC is a high-performance, enterprise-grade system for backing up Linux
|
||||||
|
and WinXX PCs and laptops to a server's disk. BackupPC is highly configurable
|
||||||
|
and easy to install and maintain.
|
||||||
|
This package contains specific configuration for SME server
|
||||||
|
|
||||||
|
#----------------------------------------------------
|
||||||
|
|
||||||
|
#%package -n smeserver-BackupPC4
|
||||||
|
#Summary: BackupPC 4 integration into SME server
|
||||||
|
#Group: Email
|
||||||
|
#Requires: BackupPC4
|
||||||
|
#Conflicts: smeserver-BackupPC
|
||||||
|
|
||||||
|
#%description -n smeserver-BackupPC4
|
||||||
|
#BackupPC is a high-performance, enterprise-grade system for backing up Linux
|
||||||
|
#and WinXX PCs and laptops to a server's disk. BackupPC is highly configurable
|
||||||
|
#and easy to install and maintain.
|
||||||
|
#This package contains specific configuration for SME server
|
||||||
|
|
||||||
|
#----------------------------------------------------
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Sat Sep 07 2024 cvs2git.sh aka Brian Read <brianr@koozali.org> 0.2-16.sme
|
||||||
|
- Roll up patches and move to git repo [SME: 12338]
|
||||||
|
|
||||||
|
* Sat Sep 07 2024 BogusDateBot
|
||||||
|
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
|
||||||
|
by assuming the date is correct and changing the weekday.
|
||||||
|
|
||||||
|
* Sat Feb 11 2023 Zsolt Vasarhelyi <vasarhelyizsolt@hotmail.com> 0.2-15.sme
|
||||||
|
- expand-updatedb-conf patch [SME: 10513]
|
||||||
|
|
||||||
|
* Fri Feb 10 2023 Zsolt Vasarhelyi <vasarhelyizsolt@hotmail.com> 0.2-14.sme
|
||||||
|
- $Conf{TopDir} not in locate configuration's PRUNEPATHS [SME: 10513]
|
||||||
|
|
||||||
|
* Sun Jul 31 2022 Jean-Philippe Pialasse <tests@pialasse.com> 0.2-13.sme
|
||||||
|
- update to httpd 2.4 syntax [SME: 12036]
|
||||||
|
including Requires, and bkpc-conf
|
||||||
|
|
||||||
|
* Sat Jul 30 2022 Brian Read <brianr@bjsystems.co.uk> 0.2-12.sme
|
||||||
|
- Re-build and link to latest devtools [SME: 11997]
|
||||||
|
|
||||||
|
* Mon Jul 25 2022 Zsolt Vasarhelyi <vasarhelyizsolt@hotmail.com> 0.2-11.sme
|
||||||
|
- update to httpd 2.4 syntax [SME: 12036]
|
||||||
|
|
||||||
|
* Thu Jul 21 2022 Jean-Philippe Pialasse <tests@pialasse.com> 0.2-10.sme
|
||||||
|
- add configuration to core backup [SME: 12000]
|
||||||
|
- Re-build and link to latest devtools deprecated use of DefaultType [SME: 11875]
|
||||||
|
|
||||||
|
* Fri Oct 01 2021 Brian Read <brianr@bjsystems.co.uk> 0.2-9.sme
|
||||||
|
- Add in code for SM2 panel using iframe - note: Authentication not sorted [SME: 11701]
|
||||||
|
|
||||||
|
* Fri Apr 02 2021 Jean-Philippe Pialasse <tests@pialasse.com> 0.2-8.sme
|
||||||
|
- allow localhost SME backup without SSH, but sudo [SME: 10884]
|
||||||
|
|
||||||
|
* Wed Jan 27 2021 Brian Read <brianr@bjsystems.co.uk> 0.2-7.sme
|
||||||
|
- Get-httpd-bkpc-task-running [SME: 11055]
|
||||||
|
|
||||||
|
* Mon Jan 11 2021 Brian Read <brianr@bjsystems.co.uk> 0.2-6.sme
|
||||||
|
- Update createlinks for systemd according to [SME: 10959][SME: 11055]
|
||||||
|
|
||||||
|
* Fri Nov 27 2020 Brian Read <brianr@bjsystems.co.uk> 0.2-5.sme
|
||||||
|
- Add in extra Loadmodules to httpd.conf [SME: 11055]
|
||||||
|
|
||||||
|
* Tue Oct 27 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 0.2-4.sme
|
||||||
|
- Initial build for SME v10 [SME:11055]
|
||||||
|
- Hard work done by Brian Read
|
||||||
|
- Remove v3 option and revert to just smeserver-BackupPC
|
||||||
|
|
||||||
|
* Mon Nov 25 2019 Jean-Philipe Pialasse <tests@pialasse.com> 0.2-3.sme
|
||||||
|
- initial build to install BackupPC4fix [SME: 10514]
|
||||||
|
|
||||||
|
* Wed May 03 2017 Jean-Philipe Pialasse <tests@pialasse.com> 0.2-2.sme
|
||||||
|
- update TKT auth parameter for SME 9.2 update [SME: 10266]
|
||||||
|
|
||||||
|
* Tue Nov 12 2013 Daniel B. <daniel@firewall-services.com> 0.2-1.sme
|
||||||
|
- Rebuild for SME9
|
||||||
|
|
||||||
|
* Mon Nov 29 2010 Daniel B. <daniel@firewall-services.com> 0.1-12.sme
|
||||||
|
- Support pbzip2 for archiving
|
||||||
|
- Use nice to reduce the priority of compression
|
||||||
|
|
||||||
|
* Tue Jun 16 2009 Daniel B. <daniel@firewall-services.com> [0.1-11]
|
||||||
|
- Remove double quotes when calling signal-event with ssh [SME: 5302]
|
||||||
|
|
||||||
|
* Fri May 29 2009 Daniel B. <daniel@firewall-services.com> [0.1-10]
|
||||||
|
- Call signal-event with it full path in smeserver-template.pl [SME: 5302]
|
||||||
|
|
||||||
|
* Tue May 12 2009 Daniel B. <daniel@firewall-services.com> [0.1-9]
|
||||||
|
- Add optionnal encryption of archives generated with BackupPC_SME_localArchive
|
||||||
|
BackupPC_SME_usbArchive and BackupPC_SME_remoteArchive using openssl
|
||||||
|
- Generate a key and save it in /etc/BackupPC/archive.key
|
||||||
|
- Fixe permission restriction on /etc/BackupPC/*
|
||||||
|
|
||||||
|
* Thu May 07 2009 Daniel B. <daniel@firewall-services.com> [0.1-8]
|
||||||
|
- Link backuppc-checkupgrade script in post-upgrade event
|
||||||
|
so the contrib is correctly configured without running backuppc-update
|
||||||
|
event [SME: 5221]
|
||||||
|
|
||||||
|
* Tue May 05 2009 Daniel B. <daniel@firewall-services.com> [0.1-7]
|
||||||
|
- Fixe permissions on /etc/BackupPC/pc
|
||||||
|
|
||||||
|
* Mon Mar 23 2009 Daniel B. <daniel@firewall-services.com> [0.1-6]
|
||||||
|
- modify default httpd conf (cleanup) to use the new paths
|
||||||
|
- Add quotes in share names for *Archive.conf files
|
||||||
|
- Enhance provided template
|
||||||
|
|
||||||
|
* Wed Mar 18 2009 Daniel B. <daniel@firewall-services.com> [0.1-5]
|
||||||
|
- Enhance sudoers templates
|
||||||
|
|
||||||
|
* Mon Feb 23 2009 Daniel B. <daniel@firewall-services.com> [0.1-4]
|
||||||
|
- Fix logrotate issue (send a sigusr1 signal to httpd-bkpc)
|
||||||
|
|
||||||
|
* Tue Jan 20 2009 Daniel B. <daniel@firewall-services.com> [0.1-3]
|
||||||
|
- Update Exclude path for smeserver config example
|
||||||
|
|
||||||
|
* Thu Dec 11 2008 Daniel B. <daniel@firewall-services.com> [0.1-2]
|
||||||
|
- Revert config and logs paths to their default location
|
||||||
|
- Expand-templates during bootrape-console-save instead of post-upgrade
|
||||||
|
- Remove sudoers templates.metadata to prevent conflict, added smeserver-remoteuseraccess
|
||||||
|
as a dependency
|
||||||
|
|
||||||
|
* Thu Nov 13 2008 Daniel B. <daniel@firewall-services.com> [0.1-1]
|
||||||
|
- Fix logrotate issue
|
||||||
|
|
||||||
|
* Thu Aug 14 2008 Daniel B. <daniel@firewall-services.com> [0.1-0]
|
||||||
|
- Adapted to work with 3.1.0
|
||||||
|
- Split smeserver specific stuff in a separate srpm
|
||||||
|
- Remove pre-compiled binaries from the srpm (par2cmdline must be downloaded separatly if needed)
|
||||||
|
- A dedicated httpd instance is used (running under backuppc user). This increase security as
|
||||||
|
user www no longer has access to backuppc data.
|
||||||
|
- Authentication is integrated with the server-manager (no need to login two times now)
|
||||||
|
- Added some config example (with backups disabled). These can be used as templates for other hosts
|
||||||
|
- Some corrections in backup export scripts (*copyPool scipts still need to be re-written
|
||||||
|
to be more reliable, maybe with dump/restore, or dd, and with built-in support for LVM snapshots)
|
||||||
|
|
||||||
|
* Thu May 10 2007 Daniel Berteaud <daniel@firewall-services.com>
|
||||||
|
- [3.0-1]
|
||||||
|
- corrected default config for localhost (excluding by default /opt/backuppc and /selinux)
|
||||||
|
- improvement of the rpm scriplets
|
||||||
|
- start and stop script linked to e-smith-service
|
||||||
|
- scripts for offline backups
|
||||||
|
- par2 included
|
||||||
|
|
||||||
|
* Tue Jan 30 2007 Daniel Berteaud <daniel@firewall-services.com>
|
||||||
|
- [3.0-0]
|
||||||
|
- rpm package
|
||||||
|
- script BackupPC_SME_remoteBackup to remotly backup the pool (to another UNIX host)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q -n %{name}-%{version}
|
||||||
|
|
||||||
|
%build
|
||||||
|
perl createlinks
|
||||||
|
|
||||||
|
%install
|
||||||
|
|
||||||
|
%{__mkdir} -p $RPM_BUILD_ROOT/var/service/httpd-bkpc/supervise
|
||||||
|
%{__mkdir} -p $RPM_BUILD_ROOT/var/service/httpd-bkpc/log/supervise
|
||||||
|
%{__mkdir} -p $RPM_BUILD_ROOT/var/log/httpd-bkpc
|
||||||
|
|
||||||
|
(cd root ; /usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT)
|
||||||
|
/bin/rm -f %{name}-%{version}-filelist
|
||||||
|
|
||||||
|
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
|
||||||
|
--file "/usr/share/BackupPC/bin/BackupPC_SME_pre-backup" "attr(0755,root,root) %config(noreplace)" \
|
||||||
|
--file "/usr/share/BackupPC/bin/BackupPC_SME_usbArchive" "attr(0755,root,root)" \
|
||||||
|
--file "/usr/share/BackupPC/bin/BackupPC_SME_usbCopyPool" "attr(0755,root,root)" \
|
||||||
|
--file "/usr/share/BackupPC/bin/BackupPC_SME_localArchive" "attr(0755,root,root)" \
|
||||||
|
--file "/usr/share/BackupPC/bin/BackupPC_SME_localCopyPool" "attr(0755,root,root)" \
|
||||||
|
--file "/usr/share/BackupPC/bin/BackupPC_SME_remoteArchive" "attr(0755,root,root)" \
|
||||||
|
--file "/usr/share/BackupPC/bin/BackupPC_SME_remoteCopyPool" "attr(0755,root,root)" \
|
||||||
|
--file "/etc/BackupPC/pc/localserver-template.pl2" "attr(640,backuppc,backuppc) %config(noreplace)" \
|
||||||
|
--file "/etc/BackupPC/pc/smeserver-template.pl2" "attr(640,backuppc,backuppc) %config(noreplace)" \
|
||||||
|
--file "/etc/BackupPC/pc/windows-template.pl" "attr(640,backuppc,backuppc) %config(noreplace)" \
|
||||||
|
--file "/etc/BackupPC/usbArchive.conf" "attr(640,backuppc,backuppc) %config(noreplace)" \
|
||||||
|
--file "/etc/BackupPC/usbCopyPool.conf" "attr(640,backuppc,backuppc) %config(noreplace)" \
|
||||||
|
--file "/etc/BackupPC/localArchive.conf" "attr(640,backuppc,backuppc) %config(noreplace)" \
|
||||||
|
--file "/etc/BackupPC/localCopyPool.conf" "attr(640,backuppc,backuppc) %config(noreplace)" \
|
||||||
|
--file "/etc/BackupPC/remoteArchive.conf" "attr(640,backuppc,backuppc) %config(noreplace)" \
|
||||||
|
--file "/etc/BackupPC/remoteCopyPool.conf" "attr(640,backuppc,backuppc) %config(noreplace)" \
|
||||||
|
--dir "/etc/BackupPC/pc" "attr(750,backuppc,backuppc)" \
|
||||||
|
--dir "/var/service/httpd-bkpc" "attr(01755,root,root)" \
|
||||||
|
--file "/var/service/httpd-bkpc/run" "attr(0700,root,root)" \
|
||||||
|
--dir "/var/service/httpd-bkpc/supervise" "attr(0700,root,root)" \
|
||||||
|
--dir "/var/service/httpd-bkpc/log" "attr(0755,root,root)" \
|
||||||
|
--file "/var/service/httpd-bkpc/log/run" "attr(0755,root,root)" \
|
||||||
|
--dir "/var/service/httpd-bkpc/log/supervise" "attr(0700,root,root)" \
|
||||||
|
--dir "/var/log/httpd-bkpc" "attr(0750,smelog,smelog)" \
|
||||||
|
--ignoredir "/root/var/" \
|
||||||
|
--ignoredir "/usr/share/BackupPC" \
|
||||||
|
--ignoredir "/usr/share/BackupPC/lib" \
|
||||||
|
--ignoredir "/usr/share/BackupPC/lib/BackupPC" \
|
||||||
|
--ignoredir "/etc/BackupPC" \
|
||||||
|
--ignoredir "/etc/httpd" \
|
||||||
|
> %{name}-%{version}-filelist
|
||||||
|
|
||||||
|
|
||||||
|
%clean
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
%files -f %{name}-%{version}-filelist
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
|
||||||
|
#%files -n smeserver-BackupPC4 -f %{name}-%{version}-filelist
|
||||||
|
#%defattr(-,root,root,-)
|
||||||
|
|
||||||
|
|
||||||
|
%pre
|
||||||
|
#%{_sbindir}/useradd -c "BackupPC User" -m -d /home/e-smith/files/users/backuppc -r -s /sbin/nologin backuppc >& /dev/null || :
|
||||||
|
%{_sbindir}/usermod -m -d /var/lib/BackupPC backuppc >& /dev/null || :
|
||||||
|
|
||||||
|
%post
|
||||||
|
systemctl enable backuppc
|
||||||
|
systemctl start backuppc
|
||||||
|
|
||||||
|
%preun
|
||||||
|
|
||||||
|
# Disable services, and stop them
|
||||||
|
if [ $1 = 0 ]; then # Uninstall only, not upgrade
|
||||||
|
db configuration setprop backuppc status disabled >& /dev/null || :
|
||||||
|
db configuration setprop httpd-bkpc status disabled >& /dev/null || :
|
||||||
|
service backuppc stop >& /dev/null || :
|
||||||
|
fi
|
||||||
|
|
||||||
|
true
|
Loading…
Reference in New Issue
Block a user