Skip to content

Commit a1028d3

Browse files
author
Yutaro-B18016
authored
Merge pull request #6 from Yutaro-B18016:add-Fedora-linux-support
add Fedora linux support
2 parents 7307d7c + 516762a commit a1028d3

2 files changed

Lines changed: 92 additions & 0 deletions

File tree

fedora/allow-vsock.te

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
module allow-vsock 1.0;
3+
4+
require {
5+
type unconfined_service_t;
6+
type unlabeled_t;
7+
class vsock_socket { getattr read write };
8+
}
9+
10+
#============= unconfined_service_t ==============
11+
allow unconfined_service_t unlabeled_t:vsock_socket { getattr read write };

fedora/install-config.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/bin/bash
2+
3+
#
4+
# This script is for Fedora Linux to configure XRDP for enhanced session mode
5+
#
6+
# The configuration is adapted from the Arch script.
7+
#
8+
9+
if [ "$(id -u)" -ne 0 ]; then
10+
echo 'This script must be run with root privileges' >&2
11+
exit 1
12+
fi
13+
14+
# Use rpm -q to check for exact package name
15+
if ! rpm -q xrdp 2>&1 > /dev/null ; then
16+
echo 'xrdp not installed. Run dnf install xrdp first to install xrdp.' >&2
17+
exit 1
18+
fi
19+
20+
###############################################################################
21+
# Configure XRDP
22+
#
23+
systemctl enable xrdp
24+
systemctl enable xrdp-sesman
25+
26+
# Configure the installed XRDP ini files.
27+
# use vsock transport.
28+
sed -i_orig -e 's/port=3389/port=vsock:\/\/-1:3389/g' /etc/xrdp/xrdp.ini
29+
# use rdp security.
30+
sed -i_orig -e 's/security_layer=negotiate/security_layer=rdp/g' /etc/xrdp/xrdp.ini
31+
# remove encryption validation.
32+
sed -i_orig -e 's/crypt_level=high/crypt_level=none/g' /etc/xrdp/xrdp.ini
33+
# disable bitmap compression since its local its much faster
34+
sed -i_orig -e 's/bitmap_compression=true/bitmap_compression=false/g' /etc/xrdp/xrdp.ini
35+
#
36+
# sed -n -e 's/max_bpp=32/max_bpp=24/g' /etc/xrdp/xrdp.ini
37+
38+
# use the default lightdm x display
39+
# sed -i_orig -e 's/X11DisplayOffset=10/X11DisplayOffset=0/g' /etc/xrdp/sesman.ini
40+
# rename the redirected drives to 'shared-drives'
41+
sed -i_orig -e 's/FuseMountName=thinclient_drives/FuseMountName=shared-drives/g' /etc/xrdp/sesman.ini
42+
43+
# Change the allowed_users
44+
echo "allowed_users=anybody" > /etc/X11/Xwrapper.config
45+
46+
47+
#Ensure hv_sock gets loaded
48+
if [ ! -e /etc/modules-load.d/hv_sock.conf ]; then
49+
echo "hv_sock" > /etc/modules-load.d/hv_sock.conf
50+
fi
51+
52+
# Configure the policy xrdp session
53+
cat > /etc/polkit-1/rules.d/02-allow-colord.rules <<EOF
54+
polkit.addRule(function(action, subject) {
55+
if ((action.id == "org.freedesktop.color-manager.create-device" ||
56+
action.id == "org.freedesktop.color-manager.modify-profile" ||
57+
action.id == "org.freedesktop.color-manager.delete-device" ||
58+
action.id == "org.freedesktop.color-manager.create-profile" ||
59+
action.id == "org.freedesktop.color-manager.modify-profile" ||
60+
action.id == "org.freedesktop.color-manager.delete-profile") &&
61+
subject.isInGroup("users"))
62+
{
63+
return polkit.Result.YES;
64+
}
65+
});
66+
EOF
67+
68+
# Compile selinux module!
69+
checkmodule -M -m -o allow-vsock.mod allow-vsock.te
70+
semodule_package -o allow-vsock.pp -m allow-vsock.mod
71+
# Install the selinux module!
72+
semodule -i allow-vsock.pp
73+
74+
###############################################################################
75+
76+
echo "####### Configuration Done #######"
77+
echo "Next to do"
78+
echo "Shutdown this VM"
79+
echo "On your host machine in an Administrator powershell prompt, execute this command: "
80+
echo " Set-VM -VMName <your_vm_name> -EnhancedSessionTransportType HvSocket"
81+
echo "Start this VM, and you will see Enhanced mode available!"

0 commit comments

Comments
 (0)