hi,

because no one cared about my request i tried to fix it by myself. attached is a patch which adds an --ssh-agent option to x2goclient. if x2goclient is called with this option it uses a running ssh-agent to connect to the x2goserver.

btw. i dont know anything about coding C++ nor anything about x2goclient development. so maybe this patch does break something else or may be a bad hack. however it works for me.

maybe the x2go devs could include it (or write a better one :)) in one of the next releases? this would be great because i now have SSO with my usb token for all important tools. ssh-agent is started at logon and everything works without entering my passphrase again (ssh/scp, sshfs, nxclient, x2goclient etc.).

regards
heiko

On Sat, 09 Apr 2011 14:59:35 +0200, Heiko Baumann <[email protected]> wrote:
hi all,

is it still not possible to use x2goclient with a running ssh agent?

regards
heiko

On Thu, 04 Nov 2010 16:28:45 +0100, Heiko Baumann <[email protected]> wrote:
do you use ssh-agent oder just a ssh key with passphrase? i my case using a ssh key (with or without passphrase) works great but if run something like
this:

eval `ssh-agent -s`
ssh-add

before starting x2goclient from this shell it does not use the running agent. if i do a simple "ssh -l username sshhost" from the same shell it
works without asking a password.

it looks like x2goclient does not care about a running ssh-agent!?

using it that way would be a great improvement in security imho and makes single-sign-on possible if you start your ssh-agent at login time.....

greetz
heiko

On Thu, 04 Nov 2010 15:53:08 +0100, Philipp Huebner <[email protected]>
wrote:
IIRC,
it simply worked for me.
Instead of a password, the passphrase was being asked.

All I had to do was a normal login via SSH previously to get the
known_hosts stuff sorted.

Regards,
_______________________________________________
X2go-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/x2go-dev

_______________________________________________
X2go-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/x2go-dev
--- sshprocess.h.org	2009-10-27 22:26:00.000000000 +0100
+++ sshprocess.h	2011-04-22 12:15:06.000000000 +0200
@@ -28,7 +28,7 @@
 		             const QString& host,const QString& pt,
 		             const QString& cmd, const QString& pass,
 		             const QString& key=QString::null,
-		             bool acc=false );
+		             bool acc=false, bool useagent=false );
 		virtual ~sshProcess();
 		void startNormal ( bool accept=false );
 		QString getResponce();
--- sshprocess.cpp.org	2009-11-20 23:47:10.000000000 +0100
+++ sshprocess.cpp	2011-04-22 13:49:33.000000000 +0200
@@ -26,7 +26,7 @@
 sshProcess::sshProcess ( QObject* parent,const QString& user,
                          const QString& host,const QString& pt,
                          const QString& cmd,const QString& pass,
-                         const QString& key, bool acc )
+                         const QString& key, bool acc, bool useagent )
 		: QProcess ( parent )
 {
 	sudoErr=false;
@@ -44,7 +44,10 @@
 	this->key=key;
 	autoAccept=acc;
 	env = QProcess::systemEnvironment();
-	cleanEnv ( true );
+	if ( !useagent )
+	{
+		cleanEnv ( true );
+	}
 #ifdef Q_OS_DARWIN
 	//run x2goclient from bundle
 	QDir dir ( QApplication::applicationDirPath() );
--- onmainwindow.h.org	2009-11-26 22:20:26.000000000 +0100
+++ onmainwindow.h	2011-04-22 12:26:48.000000000 +0200
@@ -499,6 +499,7 @@
 		QString agentPid;
 		bool cardReady;
 		bool useSshAgent;
+		bool useRunningSshAgent;
 		void loadSettings();
 		void showPass ( UserButton* user );
 		void clean();
--- onmainwindow.cpp.org	2009-11-27 23:55:06.000000000 +0100
+++ onmainwindow.cpp	2011-04-22 12:18:32.000000000 +0200
@@ -1109,7 +1109,7 @@
 	{
 		proc=new sshProcess ( this,user,host,sshPort,
 		                      "x2gogetservers",
-		                      passwd,currentKey,acceptRsa );
+		                      passwd,currentKey,acceptRsa,useRunningSshAgent );
 	}
 	catch ( QString message )
 	{
@@ -2105,7 +2105,7 @@
 	{
 		proc=new sshProcess ( this,user,host,sshPort,
 		                      "export HOSTNAME && x2golistsessions",
-		                      passwd,currentKey,acceptRsa );
+		                      passwd,currentKey,acceptRsa,useRunningSshAgent );
 	}
 	catch ( QString message )
 	{
@@ -2496,7 +2496,7 @@
 	{
 		proc=new sshProcess ( this,user,host,sshPort,
 		                      cmd,
-		                      passwd,currentKey,acceptRsa );
+		                      passwd,currentKey,acceptRsa,useRunningSshAgent );
 	}
 
 	catch ( QString message )
