[X2Go-Commits] [telekinesis] 01/01: finalize tekidata-sftpserver

git-admin at x2go.org git-admin at x2go.org
Wed Oct 1 15:26:53 CEST 2014


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository telekinesis.

commit 748f7ed13497960ebcaa16885d5985973fc8adf4
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed Oct 1 15:26:49 2014 +0200

    finalize tekidata-sftpserver
---
 .../lib/telekinesis/server/bin/tekidata-sftpserver |   36 ++------------------
 1 file changed, 3 insertions(+), 33 deletions(-)

diff --git a/server/lib/telekinesis/server/bin/tekidata-sftpserver b/server/lib/telekinesis/server/bin/tekidata-sftpserver
index 679c106..9fbd036 100755
--- a/server/lib/telekinesis/server/bin/tekidata-sftpserver
+++ b/server/lib/telekinesis/server/bin/tekidata-sftpserver
@@ -5,21 +5,7 @@ use warnings;
 use Net::SFTP::SftpServer ( { log => 'local5' }, qw ( :LOG :ACTIONS ) );
 use BSD::Resource;        # for setrlimit
 
-use constant DEBUG_USER => {
-	SFTPTEST => 1,
-}
-
-# Security - make sure we have started this as sftp not ssh
-#unless ( scalar @ARGV == 3 and
-#         $ARGV[1] eq '-c'  and
-#         ($ARGV[2] eq '/usr/lib/telekinesis/server/bin/tekidata-sftpserver') ){
-#
-#       logError "SFTP connection attempted for application $ARGV[1], $ARGV[2] - exiting";
-#       print "\n\rYou do not have permission to login interactively to this host.\n\r\n\rPlease contact the system administrator if you believe this to be a configuration error.\n\r";
-#       exit 1;
-#}
-
-my $session_name = shift;
+my $session_name = shift or die "Need session name/id is first argument.";
 my $my_home = $ENV{HOME};
 
 my $MEMLIMIT = 100 * 1024 * 1024; # 100 Mb
@@ -28,18 +14,14 @@ my $MEMLIMIT = 100 * 1024 * 1024; # 100 Mb
 setrlimit( RLIMIT_RSS,  $MEMLIMIT, $MEMLIMIT );
 setrlimit( RLIMIT_VMEM, $MEMLIMIT, $MEMLIMIT );
 
-my $debug = (defined DEBUG_USER->{uc(getpwuid($>))} and DEBUG_USER->{uc(getpwuid($>))}) ? 1 : 0;
-
 my $sftp = Net::SFTP::SftpServer->new(
-  debug               => $debug,
+  debug               => 0,
   home                => "$my_home/.x2go/C-$session_name/telekinesis/remote",
   file_perms          => 0600,
-#  on_file_sent        => \&ActionOnSent,
-#  on_file_received    => \&ActionOnReceived,
   valid_filename_char => [ 'a' .. 'z', 'A' .. 'Z', '0' .. '9', '_', '.', '-' ],
-  follow_symlinks     => 1,
   deny                => ALL,
   allow               => [ (
+                              NET_SFTP_SYMLINKS,
                               SSH2_FXP_OPEN,
                               SSH2_FXP_CLOSE,
                               SSH2_FXP_READ,
@@ -48,9 +30,7 @@ my $sftp = Net::SFTP::SftpServer->new(
                               SSH2_FXP_FSTAT,
                               SSH2_FXP_OPENDIR,
                               SSH2_FXP_READDIR,
-                              SSH2_FXP_REMOVE,
                               SSH2_FXP_STAT,
-                              SSH2_FXP_RENAME,
                               SSH2_FXP_READLINK,
                            )],
   fake_ok             => [ (
@@ -60,13 +40,3 @@ my $sftp = Net::SFTP::SftpServer->new(
 );
 
 $sftp->run();
-
-sub ActionOnSent {
-  my $fileObject = shift;
-   ## Do Stuff
-}
-
-sub ActionOnReceived {
-  my $fileObject = shift;
-   ## Do Stuff
-}

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/telekinesis.git


More information about the x2go-commits mailing list