Fix : Add Gnome RDP fix.

This commit is contained in:
Dmitry Voronin 2024-02-03 00:31:24 +03:00
parent c6f281890d
commit efb18dfb8e

View file

@ -22,3 +22,42 @@ function fix_files_sftp() {
function fix_gradle_lock() { function fix_gradle_lock() {
cd "${HOME}/.gradle" && find -type f | grep \\.lock$ | xargs -- rm cd "${HOME}/.gradle" && find -type f | grep \\.lock$ | xargs -- rm
} }
# Fix Gnome's broken RDP ffs.
# Usage: fix_gnome_rdp <USER> <PASSWORD>
function fix_gnome_rdp() {
local user="${1}"
local password="${2}"
# Check params.
if [[ "${user}" = "" ]] || [[ "${password}" = "" ]]; then
help fix_gnome_rdp
return 2
fi
# Unlock keyring. PROTIP: Disable password for it in password manager.
pkill -9 -f gnome-keyring-daemon
echo -n "${user}" | gnome-keyring-daemon --unlock
# Generate keys.
cd /tmp
openssl genrsa -out rdp-tls.key 4096
openssl req -new -key rdp-tls.key -subj "/C=US" | openssl x509 -req -days 730 -signkey rdp-tls.key -out rdp-tls.crt
mkdir -p /home/"${user}"/.local/share/gnome-remote-desktop/
mv rdp-tls.key rdp-tls.crt /home/"${user}"/.local/share/gnome-remote-desktop/
# Configure RDP.
grdctl rdp set-tls-cert /home/"${user}"/.local/share/gnome-remote-desktop/rdp-tls.crt
grdctl rdp set-tls-key /home/"${user}"/.local/share/gnome-remote-desktop/rdp-tls.key
grdctl rdp set-credentials "${user}" "${password}"
grdctl rdp disable-view-only
# Start service.
grdctl rdp enable
systemctl --user start gnome-remote-desktop.service
# Show status.
grdctl status --show-credentials
systemctl --user status gnome-remote-desktop.service
}