Skip to content

Add deployment plugin for Windows RDP via OpenSSH#6925

Merged
neilpang merged 4 commits intoacmesh-official:devfrom
curdbecker:feature/add-windows-rdp-via-openssh-deploy-plugin
May 1, 2026
Merged

Add deployment plugin for Windows RDP via OpenSSH#6925
neilpang merged 4 commits intoacmesh-official:devfrom
curdbecker:feature/add-windows-rdp-via-openssh-deploy-plugin

Conversation

@curdbecker
Copy link
Copy Markdown
Contributor

This plugin deploys a certificate into the certificate store of a remote Windows machine and assigns it as the active certificate for the Remote Desktop (RDP) server.

The plugin is not meant to deploy to the local machine, but instead converts the certificate and its private key to a PKCS12 (.pfx) container and embeds the container as Base64 inside a generated powershell script that is then executed via powershell on the Windows OpenSSH Server (needs to be installed from optional features). This ensures that the PKCS12 container is not saved on the host at all, but directly imported in the certificate store.

The idea of this plugin is to be able to deploy certificates on Windows machines that are running in a less trusted environment (e.g. my lab machine) and are not intended to hold any kind of secrets like DNS API keys. Instead, the plugin can then be run from a remote Linux machine, e.g. like my Synology NAS, that is entirely separated by a firewall etc.

Please note that AI (specifically Claude Code) was used in the creation of this script, but due to the fact that Windows works always in mysterious ways - and due to no fault of the AI unfortunately and surprisingly - I spent hours debugging and adapting it myself... only to change a few powershell lines in the end.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new acme.sh deploy hook to remotely install and bind an RDP (TermService) TLS certificate on a Windows host via OpenSSH by generating a PowerShell script that imports a PFX into the Windows certificate store and updates the RDP listener binding.

Changes:

  • Introduces windows_rdp deploy hook to build a local PFX, Base64-embed it into PowerShell, and execute it remotely over SSH.
  • Adds deploy configuration variables for SSH target, options, listener selection, and optional TermService restart.

Comment thread deploy/windows_rdp.sh Outdated
Comment thread deploy/windows_rdp.sh
Comment thread deploy/windows_rdp.sh Outdated
Comment thread deploy/windows_rdp.sh Outdated
Comment thread deploy/windows_rdp.sh Outdated
Comment thread deploy/windows_rdp.sh Outdated
Comment thread deploy/windows_rdp.sh Outdated
Comment thread deploy/windows_rdp.sh Outdated
@neilpang neilpang force-pushed the feature/add-windows-rdp-via-openssh-deploy-plugin branch from 4e43355 to 9e16af2 Compare May 1, 2026 08:54
Comment thread deploy/windows_rdp.sh Outdated
curdbecker added 4 commits May 1, 2026 16:05
This plugin deploys a certificate into the certificate store of
a remote Windows machine and assigns it as the active certificate
for the Remote Desktop (RDP) server.

The plugin is not meant to deploy to the local machine, but instead converts
the certificate and its private key to a PKCS12 (.pfx) container
and embeds the container as Base64 inside a generated powershell script that
is then executed via powershell on the Windows OpenSSH Server (needs to be
installed from optional features). This ensures that the PKCS12 container is
not saved on the host at all, but directly imported in the certificate store.

The idea of this plugin is to be able to deploy certificates on Windows
machines that are running in a less trusted environment (e.g. my lab
machine) and are not intended to hold any kind of secrets like DNS
API keys. Instead, the plugin can then be run from a remote Linux
machine, e.g. like my Synology NAS, that is entirely separated by
a firewall etc.

Please note that AI (specifically Claude Code) was used in the
creation of this script, but due to the fact that Windows works
always in mysterious ways - and due to no fault of the AI unfortunately
and surprisingly - I spent hours debugging and adapting it myself...
only to change a few powershell lines in the end.
- make variable naming in introduction comment more obvious
- explicitly request POSIX sh as interpreter
- compliy with acme.sh-specific openssl handling
- fix shellcheck issues
@neilpang neilpang force-pushed the feature/add-windows-rdp-via-openssh-deploy-plugin branch from c6a04b2 to 7a406a1 Compare May 1, 2026 14:05
@neilpang
Copy link
Copy Markdown
Member

neilpang commented May 1, 2026

@curdbecker
Copy link
Copy Markdown
Contributor Author

add your usage here https://github.com/acmesh-official/acme.sh/wiki/deployhooks

Done. Thanks a lot :)

https://github.com/acmesh-official/acme.sh/wiki/deployhooks#41-deploy-a-remote-desktop-rdp-certificate-to-a-remote-windows-host-over-openssh

Also added a small note on how to view the PowerShell script with --debug and how that can help someone that should have locked themselves out remotely.

@neilpang neilpang merged commit c9dd229 into acmesh-official:dev May 1, 2026
34 of 37 checks passed
neilpang pushed a commit that referenced this pull request May 2, 2026
* Add deployment plugin for Windows RDP via OpenSSH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants