From: Rich R. <ri...@sh...> - 2007-10-01 17:16:31
|
Peter Carlsson wrote: > Hello! > > I'm using BackupPC version 2.1.2pl1 on a Debian (stable) server to > successfully backup itself as well as two other Debian-machines on > the local network. > > What is the best/easiest way to configure BackupPC to also backup > two other machines (one Debian and on Windows XP) that is on > another network and connects to the Internet with an DSL provider > using PPPoE? > > I have failed to find information how to do that. Could someone > please explain what to do or point me to some documentation. > > I use rsync with an ssh tunnel for Linux. I use password-less ssh to get to the other box (theoretically you could also do that with XP and Cygwin, but I've found ssh for XP/Cygwin to be really unreliable as a service.) I prefer to ssh in as an unprivileged user who then opens a tunnel to the (configured read-only, listen to localhost only) rsync service. My prebackup command is: #!/bin/sh cd /tmp && /usr/bin/ssh -o "Compression yes" -o "CompressionLevel 9" -x -carcfour -2 -f -N -L 9001:localhost:873 us...@re...o 1>/dev/null 2>/dev/null & sleep 5 My postbackup command is: #!/bin/sh /usr/bin/pgrep -f '/usr/bin/ssh .* us...@re...o' | /usr/bin/xargs /usr/bin/kill And I use this ping_tcp script for checking ssh availability (because ICMP is sometimes firewalled, and it is the ssh port we really need to check for.) This script is intended to have output similar enough to /sbin/ping that BackupPC can parse it. #!/usr/bin/perl -w use strict; use Net::Ping; my $p = Net::Ping->new("tcp", 30); $p->hires(); $p->{port_num} = getservbyname($ARGV[0], "tcp"); my @res = $p->ping($ARGV[1]); if(@res) { my ($succ,$rtt,$ip) = @res; if($succ) { my $ms = $rtt*1000; print "$ARGV[1] [$ip] - $ARGV[0] - time=$ms ms\n"; } else { exit -1; } } My client.pl config file: $Conf{RsyncdClientPort} = '9001'; $Conf{ClientNameAlias} = 'localhost'; $Conf{RsyncdPasswd} = 'password'; $Conf{PingMaxMsec} = '2000'; $Conf{DumpPreUserCmd} = '/etc/BackupPC/bin/ssh_remote.host.foo'; $Conf{DumpPostUserCmd} = '/etc/BackupPC/bin/kill_ssh_remote.host.foo'; $Conf{PingCmd} = '/etc/BackupPC/bin/ping_tcp ssh remote.host.foo'; And the remote rsyncd.conf: use chroot=yes secrets file = /etc/rsyncd.secrets Hosts allow = 127.0.0.1 Hosts deny = * [BackupPC] uid = root gid = root auth users = BackupPC read only=yes path = / I'm going to put a copy of this (quick and dirty/no formatting for now) at http://shroop.net/backuppc Rich |