Rdp: различия между версиями

Материал из wiki.nntc.nnov.ru
Перейти к навигации Перейти к поиску
(Кнопка для меню GNOME3 для запуска remote-viewer)
(Кнопка для меню GNOME3 для запуска remote-viewer)
Строка 26: Строка 26:
  
 
<pre>
 
<pre>
 +
SEAT_NUMBER="1"
 
SEAT_USER="user"
 
SEAT_USER="user"
 
SEAT_PASSWORD="password"
 
SEAT_PASSWORD="password"
Строка 38: Строка 39:
 
Version=1.0
 
Version=1.0
 
Type=Application
 
Type=Application
Name=Demo Exam Seat (SPICE) 1
+
Name=Demo Exam Seat (SPICE) $SEAT_NUMBER
GenericName=Demo Exam Seat (SPICE) 1
+
GenericName=Demo Exam Seat (SPICE) $SEAT_NUMBER
 
Exec=/opt/spice-client.sh "$SEAT_USER" "$SEAT_PASSWORD" "$SEAT_VMID"
 
Exec=/opt/spice-client.sh "$SEAT_USER" "$SEAT_PASSWORD" "$SEAT_VMID"
 
Terminal=false
 
Terminal=false

Версия 10:16, 3 апреля 2023

Кнопка для меню GNOME3 для запуска xfreerdp

Просто бросьте это в рутовую консоль:

cat << 'EOF' > /usr/share/applications/demoexam-seat.desktop 
[Desktop Entry]
Version=1.0
Type=Application
Name=Demo Exam Seat
GenericName=Demo Exam Seat
Comment=
Exec=/usr/bin/xfreerdp /multimon /f /bpp:24 +fonts -compression +auto-reconnect -themes -wallpaper /cert-ignore /u:login /p:password /v:10.207.144.62:33901
Terminal=false
MimeType=text/plain;
Icon=
Categories=Development;
StartupNotify=true
EOF


Кнопка для меню GNOME3 для запуска remote-viewer

Окружение

SEAT_NUMBER="1"
SEAT_USER="user"
SEAT_PASSWORD="password"
SEAT_VMID="40101"

Кнопка запуска

cat << EOF > /usr/share/applications/demoexam-seat-spice.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=Demo Exam Seat (SPICE) $SEAT_NUMBER
GenericName=Demo Exam Seat (SPICE) $SEAT_NUMBER
Exec=/opt/spice-client.sh "$SEAT_USER" "$SEAT_PASSWORD" "$SEAT_VMID"
Terminal=false
MimeType=text/plain;
Icon=
Categories=Development;
StartupNotify=true
EOF


Скрипт

cat << 'EOF' > /opt/spice-client.sh 
#!/bin/bash

USERNAME="$1"
PASSWORD="$2"
VMID="$3"
PROXY="10.207.151.242"
PORT="8006"
NODE="cluster-node2"

DATA="$(curl -f -s -S -k --data-urlencode "username=$USERNAME" --data-urlencode "password=$PASSWORD" "https://$PROXY:$PORT/api2/json/access/ticket")"

echo "AUTH OK"

TICKET="${DATA//\"/}"
TICKET="${TICKET##*ticket:}"
TICKET="${TICKET%%,*}"
TICKET="${TICKET%%\}*}"

CSRF="${DATA//\"/}"
CSRF="${CSRF##*CSRFPreventionToken:}"
CSRF="${CSRF%%,*}"
CSRF="${CSRF%%\}*}"

curl -f -s -S -k -b "PVEAuthCookie=$TICKET" -H "CSRFPreventionToken: $CSRF" "https://$PROXY:$PORT/api2/spiceconfig/nodes/$NODE/qemu/$VMID/spiceproxy" -d "proxy=$PROXY" > ~/spiceproxy

# -f
exec remote-viewer -f ~/spiceproxy
EOF
chmod +x /opt/spice-client.sh