To: [email protected]
From: [email protected]
Subject: can't use ssh proxy with x2goplugin
Package: x2goclient
Version: 4.0.3.1

When I'm trying to use the ssh proxy configuration in session file
with x2goplugin it seems its not working.

Indeed, if you look at the session file in "~/.x2goclient/sessions" which
contains all the configuration of the session of x2goclient application you
will see all the descriptions of each session.

Which looks like this for each session:



[20150220100323537]
speed=2
pack=16m-jpeg
quality=3
fstunnel=true
export="/home/user/Bureau/MountDistantX2goPc:1;"
iconvto=UTF-8
iconvfrom=ISO8859-1
useiconv=false
fullscreen=false
multidisp=false
display=1
maxdim=false
rdpclient=rdesktop
directrdpsettings=
width=800
height=600
dpi=96
setdpi=true
xinerama=false
clipboard=both
usekbd=true
type=auto
sound=true
soundsystem=pulse
startsoundsystem=true
soundtunnel=true
defsndport=true
sndport=4713
print=true
name=username
icon=:icons/128x128/x2gosession.png
host=localhost
user=userTest
key=
rdpport=3389
sshport=2222
autologin=false
krblogin=false
krbdelegation=false
directrdp=false
rootless=false
published=false
applications=WWWBROWSER, MAILCLIENT, OFFICE, TERMINAL
command=SHADOW
rdpoptions=
rdpserver=
xdmcpserver=localhost
*usesshproxy=true*
*sshproxytype=SSH*
*sshproxyuser=usernameProxy*
*sshproxykeyfile=*
*sshproxyhost=123.452.111.124*
*sshproxyport=22*
*sshproxysamepass=false*
*sshproxysameuser=false*
*sshproxyautologin=true*
*sshproxykrblogin=false*

The part which interest me is the bold part.
Indeed, it works when i'm using this conf file with x2go client.
And when i'm using x2goplugin with this configuration it doesn't work. I
take a look at the network traffic and it seems that x2goplugin doesn't
look at the bold part (the ssh proxy).
This is why I think that x2goplugin doesn't work with ssh proxy.

Attachment : 0001-enable-use-of-ssh-proxy-conf-with-x2goplugin.patch
-- 

_________________________________________________________________________
Nicolas HUSSON
From 8a6b2ba9201d4c3ff564d28137162598affc8312 Mon Sep 17 00:00:00 2001
From: Husson <[email protected]>
Date: Wed, 25 Feb 2015 16:09:23 +0100
Subject: [PATCH] enable use of ssh proxy conf with x2goplugin

---
 onmainwindow.cpp        | 175 ++++++++++++++++++++++++++++++++++--------------
 sshmasterconnection.cpp |   8 ++-
 2 files changed, 133 insertions(+), 50 deletions(-)

diff --git a/onmainwindow.cpp b/onmainwindow.cpp
index 3c29870..a4169e0 100644
--- a/onmainwindow.cpp
+++ b/onmainwindow.cpp
@@ -16,6 +16,7 @@
 ***************************************************************************/
 
 #include "onmainwindow_privat.h"
+#include <iostream>
 
 void x2goSession::operator = ( const x2goSession& s )
 {
@@ -58,7 +59,7 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent )
     image=shape=0;
 #endif
     x2goInfof(1) << tr("Starting x2goclient...");
-    debugging = false;
+    debugging = true;
 
     setFocusPolicy ( Qt::NoFocus );
     installTranslator();
@@ -3204,6 +3205,7 @@ QString ONMainWindow::findSshKeyForServer(QString user, QString server, QString
 
 bool ONMainWindow::startSession ( const QString& sid )
 {
+
     setEnabled ( false );
 #ifdef Q_OS_LINUX
     directRDP=false;
@@ -3261,6 +3263,7 @@ bool ONMainWindow::startSession ( const QString& sid )
                                     ( QVariant ) QString::null ).toString();
     }
 
+
     QString cmd=st->setting()->value ( sid+"/command",
                                        ( QVariant ) QString::null ).toString();
     autologin=st->setting()->value ( sid+"/autologin",
@@ -3296,45 +3299,68 @@ bool ONMainWindow::startSession ( const QString& sid )
         currentKey=findSshKeyForServer(user, host, sshPort);
     }
 
-    useproxy=(st->setting()->value (
-                  sid+"/usesshproxy",
-                  false
-              ).toBool() );
-
-    QString prtype= st->setting()->value (
-                        sid+"/sshproxytype",
-                        "SSH"
-                    ).toString() ;
-
-    if(prtype=="HTTP")
-    {
-        proxyType=SshMasterConnection::PROXYHTTP;
-    }
-    else
-    {
-        proxyType=SshMasterConnection::PROXYSSH;
-    }
-
-    proxylogin=(st->setting()->value (
-                    sid+"/sshproxyuser",
-                    QString()
-                ).toString() );
-
-    proxyKey=(st->setting()->value (
-                  sid+"/sshproxykeyfile",
-                  QString()
-              ).toString() );
-    proxyKey=expandHome(proxyKey);
-
-    proxyserver=(st->setting()->value (
-                     sid+"/sshproxyhost",
-                     QString()
-                 ).toString() );
+    if (embedMode)
+	{
+    	useproxy=config.useproxy;
+    	proxyType=config.proxyType;
+    	proxylogin=config.proxylogin;
+    	proxyKey=config.proxyKey;
+    	proxyserver=config.proxyserver;
+    	proxyport=config.proxyport;
+    	proxyAutologin=config.proxyAutologin;
+    	proxyKrbLogin=config.proxyKrbLogin;
+	}
+	else
+	{
+		useproxy=(st->setting()->value (
+					  sid+"/usesshproxy",
+					  false
+				  ).toBool() );
+		QString prtype= st->setting()->value (
+							 sid+"/sshproxytype",
+							 "SSH"
+						 ).toString() ;
+		if(prtype=="HTTP")
+		{
+		  proxyType=SshMasterConnection::PROXYHTTP;
+		}
+		else
+		{
+		  proxyType=SshMasterConnection::PROXYSSH;
+
+		}
+
+		proxylogin=(st->setting()->value (
+						sid+"/sshproxyuser",
+						QString()
+					).toString() );
+
+		proxyKey=(st->setting()->value (
+					  sid+"/sshproxykeyfile",
+					  QString()
+				  ).toString() );
+		proxyKey=expandHome(proxyKey);
+
+		proxyserver=(st->setting()->value (
+						 sid+"/sshproxyhost",
+						 QString()
+					 ).toString() );
+
+		proxyport=(st->setting()->value (
+					   sid+"/sshproxyport",
+					   22
+				   ).toInt() );
+		proxyAutologin=(st->setting()->value (
+						sid+"/sshproxyautologin",
+						false
+					).toBool() );
+
+	    proxyKrbLogin=(st->setting()->value (
+	                       sid+"/sshproxykrblogin",
+	                       false
+	                   ).toBool() );
+	}
 
-    proxyport=(st->setting()->value (
-                   sid+"/sshproxyport",
-                   22
-               ).toInt() );
     if(proxyserver.indexOf(":")!=-1)
     {
         QStringList parts=proxyserver.split(":");
@@ -3350,15 +3376,6 @@ bool ONMainWindow::startSession ( const QString& sid )
                             sid+"/sshproxysameuser",
                             false
                         ).toBool() );
