Skip to content

Instantly share code, notes, and snippets.

@ernstki
Last active October 8, 2025 21:50
Show Gist options
  • Save ernstki/f26a114096db1f31901252070caf3567 to your computer and use it in GitHub Desktop.
Save ernstki/f26a114096db1f31901252070caf3567 to your computer and use it in GitHub Desktop.
rdscert - list Windows Remote Desktop machine certs in the format used by Remmina on Linux
#!/usr/bin/bash
HASHALG=sha256
files=()
args=(-$HASHALG)
while (( $# )); do
case $1 in
-*)
for arg in "${args[@]}"; do
if [[ $1 == $arg ]]; then
echo "WARNING: Duplicate argument '$1'; ignoring" >&2;
shift; continue
fi
done
args+=("$1")
;;
*)
if [[ ! -r $1 ]]; then
echo "WARNING: Unreadable file '$1'" >&2
shift; continue
fi
files+=("$1")
;;
esac
shift
done
if [[ -z "${files[@]}" ]]; then
echo "usage: rdscert [openssl x509 args] CERTFILE [CERTFILE...]" >&2;
fi
for cert in "${files[@]}"; do
( set -x; openssl x509 -fingerprint "${args[@]}" -in "$cert" ) \
| sed '/--*BEGIN/,/--*END/d'
done
@ernstki
Copy link
Author

ernstki commented Oct 8, 2025

Run certlm.msc from the Start menu, or search for "certificates" and then click "Manage computer certificates." (ref)

Then, browse to Remote DesktopCertificates in the left-hand pane. In the right-hand pane, right click on the certificate for your local machine and export it to a .cer file somewhere.

Run the above script on it like so:

./rdscert *.cer

# or, if it's in your $PATH
rdscert *.cer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment