diff --git a/.gitignore b/.gitignore index 5713cb9..5da92fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ BackupPC-3.1.2.tar.gz /BackupPC-3.3.0.tar.gz /BackupPC-3.3.1.tar.gz +/BackupPC-4.1.1.tar.gz diff --git a/BackupPC-3.2.1-locatedb.patch b/BackupPC-3.2.1-locatedb.patch deleted file mode 100644 index 70978e5..0000000 --- a/BackupPC-3.2.1-locatedb.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff -Naur BackupPC-3.2.1-pristine/init.d/src/linux-backuppc BackupPC-3.2.1/init.d/src/linux-backuppc ---- BackupPC-3.2.1-pristine/init.d/src/linux-backuppc 2011-04-24 21:31:55.000000000 -0600 -+++ BackupPC-3.2.1/init.d/src/linux-backuppc 2011-07-07 21:36:41.363281386 -0600 -@@ -20,6 +20,25 @@ - - RETVAL=0 - -+topDirCheck() -+{ -+ updatedb=/etc/updatedb.conf -+ topdir=$(perl <<_EOF_ -+ require '__CONFDIR__/config.pl'; -+ print \$Conf{TopDir}; -+_EOF_ -+) -+ if [ -r $updatedb ]; then -+ grep ^PRUNEPATHS $updatedb | grep ${topdir%%/} > /dev/null -+ if [ $? -eq 1 ]; then -+ logger -t BackupPC -s "WARNING: Your BackupPC \$Conf{TopDir} is not listed in the locate" -+ logger -t BackupPC -s "database configuration's PRUNEPATHS. This may cause all of your" -+ logger -t BackupPC -s "backed up files to be indexed!" -+ fi -+ fi -+} -+ -+ - start() { - # - # You can set the SMB share password here is you wish. Otherwise -@@ -38,6 +57,7 @@ - echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/backuppc || \ - RETVAL=1 -+ topDirCheck - return $RETVAL - } - diff --git a/BackupPC-3.2.1-piddir.patch b/BackupPC-3.2.1-piddir.patch deleted file mode 100644 index ed3e56a..0000000 --- a/BackupPC-3.2.1-piddir.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -Naur BackupPC-3.2.1-pristine/bin/BackupPC BackupPC-3.2.1/bin/BackupPC ---- BackupPC-3.2.1-pristine/bin/BackupPC 2011-04-24 21:31:54.000000000 -0600 -+++ BackupPC-3.2.1/bin/BackupPC 2011-07-08 21:14:46.609762024 -0600 -@@ -363,11 +363,11 @@ - # Write out our initial status and save our PID - # - StatusWrite(); -- unlink("$LogDir/BackupPC.pid"); -- if ( open(PID, ">", "$LogDir/BackupPC.pid") ) { -+ unlink("/var/run/BackupPC/BackupPC.pid"); -+ if ( open(PID, ">", "/var/run/BackupPC/BackupPC.pid") ) { - print(PID $$); - close(PID); -- chmod(0444, "$LogDir/BackupPC.pid"); -+ chmod(0444, "/var/run/BackupPC/BackupPC.pid"); - } - - # -@@ -1846,7 +1846,7 @@ - close(LOG); - LogFileOpen(); - print(LOG "Fatal error: unhandled signal $SigName\n"); -- unlink("$LogDir/BackupPC.pid"); -+ unlink("/var/run/BackupPC/BackupPC.pid"); - confess("Got new signal $SigName... quitting\n"); - } else { - $SigName = shift; -@@ -1968,7 +1968,7 @@ - } - delete($Info{pid}); - StatusWrite(); -- unlink("$LogDir/BackupPC.pid"); -+ unlink("/var/run/BackupPC/BackupPC.pid"); - exit(1); - } - diff --git a/BackupPC-3.2.1-rundir.patch b/BackupPC-3.2.1-rundir.patch deleted file mode 100644 index 79efff1..0000000 --- a/BackupPC-3.2.1-rundir.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -Naur BackupPC-3.2.1-pristine/bin/BackupPC BackupPC-3.2.1/bin/BackupPC ---- BackupPC-3.2.1-pristine/bin/BackupPC 2011-04-24 21:31:54.000000000 -0600 -+++ BackupPC-3.2.1/bin/BackupPC 2011-07-07 22:25:55.287651463 -0600 -@@ -1885,7 +1885,7 @@ - print(LOG $bpc->timeStamp, "unix socket() failed: $!\n"); - exit(1); - } -- my $sockFile = "$LogDir/BackupPC.sock"; -+ my $sockFile = "/var/run/BackupPC/BackupPC.sock"; - unlink($sockFile); - if ( !bind(SERVER_UNIX, sockaddr_un($sockFile)) ) { - print(LOG $bpc->timeStamp, "unix bind() failed: $!\n"); -diff -Naur BackupPC-3.2.1-pristine/lib/BackupPC/Lib.pm BackupPC-3.2.1/lib/BackupPC/Lib.pm ---- BackupPC-3.2.1-pristine/lib/BackupPC/Lib.pm 2011-04-24 21:31:55.000000000 -0600 -+++ BackupPC-3.2.1/lib/BackupPC/Lib.pm 2011-07-07 22:26:46.744614593 -0600 -@@ -686,7 +686,7 @@ - # - # First try the unix-domain socket - # -- my $sockFile = "$bpc->{LogDir}/BackupPC.sock"; -+ my $sockFile = "/var/run/BackupPC/BackupPC.sock"; - socket(*FH, PF_UNIX, SOCK_STREAM, 0) || return "unix socket: $!"; - if ( !connect(*FH, sockaddr_un($sockFile)) ) { - my $err = "unix connect: $!"; diff --git a/BackupPC-3.3.0-fix-shadow-access.patch b/BackupPC-3.3.0-fix-shadow-access.patch deleted file mode 100644 index 5dc2755..0000000 --- a/BackupPC-3.3.0-fix-shadow-access.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -Naur BackupPC-3.3.0-pristine/lib/BackupPC/CGI/Lib.pm BackupPC-3.3.0/lib/BackupPC/CGI/Lib.pm ---- BackupPC-3.3.0-pristine/lib/BackupPC/CGI/Lib.pm 2013-04-14 14:43:32.000000000 -0600 -+++ BackupPC-3.3.0/lib/BackupPC/CGI/Lib.pm 2014-02-21 22:42:25.844412429 -0700 -@@ -144,7 +144,7 @@ - # Verify we are running as the correct user - # - if ( $Conf{BackupPCUserVerify} -- && $> != (my $uid = (getpwnam($Conf{BackupPCUser}))[2]) ) { -+ && $> != (my $uid = (getpwnam($Conf{BackupPCUser}))) ) { - ErrorExit(eval("qq{$Lang->{Wrong_user__my_userid_is___}}"), <{Conf}{BackupPCUserVerify} -- && $> != (my $uid = (getpwnam($bpc->{Conf}{BackupPCUser}))[2]) ) { -+ && $> != (my $uid = (getpwnam($bpc->{Conf}{BackupPCUser}))) ) { - print(STDERR "$0: Wrong user: my userid is $>, instead of $uid" - . " ($bpc->{Conf}{BackupPCUser})\n"); - print(STDERR "Please su $bpc->{Conf}{BackupPCUser} first\n"); diff --git a/BackupPC-3.3.1-IPv6-support.patch b/BackupPC-3.3.1-IPv6-support.patch deleted file mode 100644 index 7576879..0000000 --- a/BackupPC-3.3.1-IPv6-support.patch +++ /dev/null @@ -1,171 +0,0 @@ -Index: configure.pl -=================================================================== -RCS file: /cvsroot/backuppc/BackupPC/configure.pl,v -retrieving revision 1.51 -diff -u -w -r1.51 configure.pl ---- configure.pl 12 Jan 2015 00:56:40 -0000 1.51 -+++ configure.pl 17 Oct 2016 10:42:05 -0000 -@@ -253,6 +253,7 @@ - nmblookup => "NmbLookupPath", - rsync => "RsyncClientPath", - ping => "PingPath", -+ 'ping6/ping' => "PingPath6", - df => "DfPath", - 'ssh/ssh2' => "SshPath", - sendmail => "SendmailPath", -Index: bin/BackupPC_dump -=================================================================== -RCS file: /cvsroot/backuppc/BackupPC/bin/BackupPC_dump,v -retrieving revision 1.51 -diff -u -w -r1.51 BackupPC_dump ---- bin/BackupPC_dump 12 Jan 2015 00:56:40 -0000 1.51 -+++ bin/BackupPC_dump 17 Oct 2016 10:42:05 -0000 -@@ -493,7 +493,7 @@ - } else { - $host = $client; - } -- if ( !defined(gethostbyname($host)) ) { -+ if ( !defined($bpc->resolve($host)) ) { - # - # Ok, NS doesn't know about it. Maybe it is a NetBios name - # instead. -Index: bin/BackupPC_restore -=================================================================== -RCS file: /cvsroot/backuppc/BackupPC/bin/BackupPC_restore,v -retrieving revision 1.36 -diff -u -w -r1.36 BackupPC_restore ---- bin/BackupPC_restore 12 Jan 2015 00:56:40 -0000 1.36 -+++ bin/BackupPC_restore 17 Oct 2016 10:42:05 -0000 -@@ -167,7 +167,7 @@ - # Find its IP address - # - if ( $hostIP !~ /\d+\.\d+\.\d+\.\d+/ ) { -- if ( !defined(gethostbyname($host)) ) { -+ if ( !defined($bpc->resolve($host)) ) { - # - # Ok, NS doesn't know about it. Maybe it is a NetBios name - # instead. -Index: conf/config.pl -=================================================================== -RCS file: /cvsroot/backuppc/BackupPC/conf/config.pl,v -retrieving revision 1.58 -diff -u -w -r1.58 config.pl ---- conf/config.pl 12 Jan 2015 00:56:40 -0000 1.58 -+++ conf/config.pl 17 Oct 2016 10:42:06 -0000 -@@ -1652,9 +1652,24 @@ - $Conf{PingPath} = ''; - - # -+# Like PingPath, but for IPv6. Security caution: normal users -+# should not be allowed to write to this file or directory. -+# In some environments, this is something like '/usr/bin/ping6'. -+# In modern environments, the regular ping command can handle both -+# IPv4 and IPv6. In the latter case, just set it to $Conf{PingPath} -+# -+# If you want to disable ping checking for IPv6 hosts, set this to -+# some program that exits with 0 status, eg: -+# -+# $Conf{PingPath6} = '/bin/echo'; -+# -+$Conf{PingPath6} = ''; -+ -+# - # Ping command. The following variables are substituted at run-time: - # --# $pingPath path to ping ($Conf{PingPath}) -+# $pingPath path to ping ($Conf{PingPath} or $Conf{PingPath6}) -+# depending on the address type of $host. - # $host host name - # - # Wade Brown reports that on solaris 2.6 and 2.7 ping -s returns the wrong -Index: lib/BackupPC/Config.pm -=================================================================== -RCS file: /cvsroot/backuppc/BackupPC/lib/BackupPC/Config.pm,v -retrieving revision 1.3 -diff -u -w -r1.3 Config.pm ---- lib/BackupPC/Config.pm 2 Aug 2003 08:01:43 -0000 1.3 -+++ lib/BackupPC/Config.pm 17 Oct 2016 10:42:06 -0000 -@@ -269,6 +269,9 @@ - PingPath => {struct => 'SCALAR', - type => 'STRING', }, - -+ PingPath6 => {struct => 'SCALAR', -+ type => 'STRING', }, -+ - PingArgs => {struct => 'SCALAR', - type => 'STRING', }, - -Index: lib/BackupPC/Lib.pm -=================================================================== -RCS file: /cvsroot/backuppc/BackupPC/lib/BackupPC/Lib.pm,v -retrieving revision 1.53 -diff -u -w -r1.53 Lib.pm ---- lib/BackupPC/Lib.pm 12 Jan 2015 00:56:41 -0000 1.53 -+++ lib/BackupPC/Lib.pm 17 Oct 2016 10:42:06 -0000 -@@ -982,7 +982,7 @@ - } - - my $args = { -- pingPath => $bpc->{Conf}{PingPath}, -+ pingPath => $bpc->getPingPathByAddressType( $host ), - host => $host, - }; - $pingCmd = $bpc->cmdVarSubstitute($bpc->{Conf}{PingCmd}, $args); -@@ -1543,4 +1543,27 @@ - return $glob; - } - -+# -+# Attempts to resolve a hostname. -+# Return 4 if it resolves to an IPv4 address, 6 if it resolves to an IPv6 -+# address or undef if it can not be resolved. -+# -+sub resolve -+{ -+ my ( $bpc, $host ) = @_; -+ my ( $err, @addrs ) = Socket::getaddrinfo($host); -+ return undef if ( $err ); -+ return (($addrs[0])->{'family'} == Socket::AF_INET6) ? 6 : 4; -+} -+ -+# -+# Return pingPath depending on address type of target. -+# -+sub getPingPathByAddressType -+{ -+ my ( $bpc, $host ) = @_; -+ my $at = $bpc->resolve( $host ) || 4; -+ return ($at == 6) ? $bpc->{Conf}{PingPath6} : $bpc->{Conf}{PingPath}; -+} -+ - 1; -Index: lib/BackupPC/CGI/EditConfig.pm -=================================================================== -RCS file: /cvsroot/backuppc/BackupPC/lib/BackupPC/CGI/EditConfig.pm,v -retrieving revision 1.29 -diff -u -w -r1.29 EditConfig.pm ---- lib/BackupPC/CGI/EditConfig.pm 12 Jan 2015 00:56:41 -0000 1.29 -+++ lib/BackupPC/CGI/EditConfig.pm 17 Oct 2016 10:42:06 -0000 -@@ -86,6 +86,7 @@ - {name => "SshPath"}, - {name => "NmbLookupPath"}, - {name => "PingPath"}, -+ {name => "PingPath6"}, - {name => "DfPath"}, - {name => "SplitPath"}, - {name => "ParPath"}, -Index: lib/BackupPC/Config/Meta.pm -=================================================================== -RCS file: /cvsroot/backuppc/BackupPC/lib/BackupPC/Config/Meta.pm,v -retrieving revision 1.28 -diff -u -w -r1.28 Meta.pm ---- lib/BackupPC/Config/Meta.pm 12 Jan 2015 00:56:41 -0000 1.28 -+++ lib/BackupPC/Config/Meta.pm 17 Oct 2016 10:42:06 -0000 -@@ -85,6 +85,7 @@ - SshPath => {type => "execPath", undefIfEmpty => 1}, - NmbLookupPath => {type => "execPath", undefIfEmpty => 1}, - PingPath => {type => "execPath", undefIfEmpty => 1}, -+ PingPath6 => {type => "execPath", undefIfEmpty => 1}, - DfPath => {type => "execPath", undefIfEmpty => 1}, - DfCmd => "string", - SplitPath => {type => "execPath", undefIfEmpty => 1}, diff --git a/BackupPC-3.3.1-perl_defined_at_deprecation.patch b/BackupPC-3.3.1-perl_defined_at_deprecation.patch deleted file mode 100644 index afc71c2..0000000 --- a/BackupPC-3.3.1-perl_defined_at_deprecation.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- BackupPC-3.3.1/lib/BackupPC/CGI/Browse.pm.orig 2016-07-15 10:32:24.007070271 +0200 -+++ BackupPC-3.3.1/lib/BackupPC/CGI/Browse.pm 2016-07-15 10:33:00.920213213 +0200 -@@ -65,7 +65,7 @@ - # - # default to the newest backup - # -- if ( !defined($In{num}) && defined(@Backups) && @Backups > 0 ) { -+ if ( !defined($In{num}) && @Backups > 0 ) { - $i = @Backups - 1; - $num = $Backups[$i]{num}; - } diff --git a/BackupPC-3.3.1-perl_unescaped_left_brace.patch b/BackupPC-3.3.1-perl_unescaped_left_brace.patch deleted file mode 100644 index c8930a0..0000000 --- a/BackupPC-3.3.1-perl_unescaped_left_brace.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- BackupPC-3.3.1/lib/BackupPC/Lib.pm.orig 2016-12-22 14:40:02.589015927 +0100 -+++ BackupPC-3.3.1/lib/BackupPC/Lib.pm 2016-12-22 14:41:37.511427617 +0100 -@@ -1261,7 +1261,7 @@ - # - # Replace scalar variables first - # -- $arg =~ s[\${(\w+)}(\+?)]{ -+ $arg =~ s[\$\{(\w+)}(\+?)]{ - exists($vars->{$1}) && ref($vars->{$1}) ne "ARRAY" - ? ($2 eq "+" ? $bpc->shellEscape($vars->{$1}) : $vars->{$1}) - : "\${$1}$2" -@@ -1270,7 +1270,7 @@ - # Now replicate any array arguments; this just works for just one - # array var in each argument. - # -- if ( $arg =~ m[(.*)\${(\w+)}(\+?)(.*)] && ref($vars->{$2}) eq "ARRAY" ) { -+ if ( $arg =~ m[(.*)\$\{(\w+)}(\+?)(.*)] && ref($vars->{$2}) eq "ARRAY" ) { - my $pre = $1; - my $var = $2; - my $esc = $3; -@@ -1295,7 +1295,7 @@ - sub cmdExecOrEval - { - my($bpc, $cmd, @args) = @_; -- -+ - if ( (ref($cmd) eq "ARRAY" ? $cmd->[0] : $cmd) =~ /^\&/ ) { - $cmd = join(" ", @$cmd) if ( ref($cmd) eq "ARRAY" ); - print(STDERR "cmdExecOrEval: about to eval perl code $cmd\n") -@@ -1336,7 +1336,7 @@ - my($bpc, $cmd, $stdoutCB, $ignoreStderr, $pidHandlerCB, @args) = @_; - my($pid, $out, $allOut); - local(*CHILD); -- -+ - $? = 0; - if ( (ref($cmd) eq "ARRAY" ? $cmd->[0] : $cmd) =~ /^\&/ ) { - $cmd = join(" ", @$cmd) if ( ref($cmd) eq "ARRAY" ); diff --git a/BackupPC-4.1.1-docfix.patch b/BackupPC-4.1.1-docfix.patch new file mode 100644 index 0000000..dc8fcf2 --- /dev/null +++ b/BackupPC-4.1.1-docfix.patch @@ -0,0 +1,39 @@ +--- a/configure.pl ++++ b/configure.pl +@@ -934,7 +934,7 @@ sub DoInstall + # + # Create install directories + # +- foreach my $dir ( qw(bin share/doc/BackupPC ++ foreach my $dir ( qw(bin doc + lib/BackupPC/CGI + lib/BackupPC/Config + lib/BackupPC/Lang +@@ -1064,13 +1064,13 @@ sub DoInstall + print("Making Apache configuration file for suid-perl\n"); + InstallFile("httpd/src/BackupPC.conf", "httpd/BackupPC.conf", 0644); + +- print("Installing docs in $DestDir$Conf{InstallDir}/share/doc/BackupPC\n"); ++ print("Installing docs in $DestDir$Conf{InstallDir}/doc\n"); + foreach my $doc ( qw(BackupPC.pod BackupPC.html) ) { +- InstallFile("doc/$doc", "$DestDir$Conf{InstallDir}/share/doc/BackupPC/$doc", 0444); ++ InstallFile("doc/$doc", "$DestDir$Conf{InstallDir}/doc/$doc", 0444); + # + # clean up files from old directory + # +- unlink("$DestDir$Conf{InstallDir}/doc/$doc") if ( -f "$DestDir$Conf{InstallDir}/doc/$doc" ); ++ #unlink("$DestDir$Conf{InstallDir}/doc/$doc") if ( -f "$DestDir$Conf{InstallDir}/doc/$doc" ); + } + # + # clean up old directory (ok if it quietly fails if there are other files in that directory) +--- a/lib/BackupPC/CGI/View.pm ++++ b/lib/BackupPC/CGI/View.pm +@@ -102,7 +102,7 @@ sub action + $file = $bpc->ConfDir() . "/hosts"; + $linkHosts = 1; + } elsif ( $type eq "docs" ) { +- $file = $bpc->InstallDir() . "/share/doc/BackupPC/BackupPC.html"; ++ $file = $bpc->InstallDir() . "/doc/BackupPC.html"; + } elsif ( $host ne "" ) { + if ( !defined($In{num}) ) { + # get the latest LOG file diff --git a/BackupPC-README.fedora b/BackupPC-README.fedora deleted file mode 100644 index 448c279..0000000 --- a/BackupPC-README.fedora +++ /dev/null @@ -1,17 +0,0 @@ -BackupPC's README file for Fedora - -## BackupPC's user -For security reasons, backuppc user cannot log in. If you want to start manual -backup (ie for debugging), you'll need to set it a shell : -usermod -s /bin/bash - -Do not forget to create an SSH key (ssk-keygen) and copy it to remote computers -if you plan to use tar/rsync over SSH backup method. - -## BackupPC's web interface -The CGI web interface is located at : -http://localhost/BackupPC - -You will need to create users in /etc/BackupPC/apache.users : -htpasswd -c /etc/BackupPC/apache.users username -(Note that the '-c' flag is only necessary to create the file) diff --git a/BackupPC.htaccess b/BackupPC.htaccess index 1ebc77e..e63c3b9 100644 --- a/BackupPC.htaccess +++ b/BackupPC.htaccess @@ -1,4 +1,4 @@ - + # BackupPC requires valid authentication in order for the web interface to # function properly. One can view the web interface without authentication # though all functionality is disabled. @@ -28,10 +28,9 @@ AuthName "BackupPC" require valid-user - - + Alias /BackupPC/images /usr/share/BackupPC/html/ -ScriptAlias /BackupPC /usr/share/BackupPC/sbin/BackupPC_Admin -ScriptAlias /backuppc /usr/share/BackupPC/sbin/BackupPC_Admin +ScriptAlias /BackupPC /usr/libexec/BackupPC/BackupPC_Admin +ScriptAlias /backuppc /usr/libexec/BackupPC/BackupPC_Admin diff --git a/BackupPC.spec b/BackupPC.spec index 512d67d..bd04216 100644 --- a/BackupPC.spec +++ b/BackupPC.spec @@ -1,10 +1,5 @@ -# enable -PIE build %global _hardened_build 1 -%if 0%{?rhel} && 0%{?rhel} < 5 -%global _without_selinux 1 -%endif - # tmpfiles.d & systemd support in all supported Fedora now, but not RHEL < 7 %if 0%{?fedora} || 0%{?rhel} >= 7 %global _with_tmpfilesd 1 @@ -13,136 +8,103 @@ %global _updatedb_conf /etc/updatedb.conf +%global ver_major 4 +%global ver_minor 1 +%global ver_patch 1 +%global ver_under %{ver_major}_%{ver_minor}_%{ver_patch} + Name: BackupPC -Version: 3.3.1 -Release: 9%{?dist} +Version: %{ver_major}.%{ver_minor}.%{ver_patch} +Release: 1%{?dist} Summary: High-performance backup system Group: Applications/System License: GPLv2+ -URL: http://backuppc.sourceforge.net/ - -Source0: http://downloads.sourceforge.net/backuppc/%{name}-%{version}.tar.gz -Patch0: BackupPC-3.2.1-locatedb.patch -Patch1: BackupPC-3.2.1-rundir.patch -Patch2: BackupPC-3.2.1-piddir.patch -Patch3: BackupPC-3.3.0-fix-shadow-access.patch -Patch4: BackupPC-3.3.1-perl_defined_at_deprecation.patch -Patch5: BackupPC-3.3.1-IPv6-support.patch -Patch6: BackupPC-3.3.1-perl_unescaped_left_brace.patch +URL: http://backuppc.github.io/backuppc/index.html + +Source0: https://github.com/backuppc/backuppc/releases/download/%{version}/%{name}-%{version}.tar.gz Source1: BackupPC.htaccess Source2: BackupPC.logrotate -Source3: BackupPC-README.fedora +Source3: README.setup #A C wrapper to use since perl-suidperl is no longer provided Source4: BackupPC_Admin.c Source5: backuppc.service Source6: BackupPC.tmpfiles Source7: README.RHEL -BuildRequires: %{_bindir}/smbclient, %{_bindir}/nmblookup -BuildRequires: rsync -BuildRequires: coreutils -BuildRequires: tar -BuildRequires: openssh-clients +Patch0: BackupPC-4.1.1-docfix.patch + BuildRequires: perl-generators +BuildRequires: perl(BackupPC::XS) >= 0.53 +BuildRequires: perl(CGI) BuildRequires: perl(Compress::Zlib) BuildRequires: perl(Data::Dumper) BuildRequires: perl(Digest::MD5) +BuildRequires: perl(Encode) +BuildRequires: perl(File::Listing) BuildRequires: perl(Pod::Usage) +BuildRequires: perl(version) %if 0%{?_with_systemd} -BuildRequires: systemd-units +BuildRequires: systemd %endif # Unbundled libraries -Requires: perl(Net::FTP::AutoReconnect), perl(Net::FTP::RetrHandle) +Requires: perl(Net::FTP::AutoReconnect) +Requires: perl(Net::FTP::RetrHandle) Requires: httpd -Requires: perl(File::RsyncP), perl(Compress::Zlib), perl(Archive::Zip) -Requires: perl-Time-modules, perl(XML::RSS), perl(Digest::MD5) -Requires: rsync -# This is a file dependency so EL5 can use samba or samba-client or -# samba3x-client -Requires: %{_bindir}/smbclient, %{_bindir}/nmblookup +Requires: iputils +Requires: openssh-clients +Requires: par2cmdline +Requires: rrdtool +Requires: rsync-bpc >= 3.0.9.6 +Requires: perl(Archive::Zip) +Requires: perl(BackupPC::XS) >= 0.53 +Requires: perl(CGI) +Requires: perl(Compress::Zlib) +Requires: perl(Digest::MD5) +Requires: perl(Encode) +Requires: perl(File::Listing) +Requires: perl-Time-modules +Requires: perl(version) +Requires: perl(XML::RSS) +Requires: samba-client Requires(pre): %{_sbindir}/useradd %if 0%{?_with_systemd} -Requires(preun): systemd-units -Requires(post): systemd-units, %{_sbindir}/usermod -Requires(postun): systemd-units +Requires(preun): systemd +Requires(post): systemd %{_sbindir}/usermod +Requires(postun): systemd %else Requires(preun): initscripts, chkconfig Requires(post): initscripts, chkconfig, %{_sbindir}/usermod Requires(postun): initscripts %endif -%if ! 0%{?_without_selinux} Requires: policycoreutils BuildRequires: selinux-policy-devel, checkpolicy -%endif Provides: backuppc = %{version} -# BuildRoot required for RHEL5 -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %description BackupPC is a high-performance, enterprise-grade system for backing up Linux and WinXX and Mac OS X PCs and laptops to a server's disk. BackupPC is highly configurable and easy to install and maintain. -%prep +NOTE: Proper configuration is required after install, see README.setup for more +information. -%setup -q -%patch0 -p1 -b .locatedb -%patch1 -p1 -b .rundir -%patch2 -p1 -b .piddir -%patch3 -p1 -b .shadow-access -%patch4 -p1 -b .oldperl -%patch5 -p0 -b .ipv6support -%patch6 -p1 -b .unescaped_brace_perl +%prep +%autosetup -p1 -sed -i "s|\"backuppc\"|\"$LOGNAME\"|g" configure.pl -for f in ChangeLog doc/BackupPC.pod doc/BackupPC.html; do +for f in ChangeLog; do iconv -f ISO-8859-1 -t UTF-8 $f > $f.utf && mv $f.utf $f done -#incorrect FSF address -sed -i 's|59 Temple Place, Suite 330, Boston, MA *02111-1307 USA|51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA|' \ - lib/BackupPC/CGI/Queue.pm \ - bin/BackupPC_archive \ - lib/BackupPC/CGI/StartServer.pm \ - lib/BackupPC/CGI/HostInfo.pm \ - lib/BackupPC/CGI/Archive.pm \ - lib/BackupPC/CGI/LOGlist.pm \ - lib/BackupPC/FileZIO.pm \ - lib/BackupPC/CGI/GeneralInfo.pm \ - lib/BackupPC/CGI/Browse.pm \ - lib/BackupPC/CGI/RSS.pm \ - lib/BackupPC/CGI/Restore.pm \ - lib/BackupPC/CGI/RestoreFile.pm \ - bin/BackupPC_restore \ - lib/BackupPC/CGI/DirHistory.pm \ - lib/BackupPC/Xfer/Archive.pm \ - lib/BackupPC/Config/Meta.pm \ - lib/BackupPC/CGI/ArchiveInfo.pm \ - lib/BackupPC/CGI/ReloadServer.pm \ - lib/BackupPC/CGI/View.pm \ - bin/BackupPC_tarExtract \ - lib/BackupPC/CGI/EmailSummary.pm \ - lib/BackupPC/Xfer/RsyncFileIO.pm \ - lib/BackupPC/CGI/RestoreInfo.pm \ - lib/BackupPC/CGI/StartStopBackup.pm \ - lib/BackupPC/CGI/StopServer.pm \ - lib/BackupPC/CGI/AdminOptions.pm \ - lib/BackupPC/CGI/Summary.pm \ - lib/BackupPC/CGI/EditConfig.pm - -chmod a-x LICENSE README - -cp %{SOURCE3} README.fedora -cp %{SOURCE7} README.RHEL -cp %{SOURCE4} BackupPC_Admin.c - -%if ! 0%{?_without_selinux} +cp %{SOURCE3} . +cp %{SOURCE7} . +cp %{SOURCE4} . + mkdir selinux pushd selinux @@ -177,113 +139,112 @@ EOF cat >%{name}.fc < 1,|ClientNameAlias => 0,|' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/config.pl +mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d/ +mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d/ +mkdir -p %{buildroot}%{_localstatedir}/log/%{name} +mkdir -p %{buildroot}%{_sysconfdir}/%{name} -#perl-suidperl is no longer avaialable, we use a C wrapper -mv $RPM_BUILD_ROOT%{_datadir}/%{name}/sbin/BackupPC_Admin $RPM_BUILD_ROOT%{_datadir}/%{name}/sbin/BackupPC_Admin.pl -install -p BackupPC_Admin $RPM_BUILD_ROOT%{_datadir}/%{name}/sbin/ - -%if ! 0%{?_without_selinux} - # SElinux - %{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name} - %{__install} -m644 selinux/%{name}.pp $RPM_BUILD_ROOT%{_datadir}/selinux/packages/%{name}/%{name}.pp -%endif +install -p -m 0644 %{SOURCE1} \ + %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf +install -p -m 0644 %{SOURCE2} \ + %{buildroot}%{_sysconfdir}/logrotate.d/%{name} +# perl-suidperl is no longer avaialable, we use a C wrapper +mkdir -p %{buildroot}%{_datadir}/%{name}/sbin +mv %{buildroot}%{_libexecdir}/%{name}/BackupPC_Admin \ + %{buildroot}%{_datadir}/%{name}/sbin/BackupPC_Admin +install -pm 0755 BackupPC_Admin %{buildroot}%{_libexecdir}/%{name}/ -%clean -rm -rf $RPM_BUILD_ROOT +# SElinux +mkdir -p %{buildroot}%{_datadir}/selinux/packages/%{name} +install -m 0644 selinux/%{name}.pp %{buildroot}%{_datadir}/selinux/packages/%{name}/%{name}.pp %pre %{_sbindir}/useradd -d %{_localstatedir}/lib/%{name} -r -s /sbin/nologin backuppc 2> /dev/null || : - %preun +%if 0%{?_with_systemd} +%systemd_preun backuppc.service +%else if [ $1 = 0 ]; then # Package removal, not upgrade - %if 0%{?_with_systemd} - /bin/systemctl --no-reload disable backuppc.service > /dev/null 2>&1 || : - /bin/systemctl stop backuppc.service > /dev/null 2>&1 || : - %else service backuppc stop > /dev/null 2>&1 || : chkconfig --del backuppc || : - %endif fi +%endif %post -%if ! 0%{?_without_selinux} ( # Install/update Selinux policy semodule -i %{_datadir}/selinux/packages/%{name}/%{name}.pp @@ -291,19 +252,16 @@ fi restorecon -R %{_sysconfdir}/%{name} restorecon -R %{_localstatedir}/log/%{name} ) &>/dev/null -%endif +%if 0%{?_with_systemd} +%systemd_post backuppc.service +%else if [ $1 -eq 1 ]; then # initial installation - %if 0%{?_with_systemd} - /bin/systemctl daemon-reload > /dev/null 2>&1 || : - %else chkconfig --add backuppc || : - service httpd condrestart > /dev/null 2>&1 || : - %endif - %{_sbindir}/usermod -a -G backuppc apache || : fi - +%{_sbindir}/usermod -a -G backuppc apache || : +%endif # add BackupPC backup directories to PRUNEPATHS in locate database if [ -w %{_updatedb_conf} ]; then @@ -320,41 +278,29 @@ service httpd condrestart > /dev/null 2>&1 || : if [ $1 -eq 0 ]; then # uninstall - %if ! 0%{?_without_selinux} # Remove the SElinux policy. semodule -r %{name} &> /dev/null || : - %endif - # remove BackupPC backup directories from PRUNEPATHS in locate database if [ -w %{_updatedb_conf} ]; then sed -i '\@PRUNEPATHS@s@[ ]*'%{_localstatedir}/lib/%{name}'@@' %{_updatedb_conf} || : fi fi -if [ $1 -eq 1 ]; then - # package upgrade, not uninstall - %if 0%{?_with_systemd} - /bin/systemctl try-restart backuppc.service > /dev/null 2>&1 || : - %endif - # at least one command required - : -fi +%systemd_postun_with_restart backuppc.service + %files -%defattr(-,root,root,-) -%doc README README.fedora README.RHEL ChangeLog doc/ +%doc README.md README.setup README.RHEL ChangeLog doc/* %license LICENSE - %dir %attr(-,backuppc,backuppc) %{_localstatedir}/log/%{name} %dir %attr(-,backuppc,backuppc) %{_sysconfdir}/%{name}/ - %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf %config(noreplace) %attr(-,backuppc,backuppc) %{_sysconfdir}/%{name}/* %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} - -%dir %{_datadir}/%{name} +%dir %{_datadir}/%{name} %dir %{_datadir}/%{name}/sbin %{_datadir}/%{name}/[^s]* +%attr(750,backuppc,apache) %{_datadir}/%{name}/sbin/BackupPC_Admin %if 0%{?_with_tmpfilesd} %{_tmpfilesdir}/%{name}.conf @@ -367,15 +313,21 @@ fi %attr(0755,root,root) %{_initrddir}/backuppc %endif -%attr(4750,backuppc,apache) %{_datadir}/%{name}/sbin/BackupPC_Admin -%attr(750,backuppc,apache) %{_datadir}/%{name}/sbin/BackupPC_Admin.pl +%attr(4750,backuppc,apache) %{_libexecdir}/%{name}/BackupPC_Admin %attr(-,backuppc,root) %{_localstatedir}/lib/%{name}/ - -%if ! 0%{?_without_selinux} %{_datadir}/selinux/packages/%{name}/%{name}.pp -%endif + %changelog +* Thu Mar 30 2017 Richard Shaw - 4.1.1-1 +- Update to latest upstream release, 4.1.1. + +* Sat Mar 25 2017 Richard Shaw - 4.1.0-1 +- Update to latest upstream release, 4.1.0. + +* Thu Mar 9 2017 Richard Shaw - 4.0.0-1 +- Update to latest upstream release, 4.0.0. + * Wed Mar 1 2017 Ville Skyttä - 3.3.1-9 - Move tmpfiles.d config to %%{_tmpfilesdir} - Install LICENSE as %%license diff --git a/BackupPC_Admin.c b/BackupPC_Admin.c index be3137f..db75d6b 100644 --- a/BackupPC_Admin.c +++ b/BackupPC_Admin.c @@ -1,10 +1,12 @@ #include -#ifndef REAL_PATH -#define REAL_PATH "/usr/share/BackupPC/sbin/BackupPC_Admin.pl" -#endif -int main(ac, av) -char **av; +#include +#include + +int main( int argc, char ** argv, char ** envp ) { - execv(REAL_PATH, av); - return 0; + if( setgid(getegid()) ) perror( "setgid" ); + if( setuid(geteuid()) ) perror( "setuid" ); + execv( "/usr/share/BackupPC/sbin/BackupPC_Admin", argv ); + perror( argv[0] ); + return errno; } diff --git a/README.setup b/README.setup new file mode 100644 index 0000000..501ebd9 --- /dev/null +++ b/README.setup @@ -0,0 +1,31 @@ +BackupPC's README file for Fedora & EPEL + +## BackupPC's user +For security reasons, backuppc user cannot log in. If you want to start manual +backup (ie for debugging), you'll need to set it a shell : + +Permanent: +usermod -s /bin/bash + +or + +Temporary: +su -s /bin/bash -l backuppc + + +Do not forget to create an SSH key (ssk-keygen) and copy it to remote computers +if you plan to use tar/rsync over SSH backup method. + +The easiest way to do this (after logging in as the backuppc user) is to use ssh-copy-id + +## BackupPC's web interface +The CGI web interface is located at : +http://localhost/BackupPC + +You will need to create users in /etc/BackupPC/apache.users : +htpasswd -c /etc/BackupPC/apache.users username +(Note that the '-c' flag is only necessary to create the file) + +Once complete, add that user as an admin in config.pl: + +$Conf{BackupPCUser} = '' diff --git a/backuppc.service b/backuppc.service index 2bf870c..1b0bd86 100644 --- a/backuppc.service +++ b/backuppc.service @@ -3,11 +3,11 @@ Description= BackupPC server After=syslog.target local-fs.target remote-fs.target [Service] -Type=oneshot +Type=simple User=backuppc Group=backuppc -ExecStart=/usr/share/BackupPC/bin/BackupPC -d -RemainAfterExit=yes +ExecStart=/usr/share/BackupPC/bin/BackupPC +PIDFile=/var/run/BackupPC/BackupPC.pid [Install] WantedBy=multi-user.target diff --git a/sources b/sources index 384dd58..2b81f87 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -5efdcdd48e9e0d4ef7a706902d1f8b3d BackupPC-3.3.1.tar.gz +SHA512 (BackupPC-4.1.1.tar.gz) = 3c7589bc8e28f65f373ca92342b4231cc586a63c6bb3ee3aec3f81ae6a8b6154a386db750e087e73b955e5016a92c4638033bfc7070a00325eaf41a181c10368