-    proxyAutologin=(st->setting()->value (
-                        sid+"/sshproxyautologin",
-                        false
-                    ).toBool() );
-
-    proxyKrbLogin=(st->setting()->value (
-                       sid+"/sshproxykrblogin",
-                       false
-                   ).toBool() );
 
     if(proxyKey.length()<=0 && proxyType==SshMasterConnection::PROXYSSH)
     {
@@ -10471,7 +10488,7 @@ void ONMainWindow::processSessionConfig()
     {
         QString line = lines[i];
 
-        // strip left/right whitespaces, important for plugin settings via x2goconfig
+        // strip left/right whitespaces, important for plugin settings via x2go
         line.remove(QRegExp("^\\s+"));
         line.remove(QRegExp("\\s+$"));
 
@@ -10702,6 +10719,66 @@ void ONMainWindow::processCfgLine ( QString line )
         config.connectionts=lst[1];
         return;
     }
+    if ( lst[0]=="usesshproxy" )
+	{
+    	config.useproxy=true;
+    	/*if (lst[1]=="true"){
+    		std::cout << "usesshproxy" << std::endl;
+    		config.useproxy=true;
+    	}
+    	else
+    		config.useproxy=false;*/
+    	 return;
+	}
+    if ( lst[0]=="sshproxytype" )
+   	{
+    	if (lst[1]=="HTTP"){
+    		config.proxyType=SshMasterConnection::PROXYHTTP;
+    	}
+    	else{
+    		std::cout << "ssh" << std::endl;
+    		config.proxyType=SshMasterConnection::PROXYSSH;
+    	}
+       	return;
+   	}
+    if ( lst[0]=="sshproxyuser" )
+	{
+		 config.proxylogin=lst[1];
+		 return;
+	}
+    if ( lst[0]=="sshproxyhost" )
+   	{
+   		 config.proxyserver=lst[1];
+   		 return;
+   	}
+    if ( lst[0]=="sshproxyport" )
+	{
+		 config.proxyport=lst[1].toInt();
+		 return;
+	}
+    if ( lst[0]=="sshproxyautologin" )
+	{
+    	if (lst[1]=="true")
+    		config.proxyAutologin=true;
+		else
+			config.proxyAutologin=false;
+		return;
+	}
+    if ( lst[0]=="sshproxykrblogin" )
+   	{
+    	if (lst[1]=="true")
+    		config.proxyKrbLogin=true;
+		else
+			config.proxyKrbLogin=false;
+		return;
+   	}
+    if ( lst[0]=="sshproxykeyfile" )
+	{
+		 config.proxyKey=lst[1];
+		 return;
+	}
+
+
 }
 
 void ONMainWindow::slotChangeKbdLayout(const QString& layout)
diff --git a/sshmasterconnection.cpp b/sshmasterconnection.cpp
index c8669a5..729110e 100755
--- a/sshmasterconnection.cpp
+++ b/sshmasterconnection.cpp
@@ -165,6 +165,7 @@ SshMasterConnection::SshMasterConnection (QObject* parent, QString host, int por
 
     breakLoop=false;
     kerberosDelegation=false;
+    //x2goDebug<<"SshMasterConnection, host "<<host  <<"port "<< port <<"user "<<user<<"useproxy "<< useproxy<<"proxyserver "<< proxyserver<<"proxyport "<< proxyport ;
     this->host=host;
     this->port=port;
     this->user=user;
@@ -441,9 +442,14 @@ void SshMasterConnection::run()
 #ifdef DEBUG
     x2goDebug<<"SshMasterConnection, instance "<<this<<" entering thread";
 #endif
+    x2goDebug<<"use of proxyssh?";
+    if (useproxy)
+    	 //x2goDebug<<"useproxy ssh";
+    if (proxytype==PROXYSSH)
+    	//x2goDebug<<"PROXYSSH";
     if(useproxy && proxytype==PROXYSSH)
     {
-
+    	// x2goDebug<<"yes "<<"proxyserver : "<<proxyserver<<"proxyport : "<<proxyport<<"proxylogin : "<<proxylogin;
         sshProxy=new SshMasterConnection (0, proxyserver, proxyport,acceptUnknownServers,
                                           proxylogin, proxypassword, proxykey, proxyautologin, proxyKrbLogin, false);
         connect ( sshProxy, SIGNAL ( connectionOk(QString) ), this, SLOT ( slotSshProxyConnectionOk() ) );
-- 
1.9.1

_______________________________________________
x2go-dev mailing list
[email protected]
http://lists.x2go.org/listinfo/x2go-dev

Reply via email to