CentOS Stream 8: Connect to GNOME desktop environment via XRDP

This article will describe connecting to GNOME desktop environment via XRDP.

1 Install GNOME

Install Workstation group with dnf groupinstall.

#!/bin/sh -e

sudo dnf groupinstall -y --nobest Workstation
sudo reboot

2 Install XRDP

  • Enable EPEL repository and install xrdp package.
  • Because spice-vdagentd and geoclue is denied by AVC via XRDP, add rules to SELinux and allow access.
#!/bin/sh -e

# Enable EPEL repository.
sudo dnf install -y epel-release

# Install xrdp.
sudo dnf install -y xrdp xorgxrdp
sudo systemctl enable xrdp
sudo systemctl start xrdp

# Open 3389/tcp.
sudo firewall-cmd --add-port=3389/tcp --permanent
sudo firewall-cmd --reload

# Define SELinux rules and allow it.
cat <<EOF > xrdp.te
module xrdp 1.0;
require {
    type vdagent_t;
    type geoclue_t;
    type unconfined_service_t;
    class dir search;
    class file { open read getattr };
}
allow vdagent_t unconfined_service_t:dir search;
allow vdagent_t unconfined_service_t:file { open read getattr };
allow geoclue_t unconfined_service_t:dir search;
allow geoclue_t unconfined_service_t:file { open read getattr };
EOF
sudo checkmodule -M -m -o xrdp.mod xrdp.te
sudo semodule_package -m xrdp.mod -o xrdp.pp
sudo semodule -i xrdp.pp
sudo rm xrdp.te xrdp.pp xrdp.mod

3 Connect to GNOME desktop environment via XRDP

Use Xorg as a session type. Windows Remote Desktop Connection is as the following.

0001_xrdp-gnome.png