[X2Go-Commits] [[X2Go Wiki]] page added: wiki:advanced:x2gohtmlclient

wiki-admin at x2go.org wiki-admin at x2go.org
Wed Apr 21 22:40:17 CEST 2021


A page in your DokuWiki was added or changed. Here are the details:

Date        : 2021/04/21 20:40
Browser     : Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
IP-Address  : 189.217.209.86
Hostname    : customer-189-217-209-86.cablevision.net.mx
Old Revision: ---
New Revision: https://wiki.x2go.org/doku.php/wiki:advanced:x2gohtmlclient
Edit Summary: created
User        : ncryer


----
====== HTML Plugin components ======


===== X2GoHTMLClient =====

==== index.html ====
Client HTML page. This page can be modified or embedded in existing webpage. It has two modes: native client and embedded client. User can use native client if recent version of X2Go client is installed on the system. In this case, the page will generate x2go session file, which will be automatically opened with x2go client. Second mode is to use embedded HTML Client (only supports X2GoKdrive). The HTML page provides user input for the next
settings:
<code>
X2Go Server address
Username
Password
Command to execute (KDE, GNOME, ICEWM, etc)
SSH Proxy (if not specified no proxy will be used)
Proxy login
Proxy password
</code>
The HTML page can be modified to predefine one or more of this settings. Important functions inside of this page should be defined:
<code>function getServer()
function getUname()
function getPass()
function getCommand()
function getName()
function getProxy()
function getProxyUser()
function getProxyPass()
</code>
==== x2gokdriveclient.html ====
The HTML Page to run X2Go client in separate window. By default the session's window is embedded in the start page. User can "detach" the session to separate window using "new window" button. After that session will be shown in the separate window and can be resized, opened in full screen, etc.

==== CSS/x2gostyle.css ====
WEB styles for HTML pages

==== SRC/*png SRC/*svg ====
Image resources

==== SRC/x2godomcontroller.js ====
Communication between HTML page
and X2Go HTML Client
==== SRC/x2gohtmlclient.js ====
Communication between X2Go RPC script and X2Go HTML Client
==== SRC/x2gokdrivehtmlclient.js ====
X2GoKdrive JS client

===== x2gorpc.cgi =====
CGI script for communication between HTML Client and X2Go server. It connects to X2Go server using ssh, starts/resuming sessions, opens SSH tunnels, etc

===== x2gowswrapper =====
The application which is connecting TCP sockets of X2GoKdrive agent with web sockets for HTML Client.


====== Building of the HTML Client components ======

====== JS classes ======
JS classes should be compiled in one using script minify.sh. The resulting file x2goclient.js will be placed in subdir "dist"

====== x2gowsrapper ======
Build using qmake
<code>
$qmake-qt5 && make
</code>

====== Dependencies ======

===== x2gohtmlclient =====
To compile JS scripts "minify" should be installed
===== x2gowebrpc =====
PERL modules: CGI, JSON, Encode, Expect, File::Touch
===== x2gowswrapper =====
QT5-Core,
python-websockify(later it's functionality will be included in x2gowswrapper)

====== Installation ======

Prerequements: Web Browser with support for CGI and Web sockets (for example nginx).

Example of nginx configuration (in this case with fcgiwrap https://www.nginx.com/resources/wiki/start/topics/examples/fcgiwrap/)

''/etc/nginx/sites-available/<your host>-ssl:''
<file>
server {
  listen 443 ssl;
  server_name your_host;
  ssl_certificate <your SSL cert>;
  ssl_certificate_key <your SSL cert key>;
  ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
  ssl_protocols TLSv1.2;
  ssl_prefer_server_ciphers off;
  ssl_session_timeout 5m;
  ssl_session_cache builtin:1000  shared:SSL:10m;
  ssl_session_tickets off;
  root /var/www/html;
  proxy_read_timeout 300;

  location /assets/ {
    add_header
Strict-Transport-Security "max-age=31536000";
    add_header Content-Security-Policy "default-src 'self' 'unsafe-inline' data: blob: ws: wss:; script-src 'self' 'unsafe-inline'
    add_header Feature-Policy "vibrate 'none' ; microphone 'none' ; camera 'none' ; gyroscope 'none' ; magnetometer 'none' ; geolocation 'none' ; midi 'self' ; notifications 'self' ; push 'self' ; sync-xhr 'self'";
    add_header Referrer-Policy "same-origin";
    add_header X-Content-Type-Options "nosniff";
    add_header X-Frame-Options "SAMEORIGIN";
  }

location ~* \.(pl|cgi)$ {
  gzip off;
  include /etc/nginx/fastcgi_params;
  fastcgi_pass  unix:/var/run/fcgiwrap.socket;
  }

location ~ ^/x2gows/(.*)$ {
  proxy_pass       https://127.0.0.1:$1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "upgrade";
  proxy_http_version 1.1;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header Host $http_host;
  proxy_intercept_errors on;
  proxy_redirect off;
 
proxy_cache_bypass $http_upgrade;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-NginX-Proxy true;
  proxy_ssl_session_reuse off;
  }
}
</file>

X2Go HTML client files:
<code>
<WEB ROOT>/assets/x2go-plugin/
                             CSS/x2gostyle.css
                             IMG/*.png
                             IMG/x2gobg.svg
                             JS/x2goclient.js
                             RPC/x2gorpc.cgi
                             index.html
                             x2gokdriveclient.html

</code>

This location can be changed, in this case the changes should be also done in the WEB Server configuration file and in index.html file:
<code>
var RPC_path="/assets/x2go-plugin/RPC/x2gorpc.cgi";
var asset_path="/assets/x2go-plugin/IMG/";
</code>
x2gorpc.cgi should be executable

install x2gowsrapper to /usr/bin

x2gowswarpper configuration:

/etc/x2go/x2gows/x2gows.options
<file>
ws_proto=wss
ssl_cert=<your SSL cert>
ssl_key=<your SSL cert
key>
ssl_only=true
log_dir=/var/log/x2gows
</file>
the SSL key should be same which used for WEB server.

Because x2gowswrapper is started from CGI, be sure that config and SSL Certs are accessible for web server user  (www-data in debian)

create log directory for x2gowswarpper:
<code>
#mkdir /var/log/x2gows
#chown www-data /var/log/x2gows
</code>

to use x2go HTML client open in web browser:

<code>
https://<your host>/assets/x2go-plugin/
</code>

{{:wiki:advanced:client.png?400|}}
{{:wiki:advanced:kdr.png?400|}}


-- 
This mail was generated by DokuWiki at
https://wiki.x2go.org/



More information about the x2go-commits mailing list