[Security] Keep the Windows VM password out of the RDP client's argument list
`launch_windows` passed the VM password to xfreerdp3 as `/p:"$WIN_PASS"`. `/proc/<pid>/cmdline` is world-readable, so every other user on the machine could read the password for as long as the session stayed open — `ps` was enough. The arguments now go in over stdin with `/args-from:stdin`, leaving only that flag in the process list. The argument list itself is unchanged, and building it as an array also fixes the unquoted `$RDP_SCALE` expansion.
This commit is contained in:
1 parent
b71c60fe30
commit
fa3f607705
1 file changed
+25
-2
+25
-2
@@ -363,8 +363,31 @@ To stop: omarchy-windows-vm stop"
|
||||
fi
|
||||
# If scale is less than 130%, don't set any scale (use default 100)
|
||||
|
||||
# Connect with RDP in fullscreen (auto-detects resolution)
|
||||
xfreerdp3 /u:"$WIN_USER" /p:"$WIN_PASS" /v:127.0.0.1:3389 -grab-keyboard /sound /microphone /clipboard /cert:ignore /title:"Windows VM - Omarchy" /dynamic-resolution /gfx:AVC444 /floatbar:sticky:off,default:visible,show:fullscreen $RDP_SCALE
|
||||
RDP_ARGS=(
|
||||
"/u:$WIN_USER"
|
||||
"/p:$WIN_PASS"
|
||||
/v:127.0.0.1:3389
|
||||
-grab-keyboard
|
||||
/sound
|
||||
/microphone
|
||||
/clipboard
|
||||
/cert:ignore
|
||||
"/title:Windows VM - Omarchy"
|
||||
/dynamic-resolution
|
||||
/gfx:AVC444
|
||||
/floatbar:sticky:off,default:visible,show:fullscreen
|
||||
)
|
||||
if [[ -n $RDP_SCALE ]]; then
|
||||
RDP_ARGS+=("$RDP_SCALE")
|
||||
fi
|
||||
|
||||
# Connect with RDP in fullscreen (auto-detects resolution). The arguments go
|
||||
# in over stdin rather than on the command line: /proc/<pid>/cmdline is
|
||||
# world-readable, so passing the VM password as /p:"$WIN_PASS" would show it
|
||||
# to every other user on the machine for as long as the session is open.
|
||||
# /args-from must stay the only argument here — FreeRDP rejects it outright
|
||||
# when it is combined with any other, so new flags belong in RDP_ARGS above.
|
||||
printf '%s\n' "${RDP_ARGS[@]}" | xfreerdp3 /args-from:stdin
|
||||
|
||||
# After RDP closes, stop the container unless --keep-alive was specified
|
||||
if [[ $KEEP_ALIVE = "false" ]]; then
|
||||
|
||||
Reference in new issue
Block a user