winapps icon indicating copy to clipboard operation
winapps copied to clipboard

Installation and launch issues of RDP apps on custom port

Open killahop opened this issue 1 year ago • 7 comments

My host machine has an RDP server running on UDP port 3389 for support. Docker and Windows are configured on port 3390. I attempted to install Winapps on a port other than 3389. By modifying the setup.sh file and adding :3390 to lines 1055 and 1184, I can connect using xfreerdp3 /v:127.0.0.1:3390 /u:docker /p:password, but the installation fails if I modify only line 86. Additionally, I have installed Excel, which is visible in GNOME, but it does not launch, likely due to the installation logic. I hope this information can assist in resolving the issue.

killahop avatar Oct 21 '24 17:10 killahop

By modifying the setup.sh file like this: /v:"$RDP_IP:3390" &>"$FREERDP_LOG" & at line 1055 and line 1184, it works."

killahop avatar Oct 22 '24 09:10 killahop

@killahop Are you suggesting the RDP port should be specified within the WinApps configuration file instead of being hard-coded?

KernelGhost avatar Oct 24 '24 07:10 KernelGhost

I’ve already specified the port number I wanted to use, which is 3390, in the configuration files. However, I encountered issues with this setup, particularly with the checks for the RDP connection. It didn’t seem to work properly. If you have any suggestions on how to resolve this issue, I would appreciate your help!

Thank you!

killahop avatar Oct 24 '24 10:10 killahop

Here's a bit of code from my automation script:

WORKDIR="/opt/winapps"

tee -a ${WORKDIR}/winapps/oem/rdp-allow.ps1 &>/dev/null <<EOF
\$portvalue = 3390

Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber" -Value \$portvalue

New-NetFirewallRule -DisplayName 'RDPPORTLatest-TCP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol TCP -LocalPort \$portvalue
New-NetFirewallRule -DisplayName 'RDPPORTLatest-UDP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol UDP -LocalPort \$portvalue
EOF

tee -a ${WORKDIR}/winapps/oem/install.bat &>/dev/null <<EOF
powershell -ExecutionPolicy Bypass -File C:\OEM\rdp-allow.ps1
EOF

sudo sed -i 's/local FILE_PATH=""/local FILE_PATH=""\n    RDP_IP="$DOCKER_IP:$RDP_PORT"\n    echo ":: ip: $RDP_IP port: $RDP_PORT"/' ${WORKDIR}/bin/winapps

A file called rdp-allow.ps1 is created that changes the Windows RDP port to 3390 and allows this port through the firewall. I add the rdp-allow.ps1 startup line to install.bat for Windows postinstall. In the bash script /repo/bin/winapps I add 2 lines after the line local FILE_PATH="" on line 507 using sed

local FILE_PATH=""
RDP_IP="$DOCKER_IP:$RDP_PORT"
echo ":: ip: $RDP_IP port: $RDP_PORT" 

I'm not sure about working through other backends, I was testing in Docker.

xenongee avatar Oct 31 '24 07:10 xenongee

as soon as I do a new installation I'll try these changes of yours. thanks

killahop avatar Oct 31 '24 11:10 killahop

@killahop I think to be experiencing something similar to your issue. When I try to start any MS software two winapps popup windows show up with messages "Booting windows" and "The Windows RDP port '3389' is closed. Please ensure Remote Desktop is correctly configured on Windows".

Screenshot from 2025-01-11 11-06-04

Screenshot from 2025-01-11 11-04-50 If I start Windows using sudo docker compose up in the terminal then all works well, but it's the automation of the process (so that I don't need to start Windows by myself) that I'm still struggling with... I'm on linux mint 22 and my config file is as follows

RDP_USER="docker"
RDP_PASS=""
RDP_DOMAIN=""
RDP_IP="127.0.0.1"
WAFLAVOR="docker" # Acceptable values are 'docker', 'podman' and 'libvirt'.
RDP_SCALE=100 # Acceptable values are 100, 140, and 180.
RDP_FLAGS="/cert:tofu /sound /microphone /monitors:0"
MULTIMON="true"
DEBUG="true"
FREERDP_COMMAND="xfreerdp3"

I'm still new to this project and so thank you very much in advance for any pointers.

averter avatar Jan 11 '25 11:01 averter

I've also been having issues with getting winapps going with a custom port. After quite a bit of troubleshooting, I've got it working. To get the installation (setup.sh) working, I replaced the $RDP_IP variables in the freerdp commands with 127.0.0.1:55555. This was already set in my winapps.conf, but I guess the port isn't read correctly when it is sourced.

I then discovered that I could give this argument to freerdp /port:55555. I added this to my winapps.conf in the RDP_FLAGS variable, and got rid of the port in RDP_IP. This finally allowed me to launch winapps and the detected applications. I'm not sure if this would have fixed the initial installation process as well, I did not go back to try it all from scratch again.

Note that this was all done on Rocky Linux 9 using rootless podman.

gaben0 avatar May 24 '25 07:05 gaben0