devolutions-gateway icon indicating copy to clipboard operation
devolutions-gateway copied to clipboard

fix(dgw): enable SSL protocol in RDP proxy

Open TheBestTvarynka opened this issue 1 month ago • 4 comments

Hi,

During the debugging, I faced the following error message when connecting using mstscex:

image

The error happened right after sending the erectDomainrequest packet by mstsc:

image

It turned out that the problem was in the ConnectionRequest PDU sent from the Devolutions Gateway to the target RDP server. The mstsc expects the ConnectionRequest flags to be the same. The connection fails when the proxy alters security protocol flags. That is what I came up with.

I found a very similar problem here: https://serverfault.com/a/720161:

The error was in this step:

The proxy receives and modifies (if necessary) the ConnectionRequestPDU message of the RDP Protocol to ensure the SupportedProtocol flags are set to ProtocolHybrid & ProtocolSSL. This will ensure the use of CredSSP. That is forwarded to srvPPassTest2.

As it turns out, I also had to set the ProtocolHybridEx flag in the ConnectionRequestPDU. I'm guessing this is because the forwarded messages, the ones after the TSCredential, care about this flag.

That being the case, I've decided to just forward the flags used by the client, instead of building them myself. If the ProtocolHybrid flag isn't set, I'll error out gently since we require Network Level Authentication (NLA) be used.

cc @awakecoding

TheBestTvarynka avatar Nov 14 '25 18:11 TheBestTvarynka

Marking as draft to avoid merging in your other branch by mistake

CBenoit avatar Nov 15 '25 09:11 CBenoit

@CBenoit, I don't know why the CI failed 😕. All tests are green on my Windows machine. The error message in the CI logs is not clear. I wanted just to re-run the failed job, but I do not have enough permissions to do so

TheBestTvarynka avatar Nov 26 '25 15:11 TheBestTvarynka

@CBenoit, I don't know why the CI failed 😕. All tests are green on my Windows machine. The error message in the CI logs is not clear. I wanted just to re-run the failed job, but I do not have enough permissions to do so

@TheBestTvarynka I did the re-run.

RRRadicalEdward avatar Nov 28 '25 12:11 RRRadicalEdward

@CBenoit, I think you can merge this PR now. The CI is green 💚

TheBestTvarynka avatar Nov 28 '25 16:11 TheBestTvarynka