Giter Club home page Giter Club logo

remotedesktopservicescertificateselector's Introduction

program icon Remote Desktop Services Certificate Selector

build status

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). However, Microsoft deleted this file from Windows Server 2012 and later, which means you can only configure it programmatically using WMI. This program restores the graphical certificate choice functionality that was removed.

Thanks to major web browser vendors needlessly bullying certificate authorities into restricting the maximum validity period of certificates 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 certificate signing request, 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, TLS 1.3, and improved cipher suites.

program screenshot

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

Requirements

Installation

  1. Download the latest EXE file from Releases.

This is 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 pair of PEM or DER files, you will first need to temporarily convert it to PKCS #12 using OpenSSL.

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

Warning

This PFX file, not the CRT file, is the correct file to import into the Windows certificate store, because it includes the private key. Be aware that the Certificate Import Wizard defaults to only showing CER and CRT files, so it's easy to accidentally import without the private key and therefore be unable to use it with your server. Be sure to change the file type dropdown in the Open dialog box from "X.509 Certificate" 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 program icon 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.
    • Import the certificate using Action β€Ί All Tasks β€Ί Import…
    • On the Certificate Store page of the Certificate Import Wizard, ensure the Certificate Store choice set to Place all certificates in the following store: Personal.
    • 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 RDP connections to your server 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. Existing RDP sessions will continue to use the old certificate until you disconnect.

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 πŸ”’ Security Information button in the fullscreen toolbar, then click View Certificate.

  • If the Remote Desktop Connection is not in fullscreen, you can change Options β€Ί Display β€Ί Full Screen before connecting, or right-click the title bar and choose Full Screen after connecting.
  • If the πŸ”’ button doesn't appear in the blue toolbar at the top of the screen when Remote Desktop Connection is in fullscreen, then the connection is using a self-signed certificate.

You can also test the certificate with OpenSSL.

openssl s_client -connect myserver.com:3389 | openssl x509 -noout -text

remotedesktopservicescertificateselector's People

Contributors

aldaviva avatar

Stargazers

 avatar  avatar  avatar  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.