@@ -2708,7 +2708,7 @@
 	{
 		proc=new sshProcess ( this,user,host,sshPort,
 		                      cmd,
-		                      passwd,currentKey,acceptRsa );
+		                      passwd,currentKey,acceptRsa,useRunningSshAgent );
 	}
 	catch ( QString message )
 	{
@@ -3237,7 +3237,7 @@
 	{
 		tunnel=new sshProcess ( this,user,host,sshPort,
 		                        QString::null,
-		                        passwd,currentKey,acceptRsa );
+		                        passwd,currentKey,acceptRsa,useRunningSshAgent );
 	}
 	catch ( QString message )
 	{
@@ -3308,7 +3308,7 @@
 		{
 			paProc=new sshProcess ( this,user,host,sshPort,
 			                        scmd,
-			                        passwd,currentKey,acceptRsa );
+			                        passwd,currentKey,acceptRsa,useRunningSshAgent );
 		}
 		catch ( QString message )
 		{
@@ -3326,7 +3326,7 @@
 		{
 			paProc=new sshProcess ( this,user,host,sshPort,
 			                        scmd,
-			                        passwd,currentKey,acceptRsa );
+			                        passwd,currentKey,acceptRsa,useRunningSshAgent );
 		}
 		catch ( QString message )
 		{
@@ -3408,7 +3408,7 @@
 		{
 			paProc=new sshProcess ( this,user,host,sshPort,
 			                        "",
-			                        passwd,currentKey,acceptRsa );
+			                        passwd,currentKey,acceptRsa,useRunningSshAgent );
 		}
 		catch ( QString message )
 		{
@@ -3470,7 +3470,7 @@
 				                           sshPort,
 				                           QString::null,
 				                           passwd,currentKey,
-				                           acceptRsa );
+				                           acceptRsa,useRunningSshAgent );
 			}
 			catch ( QString message )
 			{
@@ -3988,7 +3988,7 @@
 	{
 		proc=new sshProcess ( this,user,host,sshPort,
 		                      "x2gosuspend-session "+sessId,
-		                      pass,key,acceptRsa );
+		                      pass,key,acceptRsa,useRunningSshAgent );
 	}
 	catch ( QString message )
 	{
@@ -4035,7 +4035,7 @@
 	{
 		proc=new sshProcess ( this,user,host,sshPort,
 		                      "x2goterminate-session "+sessId,
-		                      pass,key,acceptRsa );
+		                      pass,key,acceptRsa,useRunningSshAgent );
 	}
 	catch ( QString message )
 	{
@@ -4307,7 +4307,7 @@
 	{
 		proc=new sshProcess ( this,user,host,sshPort,
 		                      cmd,
-		                      passwd,currentKey,acceptRsa );
+		                      passwd,currentKey,acceptRsa,useRunningSshAgent );
 	}
 	catch ( QString message )
 	{
@@ -4389,6 +4389,11 @@
 		startHidden=true;
 		return true;
 	}
+	if ( param=="--ssh-agent" )
+	{
+		useRunningSshAgent=true;
+		return true;
+	}
 	if ( param=="--pgp-card" )
 	{
 		usePGPCard=true;
@@ -4735,6 +4740,7 @@
 	    "--maximize\t\t\t start maximized\n"
 	    "--hide\t\t\t\t start hidden\n"
 	    "--pgp-card\t\t\t use openPGP card authentication\n"
+	    "--ssh-agent\t\t\t use a running ssh-agent for authentication\n"
 	    "--add-to-known-hosts\t\t add RSA key fingerprint to "
 	    ".ssh/known_hosts\n"
 	    "\t\t\t\t if authenticity of server can't be established\n\n"
@@ -4862,7 +4868,7 @@
 			lproc=new sshProcess (
 			    this,user,host,sshPort,
 			    "export HOSTNAME && x2golistsessions",
-			    passwd,currentKey,acceptRsa );
+			    passwd,currentKey,acceptRsa,useRunningSshAgent );
 		}
 		catch ( QString message )
 		{
@@ -5033,7 +5039,7 @@
 		lproc=new sshProcess ( this,uname,
 		                       resumingSession.server,
 		                       sshPort,"",passwd,
-		                       currentKey,acceptRsa );
+		                       currentKey,acceptRsa,useRunningSshAgent );
 	}
 	catch ( QString message )
 	{
@@ -5513,7 +5519,7 @@
 		    this,user,host,sshPort,
 		    "export HOSTNAME && x2goumount_session "+
 		    sessionId+" "+args[i],
-		    passwd,currentKey,acceptRsa );
+		    passwd,currentKey,acceptRsa,useRunningSshAgent );
 		if ( cardReady || useSshAgent )
 		{
 			QStringList env=sproc->environment();
@@ -6211,7 +6217,7 @@
 	{
 		xmodProc=new sshProcess ( this,user,host,sshPort,
 		                          cmd,
-		                          passwd,currentKey,acceptRsa );
+		                          passwd,currentKey,acceptRsa,useRunningSshAgent );
 	}
 	catch ( QString message )
 	{
@@ -6250,7 +6256,7 @@
 		proc=new sshProcess ( this,user,host,sshPort,
 		                      "x2gocmdexitmessage "+
 		                      resumingSession.sessionId,
-		                      passwd,currentKey,acceptRsa );
+		                      passwd,currentKey,acceptRsa,useRunningSshAgent );
 	}
 	catch ( QString message )
 	{
@@ -6343,7 +6349,7 @@
 		fsTunnel=new sshProcess ( this,uname,
 		                          resumingSession.server,
 		                          sshPort,"",passwd,
-		                          currentKey,acceptRsa );
+		                          currentKey,acceptRsa,useRunningSshAgent );
 	}
 	catch ( QString message )
 	{
@@ -6502,7 +6508,7 @@
 	{
 		proc=new sshProcess ( this,user,host,sshPort,
 		                      cmd,
-		                      passwd,currentKey,acceptRsa );
+		                      passwd,currentKey,acceptRsa,useRunningSshAgent );
 		dir->proc=proc;
 	}
 	catch ( QString message )
@@ -7820,7 +7826,7 @@
 	{
 		paProc=new sshProcess ( this,user,host,sshPort,
 		                        scmd,
-		                        passwd,currentKey,acceptRsa );
+		                        passwd,currentKey,acceptRsa,useRunningSshAgent );
 	}
 	catch ( QString message )
 	{
_______________________________________________
X2go-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/x2go-dev

Reply via email to