Re: [BackupPC-users] A tar restore issue, does not work on localhost
I have no problem creating backups, just restoring them. But please, can someone then tell me what is the best way to do it, i am very confused now... if someone can post an example localhost.pl file i can learn from i would greatly appreciate it... Thanks for all the input... And everyone have a super day! Rob Morin Director of Technologies Dido Internet Inc. Montreal,Canada http://www.dido.ca 514-990- Rob Owens wrote: Holger Parplies wrote: Hi, Rob Morin wrote on 18.10.2007 at 08:15:47 [[BackupPC-users] A tar restore issue, does not work on localhost]: So i found this post , i forget where that mentioned to use a tarCreat file via sudo to do localhost backups... that works fine but restoring does not work, any help appreciated All other servers vis rsync work just fine let me put into a question what I gather from your post you might be asking: I'm doing local backups with XferMethod tar via sudo and a helper script. What do I need to observe when doing restores? Well, first of all, you'll also need to use sudo. If the backuppc user doesn't have sufficient permissions for *reading* the files for backup, he almost definitely won't have sufficient permissions for *writing* them on restore. Second, such helper scripts are a very real security risk. There's just about no advantage, and it's easy to get things wrong. If the backuppc user has *write access* to the script, he (or rather an intruder gaining backuppc user priviledges) has immediate full root access to the system, simply by putting anything he wants into that script and executing it with 'sudo'. Even worse, *any other user* with write access to the script (by local or remote means) can alter it and simply wait for a scheduled backup to be run, thus executing his commands. With such a script, you *really* need to make sure that *only root* has write access to it. Even worse, you need to ensure that command injection is impossible (which it probably isn't). Otherwise an attacker does not even need write access to the script in order to abuse it. Doesn't this security risk exist regardless of helper scripts? The backuppc user has write access to the pool, so can change/insert anything there. Then as long as the host machines are set up to accept restores from the backuppc server, those modified/new files can be uploaded. Is there any way to protect against this? -Rob - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/backuppc-users http://backuppc.sourceforge.net/ - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net List:https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki:http://backuppc.wiki.sourceforge.net Project: http://backuppc.sourceforge.net/
Re: [BackupPC-users] A tar restore issue, does not work on localhost
On 10/23 11:53 , Rob Morin wrote: I have no problem creating backups, just restoring them. But please, can someone then tell me what is the best way to do it, i am very confused now... if someone can post an example localhost.pl file i can learn from i would greatly appreciate it... This is the one included in the Debian package, slightly modified for my purposes (using sudo so the backup can get access to all files, for example). # cat /etc/backuppc/localhost.pl # Local server backup of /etc as user backuppc # $Conf{XferMethod} = 'tar'; $Conf{TarShareName} = ['/etc']; $Conf{TarClientCmd} = '/usr/bin/env LC_ALL=C /usr/bin/sudo $tarPath' . ' -c -v -f - -C $shareName --totals'; # let it back itself up anytime it wants to. $Conf{BlackoutPeriods} = []; there's of course a corresponding entry in /etc/sudoers: backuppc ALL=NOPASSWD: /bin/tar -- Carl Soderstrom Systems Administrator Real-Time Enterprises www.real-time.com - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net List:https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki:http://backuppc.wiki.sourceforge.net Project: http://backuppc.sourceforge.net/
Re: [BackupPC-users] A tar restore issue, does not work on localhost
So here is the error... I tried to restore these files as a test 2007-10-23 12:12:26 Running: /usr/share/backuppc/bin/BackupPC_tarCreate -h localhost http://joe.dido.ca:888/backuppc/index.cgi?host=localhost -n 13 -s / -t -r /home/rob -p /home/rob/ /home/rob/70_sare_header.cf /home/rob/70_sare_header0.cf /home/rob/70_sare_header2.cf /home/rob/70_sare_specific.cf 2007-10-23 12:12:30 Restore failed (BackupPC_tarCreate failed) My current localhost.pl # Local server backup of / as user backuppc $Conf{XferMethod} = 'tar'; $Conf{TarShareName} = ['/']; ### My old command before i just changed it #$Conf{TarClientCmd} = '/usr/bin/sudo /usr/local/bin/tarCreate -v -f - -C $shareName+ --totals'; $Conf{TarClientCmd} = '/usr/bin/env LC_ALL=C /usr/bin/sudo $tarPath' . ' -c -v -f - -C $shareName --totals'; $Conf{TarFullArgs} = '$fileList'; $Conf{TarIncrArgs} = '--newer=$incrDate $fileList'; $Conf{BackupFilesExclude} = ['/tmp', '/root/.cpan', '/var/log', '/var/downloads', '/media', '/mnt', '/proc', '/var/lib/backuppc', '/sys', '/var/oldjoe', '/var/run']; My sudo file backuppc ALL = NOPASSWD: /bin/tar Anything else you need? Thanks for your help and prompt reply! Rob Morin Director of Technologies Dido Internet Inc. Montreal,Canada http://www.dido.ca 514-990- Carl Wilhelm Soderstrom wrote: On 10/23 11:53 , Rob Morin wrote: I have no problem creating backups, just restoring them. But please, can someone then tell me what is the best way to do it, i am very confused now... if someone can post an example localhost.pl file i can learn from i would greatly appreciate it... This is the one included in the Debian package, slightly modified for my purposes (using sudo so the backup can get access to all files, for example). # cat /etc/backuppc/localhost.pl # Local server backup of /etc as user backuppc # $Conf{XferMethod} = 'tar'; $Conf{TarShareName} = ['/etc']; $Conf{TarClientCmd} = '/usr/bin/env LC_ALL=C /usr/bin/sudo $tarPath' . ' -c -v -f - -C $shareName --totals'; # let it back itself up anytime it wants to. $Conf{BlackoutPeriods} = []; there's of course a corresponding entry in /etc/sudoers: backuppc ALL=NOPASSWD: /bin/tar - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net List:https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki:http://backuppc.wiki.sourceforge.net Project: http://backuppc.sourceforge.net/
Re: [BackupPC-users] A tar restore issue, does not work on localhost
On 10/23 12:17 , Rob Morin wrote: 2007-10-23 12:12:26 Running: /usr/share/backuppc/bin/BackupPC_tarCreate -h localhost http://joe.dido.ca:888/backuppc/index.cgi?host=localhost -n 13 -s / -t -r /home/rob -p /home/rob/ /home/rob/70_sare_header.cf /home/rob/70_sare_header0.cf /home/rob/70_sare_header2.cf /home/rob/70_sare_specific.cf 2007-10-23 12:12:30 Restore failed (BackupPC_tarCreate failed) I'll point out that I distrust allowing a web application to write to the filesystem; so I don't have BackupPC set up to do restores to the filesystem. If I want to recover some files; I'll collect them up as a tarball using the web interface, copy them to the system in question, unpack them, and then move them into place after looking at things carefully. If I need to restore a whole share worth of files, I'll use BackupPC_tarCreate on the command line, and then pipe it over to the machine in question using netcat. So I've never really done what I think you're trying to do, and therefore am not much help. I do wonder why that URL is in the command line tho. The -h localhost http://joe.dido.ca:888/backuppc/index.cgi?host=localhost bit. AFAIK it should just be -h localhost; but I haven't done much with the new web interface so I could be just out of date. -- Carl Soderstrom Systems Administrator Real-Time Enterprises www.real-time.com - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net List:https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki:http://backuppc.wiki.sourceforge.net Project: http://backuppc.sourceforge.net/
Re: [BackupPC-users] A tar restore issue, does not work on localhost
OK well thanks anyways. the webserver in question, is on a secure LAN, and no public access it, only 3 technicians.. ANyone else? Thanks Rob Morin Director of Technologies Dido Internet Inc. Montreal,Canada http://www.dido.ca 514-990- Carl Wilhelm Soderstrom wrote: On 10/23 12:17 , Rob Morin wrote: 2007-10-23 12:12:26 Running: /usr/share/backuppc/bin/BackupPC_tarCreate -h localhost http://joe.dido.ca:888/backuppc/index.cgi?host=localhost -n 13 -s / -t -r /home/rob -p /home/rob/ /home/rob/70_sare_header.cf /home/rob/70_sare_header0.cf /home/rob/70_sare_header2.cf /home/rob/70_sare_specific.cf 2007-10-23 12:12:30 Restore failed (BackupPC_tarCreate failed) I'll point out that I distrust allowing a web application to write to the filesystem; so I don't have BackupPC set up to do restores to the filesystem. If I want to recover some files; I'll collect them up as a tarball using the web interface, copy them to the system in question, unpack them, and then move them into place after looking at things carefully. If I need to restore a whole share worth of files, I'll use BackupPC_tarCreate on the command line, and then pipe it over to the machine in question using netcat. So I've never really done what I think you're trying to do, and therefore am not much help. I do wonder why that URL is in the command line tho. The -h localhost http://joe.dido.ca:888/backuppc/index.cgi?host=localhost bit. AFAIK it should just be -h localhost; but I haven't done much with the new web interface so I could be just out of date. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net List:https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki:http://backuppc.wiki.sourceforge.net Project: http://backuppc.sourceforge.net/
Re: [BackupPC-users] A tar restore issue, does not work on localhost
Holger Parplies wrote: Hi, Rob Morin wrote on 18.10.2007 at 08:15:47 [[BackupPC-users] A tar restore issue, does not work on localhost]: So i found this post , i forget where that mentioned to use a tarCreat file via sudo to do localhost backups... that works fine but restoring does not work, any help appreciated All other servers vis rsync work just fine let me put into a question what I gather from your post you might be asking: I'm doing local backups with XferMethod tar via sudo and a helper script. What do I need to observe when doing restores? Well, first of all, you'll also need to use sudo. If the backuppc user doesn't have sufficient permissions for *reading* the files for backup, he almost definitely won't have sufficient permissions for *writing* them on restore. Second, such helper scripts are a very real security risk. There's just about no advantage, and it's easy to get things wrong. If the backuppc user has *write access* to the script, he (or rather an intruder gaining backuppc user priviledges) has immediate full root access to the system, simply by putting anything he wants into that script and executing it with 'sudo'. Even worse, *any other user* with write access to the script (by local or remote means) can alter it and simply wait for a scheduled backup to be run, thus executing his commands. With such a script, you *really* need to make sure that *only root* has write access to it. Even worse, you need to ensure that command injection is impossible (which it probably isn't). Otherwise an attacker does not even need write access to the script in order to abuse it. Doesn't this security risk exist regardless of helper scripts? The backuppc user has write access to the pool, so can change/insert anything there. Then as long as the host machines are set up to accept restores from the backuppc server, those modified/new files can be uploaded. Is there any way to protect against this? -Rob - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/backuppc-users http://backuppc.sourceforge.net/
Re: [BackupPC-users] A tar restore issue, does not work on localhost
On 10/18 08:15 , Rob Morin wrote: So i found this post , i forget where that mentioned to use a tarCreat file via sudo to do localhost backups... that works fine but restoring does not work, any help appreciated All other servers vis rsync work just fine HELP can you restore the file by finding it under the pc/ directory in your backppc data store and recovering it with BackupPC_zcat? Just making sure the file is there and recoverable. -- Carl Soderstrom Systems Administrator Real-Time Enterprises www.real-time.com - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/backuppc-users http://backuppc.sourceforge.net/
Re: [BackupPC-users] A tar restore issue, does not work on localhost
The files are there, however not sure what the command line would be to restore it manually... Thanks for replying Rob Morin Director of Technologies Dido Internet Inc. Montreal,Canada http://www.dido.ca 514-990- Carl Wilhelm Soderstrom wrote: On 10/18 08:15 , Rob Morin wrote: So i found this post , i forget where that mentioned to use a tarCreat file via sudo to do localhost backups... that works fine but restoring does not work, any help appreciated All other servers vis rsync work just fine HELP can you restore the file by finding it under the pc/ directory in your backppc data store and recovering it with BackupPC_zcat? Just making sure the file is there and recoverable. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/backuppc-users http://backuppc.sourceforge.net/
Re: [BackupPC-users] A tar restore issue, does not work on localhost
On 10/18 10:27 , Rob Morin wrote: The files are there, however not sure what the command line would be to restore it manually... I'll give you an example from my system (installed from a Debian package). You can modify it for your own needs. # /usr/share/backuppc/bin/BackupPC_zcat /var/lib/backuppc/pc/localhost/859/f%2fetc/fmotd.tail there's no arguments needed to BackupPC_zcat other than the filename. -- Carl Soderstrom Systems Administrator Real-Time Enterprises www.real-time.com - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/backuppc-users http://backuppc.sourceforge.net/
Re: [BackupPC-users] A tar restore issue, does not work on localhost
Hi, Rob Morin wrote on 18.10.2007 at 08:15:47 [[BackupPC-users] A tar restore issue, does not work on localhost]: So i found this post , i forget where that mentioned to use a tarCreat file via sudo to do localhost backups... that works fine but restoring does not work, any help appreciated All other servers vis rsync work just fine let me put into a question what I gather from your post you might be asking: I'm doing local backups with XferMethod tar via sudo and a helper script. What do I need to observe when doing restores? Well, first of all, you'll also need to use sudo. If the backuppc user doesn't have sufficient permissions for *reading* the files for backup, he almost definitely won't have sufficient permissions for *writing* them on restore. Second, such helper scripts are a very real security risk. There's just about no advantage, and it's easy to get things wrong. If the backuppc user has *write access* to the script, he (or rather an intruder gaining backuppc user priviledges) has immediate full root access to the system, simply by putting anything he wants into that script and executing it with 'sudo'. Even worse, *any other user* with write access to the script (by local or remote means) can alter it and simply wait for a scheduled backup to be run, thus executing his commands. With such a script, you *really* need to make sure that *only root* has write access to it. Even worse, you need to ensure that command injection is impossible (which it probably isn't). Otherwise an attacker does not even need write access to the script in order to abuse it. You can achieve the same as with your unhelpful helper script without the risks by simply putting this into the sudoers file: backuppc ALL=NOPASSWD: /bin/tar -c * That said, the only point of this seems to be to *limit backuppc's access to reading*, i.e. creating tar files and not extracting tar files. If you want to allow both backup and restore, it simply becomes backuppc ALL=NOPASSWD: /bin/tar True, if you wanted to do more complex things like limit what the backuppc user is allowed to backup, you'd need a helper script, but you're not doing that. So, to sum it up: 1.) add to localhost.pl $Conf {TarClientRestoreCmd} = '/usr/bin/sudo $tarPath -x -p --numeric-owner --same-owner -v -f - -C $shareName'; 2.) change the sudoers line to backuppc ALL=NOPASSWD: /bin/tar 3.) be more precise with your spelling ... locahost.pl file The tarCreat file used backuppc ALL = NOPASSWD: /usr/local/bin/tarCreate One other thing (actually, the part you are currently having problems with as opposed to what problems would come after you've fixed that, which I have addressed above): Error as seen in the web gui along with the command used 2007-10-17 16:05:56 Running: /usr/share/backuppc/bin/BackupPC_tarCreate -h localhost http://joe.dido.ca:888/backuppc/index.cgi?host=localhost -n 8 -s / -t -r /home/rob -p /home/rob/ /home/rob/Videotron.txt 2007-10-17 16:06:00 Restore failed (BackupPC_tarCreate failed) it appears you've incorrectly pasted something into somewhere. I *often* see things people have pasted from the web interface containing HTML markup on this list. I suppose people are either too lazy to remove it or don't notice. Perl does. The http://joe.dido.ca:888/backuppc/index.cgi?host=localhost does ***not*** belong in that command. I'm not really sure where it came from, but if it's really in the log file (and thus was in the command) and not just misquoted, then it's the cause of your problems. Hope that HELP! s. Regards, Holger - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/backuppc-users http://backuppc.sourceforge.net/