From 9c3588e7a98e08dfd3dc67a9eceb86da7f8b1fae Mon Sep 17 00:00:00 2001 From: David Fillingham Date: Sat, 14 Feb 2026 00:04:10 +1000 Subject: [PATCH] Add RDP_ASKPASS config to retrieve password from an external command Signed-off-by: David Fillingham --- bin/winapps | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/bin/winapps b/bin/winapps index 1eaccc8..1c05096 100755 --- a/bin/winapps +++ b/bin/winapps @@ -41,6 +41,7 @@ readonly RUNID="${RANDOM}" # WINAPPS CONFIGURATION FILE RDP_USER="" RDP_PASS="" +RDP_ASKPASS="" RDP_DOMAIN="" RDP_IP="" VM_NAME="RDPWindows" # FOR 'libvirt' ONLY @@ -611,7 +612,7 @@ function waRunCommand() { $RDP_FLAGS_WINDOWS \ /d:"$RDP_DOMAIN" \ /u:"$RDP_USER" \ - /p:"$RDP_PASS" \ + ${RDP_PASSWORD_ARG:+"$RDP_PASSWORD_ARG"} \ /scale:"$RDP_SCALE" \ +auto-reconnect \ +dynamic-resolution \ @@ -629,7 +630,7 @@ function waRunCommand() { $RDP_FLAGS_NON_WINDOWS \ /d:"$RDP_DOMAIN" \ /u:"$RDP_USER" \ - /p:"$RDP_PASS" \ + ${RDP_PASSWORD_ARG:+"$RDP_PASSWORD_ARG"} \ /scale:"$RDP_SCALE" \ +auto-reconnect \ /app:program:"$2",hidef:"$HIDEF" \ @@ -663,7 +664,7 @@ function waRunCommand() { $RDP_FLAGS_NON_WINDOWS \ /d:"$RDP_DOMAIN" \ /u:"$RDP_USER" \ - /p:"$RDP_PASS" \ + ${RDP_PASSWORD_ARG:+"$RDP_PASSWORD_ARG"} \ /scale:"$RDP_SCALE" \ +auto-reconnect \ /wm-class:"$FULL_NAME" \ @@ -686,7 +687,7 @@ function waRunCommand() { $RDP_FLAGS_NON_WINDOWS \ /d:"$RDP_DOMAIN" \ /u:"$RDP_USER" \ - /p:"$RDP_PASS" \ + ${RDP_PASSWORD_ARG:+"$RDP_PASSWORD_ARG"} \ /scale:"$RDP_SCALE" \ +auto-reconnect \ /drive:media,"$REMOVABLE_MEDIA" \ @@ -804,6 +805,15 @@ waLastRun waLoadConfig waGetFreeRDPCommand +# Send password on the command line if a command to retrieve the password from is not given +# Otherwise, set FREERDP_ASKPASS which freerdp will read the stdout of to use as the password +RDP_PASSWORD_ARG="/p:$RDP_PASS" + +if [[ ! -z "$RDP_ASKPASS" ]]; then + export FREERDP_ASKPASS="$RDP_ASKPASS" + unset RDP_PASSWORD_ARG +fi + # If using podman backend, modify the FreeRDP command to enter a new namespace. if [ "$WAFLAVOR" = "podman" ]; then FREERDP_COMMAND="podman unshare --rootless-netns ${FREERDP_COMMAND}"