Received: (at submit) by bugs.x2go.org; 23 Oct 2013 12:54:16 +0000
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
	ymir.das-netzwerkteam.de
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	HTML_MESSAGE,RCVD_IN_DNSWL_BLOCKED,URIBL_BLOCKED autolearn=ham version=3.3.2
X-Greylist: delayed 563 seconds by postgrey-1.34 at ymir; Wed, 23 Oct 2013 14:54:15 CEST
Received: from mx01.mykolab.com (mx01.mykolab.com [95.128.36.1])
	by ymir (Postfix) with ESMTPS id 7BD7F5DA79
	for <submit@bugs.x2go.org>; Wed, 23 Oct 2013 14:54:15 +0200 (CEST)
X-Virus-Scanned: amavisd-new at kolabsys.net
Sender: helmer.teles@mykolab.com
From: Helmer Teles <helmer.teles@mykolab.com>
To: submit@bugs.x2go.org
Subject: Default umask when mounting sshfs tunnel
Date: Wed, 23 Oct 2013 13:44:47 +0100
Message-ID: <1456688.sWGnl1COIA@zen-touch>
Content-Type: multipart/mixed; boundary="nextPart3529790.WpD8B2inZL"
Content-Transfer-Encoding: 7Bit

This is a multi-part message in MIME format.

--nextPart3529790.WpD8B2inZL
Content-Type: multipart/alternative; boundary="nextPart1486325.3Kpct7TGlk"
Content-Transfer-Encoding: 7Bit

This is a multi-part message in MIME format.

--nextPart1486325.3Kpct7TGlk
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="iso-8859-1"

Package: x2goserver
Version: 4.0.1.6-0~712~precise1
Tag: Patch

Hello dear mates.


Just had a problem that when a user moves or copy a file from the mounted sshfs dir to 
a shared directory on the x2goserver, if this is a shared folder for a group with 
respective ACL's we've got a problem with the final permissions. 


The easy way to solve this is to change the x2gomountdirs to include the umask param. 


Also included is the modification required at /etc/x2goserver.conf 
If stay uncommented the umask will stay as is on the server side ( client local computer 
) and the value provided ( 0117 ) will make all files to be with rw-rw---- 


P.S: As i don't have the original x2goserver.conf don't apply the diff as is, but use it as 
reference please. 


the diff's are attached as Mr. Michael kindly asked.


Best regards,


--
Com os melhores cumprimentos. 
Helmer Teles 

http://hteles.wordpress.com[1]

"Sent from my Linux Device"
Please don't send me proprietary file formats, use ISO standard ODF instead (ISO/IEC 
26300) 



--------
[1] http://hteles.wordpress.com/

--nextPart1486325.3Kpct7TGlk
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-=
html40/strict.dtd">
<html><head><meta name=3D"qrichtext" content=3D"1" /><style type=3D"text/cs=
s">
p, li { white-space: pre-wrap; }
</style></head><body style=3D" font-family:'OxygenSans'; font-size:9pt; fon=
t-weight:400; font-style:normal;">
<p style=3D" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-r=
ight:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span sty=
le=3D" font-family:'Courier New,courier'; color:#000000;">Package: x2goserv=
er</span></p>
<p style=3D" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-r=
ight:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span sty=
le=3D" font-family:'Courier New,courier'; color:#000000;">Version: 4.0.1.6-=
0~712~precise1</span></p>
<p style=3D" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-r=
ight:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span sty=
le=3D" font-family:'Courier New,courier'; color:#000000;">Tag: Patch</span>=
</p>
<p style=3D"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; ma=
rgin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; ">&nb=
sp;</p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=
=3D" font-size:12px; color:#141312;">Hello dear mates.</span></p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=
=3D" font-size:12px; color:#141312;"><br /></span></p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=
=3D" font-size:12px; color:#141312;">Just had a problem that when a user mo=
ves or copy a file from the mounted sshfs dir to a shared directory on the =
x2goserver, if this is a shared folder for a group with respective ACL's we=
've got a problem with the final permissions.</span> </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=
=3D" font-size:12px; color:#141312;"><br /></span></p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=
=3D" font-size:12px; color:#141312;">The easy way to solve this is to chang=
e the x2gomountdirs to include the umask param.</span> </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=
=3D" font-size:12px; color:#141312;"><br /></span></p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=
=3D" font-size:12px; color:#141312;">Also included is the modification requ=
ired at /etc/x2goserver.conf</span> </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=
=3D" font-size:12px; color:#141312;">If stay uncommented the umask will sta=
y as is on the server side ( client local computer ) and the value provided=
 ( 0117 ) will make all files to be with rw-rw----</span> </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=
