I have a server I need to RDP into that first requires a normal user name and password credentials, but then requires an OTP code. So currently I have both an RDP and OTP entry setup in RDM for this server, however, it doesn't seem that I can set up the RDP entry to point to and use the OTP (in addition to the normal creds). One thing I've managed to put together is writing up a macro PS script that is called before the RDP connection is launched and copies the current OTP to the user's clipboard, but then the user needs to know that they need to use the RDM typing clipboard feature to get the code into the windows login page (not as simple as the user using CTRL+V since the windows server login page doesn't allow that), which isn't very intuitive.
1) Is there a better way to do this?
2) Is there a command I can call in the PS macro to execute the type clipboard command? Although I'm not sure how I could get it to execute in the right context (need to click on the server window).
Please check if RDM Jump Configure Remote Desktop Manager Jump (devolutions.net) is a solution?
Because in RDM jump you typically have 2 sets of credentials, (both in your 'outer' RDM session). where the 1st set of credentials is used to connect to your RDM Jump. then within RDM jump a new RDM session starts, it gets the (OTP?) credentials from the running connection..
Regards, Ben
Hi Ben,
Unfortunately, I don't see how RDM Jump would work for this situation and I think it would be a little overkill anyway.
Hector
ah oh no sorry, misread. Thought you RDP to a first server with username+password, then started a new RDP session to a new server with OTP. your case is different. do you have an updated GINA so it askes for more authentication?
GINA?
GINA = Graphical identification and authentication - Wikipedia
that is the DLL that performs the authentication. by default it asks for username + password but MSFT + 3rd party products can enhance it to allow other ways of logon, for instance smartcard, windows hello and other authentication methods.
hihi now I read that Wiki and see that GINA is already legacy (i'm getting old) now replaced by Credential providers...
Since your server asks for an OTP I have an impression you loaded some 3rd party product that updates the 'logon screen' to ask additional info...
or: do you have a 'normal login' in windows, and is the Explorer blocked from starting up by an application that first wants to know an OTP from you.
It's a client of ours, something we wouldn't have control over. All I know is they are using a product called Passly, probably set up on their windows server in accordance with this article:
https://support.idagent.com/hc/en-us/articles/360005103037-Deploying-a-Windows-Logon-Agent
We log in to the server with the normal username and password, receive this warning message, and then have to type in the OTP from the designated authenticator.
Hector
Hi,
I do not know the specifics of the Passly credential provider, but I am familiar with how such custom extensions are built. I have my own reference source code to experiment with those, they're not using GINA, but a newer set of APIs designed to enhance Winlogon with additional UI elements and steps on top of the regular Windows logon.
The main issue here is that since these extensions are UI elements in Winlogon, there is no way to send the OTP through standard RDP. In other words, there is no way that RDM or any RDP client can automatically inject the additional fields, unless the vendor behind the custom credential provider also provides a custom virtual channel extension that could be used to communicate with the credential provider.
A quick look at the documentation from the vendor's website doesn't seem to hint that a custom virtual channel extension is available, so the only way to interact with the Winlogon UI is unfortunately... through UI operations. Automating the injection of key events from RDM is likely going to be best you are going to get, unfortunately.
Best regards,
Marc-André Moreau
Thanks for the detailed explanation Marc-Andre. I figured as much. So now the topic turns to:
2) Is there a command I can call in the PS macro to execute the type clipboard command?
Just following up on my last reply.
Hello,
For your second question, you would most likely need to use the typing macro, since the clipboard is not available in the Winlogon.
You can find more details about it here: https://kb.devolutions.net/rdm_event_auto_typing_macro.html
Best regards,
Richard Boisvert
Hi Richard,
I appreciate your reply and supplying the link, but I don't think this will work for my use case, as already discussed in parts of the ticket above. The first challenge is generating the OTP link. The second challenge is using the "Type Clipboard" command to copy the OTP code into the correct RDP session. Since nothing in the RDP session entry allows you to link and then generate the OTP, I have built a macro to accomplish the first challenge, as follows:
$s = Get-RDMSession | ? { $_.ID -eq "990f3308-a9f3-4c85-abcd-7a2c109a9f4f" }
$c = $s.SubConnections | ? { $_.ID -eq "08081056-26bd-4d5c-8edd-878ca7d817b6" }
$core_field = $c.GetType().GetField("core", [Reflection.BindingFlags]::NonPublic -bor [Reflection.BindingFlags]::Instance)
$core_val = $core_field.GetValue($c)
$core_val.HostPassword
[Devolutions.RemoteDesktopManager.Managers.ClipboardManager]::CopySecure($core_val.HostPassword, $true)
// TODO: Execute "Type Clipboard"The only thing I have left is the second challenge: execute "Type Clipboard".
So what solution can you think of that will meet both challenges?
Hello,
If you are using RDM 2021.2, you can assign an OTP directly in the RDP entry, and then use the variable $ONE_TIME_PASSWORD$, which then could be used in the Typing macro after open event.
In the properties of the RDP session, make sure Advance mode is selected, then go to One Time Password.
You can either configure it here directly by selecting custom, or use the OTP configured elsewhere, for example in the username/password entry.
Once this is done, in the Events, it can be used in the After Open event. You can use $ONE_TIME_PASSWORD${ENTER} for example.
Best regards,
Richard Boisvert
Thanks! That's exactly what I was looking for, but I am a few versions behind. I will test this out once we update.
Hello,
If you are using RDM 2021.2, you can assign an OTP directly in the RDP entry, and then use the variable $ONE_TIME_PASSWORD$, which then could be used in the Typing macro after open event.
In the properties of the RDP session, make sure Advance mode is selected, then go to One Time Password.
You can either configure it here directly by selecting custom, or use the OTP configured elsewhere, for example in the username/password entry.
Once this is done, in the Events, it can be used in the After Open event. You can use $ONE_TIME_PASSWORD${ENTER} for example.
Best regards,
Richard,
This is exactly what I am looking for, however when I put it in practice I see the macro execute however the only keep that seems to be triggered is the {ENTER} How can I validate that the $ONE_TIME_PASSWORD$ is a valid variable?
Thank You.
Looks like its working however the box that needs the OTP is not in focus as login. Still tweaking it for my needs.
In my case, got it working using a Initial wait of 5 sec, and then sending:
{Delay}{TAB}$ONE_TIME_PASSWORD${ENTER}