From: Wayne Davison Date: Wed, 12 Jan 2005 18:48:26 +0000 (+0000) Subject: This is Joe Smith's rrsync (restricted rsync) perl script. X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/44a82a175dbdb34fd2d944b5d21926e9f5348e55 This is Joe Smith's rrsync (restricted rsync) perl script. --- diff --git a/support/rrsync b/support/rrsync new file mode 100644 index 00000000..6b50b28e --- /dev/null +++ b/support/rrsync @@ -0,0 +1,54 @@ +#!/usr/bin/perl +# Name: /usr/local/bin/rrsync Author: Joe Smith 30-Sep-2004 +# Purpose: Restricts rsync to subdirectory declared in .ssh/authorized_keys +# (should have a symlink in /usr/bin) + +use Socket; +use constant LOGFILE => 'rrsync.log'; +my $Usage = <>',LOGFILE) { + my ($mm,$hh) = (localtime)[1,2]; + my $host = $ENV{SSH_CLIENT} || 'unknown'; + $host =~ s/ .*//; # Keep only the client's IP addr + $host = gethostbyaddr(inet_aton($host),AF_INET) || $host; + $_ = sprintf "%-13s",$host; + print LOG "$hh:$mm $_ [$command] =",($dir eq $orig ? " OK" : "> $dir"),"\n"; + close LOG; +} + +exec "$cmd $dir" or die "exec($cmd $dir) failed: $? $!"; +# Note: This assumes that the rsync protocol will not be maliciously hijacked.