Giter Club home page Giter Club logo

remotedesktopservicescertificateselector's Introduction

Remote Desktop Services Certificate Selector

Build

This GUI program lets you choose the certificate to encrypt your Remote Desktop Services connections.

In Windows Server 2008 R2 and earlier, this functionality was available in the Remote Desktop Session Host Configuration (tsconfig.msc), but Microsoft removed it from Windows Server 2012 and later, which means you can only configure it programmatically using WMI.

Thanks to major web browser vendors needlessly bullying certificate authorities into restricting the maximum validity duration of a certificate to roughly 1 year, I now have to deal with this problem far more often than if I could just buy a 5-year cert, install it once, and then not think about it for a long time. This change makes no sense: my owner checks are simply using domain validation, which is just a simple proof of DNS control and does not guarantee much of anything; key rotation is not more frequent because you are not required to generate a new private key or CSR, just a public cert; and all of the improvements over time in public key cryptography come from the protocols which use the certificates, not the certs themselves, such as Apache httpd and Nginx implementing HTTP/2 and TLSv1.3.

screenshot

  1. Requirements
  2. Installation
  3. Certificate Conversion
  4. Usage
  5. Validation

Requirements

Installation

  1. Download the latest EXE file from Releases.

It's a portable application. You can save it, run it, and then delete it when you're done. It won't leave any files or registry values behind.

Certificate Conversion

Both your public certificate and private key are required for servers like Remote Desktop Services. These must be imported into a Windows certificate store using PKCS #12 format, which uses the P12 and PFX file extensions. If you don't convert to PKCS #12, the private key can't be imported, and you won't be able to encrypt traffic on your server.

If you have a certificate that you want to import, like a PEM or DER encoded keypair, you will first need to temporarily convert it to PKCS #12:

openssl pkcs12 -in "mypubliccert.pem.crt" -inkey "myprivatekey.pem.key" -out "mycertandkey.pfx" -export

This PFX file is the one to import into Windows, not the CRT file. Be aware that the Certificate Import Wizard defaults to only showing .CER and .CRT files, so it's easy to accidentally import only the public key and therefore be unable to use it for your server. Be sure to change the file type dropdown in the Open dialog box to Personal Information Exchange so that your PFX file is shown.

After importing the PFX file, you can delete it from disk.

Usage

  1. Run RemoteDesktopServicesCertificateSelector.exe.
  2. If you haven't already done so, install your new certificate into Certificates (Local Computer) โ€บ Personal โ€บ Certificates.
    • You can open this certificate store by clicking certs Manage Local Computer Certificates.
    • Once it's installed, click refresh Refresh in this program to show the newly-installed certificate.
  3. Click the radio button for the certificate you want to use on your RDP connections.
  4. Click save Apply.

New connections to your RDP-tcp listener will now use the new certificate. This change takes effect immediately for all new connections; you don't need to restart any services or your computer.

You can view a certificate or copy its SHA-1 thumbprint by right-clicking on a row.

Validation

To test the new certificate, you can reconnect using mstsc.exe. Next, click the ๐Ÿ”’ button in the fullscreen toolbar, then click View Certificate.

You can also test the certificate with openssl:

echo | openssl s_client -connect myserver.com:3389 2>/dev/null | openssl x509 -noout -text

remotedesktopservicescertificateselector's People

Contributors

aldaviva avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

remotedesktopservicescertificateselector's Issues

Crash on launch

Environment

  • Windows 11 Pro
  • .NET Framework 4.8.0 or 4.8.1
  • Remote Desktop server is disabled in sysdm.cpl
  • Computer's Personal and Remote Desktop certificate stores are both empty
  • Active RDP certificate thumbprint in WMI is all zeroes:
    > wmic /namespace:\\root\cimv2\TerminalServices PATH Win32_TSGeneralSetting Get SSLCertificateSHA1Hash
    SSLCertificateSHA1Hash
    0000000000000000000000000000000000000000

Expected

  • Program launches without crashing
  • List shows 0 certificates

Actual

  1. Window is briefly shown, but the window contents (list and buttons) never render.
  2. Program exits with an uncaught exception in MainWindow.onWindowLoaded:
    Application: RemoteDesktopServicesCertificateSelector.exe
    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.ArgumentOutOfRangeException
       at System.Windows.Controls.VirtualizedCellInfoCollection.get_Item(Int32)
       at RemoteDesktopServicesCertificateSelector.Views.MainWindow.onWindowLoaded(System.Object, System.Windows.RoutedEventArgs)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
       at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
       at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs)
       at System.Windows.BroadcastEventHelper.BroadcastEvent(System.Windows.DependencyObject, System.Windows.RoutedEvent)
       at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(System.Object)
       at MS.Internal.LoadedOrUnloadedOperation.DoWork()
       at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
       at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
       at System.Windows.Media.MediaContext.RenderMessageHandlerCore(System.Object)
       at System.Windows.Media.MediaContext.RenderMessageHandler(System.Object)
       at System.Windows.Media.MediaContext.Resize(System.Windows.Media.ICompositionTarget)
       at System.Windows.Interop.HwndTarget.OnResize()
       at System.Windows.Interop.HwndTarget.HandleMessage(MS.Internal.Interop.WindowMessage, IntPtr, IntPtr)
       at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
       at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
       at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
    

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.