=3D" font-size:12px; color:#141312;"><br /></span></p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=
=3D" font-size:12px; color:#141312;">P.S: As i don't have the original x2go=
server.conf don't apply the diff as is, but use it as reference please.</sp=
an> </p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=
=3D" font-size:12px; color:#141312;"><br /></span></p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=
=3D" font-size:12px; color:#141312;">the diff's are attached as Mr. Michael=
 kindly asked.</span></p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=
=3D" font-size:12px; color:#141312;"><br /></span></p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=
=3D" font-size:12px; color:#141312;">Best regards,</span></p>
<p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-rig=
ht:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=
=3D" font-size:12px; color:#141312;"><br /></span></p>
<p style=3D" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-r=
ight:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">--</p>
<p style=3D" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-r=
ight:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Com os me=
lhores cumprimentos. </p>
<p style=3D" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-r=
ight:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Helmer Te=
les=A0<br /><a href=3D"http://hteles.wordpress.com/"><span style=3D" text-d=
ecoration: underline; color:#0057ae;">http://hteles.wordpress.com</span></a=
><br /></p>
<p style=3D" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-r=
ight:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&quot;Sen=
t from my Linux Device&quot;</p>
<p style=3D" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-r=
ight:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Please do=
n't send me proprietary file formats, use ISO standard ODF instead (ISO/IEC=
 26300) <br /></p></body></html>=

--nextPart1486325.3Kpct7TGlk--

--nextPart3529790.WpD8B2inZL
Content-Disposition: attachment; filename="x2gomountdirs.patch"
Content-Transfer-Encoding: 7Bit
Content-Type: application/octet-stream; name="x2gomountdirs.patch"

--- x2gomountdirs.orig	2013-10-23 13:00:43.606513703 +0100
+++ x2gomountdirs	2013-10-23 13:03:04.398514662 +0100
@@ -267,15 +267,28 @@
 
 	if (db_insertmount( $session, $mntpath, $host))
 	{
+
+		my $Config = new Config::Simple(syntax=>'ini');
+		$Config->read('/etc/x2go/x2goserver.conf' );
+		my $umask=$Config->param("security.umask");
+		my $umaskstr="";
+
+		if ($umask ne "")
+        	{
+        		$umaskstr="umask=$umask";
+        	} else {
+        		$umaskstr="default_permissions";
+        	}
 		my $code_conv=$ENV{'X2GO_ICONV'};
+
 		if ($code_conv ne "")
 		{
 			$code_conv="-o $code_conv";
 		}
-		$msg = "sshfs $code_conv -o idmap=user,uid=`id -u`,gid=`id -g`,ServerAliveInterval=300,Cipher=blowfish,IdentityFile=$key,UserKnownHostsFile=$key.ident \"$user\"\@$host:\"@dirs[$i]\" \"$mntpath\" -p $port";
+		$msg = "sshfs $code_conv -o idmap=user,uid=`id -u`,gid=`id -g`,$umaskstr,ServerAliveInterval=300,Cipher=blowfish,IdentityFile=$key,UserKnownHostsFile=$key.ident \"$user\"\@$host:\"@dirs[$i]\" \"$mntpath\" -p $port";
 		syslog('debug', "executing: $msg");
 		print "inserted, $msg\n";
-		if (system("sshfs  $code_conv -o idmap=user,uid=`id -u`,gid=`id -g`,ServerAliveInterval=300,Cipher=blowfish,IdentityFile=$key,UserKnownHostsFile=$key.ident \"$user\"\@$host:\"@dirs[$i]\" \"$mntpath\" -p $port 2>>~/mounts.log")==0)
+		if (system("sshfs  $code_conv -o idmap=user,uid=`id -u`,gid=`id -g`,$umaskstr,ServerAliveInterval=300,Cipher=blowfish,IdentityFile=$key,UserKnownHostsFile=$key.ident \"$user\"\@$host:\"@dirs[$i]\" \"$mntpath\" -p $port 2>>~/mounts.log")==0)
 		{
 			print "mount @dirs[$i] ok\n";
 			syslog('notice', "successfully mounted $user\@$host:$port@dirs[$i] to $mntpath");

--nextPart3529790.WpD8B2inZL
Content-Disposition: attachment; filename="x2goserver.conf.patch"
Content-Transfer-Encoding: 7Bit
Content-Type: application/octet-stream; name="x2goserver.conf.patch"

--- x2goserver.conf	2013-10-23 13:17:23.590515059 +0100
+++ x2goserver.conf.new	2013-10-23 13:16:51.490507049 +0100
@@ -4,6 +4,10 @@
 [limit groups]
 #folder1=1
 
+[security]
+# Leave uncommented to keep the default server umask
+#umask="0117"
+
 [log]
 # possible levels are: emerg, alert, crit, err, warning, notice, info, debug
 loglevel=warning

--nextPart3529790.WpD8B2inZL--
