X-Git-Url: https://git.ralfj.de/schsh.git/blobdiff_plain/5271c7e79fc1c1250a9c9d20f461638b8cb1f44a..8267bd6bf492d37367ef794bc0b4f3fd2791a6c5:/schsh-rrsync?ds=inline diff --git a/schsh-rrsync b/schsh-rrsync old mode 100755 new mode 100644 index bb51629..75c252b --- a/schsh-rrsync +++ b/schsh-rrsync @@ -3,16 +3,16 @@ # Purpose: Restricts rsync to subdirectory declared in .ssh/authorized_keys # Author: Joe Smith 30-Sep-2004 # Modified by: Wayne Davison +# Modified by: Ralf Jung use strict; -use Socket; +# use Socket; use Cwd 'abs_path'; use File::Glob ':glob'; # You may configure these values to your liking. See also the section # of options if you want to disable any options that rsync accepts. use constant RSYNC => '/usr/bin/rsync'; -use constant LOGFILE => 'rrsync.log'; my $Usage = < 1; $short_with_num = "[$short_with_num]" if length($short_with_num) > 1; -my $write_log = -f LOGFILE && open(LOG, '>>', LOGFILE); - -chdir($subdir) or die "$0: Unable to chdir to restricted dir: $!\n"; - my(@opts, @args); my $in_options = 1; my $last_opt = ''; @@ -191,16 +182,6 @@ die "$0: invalid rsync-command syntax or options\n" if $in_options; @args = ( '.' ) if !@args; -if ($write_log) { - my ($mm,$hh) = (localtime)[1,2]; - my $host = $ENV{SSH_CONNECTION} || 'unknown'; - $host =~ s/ .*//; # Keep only the client's IP addr - $host =~ s/^::ffff://; - $host = gethostbyaddr(inet_aton($host),AF_INET) || $host; - printf LOG "%02d:%02d %-13s [%s]\n", $hh, $mm, $host, "@opts @args"; - close LOG; -} - # Note: This assumes that the rsync protocol will not be maliciously hijacked. exec(RSYNC, @opts, @args) or die "exec(rsync @opts @args) failed: $? $!";