From b90fb086a97893df2341d0f07ec1ffd4a778b8b0 Mon Sep 17 00:00:00 2001 From: Rohan Barar Date: Tue, 30 Jul 2024 23:16:51 +1000 Subject: [PATCH] Updated WinApps config file template as per request in #175 --- README.md | 103 ++++++++++++++++++++++++++++++++++++++++++++++----- bin/winapps | 12 +++++- installer.sh | 20 +--------- 3 files changed, 105 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index fcfc50d..519047d 100644 --- a/README.md +++ b/README.md @@ -293,18 +293,101 @@ sudo flatpak override --filesystem=home com.freerdp.FreeRDP # To use `+home-driv ### Step 3: Create a WinApps Configuration File Create a configuration file at `~/.config/winapps/winapps.conf` containing the following: ```bash +################################## +# WINAPPS CONFIGURATION FILE # +################################## + +# INSTRUCTIONS +# - Leading and trailing whitespace are ignored. +# - Empty lines are ignored. +# - Lines starting with '#' are ignored. +# - All characters following a '#' are ignored. + +# [WINDOWS USERNAME] RDP_USER="MyWindowsUser" + +# [WINDOWS PASSWORD] RDP_PASS="MyWindowsPassword" -#RDP_DOMAIN="MYDOMAIN" -#RDP_IP="192.168.123.111" -#WAFLAVOR="docker" # Acceptable values are 'docker', 'podman' and 'libvirt'. -#RDP_SCALE=100 # Acceptable values are 100, 140, and 180. -#RDP_FLAGS="" -#MULTIMON="true" -#DEBUG="true" -#AUTOPAUSE="on" # Acceptable values are 'on' and 'off'. -#AUTOPAUSE_TIME="300" # Seconds before pausing Windows due to inactivity. Ignored if AUTOPAUSE 'off'. -#FREERDP_COMMAND="xfreerdp" + +# [WINDOWS DOMAIN] +# DEFAULT VALUE: '' (BLANK) +RDP_DOMAIN="" + +# [WINDOWS IPV4 ADDRESS] +# NOTES: +# - If using 'libvirt', 'RDP_IP' will be determined by WinApps at runtime if left unspecified. +# DEFAULT VALUE: +# - 'docker': '127.0.0.1' +# - 'podman': '127.0.0.1' +# - 'libvirt': '' (BLANK) +RDP_IP="" + +# [WINAPPS BACKEND] +# DEFAULT VALUE: 'docker' +# VALID VALUES: +# - 'docker' +# - 'podman' +# - 'libvirt' +WAFLAVOR="docker" + +# [DISPLAY SCALING FACTOR] +# NOTES: +# - If an unsupported value is specified, a warning will be displayed. +# - If an unsupported value is specified, WinApps will use the closest supported value. +# DEFAULT VALUE: '100' +# VALID VALUES: +# - '100' +# - '140' +# - '180' +RDP_SCALE="100" + +# [ADDITIONAL FREERDP FLAGS & ARGUMENTS] +# DEFAULT VALUE: '' (BLANK) +# VALID VALUES: See https://github.com/awakecoding/FreeRDP-Manuals/blob/master/User/FreeRDP-User-Manual.markdown +RDP_FLAGS="" + +# [MULTIPLE MONITORS] +# NOTES: +# - If enabled, a FreeRDP bug *might* produce a black screen. +# DEFAULT VALUE: 'false' +# VALID VALUES: +# - 'true' +# - 'false' +MULTIMON="false" + +# [DEBUG WINAPPS] +# NOTES: +# - Creates and appends to ~/.local/share/winapps/winapps.log when running WinApps. +# DEFAULT VALUE: 'true' +# VALID VALUES: +# - 'true' +# - 'false' +DEBUG="true" + +# [AUTOMATICALLY PAUSE WINDOWS] +# DEFAULT VALUE: 'on' +# VALID VALUES: +# - 'on' +# - 'off' +AUTOPAUSE="on" + +# [AUTOMATICALLY PAUSE WINDOWS TIMEOUT] +# NOTES: +# - This setting determines the duration of inactivity to tolerate before Windows is automatically paused. +# - This setting is ignored if 'AUTOPAUSE' is set to 'off'. +# - The value must be specified in seconds (to the nearest 10 seconds e.g., '30', '40', '50', etc.). +# - For RemoteApp RDP sessions, there is a mandatory 20-second delay, so the minimum value that can be specified here is '20'. +# - Source: https://techcommunity.microsoft.com/t5/security-compliance-and-identity/terminal-services-remoteapp-8482-session-termination-logic/ba-p/246566 +# DEFAULT VALUE: '300' +# VALID VALUES: >=20 +AUTOPAUSE_TIME="300" + +# [FREERDP COMMAND] +# NOTES: +# - WinApps will attempt to automatically detect the correct command to use for your system. +# DEFAULT VALUE: '' (BLANK) +# VALID VALUES: The command required to run FreeRDPv3 on your system (e.g., 'xfreerdp', 'xfreerdp3', etc.). +FREERDP_COMMAND="" ``` > [!NOTE] diff --git a/bin/winapps b/bin/winapps index 997c088..127d434 100755 --- a/bin/winapps +++ b/bin/winapps @@ -207,6 +207,13 @@ function waLoadConfig() { # Update $RDP_SCALE. waFixScale + + # Update $AUTOPAUSE_TIME. + # RemoteApp RDP sessions take, at minimum, 20 seconds to be terminated by the Windows server. + # Hence, subtract 20 from the timeout specified by the user, as a 'built in' timeout of 20 seconds will occur. + # Source: https://techcommunity.microsoft.com/t5/security-compliance-and-identity/terminal-services-remoteapp-8482-session-termination-logic/ba-p/246566 + AUTOPAUSE_TIME=$((AUTOPAUSE_TIME - 20)) + AUTOPAUSE_TIME=$((AUTOPAUSE_TIME < 0 ? 0 : AUTOPAUSE_TIME)) } # Name: 'waLastRun' @@ -489,6 +496,9 @@ function waRunCommand() { # Run option. if [ "$1" = "windows" ]; then + # Update timeout (since there is no 'in-built' 20 second delay for full RDP sessions post-logout). + AUTOPAUSE_TIME=$((AUTOPAUSE_TIME + 20)) + # Open Windows RDP session. dprint "WINDOWS" $FREERDP_COMMAND \ @@ -601,8 +611,6 @@ function waRunCommand() { touch "${APPDATA_PATH}/FreeRDP_Process_${FREERDP_PID}.cproc" # Wait for the process to terminate. - # Note: RemoteApp sessions take, at minimum, 20 seconds to be terminated by the Windows server. - # Source: https://techcommunity.microsoft.com/t5/security-compliance-and-identity/terminal-services-remoteapp-8482-session-termination-logic/ba-p/246566 wait $FREERDP_PID # Remove the file with the process ID. diff --git a/installer.sh b/installer.sh index e2e9cb6..d3a3d76 100755 --- a/installer.sh +++ b/installer.sh @@ -72,19 +72,6 @@ readonly INQUIRER_PATH="./install/inquirer.sh" # UNIX path to the 'inquirer' scr readonly VM_NAME="RDPWindows" # Name of the Windows VM (FOR 'libvirt' ONLY). readonly RDP_PORT=3389 # Port used for RDP on Windows. readonly DOCKER_IP="127.0.0.1" # Localhost. -readonly WINAPPS_CONFIG="\ -RDP_USER=\"MyWindowsUser\" -RDP_PASS=\"MyWindowsPassword\" -#RDP_DOMAIN=\"MYDOMAIN\" -#RDP_IP=\"192.168.123.111\" -#WAFLAVOR=\"docker\" # Acceptable values are 'docker', 'podman' and 'libvirt'. -#RDP_SCALE=100 # Acceptable values are 100, 140, and 180. -#RDP_FLAGS=\"\" -#MULTIMON=\"true\" -#DEBUG=\"true\" -#AUTOPAUSE=\"on\" # Acceptable values are 'on' and 'off'. -#AUTOPAUSE_TIME=\"300\" # Seconds before pausing Windows due to inactivity. Ignored if AUTOPAUSE 'off'. -#FREERDP_COMMAND=\"xfreerdp\"" ### GLOBAL VARIABLES ### # USER INPUT @@ -102,7 +89,7 @@ WAFLAVOR="docker" # Imported variable. RDP_SCALE=100 # Imported variable. RDP_FLAGS="" # Imported variable. MULTIMON="false" # Imported variable. -DEBUG="false" # Imported variable. +DEBUG="true" # Imported variable. FREERDP_COMMAND="" # Imported variable. MULTI_FLAG="" # Set based on value of $MULTIMON. @@ -445,10 +432,7 @@ function waLoadConfig() { # Display the suggested action(s). echo "--------------------------------------------------------------------------------" echo -e "Please create a configuration file at ${COMMAND_TEXT}${CONFIG_PATH}${CLEAR_TEXT}." - echo -e "\nThe configuration file should contain the following:" - echo -e "\n${COMMAND_TEXT}${WINAPPS_CONFIG}${CLEAR_TEXT}" - echo -e "\nThe ${COMMAND_TEXT}RDP_USER${CLEAR_TEXT} and ${COMMAND_TEXT}RDP_PASS${CLEAR_TEXT} fields should contain the Windows user's account name and password." - echo -e "Note that the Windows user's PIN combination CANNOT be used to populate ${COMMAND_TEXT}RDP_PASS${CLEAR_TEXT}." + echo -e "See https://github.com/winapps-org/winapps?tab=readme-ov-file#step-3-create-a-winapps-configuration-file" echo "--------------------------------------------------------------------------------" # Terminate the script.