Subject: Bug#784: [X2Go-Dev] Bug#784: x2gobroker-agent.pl commands break if user shell environment has login settings it doesn't like

From: Mike Gabriel <[email-masked]>
Date: Tue, 10 Feb 2015 08:23:20 +0000

Control: tag -1 pending
Control: tag -1 fixed 0.3.0.0

Hi Jason,

On  Di 10 Feb 2015 06:13:52 CET, Jason Alavaliant wrote:

> Package: x2ggobroker-agent
> Version: 0.0.2.3
>
> One of my users started to get their connections to the x2go broker  
> failing with 'Error downloading http://x2go-broker-url/plain/inifile  
> - server replied: Internal Server Error'
>
> Tracking back through the commands the broker was logging the issue  
> turned out be
>
> /usr/lib/x2go/x2gobroker-agent $USER listsessions
> (and other commands that x2gobroker-agent.pl runs by su - username  
> -c command) returning things like
>
> OK
> [1] 32542
> klipper: Command not found.
> [1] + exit 1       klipper
>
> which was a result of how the command is run;     since the  
> x2gobroker-agent $USER FOO   commands all internally su to the named  
> user to run the command it results in the user's environment being  
> sourced which puts them at the risk of being broken by the user's  
> environment.    My user in this case had embedded a command that  
> didn't exist on the broker host to run as soon as their shell  
> environment was created which caused the broker to error out.    
> (possibly compounded by in this case the shell tcsh being used as  
> the user's default shell - tcsh in my experience being very  
> temperamental with it's startup files - a single failure will stop  
> the environment file sourcing to error our instantly and not process  
> further lines.  I've not had time to cross compare with bash etc and  
> see if this problem only exists for tcsh or if it effects most  
> shells).
>
> I managed to work around the issue in my case by fixing the su  
> commands in x2gobroker-agent.pl to use /bin/sh (which links to  
> /bin/dash) on my system to avoid user shell startup file environment  
> issues breaking logging in via the broker.    It feels more like a  
> workaround that a proper fix to me so I'm not suggesting the  
> attached patch for merging,   rather just as an example of how I got  
> around it in my case.     My feeling is that there must be a better  
> way to ensure these x2gobroker-agent commands can't be broken by the  
> user env but I'm not managing to come up with a better solution  
> currently.
>
> Thanks
> Jason

This issue is already fixed in Git and pending for 0.0.3.0. I have  
marked the appropriate changelog line and added a closure there for  
this bug.

Mike

-- 

DAS-NETZWERKTEAM
mike gabriel, herweg 7, 24357 fleckeby
fon: +49 (1520) 1976 148

GnuPG Key ID 0x25771B31
mail: [email-masked], http://das-netzwerkteam.de

freeBusy:
https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.xfb