cedrozor / myrtille

A native HTML4 / HTML5 Remote Desktop Protocol and SSH client
https://www.myrtille.io
Apache License 2.0
1.78k stars 369 forks source link

Take standard console session if enhanced not supported #284

Open JoeyCarry opened 3 years ago

JoeyCarry commented 3 years ago

Hi there,

I'm using the myrtille console like this way:

http://localhost:8008/MyrtilleAdmin/ConnectionService/GetConnectionId { "User": { "Domain": "domain", "UserName": "administrator", "Password": "password" }, "Host": { "IPAddress": "hostip" }, "VM": { "Guid": "vmid", "EnhancedMode" : true } "AllowRemoteclipboard": false, "AllowFileTransfer": false, "AllowPrintdownload": false, "AllowAudioPlayback": false, "AllowSessionSharing": false, "MaxActiveGuests": 0 }

https://localhost/Myrtille/?cid=[cid]&__EVENTTARGET=&__EVENTARGUMENT=&connect=Connect%2

Is it possible to confire something like a parameter to take a standard session if the enhanced session is not supported ?(for example in Linux VMs)

cedrozor commented 3 years ago

Hi,

I don't remember the exit code returned by FreeRDP when a connection fails in enhanced mode (I will have to re-check that). What you can do is listen this exit code (it will be logged into (myrtille path)\log\Myrtille.Services.log) and retry a connection in standard mode if the enhanced mode failed (add a case block into handleRemoteSessionExit(exitCode).

But indeed, this would be an interesting option to have, with for example a StandardModeFallback bool param into the VM info (default false maybe, because in standard mode you loose many things: printer, audio, clipboard, etc. and this may not be wanted).

JoeyCarry commented 3 years ago

Thanks for the information. The exit code should be 131080. How would that case block look like? Unfortunately I'm not quite into programming and the myrtille code.

cedrozor commented 3 years ago

Hi, Sorry for the little delay. The problem in your case is that you use the connection API which provides 1 time usable connections IDs, so you can't reuse the same ID to connect afterward without the enhanced mode enabled.

The fallback in standard mode should be handled by the gateway after a connection failure (131080), so presumably here: https://github.com/cedrozor/myrtille/blob/master/Myrtille.Web/Default.aspx.cs#L231, with the same connection details (see https://github.com/cedrozor/myrtille/blob/master/Myrtille.Web/Default.aspx.cs#L579) but without the enhanced mode, instead of redirecting to the login page. This can't be done by the javascript function handleRemoteSessionExit(exitCode) because the client (browser) doesn't know the connection details.