Subject: Bug#1150: x2goclient on windows creates host_rsa_key, sshd wants host_dsa_key

From: Enrqiue Perez-Terron <[email-masked]>
Date: Fri, 17 Feb 2017 21:43:30 +0100

Package: x2goclient
Version: 4.0.5.2

Error: message: 
SSH daemon failed to open its public host key

Circumstances:
I just installed the windows client on a Windows 10, 64-bit PC, 
defined a session (which uses a key file for authentication
and logs into an Ubuntu server given by IP address, where I had 
just installed the x2go server, and additionally installed gnome) 
and launched the session.

Afterward the directory C:/Users/Enrique/.x2go/etc contained the following files:

ssh_host_rsa_key
ssh_host_rsa_key.pub
sshd_config

Using cygwin on the same windows PC, I ran this command:

ssh-keygen -t dsa -b 1024 -N "" -f "C:/Users/Enrique/.x2go/etc/ssh_host_dsa_key" -q

After this, I restarted x2goclient, and the error message did not appear.

Looking at the source, it appears that the error message is emitted by
ONMainWindow::createRSAKey(), when it fails to open the file given
by the QFile object "rsa".

I observed that the createRSAKey() conditionally sets the file name on 
the object to ssh_host_dsa_key.pub, if compiled for Windows.

However, ONMainWindow::startWinServers() seems to be called unconditionally 
with RSA_KEY_TYPE, creating the rsa key file only.

I don't know why the file name in question is changed to *_dsa_* on Windows,
but if there is a good reason, the call to generateHostKey() 
in startWinServers should probably be modified accordingly. StartWinServers()
appears to be called only when compiled for Windows.

(For the record, even after running the ssh-keygen command, x2goclient
still appears to fail at starting a local sshd server, but I have not yet
investigated that. Perhaps listening on the socket port 7022 needs a 
privilege or raised "integrity label" on Windows. A black window appears,
but disappears after a while.)

Regards,
Enrique